修改地址逻辑
This commit is contained in:
parent
f9f39c2ac0
commit
f9f0e2e4f8
@ -180,6 +180,22 @@ class OrderLogic extends BaseLogic
|
|||||||
$order['source'] = $params['source'];
|
$order['source'] = $params['source'];
|
||||||
}
|
}
|
||||||
//处理返回最近的店铺
|
//处理返回最近的店铺
|
||||||
|
$store_check = 0;
|
||||||
|
if(empty($user)){
|
||||||
|
$store_id = getenv('STORE_ID') ?? 1;
|
||||||
|
$store['near_store'] =SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[];
|
||||||
|
}else{
|
||||||
|
$checkOrderStore = StoreOrder::where('uid',$user['id'])->field('id,store_id')
|
||||||
|
->order('id','desc')->find();
|
||||||
|
if($checkOrderStore){
|
||||||
|
$store['near_store'] =SystemStore::where('id', $checkOrderStore['store_id'])->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[];
|
||||||
|
}else{
|
||||||
|
$store_id = getenv('STORE_ID') ?? 1;
|
||||||
|
$store['near_store'] =SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[];
|
||||||
|
}
|
||||||
|
$store_check = 1;
|
||||||
|
}
|
||||||
|
if ($store_check) {
|
||||||
if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) {
|
if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) {
|
||||||
$storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray();
|
$storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray();
|
||||||
$nearestStore = null;
|
$nearestStore = null;
|
||||||
@ -195,22 +211,7 @@ class OrderLogic extends BaseLogic
|
|||||||
if ($nearestStore) {
|
if ($nearestStore) {
|
||||||
$store['near_store'] = $nearestStore;
|
$store['near_store'] = $nearestStore;
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
if(empty($user)){
|
|
||||||
$store_id = getenv('STORE_ID') ?? 1;
|
|
||||||
$store['near_store'] =SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[];
|
|
||||||
}else{
|
|
||||||
$checkOrderStore = StoreOrder::where('uid',$user['id'])->field('id,store_id')
|
|
||||||
->order('id','desc')->find();
|
|
||||||
if($checkOrderStore){
|
|
||||||
$store['near_store'] =SystemStore::where('id', $checkOrderStore['store_id'])->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[];
|
|
||||||
}else{
|
|
||||||
$store_id = getenv('STORE_ID') ?? 1;
|
|
||||||
$store['near_store'] =SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
self::setError($e->getMessage());
|
self::setError($e->getMessage());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user