添加店铺街接口

This commit is contained in:
wangxiaowei 2024-09-30 09:50:50 +08:00
parent f7b58b69b4
commit 7b566f3fb8
2 changed files with 48 additions and 0 deletions

@ -41,6 +41,13 @@ class LocalStore extends Api
return JsonServer::success('查询成功', $result);
}
// 查询店铺街
public function getStreetlList() {
$data = $this->request->param();
$result = (new LocalStoreLogic)->getStreetlList($data);
return JsonServer::success('查询成功', $result);
}
// 查询本地商户订单
public function getLocalOrderList()
{

@ -70,6 +70,47 @@ class LocalStoreLogic extends Logic
return $data;
}
public function getStreetlList($data)
{
$model = new LocalStore;
$distance = "";
$s = $s1 = "";
$city_where = [];
if (isset($data['c_name'])) {
if ($data['c_name'] != "") {
$s1 = "address like '%" . $data['c_name'] . "%'";
$s = "and address like '%" . $data['c_name'] . "%'";
}
}
$count = $model->where('is_delete', 0)
->where($city_where)
->where($s1)
->where("store_state", 1)
->where("shopLogo is not null")
->count();
$size = $data['page_size'];
$page = ($data['page_no'] - 1) * $data['page_size'];
$sql = "SELECT * FROM ls_local_store where is_delete = 0 and store_state = 1 and shopLogo is not null $s ORDER BY lstore_id asc limit " . $page . "," . $size;
$lists = Db::query($sql);
foreach ($lists as $key => $value) {
$lists[$key]['distance'] = round($this->distance($data['latitude'], $data['longitude'], $value['latitude'], $value['longitude']) / 1000, 2) . "公里";
$lists[$key]['store_nickname'] = $value["shopName"];
}
$data = [
'list' => $lists,
'page' => $data['page_no'],
'size' => $data['page_size'],
'count' => $count,
'more' => is_more($count, $data['page_no'], $data['page_size'])
];
return $data;
}
public function getLocalOrderList($data)
{
$count = LocalStoreOrder::where(['lstore_id' => $data['lstore_id'], 'pay_shop_type' => 1, 'state' => 1])->count();