作者 耿培杰

修改接口

@@ -56,6 +56,7 @@ class Goods extends Api @@ -56,6 +56,7 @@ class Goods extends Api
56 * @ApiSummary (推荐商品列表) 56 * @ApiSummary (推荐商品列表)
57 * @ApiMethod (POST) 57 * @ApiMethod (POST)
58 * @ApiRoute (/api/goods/getRecommendGoods) 58 * @ApiRoute (/api/goods/getRecommendGoods)
  59 + * @ApiParams (name=limit, type=string, required=false, description="显示条数 默认10条")
59 * @ApiReturn({ 60 * @ApiReturn({
60 "code": 1, 61 "code": 1,
61 "msg": "请求成功", 62 "msg": "请求成功",
@@ -77,10 +78,12 @@ class Goods extends Api @@ -77,10 +78,12 @@ class Goods extends Api
77 */ 78 */
78 public function getRecommendGoods() 79 public function getRecommendGoods()
79 { 80 {
  81 + $limit = $this->request->param('limit')?$this->request->param('limit'):10;
80 $where['g.is_recommend'] = 1; 82 $where['g.is_recommend'] = 1;
81 83
82 - $data = $this->goodsModel->selectData($where, 10,$this->lang);  
83 - 84 + $list = $this->goodsModel->selectData($where, $limit,$this->lang);
  85 + $data['image'] = cdnurl(config('site.index_recommend_image'));
  86 + $data['list'] = $list;
84 $this->success('请求成功', $data); 87 $this->success('请求成功', $data);
85 } 88 }
86 89
@@ -90,6 +93,7 @@ class Goods extends Api @@ -90,6 +93,7 @@ class Goods extends Api
90 * @ApiSummary (商品列表) 93 * @ApiSummary (商品列表)
91 * @ApiMethod (POST) 94 * @ApiMethod (POST)
92 * @ApiRoute (/api/goods/getGoodsList) 95 * @ApiRoute (/api/goods/getGoodsList)
  96 + * @ApiParams (name=type, type=string, required=false, description="类型:1=普通商品,2=推荐商品 默认全部")
93 * @ApiParams (name=page, type=string, required=false, description="页数") 97 * @ApiParams (name=page, type=string, required=false, description="页数")
94 * @ApiReturn({ 98 * @ApiReturn({
95 "code": 1, 99 "code": 1,
@@ -118,6 +122,7 @@ class Goods extends Api @@ -118,6 +122,7 @@ class Goods extends Api
118 $limit = Config::get('paginate.index_rows'); 122 $limit = Config::get('paginate.index_rows');
119 $where = []; 123 $where = [];
120 124
  125 + $type = $this->request->param('type');
121 $keyword = $this->request->param('keyword'); 126 $keyword = $this->request->param('keyword');
122 if ($keyword){ 127 if ($keyword){
123 $where['g.ch_name|g.en_name|g.ch_content|g.en_content'] = ['like','%'.$keyword.'%']; 128 $where['g.ch_name|g.en_name|g.ch_content|g.en_content'] = ['like','%'.$keyword.'%'];
@@ -125,6 +130,11 @@ class Goods extends Api @@ -125,6 +130,11 @@ class Goods extends Api
125 if ($this->userId) $this->keywordLogModel->save(['user_id'=>$this->userId,'content'=>$keyword,'createtime'=>time()]); 130 if ($this->userId) $this->keywordLogModel->save(['user_id'=>$this->userId,'content'=>$keyword,'createtime'=>time()]);
126 } 131 }
127 132
  133 + if(!empty($type) && $type == 2){
  134 + $where['g.is_recommend'] = 1;
  135 + }elseif(!empty($type) && $type == 1){
  136 + $where['g.is_recommend'] = 2;
  137 + }
128 $data = $this->goodsModel->selectPageData($where,$page,$limit,$this->lang); 138 $data = $this->goodsModel->selectPageData($where,$page,$limit,$this->lang);
129 $this->success('请求成功', $data); 139 $this->success('请求成功', $data);
130 } 140 }
@@ -50,4 +50,5 @@ return array ( @@ -50,4 +50,5 @@ return array (
50 'en_vip_text' => '<p>会员特权英文</p>', 50 'en_vip_text' => '<p>会员特权英文</p>',
51 'en_withdraw_deposit_text' => '<p>会员特权英文</p>', 51 'en_withdraw_deposit_text' => '<p>会员特权英文</p>',
52 'en_distribution_text' => '<p>会员特权英文</p>', 52 'en_distribution_text' => '<p>会员特权英文</p>',
  53 + 'index_recommend_image' => '/uploads/20200526/a677bd6b92fca41ed1a5be015a14f8a0.png',
53 ); 54 );
@@ -9418,7 +9418,24 @@ @@ -9418,7 +9418,24 @@
9418 <div class="panel panel-default"> 9418 <div class="panel panel-default">
9419 <div class="panel-heading"><strong>参数</strong></div> 9419 <div class="panel-heading"><strong>参数</strong></div>
9420 <div class="panel-body"> 9420 <div class="panel-body">
9421 - 9421 + <table class="table table-hover">
  9422 + <thead>
  9423 + <tr>
  9424 + <th>名称</th>
  9425 + <th>类型</th>
  9426 + <th>必选</th>
  9427 + <th>描述</th>
  9428 + </tr>
  9429 + </thead>
  9430 + <tbody>
  9431 + <tr>
  9432 + <td>limit</td>
  9433 + <td>string</td>
  9434 + <td></td>
  9435 + <td>显示条数 默认10条</td>
  9436 + </tr>
  9437 + </tbody>
  9438 + </table>
9422 </div> 9439 </div>
9423 </div> 9440 </div>
9424 <div class="panel panel-default"> 9441 <div class="panel panel-default">
@@ -9436,7 +9453,8 @@ @@ -9436,7 +9453,8 @@
9436 <div class="panel-body"> 9453 <div class="panel-body">
9437 <form enctype="application/x-www-form-urlencoded" role="form" action="/api/goods/getRecommendGoods" method="POST" name="form21" id="form21"> 9454 <form enctype="application/x-www-form-urlencoded" role="form" action="/api/goods/getRecommendGoods" method="POST" name="form21" id="form21">
9438 <div class="form-group"> 9455 <div class="form-group">
9439 - 9456 + <label class="control-label" for="limit">limit</label>
  9457 + <input type="string" class="form-control input-sm" id="limit" placeholder="显示条数 默认10条" name="limit">
9440 </div> 9458 </div>
9441 <div class="form-group"> 9459 <div class="form-group">
9442 <button type="submit" class="btn btn-success send" rel="21">提交</button> 9460 <button type="submit" class="btn btn-success send" rel="21">提交</button>
@@ -9538,6 +9556,12 @@ @@ -9538,6 +9556,12 @@
9538 </thead> 9556 </thead>
9539 <tbody> 9557 <tbody>
9540 <tr> 9558 <tr>
  9559 + <td>type</td>
  9560 + <td>string</td>
  9561 + <td></td>
  9562 + <td>类型:1=普通商品,2=推荐商品 默认全部</td>
  9563 + </tr>
  9564 + <tr>
9541 <td>page</td> 9565 <td>page</td>
9542 <td>string</td> 9566 <td>string</td>
9543 <td></td> 9567 <td></td>
@@ -9562,6 +9586,10 @@ @@ -9562,6 +9586,10 @@
9562 <div class="panel-body"> 9586 <div class="panel-body">
9563 <form enctype="application/x-www-form-urlencoded" role="form" action="/api/goods/getGoodsList" method="POST" name="form22" id="form22"> 9587 <form enctype="application/x-www-form-urlencoded" role="form" action="/api/goods/getGoodsList" method="POST" name="form22" id="form22">
9564 <div class="form-group"> 9588 <div class="form-group">
  9589 + <label class="control-label" for="type">type</label>
  9590 + <input type="string" class="form-control input-sm" id="type" placeholder="类型:1=普通商品,2=推荐商品 默认全部" name="type">
  9591 + </div>
  9592 + <div class="form-group">
9565 <label class="control-label" for="page">page</label> 9593 <label class="control-label" for="page">page</label>
9566 <input type="string" class="form-control input-sm" id="page" placeholder="页数" name="page"> 9594 <input type="string" class="form-control input-sm" id="page" placeholder="页数" name="page">
9567 </div> 9595 </div>
@@ -12827,7 +12855,7 @@ @@ -12827,7 +12855,7 @@
12827 12855
12828 <div class="row mt0 footer"> 12856 <div class="row mt0 footer">
12829 <div class="col-md-6" align="left"> 12857 <div class="col-md-6" align="left">
12830 - Generated on 2020-05-21 17:02:37 </div> 12858 + Generated on 2020-05-26 15:11:09 </div>
12831 <div class="col-md-6" align="right"> 12859 <div class="col-md-6" align="right">
12832 <a href="./" target="_blank">E-MP market</a> 12860 <a href="./" target="_blank">E-MP market</a>
12833 </div> 12861 </div>