Exchange.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace app\mobile\controller;
  3. use app\BaseController;
  4. use app\mobile\logic\ExchangeLogic;
  5. use think\exception\ValidateException;
  6. use think\facade\Config;
  7. use think\facade\Validate;
  8. //兑换
  9. class Exchange extends BaseController
  10. {
  11. //商品列表
  12. public function goodList()
  13. {
  14. $param = $this->request->only(['page' => 1, 'size' => 10], 'post');
  15. return ExchangeLogic::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 ExchangeLogic::goodInfo($code);
  24. }
  25. //兑换商品下单
  26. public function orderAdd(){
  27. $param = $this->request->only(['good_id','addr_id','num','remark'],'post');
  28. $val = Validate::rule(Config::get('validate_rules.ExchangeOrderAdd'));
  29. if(!$val->check($param)) throw new ValidateException($val->getError());
  30. return ExchangeLogic::orderAdd($param);
  31. }
  32. //兑换订单列表
  33. public function orderList(){
  34. $param = $this->request->only(['page' => 1, 'size' => 10,'status'=>''], 'post');
  35. return ExchangeLogic::orderList($param);
  36. }
  37. //兑换订单详情
  38. public function orderInfo(){
  39. $id = $this->request->post('id/d', 0);
  40. return ExchangeLogic::orderInfo($id);
  41. }
  42. }