Good.php 728 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\mobile\controller;
  3. use app\BaseController;
  4. use app\mobile\logic\GoodLogic;
  5. use think\exception\ValidateException;
  6. use think\facade\Config;
  7. use think\facade\Validate;
  8. //商品
  9. class Good extends BaseController
  10. {
  11. //列表
  12. public function goodList()
  13. {
  14. $param = $this->request->only(['page' => 1, 'size' => 10], 'post');
  15. return GoodLogic::goodList($param);
  16. }
  17. //详情
  18. public function goodInfo()
  19. {
  20. $code = $this->request->post('code', '');
  21. $val = Validate::rule(Config::get('validate_rules.goodInfo'));
  22. if (!$val->check(['code' => $code])) throw new ValidateException($val->getError());
  23. return GoodLogic::goodInfo($code);
  24. }
  25. }