支持后台用户手动录入个人业绩与账户消耗,独立计算转化指标,接入 DataScope 数据权限。 Co-authored-by: Cursor <cursoragent@cursor.com>
62 lines
1.5 KiB
PHP
62 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace app\adminapi\validate\stats;
|
|
|
|
use app\common\model\stats\PersonalAccountCost;
|
|
use app\common\validate\BaseValidate;
|
|
|
|
class PersonalAccountCostValidate extends BaseValidate
|
|
{
|
|
protected $rule = [
|
|
'id' => 'require|checkExists',
|
|
'cost_date' => 'require|dateFormat:Y-m-d',
|
|
'media_source' => 'require|max:120',
|
|
'amount' => 'require|float|egt:0',
|
|
'remark' => 'max:255',
|
|
];
|
|
|
|
protected $message = [
|
|
'id.require' => '参数缺失',
|
|
'cost_date.require' => '请选择日期',
|
|
'cost_date.dateFormat' => '日期格式错误',
|
|
'media_source.require' => '请填写自媒体来源',
|
|
'media_source.max' => '自媒体来源不能超过120个字符',
|
|
'amount.require' => '请输入账户消耗金额',
|
|
'amount.float' => '账户消耗金额格式错误',
|
|
'amount.egt' => '账户消耗金额不能小于0',
|
|
'remark.max' => '备注不能超过255个字符',
|
|
];
|
|
|
|
public function sceneAdd()
|
|
{
|
|
return $this->remove('id', true);
|
|
}
|
|
|
|
public function sceneEdit()
|
|
{
|
|
return $this->remove('cost_date', true)->remove('media_source', true);
|
|
}
|
|
|
|
public function sceneDetail()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
public function sceneDelete()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
public function checkExists($value)
|
|
{
|
|
$model = PersonalAccountCost::find($value);
|
|
if (!$model) {
|
|
return '记录不存在';
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|