MerchantValidate.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020-03-26
  7. *
  8. *
  9. */
  10. namespace app\validate\admin;
  11. use think\Validate;
  12. /**
  13. * Class MerchantValidate
  14. * @package app\validate\admin
  15. * @author xaboy
  16. * @day 2020-04-17
  17. */
  18. class MerchantValidate extends Validate
  19. {
  20. /**
  21. * @var bool
  22. */
  23. protected $failException = true;
  24. /**
  25. * @var array
  26. */
  27. protected $rule = [
  28. 'category_id|商户分类' => 'require',
  29. 'mer_name|商户名称' => 'require|max:32',
  30. 'mer_account|商户账号' => 'require|alphaNum|min:4|max:16',
  31. 'mer_password|商户密码' => 'require|min:4|max:16',
  32. 'real_name|商户姓名' => 'max:16',
  33. 'mer_phone|商户手机号' => 'require',
  34. 'sort|排序' => 'require',
  35. 'mer_keyword|商户关键字' => 'max:64',
  36. 'mer_address|商户地址' => 'max:64',
  37. 'mark|备注' => 'max:64',
  38. 'status|开启状态' => 'require|in:0,1',
  39. 'is_audit|产品审核状态' => 'require|in:0,1',
  40. 'is_best|推荐状态' => 'require|in:0,1',
  41. 'is_bro_goods|直播商品状态' => 'require|in:0,1',
  42. 'is_bro_room|直播间状态' => 'require|in:0,1',
  43. ];
  44. /**
  45. * @return $this
  46. * @author xaboy
  47. * @day 2020-04-17
  48. */
  49. public function isUpdate()
  50. {
  51. unset($this->rule['mer_account|商户账号'], $this->rule['mer_password|商户密码']);
  52. return $this;
  53. }
  54. }