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