|
|
|
@ -52,14 +52,9 @@ class Goods extends Base |
|
|
|
*/ |
|
|
|
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); |
|
|
|
$params = ['type'=> 1]; |
|
|
|
$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); |
|
|
|
} |
|
|
|
@ -100,20 +95,16 @@ class Goods extends Base |
|
|
|
*/ |
|
|
|
public function incrRanking() |
|
|
|
{ |
|
|
|
$params = input('get.'); |
|
|
|
$params = $this->request->post('id'); |
|
|
|
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('失败'); |
|
|
|
} |
|
|
|
} |
|
|
|
|