StoreCombinationValidate.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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\marketing;
  12. use think\Validate;
  13. class StoreCombinationValidate extends Validate
  14. {
  15. /**
  16. * 定义验证规则
  17. * 格式:'字段名' => ['规则1','规则2'...]
  18. *
  19. * @var array
  20. */
  21. protected $rule = [
  22. 'product_id' => 'require',
  23. 'title' => 'require',
  24. 'info' => 'require',
  25. 'unit_name' => 'require',
  26. 'images' => 'require',
  27. 'section_time' => 'require',
  28. 'num' => 'require|gt:0',
  29. 'once_num' => 'require|gt:0',
  30. 'temp_id' => 'require',
  31. 'description' => 'require',
  32. 'attrs' => 'require',
  33. 'items' => 'require',
  34. 'people' => 'require|gt:1',
  35. 'effective_time' => 'require|gt:0',
  36. 'virtual' => 'require|gt:0|elt:100',
  37. ];
  38. /**
  39. * 定义错误信息
  40. * 格式:'字段名.规则名' => '错误信息'
  41. *
  42. * @var array
  43. */
  44. protected $message = [
  45. 'product_id.require' => '请选择商品',
  46. 'title.require' => '请填写商品标题',
  47. 'info.require' => '请填写拼团活动简介',
  48. 'unit_name.require' => '请填写单位',
  49. 'images.require' => '请选择商品轮播图',
  50. 'section_time.require' => '请选择时间段',
  51. 'num.require' => '请填写购买数量',
  52. 'num.gt' => '购买数量必须大于0',
  53. 'virtual.require' => '请填写虚拟拼团比例',
  54. 'virtual.gt' => '虚拟拼团比例必须在1-100之间',
  55. 'virtual.elt' => '虚拟拼团比例必须在1-100之间',
  56. 'once_num.require' => '请填写单次购买数量',
  57. 'once_num.gt' => '单次购买数量必须大于0',
  58. 'temp_id.require' => '请选择运费模板',
  59. 'description.require' => '请填写拼团商品详情',
  60. 'attrs.require' => '请选择规格',
  61. 'people.require' => '请填写成团人数',
  62. 'people.gt' => '拼团人数不能小于2人',
  63. 'effective_time.require' => '请填写成团有效期',
  64. 'effective_time.gt' => '成团有效期必须大于0',
  65. ];
  66. protected $scene = [
  67. 'save' => ['product_id', 'title', 'info', 'unit_name', 'image', 'images', 'section_time', 'is_host', 'is_show', 'num', 'people', 'once_num', 'virtual', 'temp_id', 'sort', 'description', 'attrs', 'items', 'people', 'effective_time'],
  68. ];
  69. }