正在显示
1 个修改的文件
包含
69 行增加
和
76 行删除
@@ -309,43 +309,39 @@ class Index extends Api | @@ -309,43 +309,39 @@ class Index extends Api | ||
309 | } | 309 | } |
310 | $rult = Db::name('seller')->where($map3)->where($map)->where($map2)->order('weight asc')->page($param['pages'], $param['rows'])->select(); | 310 | $rult = Db::name('seller')->where($map3)->where($map)->where($map2)->order('weight asc')->page($param['pages'], $param['rows'])->select(); |
311 | $count = Db::name('seller')->where($map3)->where($map)->where($map2)->order('weight asc')->select(); | 311 | $count = Db::name('seller')->where($map3)->where($map)->where($map2)->order('weight asc')->select(); |
312 | - //asc | 312 | + if (empty($rult)) { |
313 | + //如果为空 | ||
313 | $list = [ | 314 | $list = [ |
314 | 'count' => 0, | 315 | 'count' => 0, |
315 | 'list' => [] | 316 | 'list' => [] |
316 | ]; | 317 | ]; |
317 | - } else | ||
318 | -{ | 318 | + } else { |
319 | //计算距离 KM | 319 | //计算距离 KM |
320 | -foreach ($rult as $k => $v) | ||
321 | -{ | ||
322 | -$ruestul[$k]['id'] = $v['id']; | ||
323 | -$ruestul[$k]['title'] = $v['title']; | ||
324 | -$ruestul[$k]['address'] = $v['address']; | ||
325 | -$ruestul[$k]['avatar'] = cdnurl($v['avatar']); | ||
326 | -$ruestul[$k]['order'] = $v['order']; | ||
327 | -if (empty($param['lng']) || $param['lng'] == null || $param['lng'] == '' || $param['lng'] == "") | ||
328 | -{ | ||
329 | -$ruestul[$k]['from'] = '暂无距离信息'; | ||
330 | -} | ||
331 | - | ||
332 | -else { | 320 | + foreach ($rult as $k => $v) { |
321 | + $ruestul[$k]['id'] = $v['id']; | ||
322 | + $ruestul[$k]['title'] = $v['title']; | ||
323 | + $ruestul[$k]['address'] = $v['address']; | ||
324 | + $ruestul[$k]['avatar'] = cdnurl($v['avatar']); | ||
325 | + $ruestul[$k]['order'] = $v['order']; | ||
326 | + if (empty($param['lng']) || $param['lng'] == null || $param['lng'] == '' || $param['lng'] == "") { | ||
327 | + $ruestul[$k]['from'] = '暂无距离信息'; | ||
328 | + } else { | ||
333 | $ruestul[$k]['from'] = $this->getDistance($param['lng'], $param['lat'], $v['lng'], $v['lat']) . 'km'; | 329 | $ruestul[$k]['from'] = $this->getDistance($param['lng'], $param['lat'], $v['lng'], $v['lat']) . 'km'; |
334 | -} | ||
335 | -$ruestul[$k]['talk_num'] = $v['talk_num']; | ||
336 | -} | ||
337 | -$newarr = array_column($ruestul, 'from'); | ||
338 | -array_multisort($newarr, SORT_ASC, $ruestul); | ||
339 | -$list = [ | 330 | + } |
331 | + $ruestul[$k]['talk_num'] = $v['talk_num']; | ||
332 | + } | ||
333 | + $newarr = array_column($ruestul, 'from'); | ||
334 | + array_multisort($newarr, SORT_ASC, $ruestul); | ||
335 | + $list = [ | ||
340 | 'count' => count($count), | 336 | 'count' => count($count), |
341 | 'list' => $ruestul | 337 | 'list' => $ruestul |
342 | -]; | ||
343 | -} | ||
344 | -$this->success('成功', $list); | ||
345 | -} | 338 | + ]; |
339 | + } | ||
340 | + $this->success('成功', $list); | ||
341 | + } | ||
346 | 342 | ||
347 | 343 | ||
348 | -/** | 344 | + /** |
349 | * 首页接口 | 345 | * 首页接口 |
350 | * @ApiTitle (首页接口-店铺详情) | 346 | * @ApiTitle (首页接口-店铺详情) |
351 | * @ApiSummary (店铺详情) | 347 | * @ApiSummary (店铺详情) |
@@ -357,39 +353,38 @@ $this->success('成功', $list); | @@ -357,39 +353,38 @@ $this->success('成功', $list); | ||
357 | * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | 353 | * @ApiReturnParams (name="code", type="integer", required=true, sample="0") |
358 | * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | 354 | * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") |
359 | * @ApiReturn ({ | 355 | * @ApiReturn ({ |
360 | -'code':'1', | ||
361 | -'msg':'返回成功', | ||
362 | -"data": { | ||
363 | -"id": 3, | ||
364 | -"avatar": "http://xiche.qiniu.bronet.cn/uploads/20200831/FsGkAQhqnwBodzLvJyn1rtbZIFUd.png", | ||
365 | -"title": "这是第三个店铺", | ||
366 | -"opentime": "8:00-9:00", | ||
367 | -"address": "北京市北京市海淀区吴玉章路", | ||
368 | -"mobile": "1391929399", | ||
369 | -"content": "<p>这是第三个商家的详情</p>", | ||
370 | -"num": 3, //平均评分 | ||
371 | -"talkList": { | ||
372 | -"count": 1,//评论总数 | ||
373 | -"talk": [ | ||
374 | -{ | ||
375 | -"id": 1, //评论id | ||
376 | -"num": 3, //评分 | ||
377 | -"createtime": "1970-05-09", //评论时间 | ||
378 | -"avatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/0wpUDw5m0LRvdDueia3uMWmrYb53GXRaTnYwMWC18kRmX6P6PIaPDgQqarEIfwroicx1z51D6bjQicOV0PibBx2PqQ/132", | ||
379 | -"nickname": "Gody", | ||
380 | -"images": [ //评论图 | ||
381 | -"http://xiche.qiniu.bronet.cn/uploads/20200831/FsGkAQhqnwBodzLvJyn1rtbZIFUd.png", | ||
382 | -"http://xiche.qiniu.bronet.cn/uploads/20200831/FsGkAQhqnwBodzLvJyn1rtbZIFUd.png" | ||
383 | -] | ||
384 | -} | ||
385 | -] | ||
386 | -} | ||
387 | -} | ||
388 | -}) | 356 | + 'code':'1', |
357 | + 'msg':'返回成功', | ||
358 | + "data": { | ||
359 | + "id": 3, | ||
360 | + "avatar": "http://xiche.qiniu.bronet.cn/uploads/20200831/FsGkAQhqnwBodzLvJyn1rtbZIFUd.png", | ||
361 | + "title": "这是第三个店铺", | ||
362 | + "opentime": "8:00-9:00", | ||
363 | + "address": "北京市北京市海淀区吴玉章路", | ||
364 | + "mobile": "1391929399", | ||
365 | + "content": "<p>这是第三个商家的详情</p>", | ||
366 | + "num": 3, //平均评分 | ||
367 | + "talkList": { | ||
368 | + "count": 1,//评论总数 | ||
369 | + "talk": [ | ||
370 | + { | ||
371 | + "id": 1, //评论id | ||
372 | + "num": 3, //评分 | ||
373 | + "createtime": "1970-05-09", //评论时间 | ||
374 | + "avatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/0wpUDw5m0LRvdDueia3uMWmrYb53GXRaTnYwMWC18kRmX6P6PIaPDgQqarEIfwroicx1z51D6bjQicOV0PibBx2PqQ/132", | ||
375 | + "nickname": "Gody", | ||
376 | + "images": [ //评论图 | ||
377 | + "http://xiche.qiniu.bronet.cn/uploads/20200831/FsGkAQhqnwBodzLvJyn1rtbZIFUd.png", | ||
378 | + "http://xiche.qiniu.bronet.cn/uploads/20200831/FsGkAQhqnwBodzLvJyn1rtbZIFUd.png" | ||
379 | + ] | ||
380 | + } | ||
381 | + ] | ||
382 | + } | ||
383 | + } | ||
384 | + }) | ||
389 | */ | 385 | */ |
390 | -public | ||
391 | -function SellerCon() | ||
392 | -{ | 386 | + public function SellerCon() |
387 | + { | ||
393 | $param = $this->request->param(); | 388 | $param = $this->request->param(); |
394 | $seller_arr = Db::name('seller')->where('id', $param['id'])->find(); | 389 | $seller_arr = Db::name('seller')->where('id', $param['id'])->find(); |
395 | if (empty($seller_arr)) { | 390 | if (empty($seller_arr)) { |
@@ -458,10 +453,10 @@ function SellerCon() | @@ -458,10 +453,10 @@ function SellerCon() | ||
458 | ]; | 453 | ]; |
459 | } | 454 | } |
460 | $this->success('成功', $list); | 455 | $this->success('成功', $list); |
461 | -} | 456 | + } |
462 | 457 | ||
463 | 458 | ||
464 | -/** | 459 | + /** |
465 | * 首页接口 | 460 | * 首页接口 |
466 | * @ApiTitle (首页接口-添加评论) | 461 | * @ApiTitle (首页接口-添加评论) |
467 | * @ApiSummary (添加评论) | 462 | * @ApiSummary (添加评论) |
@@ -475,13 +470,12 @@ function SellerCon() | @@ -475,13 +470,12 @@ function SellerCon() | ||
475 | * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | 470 | * @ApiReturnParams (name="code", type="integer", required=true, sample="0") |
476 | * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | 471 | * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") |
477 | * @ApiReturn ({ | 472 | * @ApiReturn ({ |
478 | -'code':'1', | ||
479 | -'msg':'返回成功', | ||
480 | -}) | 473 | + 'code':'1', |
474 | + 'msg':'返回成功', | ||
475 | + }) | ||
481 | */ | 476 | */ |
482 | -public | ||
483 | -function TalkSave() | ||
484 | -{ | 477 | + public function TalkSave() |
478 | + { | ||
485 | $param = $this->request->param(); | 479 | $param = $this->request->param(); |
486 | $user_id = $this->is_token($this->request->header()); | 480 | $user_id = $this->is_token($this->request->header()); |
487 | $data = [ | 481 | $data = [ |
@@ -496,10 +490,10 @@ function TalkSave() | @@ -496,10 +490,10 @@ function TalkSave() | ||
496 | $talk_num = Db::name('seller')->where('id', $param['seller_id'])->value('talk_num'); | 490 | $talk_num = Db::name('seller')->where('id', $param['seller_id'])->value('talk_num'); |
497 | Db::name('seller')->where('id', $param['seller_id'])->update(['talk_num' => $talk_num + 1]); | 491 | Db::name('seller')->where('id', $param['seller_id'])->update(['talk_num' => $talk_num + 1]); |
498 | $this->res($res); | 492 | $this->res($res); |
499 | -} | 493 | + } |
500 | 494 | ||
501 | 495 | ||
502 | -/** | 496 | + /** |
503 | * 首页接口 | 497 | * 首页接口 |
504 | * @ApiTitle (首页接口-联系客服文字) | 498 | * @ApiTitle (首页接口-联系客服文字) |
505 | * @ApiSummary (联系客服文字) | 499 | * @ApiSummary (联系客服文字) |
@@ -508,14 +502,13 @@ function TalkSave() | @@ -508,14 +502,13 @@ function TalkSave() | ||
508 | * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | 502 | * @ApiReturnParams (name="code", type="integer", required=true, sample="0") |
509 | * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | 503 | * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") |
510 | * @ApiReturn ({ | 504 | * @ApiReturn ({ |
511 | -'code':'1', | ||
512 | -'msg':'返回成功', | ||
513 | -}) | 505 | + 'code':'1', |
506 | + 'msg':'返回成功', | ||
507 | + }) | ||
514 | */ | 508 | */ |
515 | -public | ||
516 | -function Lianxi() | ||
517 | -{ | 509 | + public function Lianxi() |
510 | + { | ||
518 | $title = Db::name('lianxi')->where('id', 1)->value('title'); | 511 | $title = Db::name('lianxi')->where('id', 1)->value('title'); |
519 | $this->success('成功', $title); | 512 | $this->success('成功', $title); |
520 | -} | 513 | + } |
521 | } | 514 | } |
-
请 注册 或 登录 后发表评论