MealValidate.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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\serve;
  12. use think\Validate;
  13. class MealValidate extends Validate
  14. {
  15. /**
  16. * 定义验证规则
  17. * 格式:'字段名' => ['规则1','规则2'...]
  18. *
  19. * @var array
  20. */
  21. protected $rule = [
  22. 'meal_id' => 'require|number',
  23. 'price' => 'require',
  24. 'num' => 'require|number',
  25. 'type' => 'require',
  26. ];
  27. /**
  28. * 定义错误信息
  29. * 格式:'字段名.规则名' => '错误信息'
  30. *
  31. * @var array
  32. */
  33. protected $message = [
  34. 'meal_id.require' => '请传入套餐id',
  35. 'meal_id.number' => '套餐id必须为数字',
  36. 'price.require' => '请填写套餐金额',
  37. 'num.require' => '请填写购买数量',
  38. 'num.number' => '购买数量必须为数字',
  39. 'type.require' => '请填写购买套餐类型'
  40. ];
  41. }