Cooperation.php 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. class Cooperation extends Validate
  5. {
  6. // 验证规则
  7. protected $rule = [
  8. 'id' => 'require|number',
  9. 'name' => 'require|max:32',
  10. 'mobile' => 'require|max:16',
  11. 'servicetype_id' => 'require|number',
  12. ];
  13. // 验证提示
  14. protected $message = [
  15. 'id.require' => '请输入商务合作ID',
  16. 'id.number' => '您输入的商务合作ID,必须是数字类型',
  17. 'name.require' => '请输入联系人',
  18. 'name.max' => '您输入的联系人,必须小于32字符',
  19. 'mobile.require' => '请输入联系电话',
  20. 'mobile.max' => '您输入的联系电话,必须小于16字符',
  21. 'servicetype_id.require' => '请输入合作内容',
  22. 'servicetype_id.number' => '您输入的合作内容,必须是数字类型',
  23. ];
  24. // 应用场景
  25. protected $scene = [
  26. 'add' => ['name','mobile','servicetype_id'],
  27. 'edit' => ['id','name','mobile','servicetype_id'],
  28. ];
  29. }