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