| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace App\Http\Controllers\Api\v1;
- use App\Http\Controllers\Api\webApp;
- use App\Services\Api\GoodsService;
- use App\Services\Api\MemberService;
- /**
- * 商品管理
- * @package App\Http\Controllers\Api
- */
- class GoodsController extends webApp
- {
- /**
- * 列表
- * @return array
- */
- public function index()
- {
- $params =request()->post();
- $pageSize = request()->post('pageSize', 12);
- $params['picker_status'] = 1;
- $params['user_id'] = $this->userId;
- $userInfo = MemberService::make()->getInfo($this->userId,[], true);
- $confirmStatus = isset($userInfo['confirm_status'])? $userInfo['confirm_status'] : 0;
- $pickerStatus = isset($userInfo['picker_status'])? $userInfo['picker_status'] : 0;
- if($confirmStatus != 1 || $pickerStatus!= 1){
- return message(2043, false);
- }
- $datas = GoodsService::make()->getDataList($params, $pageSize);
- return message(1010, true, $datas);
- }
- /**
- * 详情
- */
- public function info()
- {
- $params = request()->all();
- $id = isset($params['id'])? intval($params['id']) : 0;
- if(empty($id)){
- return message(1036, false);
- }
- $userInfo = MemberService::make()->getInfo($this->userId,[], true);
- $confirmStatus = isset($userInfo['confirm_status'])? $userInfo['confirm_status'] : 0;
- $pickerStatus = isset($userInfo['picker_status'])? $userInfo['picker_status'] : 0;
- if($confirmStatus != 1 || $pickerStatus!= 1){
- return message(2043, false,[],405);
- }
- if($info = GoodsService::make()->getInfo($id)){
- return message(1010, true, $info);
- }else{
- return message(1009, false);
- }
- }
- }
|