Dinner.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace app\common\validate;
  3. use think\Db;
  4. use think\Validate;
  5. class Dinner extends Validate{
  6. protected $rule = [
  7. 'name|食品名' => 'require',
  8. 'money|价格' => 'require',
  9. 'start_time|(预售)可以售卖的开始时间' => 'require',
  10. 'end_time|(预售)可以售卖的结束时间' => 'require',
  11. 'today_start_time|(当日)可以售卖的开始时间' => 'require',
  12. 'today_end_time|(当日)可以售卖的结束时间' => 'require',
  13. 'dinner_type_id|分类' => 'require',
  14. 'imgs|图片' => 'require',
  15. 'discount|折扣' => 'require|egt:0|elt:1',
  16. ];
  17. protected $message = [
  18. 'discount.require' => "折扣必须是0-1之间的值",
  19. 'discount.egt' => "折扣必须是0-1之间的值",
  20. 'discount.elt' => "折扣必须是0-1之间的值",
  21. 'imgs.elt' => "请上传图片",
  22. ];
  23. protected $scene = [
  24. 'cate0' => ['name','money','dinner_type_id','imgs','start_time','end_time','today_start_time','today_end_time','discount'],
  25. 'cate1' => ['name','money','dinner_type_id','imgs'],
  26. ];
  27. protected function checkUnique($value,$rule,$data=[])
  28. {
  29. }
  30. }