Merge branch 'develop'
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\admin\service\ApprovalFlowsService;
|
||||
|
||||
class ApprovalFlowsController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new ApprovalFlowsService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
// protected function indexFormat($data)
|
||||
// {
|
||||
// if (isset($data['created_at']))
|
||||
// $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
// if (isset($data['updated_at']))
|
||||
// $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
// return $data;
|
||||
// }
|
||||
|
||||
|
||||
public function desc()
|
||||
{
|
||||
|
||||
|
||||
// type sequential(顺序会签), parallel(并行会签), any(或签)
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\admin\service\ApprovalInstancesService;
|
||||
|
||||
class ApprovalInstancesController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new ApprovalInstancesService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
// protected function indexFormat($data)
|
||||
// {
|
||||
// if (isset($data['created_at']))
|
||||
// $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
// if (isset($data['updated_at']))
|
||||
// $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
// return $data;
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\admin\service\ApprovalRecordsService;
|
||||
use app\admin\service\SysDictService;
|
||||
use app\common\model\SysDictItem;
|
||||
use support\Request;
|
||||
|
||||
class ApprovalRecordsController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new ApprovalRecordsService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function indexFormat($data)
|
||||
{
|
||||
if (isset($data['records']) && count($data['records']) > 0) {
|
||||
foreach ($data['records'] as $key => &$record) {
|
||||
$result = [
|
||||
'id' => $record['id'],
|
||||
'flows_name' => $record['approvalInstance']['flows']['name'],
|
||||
|
||||
'instance_id' => $record['instance_id'],
|
||||
|
||||
'biz_id' => $record['approvalInstance']['biz_id'],
|
||||
'biz_desc' => '备货单【'.$record['approvalInstance']['bizInfo']['order_no'].'】',
|
||||
'biz_type' => $record['approvalInstance']['flow_type'],
|
||||
|
||||
'initiator_name' => $record['approvalInstance']['initiator']['name'],
|
||||
'initiator_avatar' => $record['approvalInstance']['initiator']['avatar'],
|
||||
|
||||
'approver_name' => $record['approver']['name'],
|
||||
'approver_avatar' => $record['approver']['avatar'],
|
||||
|
||||
'step_index' => $record['step_index'],
|
||||
'action' => $record['action'],
|
||||
'action_desc' => SysDictItem::where('item_value', $record['action'])->where('status', 1)->value('item_label'),
|
||||
'status' => $record['status'],
|
||||
'status_desc' => SysDictItem::where('item_value', $record['status'])->where('status', 1)->value('item_label'),
|
||||
'comment' => $record['comment'],
|
||||
'approved_at' => $record['approved_at'],
|
||||
|
||||
'finished_at' => $record['approvalInstance']['finished_at'],
|
||||
'deadline_at' => $record['approvalInstance']['deadline_at'],
|
||||
|
||||
'created_at' => $record['created_at']
|
||||
];
|
||||
$record = $result;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
public function approve(Request $request)
|
||||
{
|
||||
try {
|
||||
$res = $this->service->serviceApprove($request);
|
||||
return $this->success([], $res['msg']);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function logs(Request $request)
|
||||
{
|
||||
try {
|
||||
$instanceId = $request->get('instance_id');
|
||||
$appro = new \app\common\utils\approval\service\ApprovalFlowService();
|
||||
$res = $appro->getSimpleTimeline($instanceId, 'name', 'prepend');
|
||||
return $this->success($res);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\service\OssService;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\admin\service\BrandService;
|
||||
|
||||
class BrandController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new BrandService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function indexFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
if (!empty($data['logo']))
|
||||
$data['logo_full'] = (new OssService)->generatePrivateUrl($data['logo']);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function showFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
if (empty($data['logo']))
|
||||
$data['logo_full'] = (new OssService)->generatePrivateUrl($data['logo']);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\admin\service\BrandSeriesService;
|
||||
|
||||
class BrandSeriesController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new BrandSeriesService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function indexFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function showFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\common\service\StockOrdersService;
|
||||
use support\Request;
|
||||
|
||||
class StockOrdersController extends BaseController
|
||||
{
|
||||
protected $noNeedLogin = ['print'];
|
||||
|
||||
protected $noNeedHeaderData = ['print'];
|
||||
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new StockOrdersService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function indexFormat($data)
|
||||
{
|
||||
if (isset($data['created_at'])) $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at'])) $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
if (isset($data['eta_ship_date'])) $data['eta_ship_date'] = date('Y-m-d', $data['eta_ship_date']);
|
||||
if (isset($data['biz_date'])) $data['biz_date'] = date('Y-m-d', $data['biz_date']);
|
||||
if (isset($data['latest_arrival_date'])) $data['latest_arrival_date'] = date('Y-m-d', $data['latest_arrival_date']);
|
||||
|
||||
if (isset($data['id'])) {
|
||||
$appro = new \app\common\utils\approval\service\ApprovalFlowService();
|
||||
$appro = $appro->getBriefStatusByBiz($data['id'], null, 'name');
|
||||
$map = ['processing'=>'审批中','pending'=>'审批中','approved'=>'已通过','rejected'=>'已拒绝','revoked'=>'已撤回'];
|
||||
if ($appro) {
|
||||
$data['appro_status'] = [
|
||||
'status' => $appro['status'],
|
||||
'status_desc' => $map[$appro['status']],
|
||||
'name' => isset($appro['step'])?$appro['step']['name']:''
|
||||
];
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
protected function showFormat($data)
|
||||
{
|
||||
if (isset($data['created_at'])) $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at'])) $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
if (isset($data['eta_ship_date'])) $data['eta_ship_date'] = date('Y-m-d', $data['eta_ship_date']);
|
||||
if (isset($data['biz_date'])) $data['biz_date'] = date('Y-m-d', $data['biz_date']);
|
||||
if (isset($data['latest_arrival_date'])) $data['latest_arrival_date'] = date('Y-m-d', $data['latest_arrival_date']);
|
||||
|
||||
if (!empty($data['contract'])) {
|
||||
$data['contract_url'] = (new \app\common\service\OssService)->generatePrivateUrl($data['contract']);
|
||||
}
|
||||
|
||||
if (count($data['moneyValues']) > 0) {
|
||||
$data['cif_total_amount'] = [
|
||||
'exchange_rate' => $data['moneyValues']['exchange_rate'],
|
||||
'amount' => $data['moneyValues']['amount'],
|
||||
'currency' => $data['moneyValues']['currency'],
|
||||
'id' => $data['moneyValues']['id']
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($data['items'] as &$item) {
|
||||
foreach ($item['moneyValues'] as $mv) {
|
||||
$item[$mv['field']] = [
|
||||
'exchange_rate' => $mv['exchange_rate'],
|
||||
'amount' => $mv['amount'],
|
||||
'currency' => $mv['currency'],
|
||||
'id' => $mv['id']
|
||||
];
|
||||
}
|
||||
unset($item['moneyValues']);
|
||||
|
||||
foreach ($item['options'] as $opt) {
|
||||
$item['modify_list'][] = [
|
||||
"id" => $opt['id'],
|
||||
"order_item_id" => $opt['order_item_id'],
|
||||
"option_id" => $opt['option_id'],
|
||||
"option_name_snapshot" => $opt['option_name_snapshot'],
|
||||
"option_price" => $opt['option_price']
|
||||
];
|
||||
}
|
||||
unset($item['options']);
|
||||
}
|
||||
unset($item);
|
||||
|
||||
|
||||
foreach ($data['accounts'] as $acc) {
|
||||
$data['account_list'][] = [
|
||||
"id" => $acc['id'],
|
||||
"order_id" => $acc['order_id'],
|
||||
"seq_no" => $acc['seq_no'],
|
||||
"remit_country_id" => $acc['remit_country_id'],
|
||||
"remit_country_name_snapshot" => $acc['remit_country_name_snapshot'],
|
||||
"remit_date" => date('Y-m-d', $acc['remit_date']),
|
||||
"currency_code" => $acc['currency_code'],
|
||||
"currency_name_snapshot" => $acc['currency_name_snapshot'],
|
||||
"account_id" => $acc['account_id'],
|
||||
"account_name_snapshot" => $acc['account_name_snapshot'],
|
||||
"remitter_name" => $acc['remitter_name'],
|
||||
"amount" => $acc['amount']
|
||||
];
|
||||
}
|
||||
unset($data['accounts']);
|
||||
|
||||
$data['veh_list'] = $data['items'];
|
||||
unset($data['items']);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
protected function printFormat($data)
|
||||
{
|
||||
$data['file_url_full'] = (!empty($data['file_url'])) ? (new \app\common\service\OssService)->generatePrivateUrl($data['file_url']) : '';
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
public function print(Request $request)
|
||||
{
|
||||
try {
|
||||
$raw = $this->service->servicePrint($request);
|
||||
$data = $this->transformData($raw, method_exists($this, 'printFormat')
|
||||
? [$this, 'printFormat']
|
||||
: null);
|
||||
return $this->success($data);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function detail(Request $request)
|
||||
{
|
||||
try {
|
||||
$raw = $this->service->serviceDetail($request);
|
||||
$data = $this->transformData($raw, method_exists($this, 'detailFormat')
|
||||
? [$this, 'detailFormat']
|
||||
: null);
|
||||
return $this->success($data);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function desc(Request $request)
|
||||
{
|
||||
|
||||
$data = [
|
||||
'id' => '', //'主键',
|
||||
'order_no' => '', //'备货单编号(业务唯一)',
|
||||
'pi_no' => '', //'PI号'/'阿里订单号',
|
||||
'biz_date' => '', //'单据日期(时间戳)',
|
||||
'salesperson_id' => '', //'业务员ID(关联数据)',
|
||||
'salesperson_snapshot' => '', //'业务员姓名快照',
|
||||
'clearance_country_id' => '', //'清关目的国ID(关联数据)',
|
||||
'clearance_country_snapshot' => '', //'清关目的国名称快照',
|
||||
// 'ali_order_no' => '', //'阿里订单号',
|
||||
'customer_source_id' => '', //'客户来源ID(关联数据)',
|
||||
'customer_source_snapshot' => '', //'客户来源名称快照',
|
||||
'customer_id' => '', //'客户ID(关联数据)',
|
||||
'customer_snapshot' => '', //'客户名称快照',
|
||||
'customer_country_id' => '', //'客户所在国ID(关联数据)',
|
||||
'customer_country_snapshot' => '', //'客户所在国名称快照',
|
||||
'declarant_name' => '', //'清关人(文本)',
|
||||
'eta_ship_date' => '', //'预计发运日(时间戳)',
|
||||
'shipping_method' => '', //'出运方式(如海运/空运/铁路等)',
|
||||
'cif_total_amount' => '', //'0.00' COMMENT '合计到岸价(CIF)',
|
||||
'domestic_port_id' => '', //'国内收货港ID(关联数据)',
|
||||
'domestic_port_snapshot' => '', //'国内收货港名称快照',
|
||||
'trade_term_id' => '', //'贸易条款ID(关联数据,EXW/FOB/CIF等)',
|
||||
'trade_term_snapshot' => '', //'贸易条款名称快照',
|
||||
'clearance_port_id' => '', //'清关目的港ID(关联数据)',
|
||||
'clearance_port_snapshot' => '', //'清关目的港名称快照',
|
||||
'latest_arrival_date' => '', //'最迟到港时间(时间戳)',
|
||||
'contract_exchange_rate' => '', //'合同汇率(下单锁定)',
|
||||
'settlement_currency' => '', //'CNY' COMMENT '结算币种',
|
||||
'remark' => '', //'备注',
|
||||
// 'real_veh' => '', //'0' COMMENT '实车ID',
|
||||
'is_final' => '', //'0' COMMENT '是否终版1是0否',
|
||||
'status' => '', //'draft' COMMENT '单据状态:draft/submitted/approved/void/reversed等',
|
||||
];
|
||||
|
||||
// (?<=\x60 )[^\r\n']*(?=')
|
||||
|
||||
$items = [
|
||||
// 'id' => '', // '主键',
|
||||
// 'order_id' => '', // '所属备货单ID',
|
||||
// 'product_code' => '', // '商品编号(可作外部编码)',
|
||||
// 'sku_snapshot' => '', // '商品/车型名称快照',
|
||||
// 'unit_price_value_id' => '', // '单价',
|
||||
// 'handling_fee_value_id' => '', // '操作费',
|
||||
// 'fob_transport_fee_value_id' => '', // 'FOB内陆运费',
|
||||
// 'port_misc_fee_value_id' => '', // '港杂费',
|
||||
// 'retrofit_fee_value_id' => '', // '改装费',
|
||||
// 'total_price_value_id' => '', // '合计(按订单结算币计算)',
|
||||
|
||||
'vin' => '', // '车架号',
|
||||
'sku_id' => '', // '商品/车型ID(关联数据)',
|
||||
'model_snapshot' => '', // '车型(若与sku一致可复用;此处为显示快照)',
|
||||
'quantity' => '', // '1.000000' COMMENT '数量',
|
||||
'color_interior_id' => '', // '颜色内饰ID(关联数据)',
|
||||
'color_interior_snapshot' => '', // '颜色内饰名称快照',
|
||||
'color_exterior_id' => '', // '颜色外饰ID(关联数据)',
|
||||
'color_exterior_snapshot' => '', // '颜色外饰名称快照',
|
||||
'remark' => '', // '备注',
|
||||
'unit_price' => '', // '0.000000' COMMENT '单价(含/不含税按业务口径约定)',
|
||||
'handling_fee' => '', // '0.000000' COMMENT '手续费(按单车)',
|
||||
'fob_transport_fee' => '', // '0.000000' COMMENT 'FOB运输费(按单车)',
|
||||
'port_misc_fee' => '', // '0.000000' COMMENT '港杂(按单车)',
|
||||
'retrofit_fee' => '', // '0.000000' COMMENT '改装费(按单车)',
|
||||
'total_price' => '', // '0.000000' COMMENT '总价(quantity*unit_price,写时落地)',
|
||||
'official_price' => '', // 官方指导价
|
||||
'discount_price' => '', // 优惠价
|
||||
|
||||
|
||||
'modify_list' => [
|
||||
// 'order_item_id' => '', // '所属明细ID',
|
||||
'option_id' => '', // '配置项ID(关联数据)',
|
||||
'option_name_snapshot' => '', // '配置项名称快照',
|
||||
'option_price' => '', // '配置项价格(可选,写时快照)',
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
$account = [
|
||||
'order_id' => '', // '所属备货单ID',
|
||||
// 'seq_no' => '', // '1' COMMENT '账户序号(行号)',
|
||||
'remit_country_id' => '', // '汇款国ID(关联数据)',
|
||||
'remit_country_name_snapshot' => '', // '汇款国名称快照',
|
||||
'remit_date' => '', // '汇款日期(时间戳)',
|
||||
'currency_code' => '', // 'USD' COMMENT '币种代码(如USD/CNY/AED等)',
|
||||
'currency_name_snapshot' => '', // '币种名称快照(可选)',
|
||||
'account_id' => '', // '账户ID(关联数据)',
|
||||
'account_name_snapshot' => '', // '账户名称/开户名快照',
|
||||
'remitter_name' => '', // '汇款人',
|
||||
'amount' => '', // '0.00' COMMENT '金额',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\model\Corp;
|
||||
use app\common\model\SysCurrency;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\admin\service\SysAccountService;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard\Currency;
|
||||
|
||||
class SysAccountController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new SysAccountService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function indexFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
if (isset($data['currency_id']) && $data['currency_id'])
|
||||
$data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name');
|
||||
if (isset($data['corp_id']) && $data['corp_id'])
|
||||
$data['corp_name'] = Corp::where('id', $data['corp_id'])->value('name');
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function showFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
if (isset($data['currency_id']))
|
||||
$data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->value('currency_name');
|
||||
if (isset($data['corp_id']) && $data['corp_id'])
|
||||
$data['corp_name'] = Corp::where('id', $data['corp_id'])->value('name');
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\model\Country;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\admin\service\SysCurrencyService;
|
||||
|
||||
class SysCurrencyController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new SysCurrencyService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function indexFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
if (isset($data['last_updated']))
|
||||
$data['last_updated'] = date('Y-m-d H:i:s', $data['last_updated']);
|
||||
if (isset($data['country_id'])){
|
||||
$data['country_name'] = Country::where('id',$data['country_id'])->value('item_label');
|
||||
} else {
|
||||
$data['country_name'] = '';
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function showFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
if (isset($data['last_updated']))
|
||||
$data['last_updated'] = date('Y-m-d H:i:s', $data['last_updated']);
|
||||
if (isset($data['country_id'])){
|
||||
$data['country_name'] = Country::where('id',$data['country_id'])->value('item_label');
|
||||
} else {
|
||||
$data['country_name'] = '';
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\admin\service\SysDictCategoryService;
|
||||
use support\Request;
|
||||
|
||||
class SysDictCategoryController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new SysDictCategoryService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function indexFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function showFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function preset(Request $request)
|
||||
{
|
||||
try {
|
||||
$params = $request->all();
|
||||
$result = (new SysDictCategoryService)->getList($params);
|
||||
return $this->success($result, '获取字典项列表');
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\model\SysDictItem;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\admin\service\SysDictService;
|
||||
use support\Request;
|
||||
|
||||
class SysDictController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new SysDictService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function indexFormat($data)
|
||||
{
|
||||
if (isset($data['sysDictItem']))
|
||||
$data['sysDictItem'] = SysDictItem::where('dict_id',$data['id'])->get();
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
if (isset($data['category_id'])){
|
||||
$data['category'] = SysDictItem::where('id',$data['category_id'])->value('item_label');
|
||||
} else {
|
||||
$data['category'] = '';
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function showFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
$data['sysDictItem'] = SysDictItem::where('dict_id',$data['id'])->get();
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function listScopeFormat($data)
|
||||
{
|
||||
$rdata = [];
|
||||
foreach ($data as $item) {
|
||||
$rdata[$item['dict_code']] = $item['sysDictItem'];
|
||||
}
|
||||
return $rdata;
|
||||
}
|
||||
|
||||
public function listScope(Request $request)
|
||||
{
|
||||
try {
|
||||
$raw = $this->service->serviceListAllScope($request);
|
||||
$data = $this->transformData($raw, method_exists($this, 'listScopeFormat')
|
||||
? [$this, 'listScopeFormat']
|
||||
: null);
|
||||
return $this->success($data);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function group(Request $request)
|
||||
{
|
||||
try {
|
||||
$raw = $this->service->group($request);
|
||||
$data = $this->transformData($raw, method_exists($this, 'groupFormat')
|
||||
? [$this, 'groupFormat']
|
||||
: null);
|
||||
return $this->success($data);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\admin\service\SysDictItemService;
|
||||
|
||||
class SysDictItemController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new SysDictItemService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function indexFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function showFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\model\Country;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\admin\service\SysPortService;
|
||||
|
||||
class SysPortController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new SysPortService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function indexFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
if (isset($data['country_id']))
|
||||
if (isset($data['country_id']))
|
||||
$data['country_name'] = Country::where('id', $data['country_id'])->value('cn_addr');
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function showFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
$data['country_name'] = Country::where('id', $data['country_id'])->value('cn_addr');
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -154,4 +154,16 @@ class UserController extends BaseController
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function updateSign(Request $request)
|
||||
{
|
||||
try {
|
||||
$data = $request->post();
|
||||
$this->service->serviceUpdateSign($request, $data);
|
||||
return $this->success([], '签名成功');
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\admin\service\VehColorService;
|
||||
|
||||
class VehColorController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new VehColorService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function indexFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function showFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\admin\service\VehModificationService;
|
||||
|
||||
class VehModificationController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new VehModificationService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function indexFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function showFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
|
||||
use app\common\traits\crud\CrudLogicTrait;
|
||||
use app\admin\model\ApprovalFlows;
|
||||
|
||||
class ApprovalFlowsLogic
|
||||
{
|
||||
use CrudLogicTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = ApprovalFlows::class;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
|
||||
use app\common\traits\crud\CrudLogicTrait;
|
||||
use app\admin\model\ApprovalInstances;
|
||||
|
||||
class ApprovalInstancesLogic
|
||||
{
|
||||
use CrudLogicTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = ApprovalInstances::class;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
|
||||
use app\common\traits\crud\CrudLogicTrait;
|
||||
use app\admin\model\ApprovalRecords;
|
||||
|
||||
class ApprovalRecordsLogic
|
||||
{
|
||||
use CrudLogicTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = ApprovalRecords::class;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
|
||||
use app\common\traits\crud\CrudLogicTrait;
|
||||
use app\common\model\Brand;
|
||||
|
||||
class BrandLogic
|
||||
{
|
||||
use CrudLogicTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = Brand::class;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
|
||||
use app\common\traits\crud\CrudLogicTrait;
|
||||
use app\common\model\BrandSeries;
|
||||
|
||||
class BrandSeriesLogic
|
||||
{
|
||||
use CrudLogicTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = BrandSeries::class;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
|
||||
use app\common\traits\crud\CrudLogicTrait;
|
||||
use app\common\model\SysAccount;
|
||||
|
||||
class SysAccountLogic
|
||||
{
|
||||
use CrudLogicTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = SysAccount::class;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
|
||||
use app\common\traits\crud\CrudLogicTrait;
|
||||
use app\common\model\SysCurrency;
|
||||
|
||||
class SysCurrencyLogic
|
||||
{
|
||||
use CrudLogicTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = SysCurrency::class;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
|
||||
use app\common\traits\crud\CrudLogicTrait;
|
||||
use app\common\model\SysDictCategory;
|
||||
|
||||
class SysDictCategoryLogic
|
||||
{
|
||||
use CrudLogicTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = SysDictCategory::class;
|
||||
|
||||
public function getList()
|
||||
{
|
||||
return SysDictCategory::where('status', 1)->orderBy('sort','desc')->get(['id', 'category_name']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
|
||||
use app\common\traits\crud\CrudLogicTrait;
|
||||
use app\common\model\SysDictItem;
|
||||
|
||||
class SysDictItemLogic
|
||||
{
|
||||
use CrudLogicTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = SysDictItem::class;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
|
||||
use app\common\traits\crud\CrudLogicTrait;
|
||||
use app\common\model\SysDict;
|
||||
|
||||
class SysDictLogic
|
||||
{
|
||||
use CrudLogicTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = SysDict::class;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
|
||||
use app\common\traits\crud\CrudLogicTrait;
|
||||
use app\common\model\SysPort;
|
||||
|
||||
class SysPortLogic
|
||||
{
|
||||
use CrudLogicTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = SysPort::class;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
|
||||
use app\common\traits\crud\CrudLogicTrait;
|
||||
use app\common\model\VehColor;
|
||||
|
||||
class VehColorLogic
|
||||
{
|
||||
use CrudLogicTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = VehColor::class;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
|
||||
use app\common\traits\crud\CrudLogicTrait;
|
||||
use app\common\model\VehModification;
|
||||
|
||||
class VehModificationLogic
|
||||
{
|
||||
use CrudLogicTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = VehModification::class;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use support\Model;
|
||||
|
||||
class ApprovalFlows extends Model
|
||||
{
|
||||
/**
|
||||
* The connection name for the model.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $connection = 'mysql';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'approval_flows';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
protected $dateFormat = 'U';
|
||||
|
||||
/**
|
||||
* 允许自动填充模型字段
|
||||
*/
|
||||
protected $fillable = ['id', 'name', 'type', 'steps', 'is_active', 'timeout_hours', 'timeout_action', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* 不允许自动填充模型字段
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
|
||||
protected $casts = [
|
||||
'steps' => 'array',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\common\model\StockOrders;
|
||||
use app\common\model\User;
|
||||
use support\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class ApprovalInstances extends Model
|
||||
{
|
||||
/**
|
||||
* The connection name for the model.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $connection = 'mysql';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'approval_instances';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
protected $dateFormat = 'U';
|
||||
|
||||
/**
|
||||
* 允许自动填充模型字段
|
||||
*/
|
||||
// protected $fillable = ['id', 'flow_type', 'biz_id', 'biz_type', 'form_data', 'initiator_id', 'status', 'current_step', 'finished_at', 'deadline_at', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* 不允许自动填充模型字段
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'flow_type',
|
||||
'biz_id',
|
||||
'biz_type',
|
||||
'form_data',
|
||||
'initiator_id',
|
||||
'status',
|
||||
'current_step',
|
||||
'finished_at',
|
||||
'deadline_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'form_data' => 'array', // 自动转换 JSON 字段为数组
|
||||
'finished_at' => 'datetime',
|
||||
'deadline_at' => 'datetime',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* 一个审批实例可以有多个审批记录
|
||||
*/
|
||||
public function approvalRecords(): HasMany
|
||||
{
|
||||
return $this->hasMany(ApprovalRecords::class, 'instance_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前步骤的所有审批记录(pending 状态)
|
||||
*/
|
||||
public function currentStepRecords()
|
||||
{
|
||||
return $this->approvalRecords()
|
||||
->where('step_index', $this->current_step)
|
||||
->where('status', 'pending');
|
||||
}
|
||||
|
||||
public function flows()
|
||||
{
|
||||
return $this->belongsTo(ApprovalFlows::class, 'flow_type', 'type');
|
||||
}
|
||||
|
||||
public function initiator()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'initiator_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
public function bizInfo()
|
||||
{
|
||||
return $this->hasOne(StockOrders::class, 'id', 'biz_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\common\model\User;
|
||||
use support\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class ApprovalRecords extends Model
|
||||
{
|
||||
/**
|
||||
* The connection name for the model.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $connection = 'mysql';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'approval_records';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
protected $dateFormat = 'U';
|
||||
|
||||
/**
|
||||
* 允许自动填充模型字段
|
||||
*/
|
||||
// protected $fillable = ['id', 'instance_id', 'approver_id', 'step_index', 'action', 'status', 'comment', 'approved_at', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* 不允许自动填充模型字段
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'instance_id',
|
||||
'approver_id',
|
||||
'step_index',
|
||||
'action',
|
||||
'status',
|
||||
'comment',
|
||||
'approved_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'approved_at' => 'datetime',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* 一条审批记录属于一个审批实例
|
||||
*/
|
||||
public function approvalInstance(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ApprovalInstances::class, 'instance_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联审批人
|
||||
*/
|
||||
public function approver()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'approver_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
use app\admin\validate\ApprovalFlowsValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\admin\model\ApprovalFlows;
|
||||
use support\Request;
|
||||
|
||||
class ApprovalFlowsService
|
||||
{
|
||||
|
||||
use CrudServiceTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = ApprovalFlows::class;
|
||||
|
||||
/**
|
||||
* 验证器
|
||||
*/
|
||||
protected $validator = ApprovalFlowsValidate::class;
|
||||
|
||||
/**
|
||||
* 获取验证器
|
||||
*/
|
||||
public function getValidator()
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
|
||||
protected function buildQueryConfig(Request $request, string $scene = 'index'): array
|
||||
{
|
||||
$p = $request->all();
|
||||
|
||||
$config = [];
|
||||
$config['model'] = $this->modelClass;
|
||||
switch ($scene) {
|
||||
case 'index':
|
||||
$config['order']['id'] = 'desc';
|
||||
break;
|
||||
case 'show':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'store':
|
||||
break;
|
||||
case 'update':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'destroy':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
use app\admin\validate\ApprovalInstancesValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\admin\model\ApprovalInstances;
|
||||
|
||||
class ApprovalInstancesService
|
||||
{
|
||||
|
||||
use CrudServiceTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = ApprovalInstances::class;
|
||||
|
||||
/**
|
||||
* 验证器
|
||||
*/
|
||||
protected $validator = ApprovalInstancesValidate::class;
|
||||
|
||||
/**
|
||||
* 获取验证器
|
||||
*/
|
||||
public function getValidator()
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
use app\admin\validate\ApprovalRecordsValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\admin\model\ApprovalRecords;
|
||||
use support\Request;
|
||||
|
||||
class ApprovalRecordsService
|
||||
{
|
||||
|
||||
use CrudServiceTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = ApprovalRecords::class;
|
||||
|
||||
/**
|
||||
* 验证器
|
||||
*/
|
||||
protected $validator = ApprovalRecordsValidate::class;
|
||||
|
||||
/**
|
||||
* 获取验证器
|
||||
*/
|
||||
public function getValidator()
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
|
||||
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
|
||||
{
|
||||
$p = $request->all();
|
||||
|
||||
$config = [];
|
||||
$config['model'] = $this->modelClass;
|
||||
switch ($scene) {
|
||||
case 'index':
|
||||
$config['order']['id'] = 'desc';
|
||||
|
||||
$config['with'] = [
|
||||
'approvalInstance',
|
||||
'approver',
|
||||
'approvalInstance.flows',
|
||||
'approvalInstance.initiator',
|
||||
'approvalInstance.bizInfo'
|
||||
];
|
||||
|
||||
// $config['dataLimit']['type'] = 'relation';
|
||||
// $config['dataLimit']['userId'] = $request->user->uid;
|
||||
// $config['dataLimit']['userField'] = 'approver_id';
|
||||
break;
|
||||
case 'show':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'store':
|
||||
break;
|
||||
case 'update':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'destroy':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'logs':
|
||||
$config['where']['instance_id'] = $p['instance_id'];
|
||||
$config['order']['id'] = 'desc';
|
||||
break;
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
||||
public function serviceApprove(Request $request)
|
||||
{
|
||||
$param = $request->all();
|
||||
$appro = new \app\common\utils\approval\service\ApprovalFlowService();
|
||||
return $appro->approve($param['instance_id'], $request->user->uid, $param['action'], $param['comment']);
|
||||
}
|
||||
|
||||
|
||||
public function serviceLogs(Request $request)
|
||||
{
|
||||
$config = $this->buildQueryConfig($request, 'logs');
|
||||
$item = $this->logicListAll($config);
|
||||
return $this->postProcess('Logs', $item);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
use app\admin\validate\BrandSeriesValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\BrandSeries;
|
||||
use support\Request;
|
||||
|
||||
class BrandSeriesService
|
||||
{
|
||||
|
||||
use CrudServiceTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = BrandSeries::class;
|
||||
|
||||
/**
|
||||
* 验证器
|
||||
*/
|
||||
protected $validator = BrandSeriesValidate::class;
|
||||
|
||||
/**
|
||||
* 获取验证器
|
||||
*/
|
||||
public function getValidator()
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询条件
|
||||
*/
|
||||
|
||||
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
|
||||
{
|
||||
$p = $request->all();
|
||||
|
||||
$config = [];
|
||||
$config['model'] = $this->modelClass;
|
||||
switch ($scene) {
|
||||
case 'index':
|
||||
// ====== ====== 排序 ====== ======
|
||||
$config['order']['sort'] = 'desc';
|
||||
$config['order']['id'] = 'desc';
|
||||
|
||||
// ====== ====== 筛选 ====== ======
|
||||
$config['where']['brand_id'] = $p['brand_id'];
|
||||
// 状态
|
||||
if (isset($p['status']) && in_array($p['status'], [0,1])) {
|
||||
$config['where']['status'] = $p['status'];
|
||||
}
|
||||
// 关键字
|
||||
if (isset($p['keyword']) && $p['keyword']) {
|
||||
$k = '%' . $p['keyword'] . '%';
|
||||
foreach (['series_code','series_name'] as $col) {
|
||||
$config['orWhere'][] = [$col, 'like', $k];
|
||||
}
|
||||
}
|
||||
//$config['where']['status'] = 1;
|
||||
break;
|
||||
case 'show':
|
||||
$config['where']['id'] = $p['id'];
|
||||
//$config['where']['status'] = 1;
|
||||
break;
|
||||
case 'store':
|
||||
break;
|
||||
case 'update':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'destroy':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
use app\admin\validate\BrandValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\Brand;
|
||||
use support\Request;
|
||||
|
||||
class BrandService
|
||||
{
|
||||
|
||||
use CrudServiceTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = Brand::class;
|
||||
|
||||
/**
|
||||
* 验证器
|
||||
*/
|
||||
protected $validator = BrandValidate::class;
|
||||
|
||||
/**
|
||||
* 获取验证器
|
||||
*/
|
||||
public function getValidator()
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询条件
|
||||
*/
|
||||
|
||||
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
|
||||
{
|
||||
$p = $request->all();
|
||||
|
||||
$config = [];
|
||||
$config['model'] = $this->modelClass;
|
||||
switch ($scene) {
|
||||
case 'index':
|
||||
// ====== ====== 排序 ====== ======
|
||||
$config['order']['sort'] = 'desc';
|
||||
$config['order']['id'] = 'desc';
|
||||
|
||||
// ====== ====== 筛选 ====== ======
|
||||
// 状态
|
||||
if (isset($p['status']) && in_array($p['status'], [0,1])) {
|
||||
$config['where']['status'] = $p['status'];
|
||||
}
|
||||
// 关键字
|
||||
if (isset($p['keyword']) && $p['keyword']) {
|
||||
$k = '%' . $p['keyword'] . '%';
|
||||
foreach (['brand_code','brand_name'] as $col) {
|
||||
$config['orWhere'][] = [$col, 'like', $k];
|
||||
}
|
||||
}
|
||||
//$config['where']['status'] = 1;
|
||||
break;
|
||||
case 'show':
|
||||
$config['where']['id'] = $p['id'];
|
||||
//$config['where']['status'] = 1;
|
||||
break;
|
||||
case 'store':
|
||||
break;
|
||||
case 'update':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'destroy':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
use app\admin\validate\SysAccountValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\SysAccount;
|
||||
use support\Request;
|
||||
|
||||
class SysAccountService
|
||||
{
|
||||
|
||||
use CrudServiceTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = SysAccount::class;
|
||||
|
||||
/**
|
||||
* 验证器
|
||||
*/
|
||||
protected $validator = SysAccountValidate::class;
|
||||
|
||||
/**
|
||||
* 获取验证器
|
||||
*/
|
||||
public function getValidator()
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询条件
|
||||
*/
|
||||
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
|
||||
{
|
||||
$p = $request->all();
|
||||
|
||||
$config = [];
|
||||
$config['model'] = $this->modelClass;
|
||||
switch ($scene) {
|
||||
case 'index':
|
||||
// ====== ====== 排序 ====== ======
|
||||
$config['order']['sort'] = 'desc';
|
||||
$config['order']['id'] = 'desc';
|
||||
|
||||
// ====== ====== 筛选 ====== ======
|
||||
// 状态
|
||||
if (isset($p['status']) && in_array($p['status'], [0,1])) {
|
||||
$config['where']['status'] = $p['status'];
|
||||
}
|
||||
// 状态
|
||||
if (isset($p['type']) && $p['type']) {
|
||||
$config['where']['type'] = $p['type'];
|
||||
}
|
||||
// 关键字
|
||||
if (isset($p['keyword']) && $p['keyword']) {
|
||||
$k = '%' . $p['keyword'] . '%';
|
||||
foreach (['account_name','account_number','bank_name','bank_branch','description'] as $col) {
|
||||
$config['orWhere'][] = [$col, 'like', $k];
|
||||
}
|
||||
}
|
||||
//$config['where']['status'] = 1;
|
||||
break;
|
||||
case 'show':
|
||||
$config['where']['id'] = $p['id'];
|
||||
//$config['where']['status'] = 1;
|
||||
break;
|
||||
case 'store':
|
||||
break;
|
||||
case 'update':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'destroy':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
use app\admin\validate\SysCurrencyValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\SysCurrency;
|
||||
use app\common\utils\translation\service\TranslationService;
|
||||
use app\queue\utils\Translat;
|
||||
use support\Request;
|
||||
|
||||
class SysCurrencyService
|
||||
{
|
||||
|
||||
use CrudServiceTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = SysCurrency::class;
|
||||
|
||||
/**
|
||||
* 验证器
|
||||
*/
|
||||
protected $validator = SysCurrencyValidate::class;
|
||||
|
||||
/**
|
||||
* 获取验证器
|
||||
*/
|
||||
public function getValidator()
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构造 CrudUtil 查询配置
|
||||
*/
|
||||
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
|
||||
{
|
||||
$p = $request->all();
|
||||
|
||||
$config = [];
|
||||
$config['model'] = $this->modelClass;
|
||||
switch ($scene) {
|
||||
case 'default':
|
||||
$config['order']['id'] = 'desc';
|
||||
case 'index':
|
||||
break;
|
||||
case 'show':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'store':
|
||||
break;
|
||||
case 'update':
|
||||
case 'destroy':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
public $translatFields = ['currency_name'];
|
||||
|
||||
public function afterServiceStore($res)
|
||||
{
|
||||
$sourceLocale = locale();
|
||||
$data = $res->toArray();
|
||||
$traitsourceFields = Translat::extractSourceFields($data, $this->translatFields);
|
||||
|
||||
(new TranslationService())->queueTranslations(
|
||||
'sys_currency',
|
||||
$res['id'],
|
||||
$sourceLocale,
|
||||
$traitsourceFields
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
use app\admin\logic\SysDictCategoryLogic;
|
||||
use app\admin\validate\SysDictCategoryValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\SysDictCategory;
|
||||
use support\exception\BusinessException;
|
||||
|
||||
class SysDictCategoryService
|
||||
{
|
||||
|
||||
use CrudServiceTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = SysDictCategory::class;
|
||||
|
||||
/**
|
||||
* 验证器
|
||||
*/
|
||||
protected $validator = SysDictCategoryValidate::class;
|
||||
|
||||
/**
|
||||
* 获取验证器
|
||||
*/
|
||||
public function getValidator()
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
/**
|
||||
* 获取系统list
|
||||
*/
|
||||
public function getList($params)
|
||||
{
|
||||
return (new SysDictCategoryLogic)->getList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
use app\admin\validate\SysDictItemValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\SysDictItem;
|
||||
use app\common\utils\translation\service\TranslationService;
|
||||
use app\queue\utils\Translat;
|
||||
use support\Request;
|
||||
|
||||
class SysDictItemService
|
||||
{
|
||||
|
||||
use CrudServiceTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = SysDictItem::class;
|
||||
|
||||
/**
|
||||
* 验证器
|
||||
*/
|
||||
protected $validator = SysDictItemValidate::class;
|
||||
|
||||
/**
|
||||
* 获取验证器
|
||||
*/
|
||||
public function getValidator()
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询条件
|
||||
*/
|
||||
protected function buildQueryConfig(Request $request, string $scene = 'index'): array
|
||||
{
|
||||
$p = $request->all();
|
||||
|
||||
$config = [];
|
||||
$config['model'] = $this->modelClass;
|
||||
switch ($scene) {
|
||||
case 'index':
|
||||
// ====== ====== 排序 ====== ======
|
||||
$config['order']['sort'] = 'desc';
|
||||
|
||||
// ====== ====== 筛选 ====== ======
|
||||
|
||||
$config['where']['dict_id'] = $p['id'];
|
||||
// 状态
|
||||
if (isset($p['status']) && in_array($p['status'], [0,1])) {
|
||||
$config['where']['status'] = $p['status'];
|
||||
}
|
||||
// 关键字
|
||||
if (isset($p['keyword']) && $p['keyword']) {
|
||||
$k = '%' . $p['keyword'] . '%';
|
||||
foreach (['item_label','item_value','remark'] as $col) {
|
||||
$config['orWhere'][] = [$col, 'like', $k];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'show':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'update':
|
||||
case 'destroy':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'store':
|
||||
break;
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
public $translatFields = ['item_label','remark'];
|
||||
|
||||
public function afterServiceStore($res)
|
||||
{
|
||||
$sourceLocale = locale();
|
||||
$data = $res->toArray();
|
||||
$traitsourceFields = Translat::extractSourceFields($data, $this->translatFields);
|
||||
|
||||
(new TranslationService())->queueTranslations(
|
||||
'sys_dict_item',
|
||||
$res['id'],
|
||||
$sourceLocale,
|
||||
$traitsourceFields
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
use app\admin\validate\SysDictValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\SysDict;
|
||||
use app\common\model\SysDictCategory;
|
||||
use app\common\utils\translation\service\TranslationService;
|
||||
use app\queue\utils\Translat;
|
||||
use support\Request;
|
||||
|
||||
class SysDictService
|
||||
{
|
||||
|
||||
use CrudServiceTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = SysDict::class;
|
||||
|
||||
/**
|
||||
* 验证器
|
||||
*/
|
||||
protected $validator = SysDictValidate::class;
|
||||
|
||||
/**
|
||||
* 获取验证器
|
||||
*/
|
||||
public function getValidator()
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建查询条件
|
||||
*/
|
||||
protected function buildQueryConfig(Request $request, string $scene = 'index'): array
|
||||
{
|
||||
$p = $request->all();
|
||||
|
||||
$config = [];
|
||||
$config['model'] = $this->modelClass;
|
||||
switch ($scene) {
|
||||
case 'index':
|
||||
// ====== ====== 排序 ====== ======
|
||||
$config['order']['id'] = 'desc';
|
||||
|
||||
// ====== ====== 筛选 ====== ======
|
||||
// 状态
|
||||
if (isset($p['status']) && in_array($p['status'], [0,1])) {
|
||||
$config['where']['status'] = $p['status'];
|
||||
}
|
||||
// 分类筛选
|
||||
if (isset($p['category_id']) && !empty($p['category_id'])) {
|
||||
$config['where']['category_id'] = $p['category_id'];
|
||||
}
|
||||
// 关键字
|
||||
if (isset($p['keyword']) && $p['keyword']) {
|
||||
$k = '%' . $p['keyword'] . '%';
|
||||
foreach (['dict_name','dict_code','description'] as $col) {
|
||||
$config['orWhere'][] = [$col, 'like', $k];
|
||||
}
|
||||
}
|
||||
|
||||
// ====== ====== 关联 ====== ======
|
||||
$config['with']['sysDictItem'][] = 'item_label';
|
||||
$config['with']['sysDictItem'][] = 'item_value';
|
||||
break;
|
||||
case 'show':
|
||||
$config['where']['id'] = $p['id'];
|
||||
// ====== ====== 关联 ====== ======
|
||||
$config['with']['sysDictItem'][] = 'item_label';
|
||||
$config['with']['sysDictItem'][] = 'item_value';
|
||||
break;
|
||||
case 'update':
|
||||
case 'destroy':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'store':
|
||||
break;
|
||||
case 'scope':
|
||||
$config['order']['id'] = 'desc';
|
||||
// 决定查id还是code
|
||||
$scopeType = 0;
|
||||
if (isset($p['scope_type']) && $p['scope_type'] > 0) {
|
||||
$scopeType = 1;
|
||||
}
|
||||
if (isset($p['scope']) && !empty($p['scope'])) {
|
||||
if ($scopeType == 1) {
|
||||
$config['where']['dict_code'] = ['in', explode(',', $p['scope'])];
|
||||
} else {
|
||||
$config['where']['id'] = ['in', explode(',', $p['scope'])];
|
||||
}
|
||||
}
|
||||
$config['with']['sysDictItem'][] = 'dict_id';
|
||||
$config['with']['sysDictItem'][] = 'item_label';
|
||||
$config['with']['sysDictItem'][] = 'item_value';
|
||||
break;
|
||||
case 'group':
|
||||
$config['order']['id'] = 'desc';
|
||||
$config['where']['id'] = 1;
|
||||
$config['with']['sysDictItem'][] = 'dict_id';
|
||||
$config['with']['sysDictItem'][] = 'item_label';
|
||||
$config['with']['sysDictItem'][] = 'item_value';
|
||||
break;
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
public function group(Request $request)
|
||||
{
|
||||
$config = $this->buildQueryConfig($request, 'group');
|
||||
$result = $this->logicShow($config);
|
||||
return $this->postProcess('group', $result);
|
||||
}
|
||||
|
||||
|
||||
public function serviceListAllScope(Request $request)
|
||||
{
|
||||
$config = $this->buildQueryConfig($request, 'scope');
|
||||
$result = $this->logicListAll($config);
|
||||
return $this->postProcess('ListAllScope', $result);
|
||||
}
|
||||
|
||||
|
||||
public function afterServiceListAllScope($data)
|
||||
{
|
||||
|
||||
// $data->each(function (&$item) {
|
||||
|
||||
// });
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public $translatFields = ['dict_name', 'description'];
|
||||
|
||||
public function afterServiceStore($res)
|
||||
{
|
||||
$sourceLocale = locale();
|
||||
$data = $res->toArray();
|
||||
$traitsourceFields = Translat::extractSourceFields($data, $this->translatFields);
|
||||
|
||||
(new TranslationService())->queueTranslations(
|
||||
'sys_dict',
|
||||
$res['id'],
|
||||
$sourceLocale,
|
||||
$traitsourceFields
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
示例用法:
|
||||
|
||||
// 1) 获取分类为“车辆类型”的所有字典
|
||||
$list = $dictService->getDictsByCategoryName('车辆类型');
|
||||
// => [['dict_code' => 'SUV', 'dict_name' => '越野车'], …]
|
||||
|
||||
// 2) 获取某分类下某个 code 的名称
|
||||
$name = $dictService->getDictName('车辆类型', 'SUV');
|
||||
// => "越野车"
|
||||
|
||||
// 3) 获取某分类下拉选项
|
||||
$options = $dictService->getDictOptions('车辆类型');
|
||||
// => ['SUV' => '越野车', 'SEDAN' => '轿车', …]
|
||||
|
||||
// 4) 通过 code 直接拿名称(不管分类)
|
||||
$name = $dictService->getNameByCode('SUV');
|
||||
// => "越野车"
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 根据分类名获取字典列表
|
||||
*/
|
||||
public function getDictsByCategoryName(string $categoryName): array
|
||||
{
|
||||
$category = SysDictCategory::where('category_name', $categoryName)
|
||||
->where('status', 1)
|
||||
->first();
|
||||
|
||||
if (!$category) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $category->dicts()->get(['dict_code', 'dict_name'])->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分类名 + 字典code 获取字典项名称
|
||||
*/
|
||||
public function getDictName(string $categoryName, string $dictCode): ?string
|
||||
{
|
||||
$dict = SysDict::whereHas('category', function ($q) use ($categoryName) {
|
||||
$q->where('category_name', $categoryName)->where('status', 1);
|
||||
})
|
||||
->where('dict_code', $dictCode)
|
||||
->where('status', 1)
|
||||
->whereNull('deleted_at')
|
||||
->first();
|
||||
|
||||
return $dict?->dict_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分类名获取下拉键值对
|
||||
* 返回格式:['code1' => '名称1', 'code2' => '名称2']
|
||||
*/
|
||||
public function getDictOptions(string $categoryName): array
|
||||
{
|
||||
$dicts = $this->getDictsByCategoryName($categoryName);
|
||||
|
||||
$options = [];
|
||||
foreach ($dicts as $item) {
|
||||
$options[$item['dict_code']] = $item['dict_name'];
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典 code 获取对应的名称(不依赖分类)
|
||||
*/
|
||||
public function getNameByCode(string $dictCode): ?string
|
||||
{
|
||||
$dict = SysDict::where('dict_code', $dictCode)
|
||||
->where('status', 1)
|
||||
->whereNull('deleted_at')
|
||||
->first();
|
||||
|
||||
return $dict?->dict_name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
use app\admin\validate\SysPortValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\SysPort;
|
||||
use app\common\utils\translation\service\TranslationService;
|
||||
use app\queue\utils\Translat;
|
||||
use support\Request;
|
||||
|
||||
class SysPortService
|
||||
{
|
||||
|
||||
use CrudServiceTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = SysPort::class;
|
||||
|
||||
/**
|
||||
* 验证器
|
||||
*/
|
||||
protected $validator = SysPortValidate::class;
|
||||
|
||||
public $translatFields = ['port_name','description'];
|
||||
|
||||
/**
|
||||
* 获取验证器
|
||||
*/
|
||||
public function getValidator()
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询条件
|
||||
*/
|
||||
|
||||
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
|
||||
{
|
||||
$p = $request->all();
|
||||
|
||||
$config = [];
|
||||
$config['model'] = $this->modelClass;
|
||||
switch ($scene) {
|
||||
case 'index':
|
||||
// ====== ====== 排序 ====== ======
|
||||
$config['order']['sort'] = 'desc';
|
||||
$config['order']['id'] = 'desc';
|
||||
|
||||
// ====== ====== 筛选 ====== ======
|
||||
// 状态
|
||||
if (isset($p['status']) && in_array($p['status'], [0,1])) {
|
||||
$config['where']['status'] = $p['status'];
|
||||
}
|
||||
// 关键字
|
||||
if (isset($p['keyword']) && $p['keyword']) {
|
||||
$k = '%' . $p['keyword'] . '%';
|
||||
foreach (['port_code','port_name'] as $col) {
|
||||
$config['orWhere'][] = [$col, 'like', $k];
|
||||
}
|
||||
}
|
||||
// 场景
|
||||
if (isset($p['scene']) && $p['scene']) {
|
||||
if($p['country_id'] == 'domestic'){
|
||||
$config['where']['country_id'] = 45;
|
||||
}else{
|
||||
$config['where']['country_id'] = ['<>', 45];
|
||||
}
|
||||
}
|
||||
//$config['where']['status'] = 1;
|
||||
break;
|
||||
case 'show':
|
||||
$config['where']['id'] = $p['id'];
|
||||
//$config['where']['status'] = 1;
|
||||
break;
|
||||
case 'store':
|
||||
break;
|
||||
case 'update':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'destroy':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加前置处理
|
||||
*/
|
||||
public function beforeServiceStore($data, Request $request)
|
||||
{
|
||||
if(empty($data['lat']))
|
||||
unset($data['lat']);
|
||||
if(empty($data['lng']))
|
||||
unset($data['lng']);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function afterServiceStore($res)
|
||||
{
|
||||
$sourceLocale = locale();
|
||||
$data = $res->toArray();
|
||||
$traitsourceFields = Translat::extractSourceFields($data, $this->translatFields);
|
||||
|
||||
(new TranslationService())->queueTranslations(
|
||||
'sys_port_translation',
|
||||
$res['id'],
|
||||
$sourceLocale,
|
||||
$traitsourceFields
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加前置处理
|
||||
*/
|
||||
public function beforeServiceUpdate($data, Request $request)
|
||||
{
|
||||
if(empty($data['lat']))
|
||||
unset($data['lat']);
|
||||
if(empty($data['lng']))
|
||||
unset($data['lng']);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -90,6 +90,9 @@ class UserService
|
||||
if (isset($p['id']) && $p['id']) {
|
||||
$config['where']['id'] = $p['id'];
|
||||
}
|
||||
if (isset($p['corp_id']) && $p['corp_id']) {
|
||||
$config['where']['corp_id'] = $p['corp_id'];
|
||||
}
|
||||
|
||||
$config['fields'] = ['id','sn', 'name', 'email', 'sex', 'phone', 'avatar', 'corp_id', 'country_id', 'position', 'report_to', 'status', 'created_at'];
|
||||
|
||||
@@ -113,6 +116,7 @@ class UserService
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'edit':
|
||||
case 'updateSign':
|
||||
$config['where']['id'] = $request->user->uid;
|
||||
break;
|
||||
}
|
||||
@@ -154,4 +158,13 @@ class UserService
|
||||
$user = $this->logicUpdateBy($config,$data);
|
||||
return $user;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function serviceUpdateSign(Request $request, array $data)
|
||||
{
|
||||
$config = $this->buildQueryConfig($request, 'updateSign');
|
||||
$user = $this->logicUpdateBy($config,$data);
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
use app\admin\validate\VehColorValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\VehColor;
|
||||
use app\common\utils\translation\service\TranslationService;
|
||||
use app\queue\utils\Translat;
|
||||
use support\Request;
|
||||
|
||||
class VehColorService
|
||||
{
|
||||
|
||||
use CrudServiceTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = VehColor::class;
|
||||
|
||||
/**
|
||||
* 验证器
|
||||
*/
|
||||
protected $validator = VehColorValidate::class;
|
||||
|
||||
public $translatFields = ['color_text'];
|
||||
|
||||
/**
|
||||
* 获取验证器
|
||||
*/
|
||||
public function getValidator()
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
public function afterServiceStore($res)
|
||||
{
|
||||
$sourceLocale = locale();
|
||||
$data = $res->toArray();
|
||||
$traitsourceFields = Translat::extractSourceFields($data, $this->translatFields);
|
||||
|
||||
(new TranslationService())->queueTranslations(
|
||||
'veh_color_translation',
|
||||
$res['id'],
|
||||
$sourceLocale,
|
||||
$traitsourceFields
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成唯一的7位颜色编码
|
||||
* 格式:C + (O/I) + 5位字母数字组合
|
||||
*
|
||||
* @param int $type 类型:2=I,其他=O
|
||||
* @return string 7位唯一编码
|
||||
*/
|
||||
public function generateUniqueColorCode($type)
|
||||
{
|
||||
$secondChar = $type ==2 ? 'I' : 'O';
|
||||
$chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$maxAttempts = 10; // 防止无限循环
|
||||
|
||||
for ($attempt = 0; $attempt < $maxAttempts; $attempt++) {
|
||||
// 生成后5位随机字符
|
||||
$suffix = '';
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$suffix .= $chars[rand(0, strlen($chars) - 1)];
|
||||
}
|
||||
|
||||
$colorCode = 'C' . $secondChar . $suffix;
|
||||
|
||||
// 检查是否已存在
|
||||
$existing = VehColor::where('color_code', $colorCode)->first();
|
||||
if (!$existing) {
|
||||
return $colorCode;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果1000次尝试后仍然重复,使用时间戳确保唯一性
|
||||
$timestamp = substr(time(), -5);
|
||||
return 'C' . $secondChar . $timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加前置处理
|
||||
*/
|
||||
public function beforeServiceStore($data, Request $request)
|
||||
{
|
||||
$type = $data['type'] ?? 0;
|
||||
$data['color_code'] = $this->generateUniqueColorCode($type);
|
||||
$data['created_by'] = $request->user->uid;
|
||||
$data['updated_by'] = $request->user->uid;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加前置处理
|
||||
*/
|
||||
public function beforeServiceUpdate($data, Request $request)
|
||||
{
|
||||
$data['updated_by'] = $request->user->uid;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\service;
|
||||
|
||||
use app\admin\validate\VehModificationValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\VehModification;
|
||||
use support\Request;
|
||||
|
||||
class VehModificationService
|
||||
{
|
||||
|
||||
use CrudServiceTrait;
|
||||
|
||||
/**
|
||||
* 指定当前要操作的模型
|
||||
*/
|
||||
protected string $modelClass = VehModification::class;
|
||||
|
||||
/**
|
||||
* 验证器
|
||||
*/
|
||||
protected $validator = VehModificationValidate::class;
|
||||
|
||||
/**
|
||||
* 获取验证器
|
||||
*/
|
||||
public function getValidator()
|
||||
{
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询条件
|
||||
*/
|
||||
|
||||
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
|
||||
{
|
||||
$p = $request->all();
|
||||
|
||||
$config = [];
|
||||
$config['model'] = $this->modelClass;
|
||||
switch ($scene) {
|
||||
case 'index':
|
||||
// ====== ====== 排序 ====== ======
|
||||
$config['order']['sort'] = 'desc';
|
||||
$config['order']['id'] = 'desc';
|
||||
|
||||
// ====== ====== 筛选 ====== ======
|
||||
// 状态
|
||||
if (isset($p['status']) && in_array($p['status'], [0,1])) {
|
||||
$config['where']['status'] = $p['status'];
|
||||
}
|
||||
// 状态
|
||||
if (isset($p['type']) && $p['type']) {
|
||||
$config['where']['type'] = $p['type'];
|
||||
}
|
||||
// 关键字
|
||||
if (isset($p['keyword']) && $p['keyword']) {
|
||||
$k = '%' . $p['keyword'] . '%';
|
||||
foreach (['code','name'] as $col) {
|
||||
$config['orWhere'][] = [$col, 'like', $k];
|
||||
}
|
||||
}
|
||||
//$config['where']['status'] = 1;
|
||||
break;
|
||||
case 'show':
|
||||
$config['where']['id'] = $p['id'];
|
||||
//$config['where']['status'] = 1;
|
||||
break;
|
||||
case 'store':
|
||||
break;
|
||||
case 'update':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'destroy':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成唯一的7位颜色编码
|
||||
* 格式:C + (O/I) + 5位字母数字组合
|
||||
*
|
||||
* @param int $type 类型
|
||||
* @return string 7位唯一编码
|
||||
*/
|
||||
public function generateUniqueModificationCode($type)
|
||||
{
|
||||
$chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$maxAttempts = 10; // 防止无限循环
|
||||
|
||||
for ($attempt = 0; $attempt < $maxAttempts; $attempt++) {
|
||||
// 生成后5位随机字符
|
||||
$suffix = '';
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$suffix .= $chars[rand(0, strlen($chars) - 1)];
|
||||
}
|
||||
|
||||
$code = 'C' . $type . $suffix;
|
||||
|
||||
// 检查是否已存在
|
||||
$existing = VehModification::where('code', $code)->first();
|
||||
if (!$existing) {
|
||||
return $code;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果1000次尝试后仍然重复,使用时间戳确保唯一性
|
||||
$timestamp = substr(time(), -5);
|
||||
return 'C' . $type . $timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加前置处理
|
||||
*/
|
||||
public function beforeServiceStore($data, Request $request)
|
||||
{
|
||||
$type = $data['type'] ?? 0;
|
||||
$data['code'] = $this->generateUniqueModificationCode($type);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class ApprovalFlowsValidate extends Validate
|
||||
{
|
||||
// 规则
|
||||
protected $rule = [
|
||||
|
||||
];
|
||||
|
||||
// 提示
|
||||
protected $message = [
|
||||
|
||||
];
|
||||
|
||||
// 场景
|
||||
protected $scene = [
|
||||
'store' => [
|
||||
|
||||
],
|
||||
|
||||
'update' => [
|
||||
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class ApprovalInstancesValidate extends Validate
|
||||
{
|
||||
// 规则
|
||||
protected $rule = [
|
||||
|
||||
];
|
||||
|
||||
// 提示
|
||||
protected $message = [
|
||||
|
||||
];
|
||||
|
||||
// 场景
|
||||
protected $scene = [
|
||||
'store' => [
|
||||
|
||||
],
|
||||
|
||||
'update' => [
|
||||
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class ApprovalRecordsValidate extends Validate
|
||||
{
|
||||
// 规则
|
||||
protected $rule = [
|
||||
|
||||
];
|
||||
|
||||
// 提示
|
||||
protected $message = [
|
||||
|
||||
];
|
||||
|
||||
// 场景
|
||||
protected $scene = [
|
||||
'store' => [
|
||||
|
||||
],
|
||||
|
||||
'update' => [
|
||||
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class BrandSeriesValidate extends Validate
|
||||
{
|
||||
// 规则
|
||||
protected $rule = [
|
||||
|
||||
];
|
||||
|
||||
// 提示
|
||||
protected $message = [
|
||||
|
||||
];
|
||||
|
||||
// 场景
|
||||
protected $scene = [
|
||||
'store' => [
|
||||
|
||||
],
|
||||
|
||||
'update' => [
|
||||
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class BrandValidate extends Validate
|
||||
{
|
||||
// 规则
|
||||
protected $rule = [
|
||||
|
||||
];
|
||||
|
||||
// 提示
|
||||
protected $message = [
|
||||
|
||||
];
|
||||
|
||||
// 场景
|
||||
protected $scene = [
|
||||
'store' => [
|
||||
|
||||
],
|
||||
|
||||
'update' => [
|
||||
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class SysAccountValidate extends Validate
|
||||
{
|
||||
// 规则
|
||||
protected $rule = [
|
||||
'corp_id' => 'require|integer|gt:0',
|
||||
];
|
||||
|
||||
// 提示
|
||||
protected $message = [
|
||||
'corp_id.require' => 'ID不能为空',
|
||||
'corp_id.integer' => 'ID必须是整数',
|
||||
'corp_id.gt' => 'ID必须大于0',
|
||||
];
|
||||
|
||||
// 场景
|
||||
protected $scene = [
|
||||
'store' => [
|
||||
'corp_id'
|
||||
],
|
||||
|
||||
'update' => [
|
||||
'corp_id'
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class SysCurrencyValidate extends Validate
|
||||
{
|
||||
// 规则
|
||||
protected $rule = [
|
||||
|
||||
];
|
||||
|
||||
// 提示
|
||||
protected $message = [
|
||||
|
||||
];
|
||||
|
||||
// 场景
|
||||
protected $scene = [
|
||||
'store' => [
|
||||
|
||||
],
|
||||
|
||||
'update' => [
|
||||
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class SysDictCategoryValidate extends Validate
|
||||
{
|
||||
// 规则
|
||||
protected $rule = [
|
||||
|
||||
];
|
||||
|
||||
// 提示
|
||||
protected $message = [
|
||||
|
||||
];
|
||||
|
||||
// 场景
|
||||
protected $scene = [
|
||||
'store' => [
|
||||
|
||||
],
|
||||
|
||||
'update' => [
|
||||
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class SysDictItemValidate extends Validate
|
||||
{
|
||||
// 规则
|
||||
protected $rule = [
|
||||
|
||||
];
|
||||
|
||||
// 提示
|
||||
protected $message = [
|
||||
|
||||
];
|
||||
|
||||
// 场景
|
||||
protected $scene = [
|
||||
'store' => [
|
||||
|
||||
],
|
||||
|
||||
'update' => [
|
||||
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class SysDictValidate extends Validate
|
||||
{
|
||||
// 规则
|
||||
protected $rule = [
|
||||
|
||||
];
|
||||
|
||||
// 提示
|
||||
protected $message = [
|
||||
|
||||
];
|
||||
|
||||
// 场景
|
||||
protected $scene = [
|
||||
'store' => [
|
||||
|
||||
],
|
||||
|
||||
'update' => [
|
||||
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class SysPortValidate extends Validate
|
||||
{
|
||||
// 规则
|
||||
protected $rule = [
|
||||
|
||||
];
|
||||
|
||||
// 提示
|
||||
protected $message = [
|
||||
|
||||
];
|
||||
|
||||
// 场景
|
||||
protected $scene = [
|
||||
'store' => [
|
||||
|
||||
],
|
||||
|
||||
'update' => [
|
||||
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class VehColorValidate extends Validate
|
||||
{
|
||||
// 规则
|
||||
protected $rule = [
|
||||
|
||||
];
|
||||
|
||||
// 提示
|
||||
protected $message = [
|
||||
|
||||
];
|
||||
|
||||
// 场景
|
||||
protected $scene = [
|
||||
'store' => [
|
||||
|
||||
],
|
||||
|
||||
'update' => [
|
||||
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class VehModificationValidate extends Validate
|
||||
{
|
||||
// 规则
|
||||
protected $rule = [
|
||||
|
||||
];
|
||||
|
||||
// 提示
|
||||
protected $message = [
|
||||
|
||||
];
|
||||
|
||||
// 场景
|
||||
protected $scene = [
|
||||
'store' => [
|
||||
|
||||
],
|
||||
|
||||
'update' => [
|
||||
|
||||
]
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user