计划任务及获客场景逻辑框架

This commit is contained in:
柳清爽
2025-04-07 09:47:07 +08:00
parent 878b3413c2
commit 8d20c59761
16 changed files with 2912 additions and 1 deletions

View File

@@ -0,0 +1,48 @@
<?php
namespace app\plan\validate;
use think\Validate;
/**
* 任务验证器
*/
class Task extends Validate
{
/**
* 验证规则
* @var array
*/
protected $rule = [
'name' => 'require|max:100',
'device_id' => 'number',
'scene_id' => 'number',
'scene_config' => 'array',
'status' => 'in:0,1,2,3',
'priority' => 'between:1,10',
'created_by' => 'number'
];
/**
* 错误信息
* @var array
*/
protected $message = [
'name.require' => '任务名称不能为空',
'name.max' => '任务名称不能超过100个字符',
'device_id.number' => '设备ID必须是数字',
'scene_id.number' => '场景ID必须是数字',
'scene_config.array'=> '场景配置必须是数组',
'status.in' => '状态值无效',
'priority.between' => '优先级必须在1到10之间',
'created_by.number' => '创建者ID必须是数字'
];
/**
* 验证场景
* @var array
*/
protected $scene = [
'create' => ['name', 'device_id', 'scene_id', 'scene_config', 'status', 'priority', 'created_by'],
'update' => ['name', 'device_id', 'scene_id', 'scene_config', 'status', 'priority']
];
}

View File

@@ -0,0 +1,51 @@
<?php
namespace app\plan\validate;
use think\Validate;
/**
* 流量验证器
*/
class Traffic extends Validate
{
/**
* 验证规则
* @var array
*/
protected $rule = [
'mobile' => 'require|mobile',
'gender' => 'in:0,1,2',
'age' => 'number|between:0,120',
'tags' => 'max:255',
'province' => 'max:50',
'city' => 'max:50',
'source_channel' => 'max:50',
'source_detail' => 'array'
];
/**
* 错误信息
* @var array
*/
protected $message = [
'mobile.require' => '手机号不能为空',
'mobile.mobile' => '手机号格式不正确',
'gender.in' => '性别值无效',
'age.number' => '年龄必须是数字',
'age.between' => '年龄必须在0到120之间',
'tags.max' => '标签不能超过255个字符',
'province.max' => '省份不能超过50个字符',
'city.max' => '城市不能超过50个字符',
'source_channel.max' => '来源渠道不能超过50个字符',
'source_detail.array'=> '来源详情必须是数组'
];
/**
* 验证场景
* @var array
*/
protected $scene = [
'create' => ['mobile', 'gender', 'age', 'tags', 'province', 'city', 'source_channel', 'source_detail'],
'update' => ['gender', 'age', 'tags', 'province', 'city']
];
}