diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index 3ac09721..1967f345 100755 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -1717,22 +1717,6 @@ class Auth extends BaseController if (!empty($user)) { Db::startTrans(); try { - StoreGroupOrder::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); - StoreOrder::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); - StoreOrderProduct::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); - UserBill::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); - FinancialRecord::where('user_id', $user['uid'])->update(['user_id' => $targetUser['uid']]); - UserAddress::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); - StoreConsumptionUser::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); - StoreConsumptionDetail::where('user_id', $user['uid'])->update(['user_id' => $targetUser['uid']]); - StoreRefundOrder::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); - UserRecharge::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); - StoreOrderStatus::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); - if ($user->now_money > 0) { - $targetUser->now_money = bcadd($targetUser->now_money, $user->now_money, 2); - $user->now_money = 0; - $targetUser->save(); - } $merchant = Merchant::where('uid', $targetUser['uid'])->find(); if (!empty($merchant)) { $orders = StoreOrder::with(['refundOrder' => function(Query $query) { @@ -1767,6 +1751,22 @@ class Auth extends BaseController $merchant->save(); } } + StoreGroupOrder::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); + StoreOrder::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); + StoreOrderProduct::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); + UserBill::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); + FinancialRecord::where('user_id', $user['uid'])->update(['user_id' => $targetUser['uid']]); + UserAddress::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); + StoreConsumptionUser::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); + StoreConsumptionDetail::where('user_id', $user['uid'])->update(['user_id' => $targetUser['uid']]); + StoreRefundOrder::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); + UserRecharge::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); + StoreOrderStatus::where('uid', $user['uid'])->update(['uid' => $targetUser['uid']]); + if ($user->now_money > 0) { + $targetUser->now_money = bcadd($targetUser->now_money, $user->now_money, 2); + $user->now_money = 0; + $targetUser->save(); + } $user->wechat_user_id = 0; $user->main_uid = $targetUser['uid']; $user->save();