Browse Source

修改接口输出bug

master
tanghuijun 4 years ago
parent
commit
786cdc2bf0
  1. 8
      app/api/controller/Goods.php

8
app/api/controller/Goods.php

@ -50,13 +50,13 @@ class Goods extends Base
* @return string msg 返回信息
* @return int code 状态码 200:成功;>=400:失败
*/
public function getTypeGoods(){
public function getTypeGoods(){
try {
$params = ['type'=> 1];
$result = $this->curl_request_post(env('APP.HOST').'/index.php/api/goods/getTypeGoods', $params);
$result = $this->curl_request_post('http://www.wenhuayun.com/index.php/api/goods/getTypeGoods', $params);
return $result;
}catch(\Exception $e){
return _error($e->getMessage(), $e->getCode() ?: 400, $e);
echo json_encode(['code'=> 'failure', $e, 'msg'=> '请求失败']); exit();
}
}
@ -88,7 +88,7 @@ class Goods extends Base
$result = $goodsService->searchGoods($post);
$end_time = microtime(true); //响应式结束计时
$userTime = $end_time-$start_time.'s';
echo json_encode(['code'=>'success', 'msg'=>'成功', 'userTime'=>$userTime, 'data'=>$result]); exit();
echo json_encode(['code'=>'success', 'msg'=>'成功', 'useTime'=>$userTime, 'data'=>$result]); exit();
}catch(\Exception $e){
echo json_encode(['code'=>'failure', 'msg'=>'请求失败']); exit();
}

Loading…
Cancel
Save