作者 王智

1

... ... @@ -78,6 +78,21 @@ class Index extends Api
$params = $this->request->param();
//用户所在省市区
// $UserAddress = $this->getCity($params['lng'], $params['lat']);
if (empty($params['lng']) || $params['lng'] == '' || $params['lng'] == "" || $params['lng'] == null) {
//首页轮播图
$IndexBanner = [];
$IndexBanner = Db::name('index_banner')->order('weigh desc')->field('id,image,web')->select();
if (!empty($IndexBanner)) {
foreach ($IndexBanner as $k => $v) {
$IndexBanner[$k]['image'] = $this->ImgUrl($v['image']);
}
}
$data = [
'IndexBanner' => $IndexBanner,
'Count' => 0,
'List' => []
];
} else {
$Map['address'] = ['LIKE', '%' . $params['city'] . '%'];
$MapKey = [];
if (!empty($params['keywords']) || $params['keywords'] != '' || $params['keywords'] != "" || $params['keywords'] != null) {
... ... @@ -114,6 +129,7 @@ class Index extends Api
'List' => $this->page_array($params['rows'], $params['pages'], $List, 0)
];
}
}
$this->success('成功', $data);
}
... ...