|
@@ -258,11 +258,11 @@ class GoodsController extends Curd
|
|
|
// 把券从000000加到真实账户
|
|
|
CouponDetailService::transCoupon('000000', $params['join_order_member_id']);
|
|
|
}
|
|
|
- }catch (BusinessException $e){
|
|
|
+ } catch (BusinessException $e) {
|
|
|
Log::error('创建订单失败', ['msg' => $e->getMessage()]);
|
|
|
_syslog("订单", $e->getMessage());
|
|
|
return json_fail($e->getMessage());
|
|
|
- }catch (\Exception $e){
|
|
|
+ } catch (\Exception $e) {
|
|
|
Log::error('创建订单失败', ['msg' => $e->getMessage()]);
|
|
|
_syslog("订单", "创建订单失败");
|
|
|
return json_fail('创建订单失败');
|
|
@@ -492,7 +492,7 @@ class GoodsController extends Curd
|
|
|
$account->member_account_updatetimes = time();
|
|
|
$account->save();
|
|
|
} else if ($params['settlement_now'] == 'Y' && $params['pay_category'] == 'CARD') { // 储值卡账户
|
|
|
- $cardNbr = $params['card_nbr'];
|
|
|
+ $cardNbr = $params['card_id'];
|
|
|
if (!$cardNbr) {
|
|
|
throw new BusinessException('账户异常');
|
|
|
}
|
|
@@ -504,10 +504,9 @@ class GoodsController extends Curd
|
|
|
throw new BusinessException('账户异常');
|
|
|
}
|
|
|
$amount = $account->member_account_surplus + $account->member_account_added;
|
|
|
- if ($params['pay_constitute'] == 'N' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
+ if ($params['order_amount_pay'] > $amount) {
|
|
|
throw new BusinessException('账户余额不足');
|
|
|
}
|
|
|
-
|
|
|
if ($params['order_amount_pay'] > $account->member_account_surplus) {
|
|
|
$cut = $account->member_account_added - ($params['order_amount_pay'] - $account->member_account_surplus);
|
|
|
$account->member_account_surplus = 0;
|
|
@@ -519,11 +518,8 @@ class GoodsController extends Curd
|
|
|
$account->member_account_update_user_id = JwtToken::getCurrentId();
|
|
|
$account->member_account_updatetimes = time();
|
|
|
$account->save();
|
|
|
-
|
|
|
- if ($params['pay_constitute'] == 'N') {
|
|
|
- $params['order_status_system'] = $systemStatus;
|
|
|
- $params['order_status_payment'] = 'SUCCESS';
|
|
|
- }
|
|
|
+ $params['order_status_system'] = $systemStatus;
|
|
|
+ $params['order_status_payment'] = 'SUCCESS';
|
|
|
}
|
|
|
if (($params['pay_constitute'] == 'Y' || $params['pay_category'] == 'QRCODE') && $params['settlement_now'] == 'Y' && !empty($params['qrcode_nbr'])) { // 付款码
|
|
|
if ($params['pay_constitute'] == 'Y' && $qrcodePayAmount <= 0) {
|
|
@@ -544,8 +540,6 @@ class GoodsController extends Curd
|
|
|
$params['order_status_system'] = 'PAYING';
|
|
|
$params['order_status_payment'] = 'PENDING';
|
|
|
$params['order_is_complete'] = 'N';
|
|
|
-// Db::rollBack();
|
|
|
-// return json_fail('支付失败');
|
|
|
} else {
|
|
|
$params['order_status_system'] = $systemStatus;
|
|
|
$params['order_status_payment'] = 'SUCCESS';
|
|
@@ -556,8 +550,6 @@ class GoodsController extends Curd
|
|
|
$params['order_status_system'] = 'PAYING';
|
|
|
$params['order_status_payment'] = 'PENDING';
|
|
|
$params['order_is_complete'] = 'N';
|
|
|
-// Db::rollBack();
|
|
|
-// return json_fail('支付失败');
|
|
|
} else {
|
|
|
$params['order_status_system'] = $systemStatus;
|
|
|
$params['order_status_payment'] = 'SUCCESS';
|
|
@@ -633,10 +625,6 @@ class GoodsController extends Curd
|
|
|
{
|
|
|
$params = $request->post();
|
|
|
$goodsClassifys = array_unique(array_column($params['goodsContentList'], 'goods_classify'));
|
|
|
- $premises = [];
|
|
|
- if (!empty($params['dept_premises_id'])) {
|
|
|
- $premises = SysDept::where('dept_name', $params['dept_premises_id'])->first();
|
|
|
- }
|
|
|
try {
|
|
|
// 下单账户
|
|
|
if (empty($params['join_order_member_id']) && !empty($params['mobile'])) {
|
|
@@ -658,11 +646,11 @@ class GoodsController extends Curd
|
|
|
// 把券从000000加到真实账户
|
|
|
CouponDetailService::transCoupon('000000', $params['join_order_member_id']);
|
|
|
}
|
|
|
- }catch (BusinessException $e){
|
|
|
+ } catch (BusinessException $e) {
|
|
|
Log::error('创建订单失败', ['msg' => $e->getMessage()]);
|
|
|
_syslog("订单", $e->getMessage());
|
|
|
return json_fail($e->getMessage());
|
|
|
- }catch (\Exception $e){
|
|
|
+ } catch (\Exception $e) {
|
|
|
Log::error('创建订单失败', ['msg' => $e->getMessage()]);
|
|
|
_syslog("订单", "创建订单失败");
|
|
|
return json_fail('创建订单失败');
|
|
@@ -732,15 +720,7 @@ class GoodsController extends Curd
|
|
|
$params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
|
|
|
|
|
|
$systemStatus = 'SENDING'; // 待发货
|
|
|
- // 立即结算
|
|
|
- if ($params['settlement_now'] == 'Y') {
|
|
|
- if (in_array($params['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD', 'PACKAGE']) && $params['delivery'] == 'ARRIVAL') {
|
|
|
- $params['order_is_complete'] = 'N';
|
|
|
- $systemStatus = "WAITING";
|
|
|
- }
|
|
|
- }
|
|
|
$params['pay_detail_item'] = [];
|
|
|
- $waitToPayAccount = [];
|
|
|
$wxAndAliPayStatus = 'Y';
|
|
|
if (!empty($params['pay_category_constitute']) && in_array('OFFLINE', $params['pay_category_constitute'])) { // 线下支付
|
|
|
$params['order_status_system'] = $systemStatus;
|
|
@@ -787,19 +767,6 @@ class GoodsController extends Curd
|
|
|
if ($params['pay_constitute'] == 'N' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
throw new BusinessException("账户余额不足");
|
|
|
}
|
|
|
-// if ($params['pay_constitute'] == 'Y' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
-// $qrcodePayAmount = $params['order_amount_pay'] - $amount;
|
|
|
-// $params['order_amount_pay'] = $amount;
|
|
|
-// }
|
|
|
-// if ($params['order_amount_pay'] > $account->member_account_surplus) {
|
|
|
-// $cut = $account->member_account_added - ($params['order_amount_pay'] - $account->member_account_surplus);
|
|
|
-// $account->member_account_surplus = 0;
|
|
|
-// $account->member_account_added = $cut;
|
|
|
-// } else {
|
|
|
-// $account->member_account_surplus = $account->member_account_surplus - $params['order_amount_pay'];
|
|
|
-// }
|
|
|
-// $account->member_account_expend = $account->member_account_expend + $params['order_amount_pay'];
|
|
|
-// $account->save();
|
|
|
// 余额账户扣款数据
|
|
|
$params['waitToPayAccount']['cash'] = [
|
|
|
'group_id' => $params['orderGroupId'],
|
|
@@ -817,58 +784,44 @@ class GoodsController extends Curd
|
|
|
|
|
|
}
|
|
|
if (!empty($params['pay_category_constitute']) && in_array('CARD', $params['pay_category_constitute'])) { // 储值卡账户
|
|
|
- $cardNbr = $params['card_nbr'];
|
|
|
- if (!$cardNbr) {
|
|
|
- throw new BusinessException("储值卡账户异常");
|
|
|
- }
|
|
|
- $account = MemberAccount::where('join_account_member_id', $params['join_order_member_id'])
|
|
|
- ->where('member_account_nbr', $cardNbr)
|
|
|
- ->where('member_account_status', 'ACTIVED')
|
|
|
- ->first();
|
|
|
- if (!$account) {
|
|
|
- throw new BusinessException("储值卡账户异常");
|
|
|
- }
|
|
|
- $amount = $account->member_account_surplus + $account->member_account_added;
|
|
|
-
|
|
|
- // 储值卡账户支付金额
|
|
|
- if (isset($constituteList['CARD'])) {
|
|
|
- $params['order_amount_pay'] = $constituteList['CARD'];
|
|
|
- $params['pay_category'] = $cardNbr;
|
|
|
- }
|
|
|
- if ($params['pay_constitute'] == 'N' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
- throw new BusinessException("储值卡账户余额不足");
|
|
|
- }
|
|
|
-// if ($params['pay_constitute'] == 'Y' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
-// $qrcodePayAmount = $params['order_amount_pay'] - $amount;
|
|
|
-// $params['order_amount_pay'] = $amount;
|
|
|
-// }
|
|
|
-//
|
|
|
-// if ($params['order_amount_pay'] > $account->member_account_surplus) {
|
|
|
-// $cut = $account->member_account_added - ($params['order_amount_pay'] - $account->member_account_surplus);
|
|
|
-// $account->member_account_surplus = 0;
|
|
|
-// $account->member_account_added = $cut;
|
|
|
-// } else {
|
|
|
-// $account->member_account_surplus = $account->member_account_surplus - $params['order_amount_pay'];
|
|
|
-// }
|
|
|
-// $account->member_account_expend = $account->member_account_expend + $params['order_amount_pay'];
|
|
|
-// $account->save();
|
|
|
- // 储值卡账户扣款数据
|
|
|
- $params['waitToPayAccount']['card'] = [
|
|
|
- 'group_id' => $params['orderGroupId'],
|
|
|
- 'member_id' => $params['join_order_member_id'],
|
|
|
- 'amount' => $constituteList['CARD'],
|
|
|
- 'nbr' => $params['join_order_member_id'] . '-CARD'
|
|
|
- ];
|
|
|
+ foreach ($params['pay_category_constitute_list'] as $constituteList) {
|
|
|
+ if ($constituteList['category'] != 'CARD') {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $cardNbr = $constituteList['card_id'];
|
|
|
+ $account = MemberAccount::where('join_account_member_id', $params['join_order_member_id'])
|
|
|
+ ->where('member_account_nbr', $cardNbr)
|
|
|
+ ->where('member_account_status', 'ACTIVED')
|
|
|
+ ->first();
|
|
|
+ if (!$account) {
|
|
|
+ Db::rollBack();
|
|
|
+ return json_fail('账户异常');
|
|
|
+ }
|
|
|
+ // 储值卡账户支付金额
|
|
|
+ if (isset($constituteList['amount'])) {
|
|
|
+ $params['order_amount_pay'] = $constituteList['amount'];
|
|
|
+ $params['pay_category'] = $cardNbr;
|
|
|
+ }
|
|
|
+ $amount = $account->member_account_surplus + $account->member_account_added;
|
|
|
+ if ($params['order_amount_pay'] > $amount) {
|
|
|
+ throw new BusinessException('账户余额不足');
|
|
|
+ }
|
|
|
+ // 储值卡账户扣款数据
|
|
|
+ $params['waitToPayAccount'][$cardNbr] = [
|
|
|
+ 'group_id' => $params['orderGroupId'],
|
|
|
+ 'member_id' => $params['join_order_member_id'],
|
|
|
+ 'amount' => $constituteList['amount'],
|
|
|
+ 'nbr' => $cardNbr
|
|
|
+ ];
|
|
|
|
|
|
- $params['order_status_system'] = $systemStatus;
|
|
|
- $params['order_status_payment'] = 'SUCCESS';
|
|
|
- // 生成支付记录
|
|
|
- $params['pay_detail_item'][] = $params;
|
|
|
+ $params['order_status_system'] = $systemStatus;
|
|
|
+ $params['order_status_payment'] = 'SUCCESS';
|
|
|
+ // 生成支付记录
|
|
|
+ $params['pay_detail_item'][] = $params;
|
|
|
|
|
|
- $params['order_amount_pay'] = $orderAmountPay;
|
|
|
+ $params['order_amount_pay'] = $orderAmountPay;
|
|
|
+ }
|
|
|
}
|
|
|
- //!empty($params['pay_category_constitute']) && in_array('CARD',$params['pay_category_constitute'])
|
|
|
- // if(($params['pay_constitute'] == 'Y' || $params['pay_category'] == 'QRCODE') && $params['settlement_now'] == 'Y' && !empty($params['qrcode_nbr'])){ // 付款码
|
|
|
if (!empty($params['pay_category_constitute']) && in_array('QRCODE', $params['pay_category_constitute']) && !empty($params['qrcode_nbr'])) { // 付款码
|
|
|
// 需要付款码的金额>0
|
|
|
if (isset($constituteList['QRCODE']) && $constituteList['QRCODE'] > 0) {
|
|
@@ -889,8 +842,6 @@ class GoodsController extends Curd
|
|
|
$params['order_status_system'] = 'PAYING';
|
|
|
$params['order_status_payment'] = 'PENDING';
|
|
|
$params['order_is_complete'] = 'N';
|
|
|
-// Db::rollBack();
|
|
|
-// return json_fail('支付失败');
|
|
|
} else {
|
|
|
$params['order_status_system'] = $systemStatus;
|
|
|
$params['order_status_payment'] = 'SUCCESS';
|
|
@@ -903,8 +854,6 @@ class GoodsController extends Curd
|
|
|
$params['order_status_system'] = 'PAYING';
|
|
|
$params['order_status_payment'] = 'PENDING';
|
|
|
$params['order_is_complete'] = 'N';
|
|
|
-// Db::rollBack();
|
|
|
-// return json_fail('支付失败');
|
|
|
} else {
|
|
|
$params['order_status_system'] = $systemStatus;
|
|
|
$params['order_status_payment'] = 'SUCCESS';
|
|
@@ -915,7 +864,6 @@ class GoodsController extends Curd
|
|
|
|
|
|
// 生成支付记录
|
|
|
$params['pay_detail_item'][] = $params;
|
|
|
-// OrderService::createPayDetail($params);
|
|
|
// 账户支付的金额
|
|
|
$params['order_amount_pay'] = $orderAmountPay;
|
|
|
}
|
|
@@ -962,13 +910,13 @@ class GoodsController extends Curd
|
|
|
return json_success('创建订单成功');
|
|
|
} catch (BusinessException $e) {
|
|
|
Db::rollBack();
|
|
|
- dump($e->getMessage());
|
|
|
_syslog("订单", $e->getMessage());
|
|
|
+ Log::error('创建订单失败', ['msg' => $e->getMessage()]);
|
|
|
return json_fail($e->getMessage());
|
|
|
} catch (\Exception $e) {
|
|
|
Db::rollBack();
|
|
|
- dump($e->getMessage());
|
|
|
_syslog("订单", "创建订单失败");
|
|
|
+ Log::error('创建订单失败', ['msg' => $e->getMessage()]);
|
|
|
return json_fail('创建订单失败');
|
|
|
}
|
|
|
}
|
|
@@ -1040,9 +988,6 @@ class GoodsController extends Curd
|
|
|
$params['order_is_complete'] = 'N';
|
|
|
$systemStatus = "WAITING";
|
|
|
}
|
|
|
-// if ($params['goods_classify'] == 'PACKAGE' && $params['delivery'] == 'ARRIVAL') {
|
|
|
-// $systemStatus = "WAITING";
|
|
|
-// }
|
|
|
Db::beginTransaction();
|
|
|
try {
|
|
|
// 使用优惠券
|
|
@@ -1057,8 +1002,6 @@ class GoodsController extends Curd
|
|
|
}
|
|
|
$couponUseJson = $discountJson;
|
|
|
$this->changeOrderCouponStatus($couponUseJson, 'USED');
|
|
|
- // 释放下单时选的优惠券
|
|
|
-// $order->order_discount_json = $this->releaseCoupon($discountJson);
|
|
|
}
|
|
|
if (empty($discountJson) && !empty($params['join_order_member_id']) && !empty($params['preferential'])) {
|
|
|
$couponResult = OrderService::payUseCoupon('pay', 'Y', $params['join_order_member_id'], $params['goodsContentList'], $params['preferential'], $params['order_amount_total']);
|
|
@@ -1380,17 +1323,12 @@ class GoodsController extends Curd
|
|
|
$payData['pay_addtimes'] = time();
|
|
|
PayDetail::insert($payData);
|
|
|
|
|
|
- $writeOffDate = [];
|
|
|
- $applyData = [];
|
|
|
-
|
|
|
Db::commit();
|
|
|
|
|
|
// 触发事件
|
|
|
if ($order->order_is_complete == 'Y' && $order->order_status_payment == 'SUCCESS') {
|
|
|
// 完成订单
|
|
|
Event::dispatch('order.complete', $params);
|
|
|
- // 会员升级
|
|
|
-// Event::dispatch('order_pay.member_level.up', $params['join_order_member_id']);
|
|
|
}
|
|
|
if ($order->order_status_payment == 'SUCCESS') {
|
|
|
// 加销售量
|
|
@@ -1418,7 +1356,6 @@ class GoodsController extends Curd
|
|
|
]
|
|
|
]
|
|
|
];
|
|
|
-// dump("小票参数", $voteData);
|
|
|
http_post_json(getenv('VOTE_MENU_URL'), $voteData);
|
|
|
}
|
|
|
}
|
|
@@ -1439,14 +1376,14 @@ class GoodsController extends Curd
|
|
|
_syslog("订单", "订单支付成功");
|
|
|
return json_success('支付成功');
|
|
|
} catch (BusinessException $e) {
|
|
|
- dump($e->getMessage());
|
|
|
Db::rollBack();
|
|
|
_syslog("订单", "订单支付失败:" . $e->getMessage());
|
|
|
+ Log::error('订单支付失败', ['msg' => $e->getMessage()]);
|
|
|
return json_fail("支付失败:" . $e->getMessage());
|
|
|
} catch (\Exception $e) {
|
|
|
- dump($e->getMessage());
|
|
|
Db::rollBack();
|
|
|
_syslog("订单", "订单支付失败");
|
|
|
+ Log::error('订单支付失败', ['msg' => $e->getMessage()]);
|
|
|
return json_fail('支付失败');
|
|
|
}
|
|
|
}
|
|
@@ -1474,7 +1411,7 @@ class GoodsController extends Curd
|
|
|
Redis::del($key);
|
|
|
}
|
|
|
// 验证线下付款密码
|
|
|
- if (!empty($params['pay_category_constitute']) && in_array('OFFLINE', $params['pay_category_constitute']) && in_array('MONEY', $params['pay_category_constitute'])) {
|
|
|
+ if (!empty($params['pay_category_constitute']) && (in_array('OFFLINE', $params['pay_category_constitute']) || in_array('MONEY', $params['pay_category_constitute']))) {
|
|
|
$password = $params['offline_password'];
|
|
|
if ($password != '666888') {
|
|
|
return json_fail("密码错误,请重新输入");
|
|
@@ -1520,7 +1457,6 @@ class GoodsController extends Curd
|
|
|
$params['order_is_complete'] = 'N';
|
|
|
$systemStatus = "WAITING";
|
|
|
}
|
|
|
- $payDetail = PayDetail::where('join_pay_order_id', $order->order_groupby)->first();
|
|
|
Db::beginTransaction();
|
|
|
try {// 使用优惠券
|
|
|
$couponUseJson = [];
|
|
@@ -1534,8 +1470,6 @@ class GoodsController extends Curd
|
|
|
}
|
|
|
$couponUseJson = $discountJson;
|
|
|
$this->changeOrderCouponStatus($couponUseJson, 'USED');
|
|
|
- // 释放下单时选的优惠券
|
|
|
-// $order->order_discount_json = $this->releaseCoupon($discountJson);
|
|
|
}
|
|
|
if (empty($discountJson) && !empty($params['join_order_member_id']) && !empty($params['preferential'])) {
|
|
|
$couponResult = OrderService::payUseCoupon('pay', 'Y', $params['join_order_member_id'], $params['goodsContentList'], $params['preferential'], $params['order_amount_total']);
|
|
@@ -1608,7 +1542,7 @@ class GoodsController extends Curd
|
|
|
$params['pay_category'] = $params['join_order_member_id'] . '-CASH';
|
|
|
}
|
|
|
$amount = $account->member_account_surplus + $account->member_account_added;
|
|
|
- if ($params['pay_constitute'] == 'N' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
+ if ($params['pay_constitute'] == 'Y' && $params['order_amount_pay'] > $amount) {
|
|
|
throw new BusinessException('账户余额不足');
|
|
|
}
|
|
|
// 余额账户扣款数据
|
|
@@ -1627,41 +1561,43 @@ class GoodsController extends Curd
|
|
|
$order->order_status_payment = 'SUCCESS';
|
|
|
}
|
|
|
if (!empty($params['pay_category_constitute']) && in_array('CARD', $params['pay_category_constitute'])) { // 储值卡账户
|
|
|
- $cardNbr = $params['card_nbr'];
|
|
|
- if (!$cardNbr) {
|
|
|
- throw new BusinessException('账户异常');
|
|
|
- }
|
|
|
- $account = MemberAccount::where('join_account_member_id', $params['join_order_member_id'])
|
|
|
- ->where('member_account_nbr', $cardNbr)
|
|
|
- ->where('member_account_status', 'ACTIVED')
|
|
|
- ->first();
|
|
|
- if (!$account) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户异常');
|
|
|
- }
|
|
|
- // 储值卡账户支付金额
|
|
|
- if (isset($constituteList['CARD'])) {
|
|
|
- $params['order_amount_pay'] = $constituteList['CARD'];
|
|
|
- $params['pay_category'] = $cardNbr;
|
|
|
- }
|
|
|
- $amount = $account->member_account_surplus + $account->member_account_added;
|
|
|
- if ($params['pay_constitute'] == 'N' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
- throw new BusinessException('账户余额不足');
|
|
|
+ foreach ($params['pay_category_constitute_list'] as $constituteList) {
|
|
|
+ if ($constituteList['category'] != 'CARD') {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $cardNbr = $constituteList['card_id'];
|
|
|
+ $account = MemberAccount::where('join_account_member_id', $params['join_order_member_id'])
|
|
|
+ ->where('member_account_nbr', $cardNbr)
|
|
|
+ ->where('member_account_status', 'ACTIVED')
|
|
|
+ ->first();
|
|
|
+ if (!$account) {
|
|
|
+ Db::rollBack();
|
|
|
+ return json_fail('账户异常');
|
|
|
+ }
|
|
|
+ // 储值卡账户支付金额
|
|
|
+ if (isset($constituteList['amount'])) {
|
|
|
+ $params['order_amount_pay'] = $constituteList['amount'];
|
|
|
+ $params['pay_category'] = $cardNbr;
|
|
|
+ }
|
|
|
+ $amount = $account->member_account_surplus + $account->member_account_added;
|
|
|
+ if ($params['pay_constitute'] == 'Y' && $params['order_amount_pay'] > $amount) {
|
|
|
+ throw new BusinessException('账户余额不足');
|
|
|
+ }
|
|
|
+ // 储值卡账户扣款数据
|
|
|
+ $waitToPayAccount[$cardNbr] = [
|
|
|
+ 'group_id' => $params['orderGroupId'],
|
|
|
+ 'member_id' => $params['join_order_member_id'],
|
|
|
+ 'amount' => $constituteList['amount'],
|
|
|
+ 'nbr' => $cardNbr
|
|
|
+ ];
|
|
|
+ // 生成支付记录
|
|
|
+ $params['order_status_payment'] = 'PENDING';
|
|
|
+ OrderService::createProductPayConstituteDetail($params);
|
|
|
+ $params['order_status_payment'] = 'SUCCESS';
|
|
|
+ $params['order_amount_pay'] = $orderAmountPay;
|
|
|
+ $order->order_status_system = $systemStatus;
|
|
|
+ $order->order_status_payment = 'SUCCESS';
|
|
|
}
|
|
|
- // 储值卡账户扣款数据
|
|
|
- $waitToPayAccount['card'] = [
|
|
|
- 'group_id' => $params['orderGroupId'],
|
|
|
- 'member_id' => $params['join_order_member_id'],
|
|
|
- 'amount' => $constituteList['CARD'],
|
|
|
- 'nbr' => $params['join_order_member_id'] . '-CARD'
|
|
|
- ];
|
|
|
- // 生成支付记录
|
|
|
- $params['order_status_payment'] = 'PENDING';
|
|
|
- OrderService::createProductPayConstituteDetail($params);
|
|
|
- $params['order_status_payment'] = 'SUCCESS';
|
|
|
- $params['order_amount_pay'] = $orderAmountPay;
|
|
|
- $order->order_status_system = $systemStatus;
|
|
|
- $order->order_status_payment = 'SUCCESS';
|
|
|
}
|
|
|
if (!empty($params['pay_category_constitute']) && in_array('QRCODE', $params['pay_category_constitute']) && !empty($params['qrcode_nbr'])) { // 付款码
|
|
|
if (isset($constituteList['QRCODE']) && $constituteList['QRCODE'] > 0) {
|
|
@@ -1756,8 +1692,6 @@ class GoodsController extends Curd
|
|
|
if ($order->order_is_complete == 'Y' && $order->order_status_payment == 'SUCCESS') {
|
|
|
// 完成订单
|
|
|
Event::dispatch('order.complete', $params);
|
|
|
- // 会员升级
|
|
|
-// Event::dispatch('order_pay.member_level.up', $params['join_order_member_id']);
|
|
|
}
|
|
|
if ($order->order_status_payment == 'SUCCESS') {
|
|
|
// 加销售量
|
|
@@ -1785,7 +1719,6 @@ class GoodsController extends Curd
|
|
|
]
|
|
|
]
|
|
|
];
|
|
|
-// dump("小票参数", $voteData);
|
|
|
http_post_json(getenv('VOTE_MENU_URL'), $voteData);
|
|
|
}
|
|
|
}
|
|
@@ -1806,10 +1739,15 @@ class GoodsController extends Curd
|
|
|
}
|
|
|
_syslog("订单", "订单支付成功");
|
|
|
return json_success('支付成功');
|
|
|
- } catch (\Exception $e) {
|
|
|
- dump($e->getMessage());
|
|
|
+ } catch (BusinessException $e) {
|
|
|
Db::rollBack();
|
|
|
_syslog("订单", "订单支付失败");
|
|
|
+ Log::error('订单支付失败', ['msg' => $e->getMessage()]);
|
|
|
+ return json_fail($e->getMessage());
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Db::rollBack();
|
|
|
+ _syslog("订单", "订单支付失败," . $e->getMessage());
|
|
|
+ Log::error('订单支付失败', ['msg' => $e->getMessage()]);
|
|
|
return json_fail('支付失败');
|
|
|
}
|
|
|
}
|
|
@@ -1884,7 +1822,7 @@ class GoodsController extends Curd
|
|
|
'order_express_json' => $params['order_express_json'] ?? '[]',
|
|
|
'order_extend_json' => $params['order_extend_json'] ? json_encode($params['order_extend_json']) : '[]',
|
|
|
'order_addtimes' => time(),
|
|
|
- 'order_add_user_id'=>JwtToken::getCurrentId()
|
|
|
+ 'order_add_user_id' => JwtToken::getCurrentId()
|
|
|
];
|
|
|
|
|
|
Order::insert($data);
|
|
@@ -2214,6 +2152,8 @@ class GoodsController extends Curd
|
|
|
$payPrepayid = 'OFFLINE_WXPAY';
|
|
|
} else if ($params['pay_category'] == 'MONEY') {
|
|
|
$payPrepayid = 'MONEY';
|
|
|
+ } else if ($params['pay_category'] == 'CARD') {
|
|
|
+ $payPrepayid = $params['card_id'];
|
|
|
} else {
|
|
|
$payPrepayid = $params['join_order_member_id'] . '-' . $params['pay_category'];
|
|
|
}
|