GetSectionGoodsForm.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace mall\models\homePageConfig;
  3. use mall\models\BaseForm;
  4. /**
  5. * 首页模块「更多」商品列表分页
  6. */
  7. class GetSectionGoodsForm extends BaseForm
  8. {
  9. public $moduleKey;
  10. public $page;
  11. public $pageSize;
  12. /** 合法模块 key */
  13. const MODULE_KEYS = ['seckill', 'groupBuy', 'hot', 'new', 'pullGoods'];
  14. public function rules()
  15. {
  16. return [
  17. ['moduleKey', 'required', 'message' => '请选择模块'],
  18. ['moduleKey', 'in', 'range' => self::MODULE_KEYS, 'message' => '无效模块'],
  19. ['page', 'default', 'value' => 1],
  20. ['pageSize', 'default', 'value' => 10],
  21. ['page', 'integer', 'min' => 1, 'message' => '页码格式错误', 'tooSmall' => '页码格式错误'],
  22. ['pageSize', 'integer', 'min' => 1, 'max' => 100,
  23. 'message' => '每页数量格式错误',
  24. 'tooSmall' => '每页数量格式错误',
  25. 'tooBig' => '每页数量不能超过100',
  26. ],
  27. ];
  28. }
  29. public function attributeLabels()
  30. {
  31. return [
  32. 'moduleKey' => '模块',
  33. 'page' => '页码',
  34. 'pageSize' => '每页数量',
  35. ];
  36. }
  37. }