123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace app\mobile\controller;
- use app\BaseController;
- use app\mobile\logic\ExchangeLogic;
- use think\exception\ValidateException;
- use think\facade\Config;
- use think\facade\Validate;
- //兑换
- class Exchange extends BaseController
- {
- //商品列表
- public function goodList()
- {
- $param = $this->request->only(['page' => 1, 'size' => 10], 'post');
- return ExchangeLogic::goodList($param);
- }
- //商品详情
- public function goodInfo()
- {
- $code = $this->request->post('code', '');
- $val=Validate::rule(Config::get('validate_rules.goodInfo'));
- if(!$val->check(['code'=>$code])) throw new ValidateException($val->getError());
- return ExchangeLogic::goodInfo($code);
- }
- //兑换商品下单
- public function orderAdd(){
- $param = $this->request->only(['good_id','addr_id','num','remark'],'post');
- $val = Validate::rule(Config::get('validate_rules.ExchangeOrderAdd'));
- if(!$val->check($param)) throw new ValidateException($val->getError());
- return ExchangeLogic::orderAdd($param);
- }
- //兑换订单列表
- public function orderList(){
- $param = $this->request->only(['page' => 1, 'size' => 10,'status'=>''], 'post');
- return ExchangeLogic::orderList($param);
- }
- //兑换订单详情
- public function orderInfo(){
- $id = $this->request->post('id/d', 0);
- return ExchangeLogic::orderInfo($id);
- }
- }
|