OfficialAccountReplyValidate.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\validate\channel;
  15. use app\common\validate\BaseValidate;
  16. /**
  17. * 微信公众号回复验证器
  18. * Class OfficialAccountReplyValidate
  19. * @package app\adminapi\validate\channel
  20. */
  21. class OfficialAccountReplyValidate extends BaseValidate
  22. {
  23. protected $rule = [
  24. 'id' => 'require|integer',
  25. 'reply_type' => 'require|in:1,2,3',
  26. 'name' => 'require',
  27. 'content_type' => 'require|in:1',
  28. 'content' => 'require',
  29. 'status' => 'require|in:0,1',
  30. 'keyword' => 'requireIf:reply_type,2',
  31. 'matching_type' => 'requireIf:reply_type,2|in:1,2',
  32. 'sort' => 'requireIf:reply_type,2',
  33. 'reply_num' => 'requireIf:reply_type,2|in:1',
  34. 'new_sort' => 'require|integer|egt:0',
  35. ];
  36. protected $message = [
  37. 'reply_type.require' => '请输入回复类型',
  38. 'reply_type.in' => '回复类型状态值错误',
  39. 'name.require' => '请输入规则名称',
  40. 'content_type.require' => '请选择内容类型',
  41. 'content_type.in' => '内容类型状态值有误',
  42. 'content.require' => '请输入回复内容',
  43. 'status.require' => '请选择启用状态',
  44. 'status.in' => '启用状态值错误',
  45. 'keyword.requireIf' => '请输入关键词',
  46. 'matching_type.requireIf' => '请选择匹配类型',
  47. 'matching_type.in' => '匹配类型状态值错误',
  48. 'sort.requireIf' => '请输入排序值',
  49. 'sort.integer' => '排序值须为整型',
  50. 'sort.egt' => '排序值须大于或等于0',
  51. 'reply_num.requireIf' => '请选择回复数量',
  52. 'reply_num.in' => '回复数量状态值错误',
  53. 'id.require' => '参数缺失',
  54. 'id.integer' => '参数格式错误',
  55. 'new_sort.require' => '请输入新排序值',
  56. 'new_sort.integer' => '新排序值须为整型',
  57. 'new_sort.egt' => '新排序值须大于或等于0',
  58. ];
  59. protected $scene = [
  60. 'add' => ['reply_type', 'name', 'content_type', 'content', 'status', 'keyword', 'matching_type', 'sort', 'reply_num'],
  61. 'detail' => ['id'],
  62. 'delete' => ['id'],
  63. 'sort' => ['id', 'new_sort'],
  64. 'status' => ['id'],
  65. 'edit' => ['id', 'reply_type', 'name', 'content_type', 'content', 'status','keyword', 'matching_type', 'sort', 'reply_num']
  66. ];
  67. }