OfficialAccountReplyValidate.php 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\adminapi\validate\wechat;
  20. use app\common\validate\BaseValidate;
  21. /**
  22. * 微信公众号回复验证器
  23. * Class OfficialAccountReplyValidate
  24. * @package app\adminapi\validate\wechat
  25. */
  26. class OfficialAccountReplyValidate extends BaseValidate
  27. {
  28. protected $rule = [
  29. 'id' => 'require|integer',
  30. 'reply_type' => 'require|in:1,2,3',
  31. 'name' => 'require',
  32. 'content_type' => 'require|in:1',
  33. 'content' => 'require',
  34. 'status' => 'require|in:0,1',
  35. 'keyword' => 'requireIf:reply_type,2',
  36. 'matching_type' => 'requireIf:reply_type,2|in:1,2',
  37. 'sort' => 'requireIf:reply_type,2',
  38. 'reply_num' => 'requireIf:reply_type,2|in:1',
  39. 'new_sort' => 'require|integer|gt:0',
  40. ];
  41. protected $message = [
  42. 'reply_type.require' => '请输入回复类型',
  43. 'reply_type.in' => '回复类型状态值错误',
  44. 'name.require' => '请输入规则名称',
  45. 'content_type.require' => '请选择内容类型',
  46. 'content_type.in' => '内容类型状态值有误',
  47. 'content.require' => '请输入回复内容',
  48. 'status.require' => '请选择启用状态',
  49. 'status.in' => '启用状态值错误',
  50. 'keyword.requireIf' => '请输入关键词',
  51. 'matching_type.requireIf' => '请选择匹配类型',
  52. 'matching_type.in' => '匹配类型状态值错误',
  53. 'sort.requireIf' => '请输入排序值',
  54. 'sort.integer' => '排序值须为整型',
  55. 'sort.gt' => '排序值须大于0',
  56. 'reply_num.requireIf' => '请选择回复数量',
  57. 'reply_num.in' => '回复数量状态值错误',
  58. 'id.require' => '参数缺失',
  59. 'id.integer' => '参数格式错误',
  60. 'new_sort.require' => '请输入新排序值',
  61. 'new_sort.integer' => '新排序值须为整型',
  62. 'new_sort.gt' => '新排序值须大于0',
  63. ];
  64. protected $scene = [
  65. 'add' => ['reply_type', 'name', 'content_type', 'content', 'status', 'keyword', 'matching_type', 'sort', 'reply_num'],
  66. 'detail' => ['id'],
  67. 'delete' => ['id'],
  68. 'sort' => ['id', 'new_sort'],
  69. 'status' => ['id'],
  70. 'edit' => ['id', 'reply_type', 'name', 'content_type', 'content', 'status','keyword', 'matching_type', 'sort', 'reply_num']
  71. ];
  72. }