Merge branch 'develop' into feature/mzl_dev
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
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;
|
||||
@@ -30,8 +31,10 @@ class SysAccountController extends BaseController
|
||||
$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_name']))
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -47,8 +50,10 @@ class SysAccountController extends BaseController
|
||||
$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_name']))
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ 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
|
||||
{
|
||||
@@ -46,4 +47,23 @@ class VehColorService
|
||||
$traitsourceFields
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加前置处理
|
||||
*/
|
||||
public function beforeServiceStore($data, Request $request)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
}
|
||||
@@ -8,22 +8,24 @@ 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,56 @@
|
||||
<?php
|
||||
namespace app\common\controller;
|
||||
|
||||
use app\common\model\User;
|
||||
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']);
|
||||
if (isset($data['created_by']) && $data['created_by'])
|
||||
$data['created_by_name'] = User::where('id', $data['created_by'])->value('name');
|
||||
if (isset($data['updated_by']) && $data['updated_by'])
|
||||
$data['updated_by_name'] = User::where('id', $data['updated_by'])->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['created_by']) && $data['created_by'])
|
||||
$data['created_by_name'] = User::where('id', $data['created_by'])->value('name');
|
||||
if (isset($data['updated_by']) && $data['updated_by'])
|
||||
$data['updated_by_name'] = User::where('id', $data['updated_by'])->value('name');
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ class SysAccount extends Model
|
||||
/**
|
||||
* 允许自动填充模型字段
|
||||
*/
|
||||
protected $fillable = ['id', 'currency_id', 'account_name', 'account_number', 'account_holder', 'bank_name', 'bank_branch', 'daily_limit', 'single_limit', 'description', 'status', 'sort', 'created_at', 'updated_at'];
|
||||
protected $fillable = ['id', 'corp_id', 'currency_id', 'account_name', 'account_number', 'account_holder', 'bank_name', 'bank_branch', 'daily_limit', 'single_limit', 'description', 'status', 'sort', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* 不允许自动填充模型字段
|
||||
|
||||
@@ -40,7 +40,7 @@ class VehColor extends Model
|
||||
/**
|
||||
* 允许自动填充模型字段
|
||||
*/
|
||||
protected $fillable = ['id', 'color_code', 'color_text', 'type', 'hex_code', 'rgb_code', 'status', 'sort', 'created_at', 'updated_at'];
|
||||
protected $fillable = ['id', 'color_code', 'color_text', 'type', 'hex_code', 'rgb_code', 'status', 'sort', 'created_at', 'updated_by', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* 不允许自动填充模型字段
|
||||
|
||||
@@ -396,4 +396,25 @@ Route::group('/crm', function () {
|
||||
Route::any('/logs', [app\crm\controller\ApprovalRecordsController::class, 'logs']);
|
||||
Route::any('/action', [app\crm\controller\ApprovalRecordsController::class, 'approve']);
|
||||
});
|
||||
|
||||
// 汽车颜色
|
||||
Route::group('/color', function () {
|
||||
Route::any('/list', [app\common\controller\VehColorController::class, 'index']);
|
||||
Route::any('/show', [app\common\controller\VehColorController::class, 'show']);
|
||||
Route::any('/store', [app\common\controller\VehColorController::class, 'store']);
|
||||
Route::any('/update', [app\common\controller\VehColorController::class, 'update']);
|
||||
Route::any('/destroy', [app\common\controller\VehColorController::class, 'destroy']);
|
||||
});
|
||||
|
||||
// 车辆
|
||||
Route::group('/vehicle', function () {
|
||||
// 基础信息
|
||||
Route::group('/sku', function () {
|
||||
Route::any('/list', [app\common\controller\VehVehicleSkuController::class, 'index']);
|
||||
Route::any('/show', [app\common\controller\VehVehicleSkuController::class, 'show']);
|
||||
Route::any('/store', [app\common\controller\VehVehicleSkuController::class, 'store']);
|
||||
Route::any('/update', [app\common\controller\VehVehicleSkuController::class, 'update']);
|
||||
Route::any('/destroy', [app\common\controller\VehVehicleSkuController::class, 'destroy']);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user