作者 王智

daima

... ... @@ -309,34 +309,36 @@ class Index extends Api
}
$rult = Db::name('seller')->where($map3)->where($map)->where($map2)->order('weight desc')->page($param['pages'], $param['rows'])->select();
$count = Db::name('seller')->where($map3)->where($map)->where($map2)->order('weight desc')->select();
if (empty($rult)) {
//如果为空
$list = [
'count' => 0,
'list' => []
];
} else {
//计算距离 KM
foreach ($rult as $k => $v) {
$ruestul[$k]['id'] = $v['id'];
$ruestul[$k]['title'] = $v['title'];
$ruestul[$k]['address'] = $v['address'];
$ruestul[$k]['avatar'] = cdnurl($v['avatar']);
$ruestul[$k]['order'] = $v['order'];
if (empty($param['lng']) || $param['lng'] == null || $param['lng'] == '' || $param['lng'] == "") {
$ruestul[$k]['from'] = '暂无距离信息';
} else {
$ruestul[$k]['from'] = $this->getDistance($param['lng'], $param['lat'], $v['lng'], $v['lat']) . 'km';
}
$ruestul[$k]['talk_num'] = $v['talk_num'];
dump($rult);
die;if (empty($rult)) {
//如果为空
$list = [
'count' => 0,
'list' => []
];
} else {
//计算距离 KM
foreach ($rult as $k => $v) {
$ruestul[$k]['id'] = $v['id'];
$ruestul[$k]['title'] = $v['title'];
$ruestul[$k]['address'] = $v['address'];
$ruestul[$k]['avatar'] = cdnurl($v['avatar']);
$ruestul[$k]['order'] = $v['order'];
if (empty($param['lng']) || $param['lng'] == null || $param['lng'] == '' || $param['lng'] == "") {
$ruestul[$k]['from'] = '暂无距离信息';
} else {
$ruestul[$k]['from'] = $this->getDistance($param['lng'], $param['lat'], $v['lng'], $v['lat']) . 'km';
}
$newarr = array_column($ruestul, 'from');
array_multisort($newarr, SORT_ASC, $ruestul);
$list = [
'count' => count($count),
'list' => $ruestul
];
$ruestul[$k]['talk_num'] = $v['talk_num'];
}
$newarr = array_column($ruestul, 'from');
array_multisort($newarr, SORT_ASC, $ruestul);
$list = [
'count' => count($count),
'list' => $ruestul
];
}
$this->success('成功', $list);
}
... ...