123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace app\common\validate;
- use think\Validate;
- class Cooperation extends Validate
- {
- // 验证规则
- protected $rule = [
- 'id' => 'require|number',
- 'name' => 'require|max:32',
- 'mobile' => 'require|max:16',
- 'servicetype_id' => 'require|number',
- ];
- // 验证提示
- protected $message = [
- 'id.require' => '请输入商务合作ID',
- 'id.number' => '您输入的商务合作ID,必须是数字类型',
- 'name.require' => '请输入联系人',
- 'name.max' => '您输入的联系人,必须小于32字符',
- 'mobile.require' => '请输入联系电话',
- 'mobile.max' => '您输入的联系电话,必须小于16字符',
- 'servicetype_id.require' => '请输入合作内容',
- 'servicetype_id.number' => '您输入的合作内容,必须是数字类型',
- ];
- // 应用场景
- protected $scene = [
- 'add' => ['name','mobile','servicetype_id'],
- 'edit' => ['id','name','mobile','servicetype_id'],
- ];
- }
|