StoreSeckillValidate.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 StoreSeckillValidate 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. 'time_id' => 'require',
  31. 'temp_id' => 'require',
  32. 'description' => 'require',
  33. 'attrs' => 'require',
  34. 'items' => 'require',
  35. ];
  36. /**
  37. * 定义错误信息
  38. * 格式:'字段名.规则名' => '错误信息'
  39. *
  40. * @var array
  41. */
  42. protected $message = [
  43. 'product_id.require' => '请选择商品',
  44. 'title.require' => '请填写商品标题',
  45. 'info.require' => '请填写秒杀活动简介',
  46. 'unit_name.require' => '请填写单位',
  47. 'images.require' => '请选择商品轮播图',
  48. 'section_time.require' => '请选择时间段',
  49. 'num.require' => '请填写数量限制',
  50. 'num.gt' => '数量限制必须大于0',
  51. 'once_num.require' => '请填写单次购买次数',
  52. 'once_num.gt' => '单次购买次数必须大于0',
  53. 'time_id.require' => '请选择秒杀时间段',
  54. 'temp_id.require' => '请选择运费模板',
  55. 'description.require' => '请填写秒杀商品详情',
  56. 'attrs.require' => '请选择规格',
  57. ];
  58. protected $scene = [
  59. 'save' => ['product_id', 'title', 'info', 'unit_name', 'image', 'images', 'give_integral', 'section_time', 'is_hot', 'status', 'num', 'once_num', 'time_id', 'temp_id', 'sort', 'description', 'attrs', 'items'],
  60. ];
  61. }