feat: 新增用户真实姓名字段及修改订单逻辑

This commit is contained in:
mkm 2024-07-23 15:08:51 +08:00
parent 31d4826466
commit ed8fdb3422
3 changed files with 20 additions and 17 deletions

View File

@ -112,6 +112,7 @@ class LoginLogic extends BaseLogic
'store_id' => SystemStoreStaff::where('phone',$userInfo['mobile'])->value('store_id')??null,
// 'sn' => $userInfo['sn'],
'token' => $userInfo['token'],
'real_name' => $userInfo['real_name'],
];
} catch (\Exception $e) {
self::setError($e->getMessage());

View File

@ -52,7 +52,6 @@ class OrderLogic extends BaseLogic
public static $total_price;
public static $pay_price;
public static $cost;
public static $profit;
public static $store_price; //门店零售价
public static $activity_price;
public static $deduction_price;
@ -71,11 +70,10 @@ class OrderLogic extends BaseLogic
self::setError('购物车为空');
return false;
}
// try {
try {
self::$total_price = 0;
self::$pay_price = 0;
self::$cost = 0; //成本由采购价替代原成本为门店零售价
self::$profit = 0; //利润
self::$activity_price = 0; //活动减少
self::$store_price = 0; //商户价
self::$deduction_price = 0;
@ -192,7 +190,7 @@ class OrderLogic extends BaseLogic
'order_id' => $params['order_id'] ?? getNewOrderId('PF'),
'total_price' => self::$total_price, //总价
'cost' => self::$cost, //成本价1-
'pay_price' => $pay_price, //后期可能有降价抵扣
'pay_price' => $pay_price, //支付价
'vip_price' => 0,
'total_num' => count($cart_select), //总数
'pay_type' => $params['pay_type'] ?? 0,
@ -202,11 +200,12 @@ class OrderLogic extends BaseLogic
'shipping_type' => $params['shipping_type'] ?? 2, //配送方式 1=快递 2=门店自提
'activity' => '减免',
'activity_price' => self::$activity_price,
'activities' => self::$activity_price > 0 ? 1 : 0,
'deduction_price' => self::$deduction_price,
'frozen_money' => self::$frozen_money, //返还金额(活动关闭得时候有)
'activities' => $off_activity,
'deduction_price' => self::$deduction_price, //抵扣金额
'frozen_money' => 0, //self::$frozen_money, //返还金额(活动关闭得时候有)
'source' => 0,
'is_storage' => $params['is_storage'] ?? 0,
'address_id' => 0,
];
$order['default_delivery'] = 0;
if ($params['store_id']) {
@ -230,6 +229,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');
}
if (empty($store_check)) {
if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) {
@ -249,10 +249,10 @@ class OrderLogic extends BaseLogic
}
}
}
// } catch (\Exception $e) {
// self::setError($e->getMessage());
// return false;
// }
} catch (\Exception $e) {
self::setError($e->getMessage());
return false;
}
return ['order' => $order, 'cart_list' => $cart_select, 'shopInfo' => $store['near_store']];
}
@ -284,7 +284,8 @@ class OrderLogic extends BaseLogic
$_order['pay_type'] = $orderInfo['order']['pay_type'];
$_order['verify_code'] = $verify_code;
$_order['reservation_time'] = null;
$_order['reservation'] = 0;$params['reservation'] ?? 0; //是否需要预约
$_order['reservation'] = 0;
$params['reservation'] ?? 0; //是否需要预约
// if (isset($params['reservation_time']) && $params['reservation_time']) {
// $_order['reservation_time'] = $params['reservation_time'];
// $_order['reservation'] = YesNoEnum::YES;

View File

@ -77,6 +77,7 @@ class UserTokenCache extends BaseCache
$userInfo = [
'user_id' => $user->id,
'nickname' => $user->nickname,
'real_name' => $user->real_name,
'token' => $token,
'mobile' => $user->mobile,
'avatar' => $user->avatar,