账户增加公司归属
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
use app\common\controller\BaseController;
|
use app\common\controller\BaseController;
|
||||||
|
use app\common\model\Corp;
|
||||||
use app\common\model\SysCurrency;
|
use app\common\model\SysCurrency;
|
||||||
use app\common\traits\crud\CrudControllerTrait;
|
use app\common\traits\crud\CrudControllerTrait;
|
||||||
use app\admin\service\SysAccountService;
|
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']);
|
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||||
if (isset($data['updated_at']))
|
if (isset($data['updated_at']))
|
||||||
$data['updated_at'] = date('Y-m-d H:i:s', $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');
|
$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;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,8 +50,10 @@ class SysAccountController extends BaseController
|
|||||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||||
if (isset($data['updated_at']))
|
if (isset($data['updated_at']))
|
||||||
$data['updated_at'] = date('Y-m-d H:i:s', $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');
|
$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;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,22 +8,24 @@ class SysAccountValidate extends Validate
|
|||||||
{
|
{
|
||||||
// 规则
|
// 规则
|
||||||
protected $rule = [
|
protected $rule = [
|
||||||
|
'corp_id' => 'require|integer|gt:0',
|
||||||
];
|
];
|
||||||
|
|
||||||
// 提示
|
// 提示
|
||||||
protected $message = [
|
protected $message = [
|
||||||
|
'corp_id.require' => 'ID不能为空',
|
||||||
|
'corp_id.integer' => 'ID必须是整数',
|
||||||
|
'corp_id.gt' => 'ID必须大于0',
|
||||||
];
|
];
|
||||||
|
|
||||||
// 场景
|
// 场景
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
'store' => [
|
'store' => [
|
||||||
|
'corp_id'
|
||||||
],
|
],
|
||||||
|
|
||||||
'update' => [
|
'update' => [
|
||||||
|
'corp_id'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -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'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 不允许自动填充模型字段
|
* 不允许自动填充模型字段
|
||||||
|
|||||||
Reference in New Issue
Block a user