MerchantValidate.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\validate\admin;
  12. use think\Validate;
  13. /**
  14. * Class MerchantValidate
  15. * @package app\validate\admin
  16. * @author xaboy
  17. * @day 2020-04-17
  18. */
  19. class MerchantValidate extends Validate
  20. {
  21. /**
  22. * @var bool
  23. */
  24. protected $failException = true;
  25. /**
  26. * @var array
  27. */
  28. protected $rule = [
  29. 'category_id|商户分类' => 'require',
  30. 'mer_name|商户名称' => 'require|max:32',
  31. 'mer_account|商户账号' => 'require|alphaNum|min:4|max:16',
  32. 'mer_password|商户密码' => 'require|min:4|max:16',
  33. 'real_name|商户姓名' => 'max:16',
  34. 'mer_phone|商户手机号' => 'require',
  35. 'sort|排序' => 'require',
  36. 'mer_keyword|商户关键字' => 'max:64',
  37. 'mer_address|商户地址' => 'max:64',
  38. 'mark|备注' => 'max:64',
  39. 'status|开启状态' => 'require|in:0,1',
  40. 'is_audit|产品审核状态' => 'require|in:0,1',
  41. 'is_best|推荐状态' => 'require|in:0,1',
  42. 'is_bro_goods|直播商品状态' => 'require|in:0,1',
  43. 'is_bro_room|直播间状态' => 'require|in:0,1',
  44. 'is_trader|自营状态' => 'require|in:0,1',
  45. 'commission_rate|提成比例' => 'egt:0'
  46. ];
  47. /**
  48. * @return $this
  49. * @author xaboy
  50. * @day 2020-04-17
  51. */
  52. public function isUpdate()
  53. {
  54. unset($this->rule['mer_account|商户账号'], $this->rule['mer_password|商户密码'], $this->rule['status|开启状态']);
  55. return $this;
  56. }
  57. }