|
@@ -321,9 +321,22 @@ class Pay extends Api
|
|
|
}
|
|
|
$userCouponsRes = Db::name('user_coupons')->insertAll($userCouponsData);
|
|
|
if (!$userCouponsRes) {
|
|
|
- throw new Exception('赠送优惠失败');
|
|
|
+ Db::rollback();
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|
|
|
+ //绑定门店
|
|
|
+ $userService = new UserService();
|
|
|
+ $userParams = [
|
|
|
+ 'user_id' => $orderInfo['user_id'],
|
|
|
+ 'company_id' => $orderInfo['company_id'],
|
|
|
+ 'comefrom' => '',//来源
|
|
|
+ ];
|
|
|
+ $userBindRes = $userService->userWallet($userParams);
|
|
|
+ if (!$userBindRes['status']) {
|
|
|
+ Db::rollback();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
$userWalletWhere['user_id'] = $orderInfo['user_id'];
|
|
|
$userWalletWhere['company_id'] = $orderInfo['company_id'];
|
|
|
$userWalletData = Db::name('user_wallet')->where($userWalletWhere)->find();
|
|
@@ -347,7 +360,8 @@ class Pay extends Api
|
|
|
];
|
|
|
$userMoneyLogRes = Db::name('user_money_log')->insertGetId($userMoneyLogData);
|
|
|
if (!$userMoneyLogRes) {
|
|
|
- throw new Exception('充值记录失败');
|
|
|
+ Db::rollback();
|
|
|
+ return false;
|
|
|
}
|
|
|
//更新钱包余额
|
|
|
$update = [
|
|
@@ -465,6 +479,18 @@ class Pay extends Api
|
|
|
Db::rollback();
|
|
|
return false;
|
|
|
}
|
|
|
+ //绑定门店
|
|
|
+ $userService = new UserService();
|
|
|
+ $userParams = [
|
|
|
+ 'user_id' => $orderInfo['user_id'],
|
|
|
+ 'company_id' => $orderInfo['company_id'],
|
|
|
+ 'comefrom' => '',//来源
|
|
|
+ ];
|
|
|
+ $userBindRes = $userService->userWallet($userParams);
|
|
|
+ if (!$userBindRes['status']) {
|
|
|
+ Db::rollback();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
$orderService = new OrderService();
|
|
|
$extData = json_decode($orderInfo['ext_data'], true);
|
|
|
$carId = isset($extData['car_id']) ? $extData['car_id'] : 0;
|