valid = \app\api\validate\Goods::class; } /** * @title 获取购物车 * @url /api/Goods/getShoppingCar * @method POST * @param string user_isli 用户isli标识码 * @return string msg 返回信息 * @return int code 状态码 200:成功;>=400:失败 */ public function getShoppingCar(){ try { // todo 被请求获取购物车 接口 $this->checkVaild($this->valid, 'getShoppingCar', 'post'); $user_isli = $this->request->post('user_isli'); $goodsService = new GoodsService(); $this->apilog->info("获取购物车", Request()->param()); $result = $goodsService->getShoppingCar($user_isli); return _success('成功', $result); }catch(\Exception $e){ return _error($e->getMessage(), $e->getCode() ?: 400, $e); } } /** * @title 根据类型获取委托信息 * @url /api/Goods/getTypeGoods * @method POST * @param string type 类型;1:点击;2:销售;3:推荐 * @param string hot 热门展示 * @param string hotsale 热卖展示 * @return string msg 返回信息 * @return int code 状态码 200:成功;>=400:失败 */ public function getTypeGoods(){ try { // todo 被请求首页排行榜 接口 // $this->checkVaild($this->valid, 'getTypeGoods', 'post'); // $goods_type = $this->request->post('goods_type'); // $type = $this->request->post('type'); $createtime = $this->request->post('createtime'); $goodsService = new GoodsService(); $result = $goodsService->getTypeGoods('1', $createtime); return _success('成功', $result); }catch(\Exception $e){ return _error($e->getMessage(), $e->getCode() ?: 400, $e); } } /** * @title 查询委托信息 * @url /api/Goods/searchGoods * @method POST * @param string entrust_time 委托时间(时间戳) * @param string record_type 数据类型 * @param string entrust_user_name 委托方名称 * @param string authorization 授权方式 * @param string pay_type 付费类型 * @param string entrust_name 委托数据名称 * @param string entrust_islicode 委托数据isli标识码 * @param string goods_islicode 商品isli标识码 * @return string msg 返回信息 * @return int code 状态码 200:成功;>=400:失败 */ public function searchGoods(){ try { // todo 被请求委托查询 接口 $this->checkVaild($this->valid, 'searchGoods', 'post'); $post = $this->request->post(['entrust_time', 'record_type', 'entrust_user_name', 'authorization', 'pay_type', 'entrust_name', 'entrust_islicode', 'goods_islicode', 'source_type', 'order_type', 'order', 'goods_status', 'page', 'limit']); $goodsService = new GoodsService(); $this->apilog->info("查询委托信息接口", $post); $result = $goodsService->searchGoods($post); return _success('成功', $result); }catch(\Exception $e){ return _error($e->getMessage(), $e->getCode() ?: 400, $e); } } /** * 排行榜递增 */ public function incrRanking() { $params = input('get.'); if (empty($params['id'])){ return _error('params error'); } Db::startTrans(); try { $goods = \app\model\Goods::find($params['id']); $this->curl_request_post('http://www.wenhuayun.com/index.php/api/goods/incrRanking', $params); $goods->recommend_sort = $goods['recommend_sort']+1; $goods->save(); Db::commit(); return _success('成功'); }catch (\Exception $e){ Db::rollback(); return _error('失败'); } } public function test(){ $goodsService = new GoodsService(); $goodsService->test(); } }