作者 王智

daima

@@ -268,6 +268,7 @@ class Index extends Api @@ -268,6 +268,7 @@ class Index extends Api
268 * @ApiParams (name="rows", type="int", required=true, description="rows") 268 * @ApiParams (name="rows", type="int", required=true, description="rows")
269 * @ApiParams (name="keywords", type="string", required=true, description="搜索关键字") 269 * @ApiParams (name="keywords", type="string", required=true, description="搜索关键字")
270 * @ApiParams (name="city", type="string", required=true, description="区域关键字") 270 * @ApiParams (name="city", type="string", required=true, description="区域关键字")
  271 + * @ApiParams (name="type", type="int", required=true, description="1=首页,2=爱车养护")
271 * @ApiReturnParams (name="code", type="integer", required=true, sample="0") 272 * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
272 * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") 273 * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
273 * @ApiReturn ({ 274 * @ApiReturn ({
@@ -294,14 +295,18 @@ class Index extends Api @@ -294,14 +295,18 @@ class Index extends Api
294 $param = $this->request->param(); 295 $param = $this->request->param();
295 $map = []; 296 $map = [];
296 $map2 = []; 297 $map2 = [];
  298 + $map3 = [];
297 if ($param['city'] != '全市') { 299 if ($param['city'] != '全市') {
298 $map['address'] = ['LIKE', '%' . $param['city'] . '%']; 300 $map['address'] = ['LIKE', '%' . $param['city'] . '%'];
299 } 301 }
300 if (!empty($param['keywords']) || $param['keywords'] != null || $param['keywords'] != '' || $param['keywords'] != "") { 302 if (!empty($param['keywords']) || $param['keywords'] != null || $param['keywords'] != '' || $param['keywords'] != "") {
301 $map2['title'] = ['LIKE', '%' . $param['keywords'] . '%']; 303 $map2['title'] = ['LIKE', '%' . $param['keywords'] . '%'];
302 } 304 }
303 - $rult = Db::name('seller')->where('is_show', 1)->where($map)->where($map2)->order('id desc')->page($param['pages'], $param['rows'])->select();  
304 - $count = Db::name('seller')->where('is_show', 1)->where($map)->where($map2)->order('id desc')->select(); 305 + if ($param['type'] == 1) {
  306 + $map3['is_show'] = ['eq', 1];
  307 + }
  308 + $rult = Db::name('seller')->where($map3)->where($map)->where($map2)->order('id desc')->page($param['pages'], $param['rows'])->select();
  309 + $count = Db::name('seller')->where($map3)->where($map)->where($map2)->order('id desc')->select();
305 if (empty($rult)) { 310 if (empty($rult)) {
306 //如果为空 311 //如果为空
307 $list = [ 312 $list = [