...
|
...
|
@@ -56,6 +56,7 @@ class Goods extends Api |
|
|
* @ApiSummary (推荐商品列表)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/goods/getRecommendGoods)
|
|
|
* @ApiParams (name=limit, type=string, required=false, description="显示条数 默认10条")
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
|
|
"msg": "请求成功",
|
...
|
...
|
@@ -77,10 +78,12 @@ class Goods extends Api |
|
|
*/
|
|
|
public function getRecommendGoods()
|
|
|
{
|
|
|
$limit = $this->request->param('limit')?$this->request->param('limit'):10;
|
|
|
$where['g.is_recommend'] = 1;
|
|
|
|
|
|
$data = $this->goodsModel->selectData($where, 10,$this->lang);
|
|
|
|
|
|
$list = $this->goodsModel->selectData($where, $limit,$this->lang);
|
|
|
$data['image'] = cdnurl(config('site.index_recommend_image'));
|
|
|
$data['list'] = $list;
|
|
|
$this->success('请求成功', $data);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -90,6 +93,7 @@ class Goods extends Api |
|
|
* @ApiSummary (商品列表)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/goods/getGoodsList)
|
|
|
* @ApiParams (name=type, type=string, required=false, description="类型:1=普通商品,2=推荐商品 默认全部")
|
|
|
* @ApiParams (name=page, type=string, required=false, description="页数")
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
...
|
...
|
@@ -118,6 +122,7 @@ class Goods extends Api |
|
|
$limit = Config::get('paginate.index_rows');
|
|
|
$where = [];
|
|
|
|
|
|
$type = $this->request->param('type');
|
|
|
$keyword = $this->request->param('keyword');
|
|
|
if ($keyword){
|
|
|
$where['g.ch_name|g.en_name|g.ch_content|g.en_content'] = ['like','%'.$keyword.'%'];
|
...
|
...
|
@@ -125,6 +130,11 @@ class Goods extends Api |
|
|
if ($this->userId) $this->keywordLogModel->save(['user_id'=>$this->userId,'content'=>$keyword,'createtime'=>time()]);
|
|
|
}
|
|
|
|
|
|
if(!empty($type) && $type == 2){
|
|
|
$where['g.is_recommend'] = 1;
|
|
|
}elseif(!empty($type) && $type == 1){
|
|
|
$where['g.is_recommend'] = 2;
|
|
|
}
|
|
|
$data = $this->goodsModel->selectPageData($where,$page,$limit,$this->lang);
|
|
|
$this->success('请求成功', $data);
|
|
|
}
|
...
|
...
|
|