WechatReplyValidate.php 741 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace app\validate\admin;
  3. use think\Validate;
  4. /**
  5. * Class WechatReplyValidate
  6. * @package app\validate\admin
  7. * @author zfy
  8. * @day 2020-04-27
  9. */
  10. class WechatReplyValidate extends Validate
  11. {
  12. /**
  13. * @var bool
  14. */
  15. protected $failException = true;
  16. /**
  17. * @var array
  18. */
  19. protected $rule = [
  20. 'type|类型' => 'require|in:text,image,news,voice',
  21. 'key|关键字' => 'require|max:32',
  22. 'data|回复内容' => 'require|array',
  23. 'status|开启状态' => 'require|in:0,1'
  24. ];
  25. /**
  26. * @return $this
  27. * @author zfy
  28. * @day 2020-04-27
  29. */
  30. public function isUpdate()
  31. {
  32. unset($this->rule['key|关键字']);
  33. return $this;
  34. }
  35. }