This commit is contained in:
mkm 2024-07-27 14:59:19 +08:00
commit ac6d03f7b5

View File

@ -231,7 +231,7 @@ class OrderLogic extends BaseLogic
$store_id = getenv('STORE_ID') ?? 1;
$store['near_store'] = SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find() ?? [];
}
$order['address_id'] = UserAddress::where('uid', $user['id'])->where('is_default', 1)->value('id')??0;
$order['address_id'] = UserAddress::where('uid', $user['id'])->where('is_default', 1)->value('id') ?? 0;
}
if (empty($store_check)) {
if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) {
@ -292,12 +292,25 @@ class OrderLogic extends BaseLogic
// $_order['reservation_time'] = $params['reservation_time'];
// $_order['reservation'] = YesNoEnum::YES;
// }
if ($addressId > 0 && $uid > 0) {
$address = UserAddress::where(['id' => $addressId, 'uid' => $uid])->find();
if ($uid > 0) {
$address = UserAddress::where(['uid' => $uid])->find();
if ($address) {
$_order['real_name'] = $address['real_name'];
$_order['user_phone'] = $address['phone'];
$_order['user_address'] = $address['detail'];
if ($address['area']) {
$_order['user_address'] = Db::name('geo_area')->where('area_code', $address['area'])->value('area_name') ?? '';
}
if ($address['street']) {
$street_name = Db::name('geo_street')->where('street_code', $address['street'])->value('street_name') ?? '';
$_order['user_address'] .= '/' . $street_name;
}
if ($address['village']) {
$village_name = Db::name('geo_village')->where('village_code', $address['village'])->value('village_name') ?? '';
$_order['user_address'] .= '/' . $village_name;
}
if ($address['brigade']) {
$_order['user_address'] .= '/' . $address['brigade'] ?? $address['brigade'] . '队' : '';
}
}
}
if ($params['shipping_type'] == 2) {
@ -577,7 +590,7 @@ class OrderLogic extends BaseLogic
'staff_id' => $params['staff_id'] ?? 0,
], ['id' => $order['id']]);
//修改商品统计记录标识
(new StoreProductLog())->where('oid',$order['id'])->update(['store_id' => $params['store_id']]);
(new StoreProductLog())->where('oid', $order['id'])->update(['store_id' => $params['store_id']]);
(new StoreOrderCartInfo())->update([
'verify_code' => $params['verify_code'] . '-1',
'writeoff_time' => time(),
@ -587,9 +600,9 @@ class OrderLogic extends BaseLogic
'update_time' => time(),
], ['oid' => $order['id']]);
$financeFlow = new StoreFinanceFlow();
$res=$financeFlow->where('order_id',$order['id'])->update(['store_id'=>$params['store_id'],'staff_id'=>$params['staff_id']]);
if($res){
$order['store_id']=$params['store_id'];
$res = $financeFlow->where('order_id', $order['id'])->update(['store_id' => $params['store_id'], 'staff_id' => $params['staff_id']]);
if ($res) {
$order['store_id'] = $params['store_id'];
}
$financeFlowLogic = new StoreFinanceFlowLogic();
$select_1 = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => ['in' => 14, 15, 16]])->select();