Gift.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Copyright (C) 2018 Baidu, Inc. All Rights Reserved.
  4. */
  5. /**
  6. * Created by PhpStorm.
  7. * User: Administrator
  8. * Date: 2018/1/22
  9. * Time: 16:07
  10. */
  11. namespace app\admin\validate;
  12. use app\common\library\ValidateExtend;
  13. class Gift extends ValidateExtend
  14. {
  15. protected $rule = [
  16. 'gameid|游戏名称 ' => 'require|isEmpty',
  17. 'title|礼包标题' => 'require|isEmpty|max:100',
  18. 'content|礼包内容' => 'require|isEmpty',
  19. 'code|礼包序列号' => 'require|isEmpty',
  20. 'starttime|有效期开始时间 ' => 'require|isEmpty',
  21. 'endtime|有效期结束时间 ' => 'require|isEmpty|gt:starttime',
  22. 'consume|领取条件 ' => 'require|number|egt:0',
  23. 'is_top|是否推荐 ' => 'in:0,1',
  24. 'description|使用方法' => 'max:400',
  25. ];
  26. protected $message = [
  27. 'gameid.isEmpty' => '游戏名称不能为空',
  28. 'title.isEmpty' => '礼包标题不能为空',
  29. 'content.isEmpty' => '礼包内容不能为空',
  30. 'code.isEmpty' => '礼包序列号',
  31. 'starttime.isEmpty' => '有效期开始时间不能为空',
  32. 'endtime.isEmpty' => '有效期结束时间不能为空',
  33. 'endtime.gt' => '有效期结束时间需大于开始时间',
  34. 'consume.egt' => '领取条件要大于等于0',
  35. ];
  36. protected $scene = [
  37. 'edit' => ['gameid', 'title', 'content','description' ,'starttime', 'endtime','consume'],
  38. 'setnew' => ['isnew'],
  39. 'lottery_add' => ['gameid', 'name' => 'require|isEmpty', 'content', 'code', 'starttime', 'endtime'],
  40. ];
  41. }