修改用户合并

This commit is contained in:
luofei 2024-03-13 09:57:58 +08:00
parent af5e6e9a4f
commit 8b1691d624

View File

@ -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();