| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace app\api\controller;
- use app\api\lists\GoodsLists;
- use app\api\logic\GoodsLogic;
- use app\api\logic\UserCouponLogic;
- use app\api\validate\GoodsValidate;
- use app\api\validate\UserCouponValidate;
- /**
- * 用户控制器
- * Class UserController
- * @package app\api\controller
- */
- class GoodsController extends BaseApiController
- {
- public array $notNeedLogin = ['lists','hotData','categoryDetail','goodsDetail','categoryCouponList'];
- public function lists()
- {
- return $this->dataLists(new GoodsLists());
- }
- public function hotData(){
- $result = GoodsLogic::getHotData();
- return $this->data($result);
- }
- public function categoryDetail()
- {
- $params = (new GoodsValidate())->goCheck('category');
- $result = GoodsLogic::detail($params['goods_category_id'],'category');
- return $this->data($result);
- }
- public function goodsDetail()
- {
- $params = (new GoodsValidate())->goCheck('goods');
- $result = GoodsLogic::detail($params['id'],'goods');
- return $this->data($result);
- }
- //商品优惠卷
- public function categoryCouponList()
- {
- $params = (new UserCouponValidate())->goCheck('category',[
- 'user_id'=>$this->userId
- ]);
- $result = UserCouponLogic::categoryCouponList($params);
- if (false === $result) {
- return $this->fail(UserCouponLogic::getError());
- }
- return $this->data($result);
- }
- }
|