| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace app\api\controller;
- use app\api\lists\FirmGoodLists;
- use app\api\lists\GoodsLists;
- use app\api\logic\GoodsLogic;
- use app\api\validate\GoodsValidate;
- /**
- * 用户控制器
- * Class UserController
- * @package app\api\controller
- */
- class GoodsController extends BaseApiController
- {
- public array $notNeedLogin = ['lists','hotData','categoryDetail','goodsDetail','eventGoodsDetail','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',$this->userId,$params);
- return $this->data($result);
- }
- public function goodsDetail()
- {
- $params = (new GoodsValidate())->goCheck('goods');
- $result = GoodsLogic::detail($params['id'],'goods');
- return $this->data($result);
- }
- public function eventGoodsDetail()
- {
- $params = (new GoodsValidate())->goCheck('goods');
- $result = GoodsLogic::eventDetail($params['id'],$this->userId);
- return $this->data($result);
- }
- public function firmGoodLists()
- {
- return $this->dataLists(new FirmGoodLists());
- }
- public function firmGoodDetail(){
- $params = (new GoodsValidate())->get()->goCheck('goods',[
- 'user_id'=>$this->userId
- ]);
- $result = GoodsLogic::firmGoodsDetail($params);
- if (false !== $result) {
- return $this->data($result);
- }
- return $this->fail(GoodsLogic::getError());
- }
- public function submitFirmGood()
- {
- $params = (new GoodsValidate())->post()->goCheck('submitGood');
- $result = GoodsLogic::sync($params,$this->userId);
- if (true === $result) {
- return $this->success('已提交', [], 1, 1);
- }
- return $this->fail(GoodsLogic::getError());
- }
- }
|