|
|
|
@ -5,6 +5,7 @@ namespace app\api\controller; |
|
|
|
use app\Request; |
|
|
|
use app\service\Goods\GoodsService; |
|
|
|
use think\cache\driver\Redis; |
|
|
|
use think\facade\Db; |
|
|
|
|
|
|
|
class Goods extends Base |
|
|
|
{ |
|
|
|
@ -94,6 +95,28 @@ class Goods extends Base |
|
|
|
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(){ |
|
|
|
|