完善自媒体渠道修改
This commit is contained in:
2026-05-19 16:39:29 +08:00
parent 1cb00e9fbe
commit 26b442b5da
2 changed files with 26 additions and 2 deletions
@@ -77,6 +77,9 @@ class AccountCostLogic extends BaseLogic
return false;
}
$mediaChannelCode = trim((string) ($params['media_channel_code'] ?? ''));
$mediaChannelName = MediaChannelService::getNameByCode($mediaChannelCode);
$supportsDeptBinding = AccountCost::supportsDeptBinding();
$deptId = $supportsDeptBinding ? (int) ($params['dept_id'] ?? 0) : 0;
$deptName = $supportsDeptBinding ? self::resolveDeptName($deptId) : '';
@@ -89,7 +92,7 @@ class AccountCostLogic extends BaseLogic
if ($supportsDeptBinding) {
if (AccountCost::where('id', '<>', (int) $params['id'])
->where('cost_date', (string) $model->cost_date)
->where('media_channel_code', (string) $model->media_channel_code)
->where('media_channel_code', $mediaChannelCode)
->where('dept_id', $deptId)
->count() > 0) {
self::setError('该日期下所选渠道和部门的账户消耗已存在,请直接编辑');
@@ -98,6 +101,8 @@ class AccountCostLogic extends BaseLogic
}
}
$model->media_channel_code = $mediaChannelCode;
$model->media_channel_name = $mediaChannelName;
if ($supportsDeptBinding) {
$model->dept_id = $deptId;
$model->dept_name = $deptName;