This commit is contained in:
mkm 2024-07-03 14:09:24 +08:00
commit b46af51480

View File

@ -192,8 +192,21 @@ class OrderLogic extends BaseLogic
$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) {
self::setError($e->getMessage());