WechatReplyValidate.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 WechatReplyValidate
  15. * @package app\validate\admin
  16. * @author xaboy
  17. * @day 2020-04-27
  18. */
  19. class WechatReplyValidate extends Validate
  20. {
  21. /**
  22. * @var bool
  23. */
  24. protected $failException = true;
  25. /**
  26. * @var array
  27. */
  28. protected $rule = [
  29. 'type|类型' => 'require|in:text,image,news,voice',
  30. 'key|关键字' => 'require|max:32',
  31. 'data|回复内容' => 'require|array',
  32. 'status|开启状态' => 'require|in:0,1'
  33. ];
  34. /**
  35. * @return $this
  36. * @author xaboy
  37. * @day 2020-04-27
  38. */
  39. public function isUpdate()
  40. {
  41. unset($this->rule['key|关键字']);
  42. return $this;
  43. }
  44. }