|
@@ -529,7 +529,7 @@ class WholeController extends Curd
|
|
|
}
|
|
|
}
|
|
|
if (!empty($discountItem['coupon_value'])) {
|
|
|
- $discount['value'] += $discountItem['coupon_value'];
|
|
|
+ $discount['value'] += round($discountItem['coupon_value'],2);
|
|
|
}
|
|
|
}
|
|
|
if (!empty($discount['coupon_name'])) {
|
|
@@ -827,13 +827,11 @@ class WholeController extends Curd
|
|
|
->where('member_account_status', 'ACTIVED')
|
|
|
->first();
|
|
|
if (!$account) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户异常');
|
|
|
+ throw new BusinessException('账户异常');
|
|
|
}
|
|
|
$amount = $account->member_account_surplus + $account->member_account_added;
|
|
|
if ($params['pay_constitute'] == 'N' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户余额不足');
|
|
|
+ throw new BusinessException('账户余额不足');
|
|
|
}
|
|
|
if ($params['pay_constitute'] == 'Y' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
$qrcodePayAmount = $params['order_amount_pay'] - $amount;
|
|
@@ -858,13 +856,11 @@ class WholeController extends Curd
|
|
|
->where('member_account_status', 'ACTIVED')
|
|
|
->first();
|
|
|
if (!$account) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户异常');
|
|
|
+ throw new BusinessException('账户异常');
|
|
|
}
|
|
|
$account->member_account_surplus = floatval($account->member_account_surplus);
|
|
|
if ($params['pay_constitute'] == 'N' && ($params['order_amount_pay'] > $account->member_account_surplus)) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户余额不足');
|
|
|
+ throw new BusinessException('账户余额不足');
|
|
|
}
|
|
|
if ($params['pay_constitute'] == 'Y' && ($params['order_amount_pay'] > $account->member_account_surplus)) {
|
|
|
$qrcodePayAmount = $params['order_amount_pay'] - $account->member_account_surplus;
|
|
@@ -904,8 +900,7 @@ class WholeController extends Curd
|
|
|
}
|
|
|
|
|
|
if ($params['pay_constitute'] == 'N' && 700 - $paySum < $params['order_amount_pay']) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('超出福利限额');
|
|
|
+ throw new BusinessException('超出福利限额');
|
|
|
} else if ($params['pay_constitute'] == 'Y' && 700 - $paySum < $params['order_amount_pay']) {
|
|
|
$qrcodePayAmount = $params['order_amount_pay'] - (700 - $paySum);
|
|
|
$params['order_amount_pay'] = (700 - $paySum);
|
|
@@ -939,8 +934,7 @@ class WholeController extends Curd
|
|
|
}
|
|
|
|
|
|
if ($params['pay_constitute'] == 'N' && 300 - $paySum < $params['order_amount_pay']) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('超出福利限额');
|
|
|
+ throw new BusinessException('超出福利限额');
|
|
|
} else if ($params['pay_constitute'] == 'Y' && 300 - $paySum < $params['order_amount_pay']) {
|
|
|
$qrcodePayAmount = $params['order_amount_pay'] - (300 - $paySum);
|
|
|
$params['order_amount_pay'] = (300 - $paySum);
|
|
@@ -952,21 +946,18 @@ class WholeController extends Curd
|
|
|
} else if ($params['pay_category'] == 'CARD') {
|
|
|
$cardNbr = $params['card_nbr'];
|
|
|
if (!$cardNbr) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户异常');
|
|
|
+ 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('账户异常');
|
|
|
+ throw new BusinessException('账户异常');
|
|
|
}
|
|
|
$amount = $account->member_account_surplus + $account->member_account_added;
|
|
|
if ($params['pay_constitute'] == 'N' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户余额不足');
|
|
|
+ throw new BusinessException('账户余额不足');
|
|
|
}
|
|
|
if ($params['pay_constitute'] == 'Y' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
$qrcodePayAmount = $params['order_amount_pay'] - $amount;
|
|
@@ -1027,8 +1018,7 @@ class WholeController extends Curd
|
|
|
$order->order_status_payment = 'SUCCESS';
|
|
|
}
|
|
|
} else {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('付款码无效');
|
|
|
+ throw new BusinessException('付款码无效');
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1430,8 +1420,7 @@ class WholeController extends Curd
|
|
|
->where('member_account_status', 'ACTIVED')
|
|
|
->first();
|
|
|
if (!$account) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户异常');
|
|
|
+ throw new BusinessException('账户异常');
|
|
|
}
|
|
|
if (isset($constituteList['CASH'])) {
|
|
|
$params['order_amount_pay'] = $constituteList['CASH'];
|
|
@@ -1439,8 +1428,7 @@ class WholeController extends Curd
|
|
|
}
|
|
|
$amount = $account->member_account_surplus + $account->member_account_added;
|
|
|
if ($params['pay_constitute'] == 'N' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户余额不足');
|
|
|
+ throw new BusinessException('账户余额不足');
|
|
|
}
|
|
|
if ($params['pay_constitute'] == 'Y' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
$qrcodePayAmount = $params['order_amount_pay'] - $amount;
|
|
@@ -1464,8 +1452,7 @@ class WholeController extends Curd
|
|
|
if (!empty($params['pay_category_constitute']) && in_array('CARD', $params['pay_category_constitute'])) {
|
|
|
$cardNbr = $params['card_nbr'];
|
|
|
if (!$cardNbr) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户异常');
|
|
|
+ throw new BusinessException('账户异常');
|
|
|
}
|
|
|
$account = MemberAccount::where('join_account_member_id', $params['join_order_member_id'])
|
|
|
->where('member_account_nbr', $cardNbr)
|
|
@@ -1482,8 +1469,7 @@ class WholeController extends Curd
|
|
|
}
|
|
|
$amount = $account->member_account_surplus + $account->member_account_added;
|
|
|
if ($params['pay_constitute'] == 'N' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户余额不足');
|
|
|
+ throw new BusinessException('账户余额不足');
|
|
|
}
|
|
|
if ($params['pay_constitute'] == 'Y' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
$qrcodePayAmount = $params['order_amount_pay'] - $amount;
|
|
@@ -1540,8 +1526,7 @@ class WholeController extends Curd
|
|
|
$order->order_status_payment = 'SUCCESS';
|
|
|
}
|
|
|
} else {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('付款码无效');
|
|
|
+ throw new BusinessException('付款码无效');
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1595,7 +1580,53 @@ class WholeController extends Curd
|
|
|
|
|
|
$appointment->save();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ if ($order->order_status_payment == 'SUCCESS') {
|
|
|
+ foreach ($params['goodsContentList'] as $goods) {
|
|
|
+ $params['join_sheet_goods_id'] = $goods['goods_id'];
|
|
|
+ if (isset($goods['goods_classify']) && in_array($goods['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD'])) {
|
|
|
+ $params['benefitId'] = 'BF' . date('YmdHis') . random_string(6, 'up');
|
|
|
+ $params['order_sheet_num'] = $goods['nbr'];
|
|
|
+
|
|
|
+ for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
+ $params['appointmentId'] = 'AP' . date('YmdHis') . random_string(6, 'up');
|
|
|
+
|
|
|
+ $this->insertAppointment($params, $writeOffDate, $applyData);
|
|
|
+ }
|
|
|
+ $goods['skuId'] = $goods['sku_id'];
|
|
|
+ $goods['category'] = $goods['goods_classify'];
|
|
|
+
|
|
|
+ $this->insertMemberBenefit($params, $goods);
|
|
|
+ } elseif (isset($goods['goods_classify']) && $goods['goods_classify'] == 'PACKAGE') {
|
|
|
+ $params['packageId'] = $goods['goods_id'];
|
|
|
+ $components = GoodsComponent::with([
|
|
|
+ 'goods' => function ($query) {
|
|
|
+ $query->select('goods_id', 'goods_name', 'goods_classify');
|
|
|
+ }
|
|
|
+ ])->where('join_component_master_goods_id', $params['packageId'])
|
|
|
+ ->get()
|
|
|
+ ->toArray();
|
|
|
+ foreach ($components as $component) {
|
|
|
+ $componentJson = json_decode($component['goods_component_json'], true);
|
|
|
+ $params['join_sheet_goods_sku_id'] = $componentJson['sku_id'];
|
|
|
+ $params['benefitId'] = 'BF' . date('YmdHis') . random_string(6, 'up');
|
|
|
+ $params['order_sheet_num'] = $goods['nbr'] * $componentJson['nbr'];
|
|
|
+ for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
+ $params['appointmentId'] = 'AP' . date('YmdHis') . random_string(8, 'up');
|
|
|
+
|
|
|
+ $this->insertAppointment($params, $writeOffDate);
|
|
|
+ }
|
|
|
+ $goods['goods_id'] = $component['join_component_goods_id'];
|
|
|
+ $goods['goods_name'] = $component['goods']['goods_name'];
|
|
|
+ $goods['goods_classify'] = $component['goods']['goods_classify'];
|
|
|
+ $goods['skuId'] = $goods['sku_id'];
|
|
|
+ $goods['category'] = 'SERVICE';
|
|
|
+
|
|
|
+ $this->insertMemberBenefit($params, $goods);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if ($params['goods_classify'] == 'VIP' && $order->order_status_payment == 'SUCCESS') {
|
|
|
$params['member_id'] = $params['join_order_member_id'];
|
|
@@ -1899,12 +1930,11 @@ class WholeController extends Curd
|
|
|
->where('member_account_status', 'ACTIVED')
|
|
|
->first();
|
|
|
if (!$account) {
|
|
|
- return json_fail('账户异常');
|
|
|
+ throw new BusinessException('账户异常');
|
|
|
}
|
|
|
$amount = $account->member_account_surplus + $account->member_account_added;
|
|
|
if ($params['pay_constitute'] == 'N' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户余额不足');
|
|
|
+ throw new BusinessException('账户余额不足');
|
|
|
}
|
|
|
if ($params['pay_constitute'] == 'Y' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
$qrcodePayAmount = $params['order_amount_pay'] - $amount;
|
|
@@ -1929,13 +1959,11 @@ class WholeController extends Curd
|
|
|
->where('member_account_status', 'ACTIVED')
|
|
|
->first();
|
|
|
if (!$account) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户异常');
|
|
|
+ throw new BusinessException('账户异常');
|
|
|
}
|
|
|
$account->member_account_surplus = floatval($account->member_account_surplus);
|
|
|
if ($params['pay_constitute'] == 'N' && ($params['order_amount_pay'] > $account->member_account_surplus)) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户余额不足');
|
|
|
+ throw new BusinessException('账户余额不足');
|
|
|
}
|
|
|
if ($params['pay_constitute'] == 'Y' && ($params['order_amount_pay'] > $account->member_account_surplus)) {
|
|
|
$qrcodePayAmount = $params['order_amount_pay'] - $account->member_account_surplus;
|
|
@@ -2009,8 +2037,7 @@ class WholeController extends Curd
|
|
|
}
|
|
|
|
|
|
if ($params['pay_constitute'] == 'N' && 300 - $paySum < $params['order_amount_pay']) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('超出福利限额');
|
|
|
+ throw new BusinessException('超出福利限额');
|
|
|
} else if ($params['pay_constitute'] == 'Y' && 300 - $paySum < $params['order_amount_pay']) {
|
|
|
$qrcodePayAmount = $params['order_amount_pay'] - (300 - $paySum);
|
|
|
$params['order_amount_pay'] = (300 - $paySum);
|
|
@@ -2023,21 +2050,18 @@ class WholeController extends Curd
|
|
|
} else if ($params['settlement_now'] == 'Y' && $params['pay_category'] == 'CARD') {
|
|
|
$cardNbr = $params['card_nbr'];
|
|
|
if (!$cardNbr) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户异常');
|
|
|
+ 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('账户异常');
|
|
|
+ throw new BusinessException('账户异常');
|
|
|
}
|
|
|
$amount = $account->member_account_surplus + $account->member_account_added;
|
|
|
if ($params['pay_constitute'] == 'N' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户余额不足');
|
|
|
+ throw new BusinessException('账户余额不足');
|
|
|
}
|
|
|
if ($params['pay_constitute'] == 'Y' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
$qrcodePayAmount = $params['order_amount_pay'] - $amount;
|
|
@@ -2105,8 +2129,7 @@ class WholeController extends Curd
|
|
|
$params['order_status_payment'] = 'SUCCESS';
|
|
|
}
|
|
|
} else {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('付款码无效');
|
|
|
+ throw new BusinessException('付款码无效');
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2154,9 +2177,7 @@ class WholeController extends Curd
|
|
|
if (isset($params['delivery']) && in_array($params['delivery'], ['PICKUP', 'ARRIVAL']) && !empty($params['dept_premises_id'])) {
|
|
|
|
|
|
if (!$premises) {
|
|
|
- Db::rollBack();
|
|
|
-
|
|
|
- return json_fail('门店不存在,请重新选择');
|
|
|
+ throw new BusinessException('门店不存在,请重新选择');
|
|
|
}
|
|
|
$params['submit_premises_id'] = $premises->dept_id;
|
|
|
}
|
|
@@ -2409,7 +2430,7 @@ class WholeController extends Curd
|
|
|
$constituteAmount = $constituteAmount + $item['amount'];
|
|
|
}
|
|
|
if ($params['order_amount_pay'] != $constituteAmount) {
|
|
|
- return json_fail('组合支付金额与应付金额不一致');
|
|
|
+ throw new BusinessException("组合支付金额与应付金额不一致");
|
|
|
}
|
|
|
$params['goods_classify'] = $goodsClassifys[0];
|
|
|
|
|
@@ -2418,14 +2439,14 @@ class WholeController extends Curd
|
|
|
if (!empty($params['pay_category_constitute']) && !in_array('OFFLINE', $params['pay_category_constitute']) && !in_array('MONEY', $params['pay_category_constitute']) && !in_array('QRCODE', $params['pay_category_constitute']) && (in_array('CASH', $params['pay_category_constitute']) || in_array('CARD', $params['pay_category_constitute']) || in_array('WELFARE', $params['pay_category_constitute']))) {
|
|
|
$code = $params['sms_code'];
|
|
|
if (!$code) {
|
|
|
- return json_fail("验证码错误,请重新输入");
|
|
|
+ throw new BusinessException("验证码错误,请重新输入");
|
|
|
}
|
|
|
$member = Member::find($params['join_order_member_id']);
|
|
|
$mobile = $member->member_mobile;
|
|
|
$key = "SMS:CODE:ORDER_PAY:" . $mobile;
|
|
|
$redisCode = Redis::get($key);
|
|
|
if ($redisCode != $code && $code != '123456') {
|
|
|
- return json_fail("验证码错误,请重新输入");
|
|
|
+ throw new BusinessException("验证码错误,请重新输入");
|
|
|
}
|
|
|
Redis::del($key);
|
|
|
}
|
|
@@ -2433,14 +2454,13 @@ class WholeController extends Curd
|
|
|
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("密码错误,请重新输入");
|
|
|
+ throw new BusinessException("密码错误,请重新输入");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (empty($params['join_order_member_id']) && !empty($params['mobile'])) {
|
|
|
if (Member::where('member_mobile', $params['mobile'])->exists()) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('会员已存在');
|
|
|
+ throw new BusinessException("会员已存在");
|
|
|
}
|
|
|
$params['join_order_member_id'] = $params['member_id'] = 'MR' . date('YmdHis') . random_string(6, 'up');
|
|
|
|
|
@@ -2449,8 +2469,7 @@ class WholeController extends Curd
|
|
|
$params['join_order_member_id'] = Member::where('member_mobile', '0000')->value('member_id');
|
|
|
}
|
|
|
if (empty($params['join_order_member_id'])) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail("检查下单账户");
|
|
|
+ throw new BusinessException("检查下单账户");
|
|
|
}
|
|
|
|
|
|
$qrcodePayAmount = 0;
|
|
@@ -2498,7 +2517,7 @@ class WholeController extends Curd
|
|
|
->where('member_account_status', 'ACTIVED')
|
|
|
->first();
|
|
|
if (!$account) {
|
|
|
- return json_fail('账户异常');
|
|
|
+ throw new BusinessException("账户异常");
|
|
|
}
|
|
|
$amount = $account->member_account_surplus + $account->member_account_added;
|
|
|
|
|
@@ -2507,8 +2526,7 @@ class WholeController extends Curd
|
|
|
$params['pay_category'] = $params['join_order_member_id'] . '-CASH';
|
|
|
}
|
|
|
if ($params['pay_constitute'] == 'N' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('账户余额不足');
|
|
|
+ throw new BusinessException("账户余额不足");
|
|
|
}
|
|
|
if ($params['pay_constitute'] == 'Y' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
$qrcodePayAmount = $params['order_amount_pay'] - $amount;
|
|
@@ -2532,47 +2550,73 @@ class WholeController extends Curd
|
|
|
$params['order_amount_pay'] = $orderAmountPay;
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ $writeOffDate = [];
|
|
|
+ $applyData = [];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ($params['order_status_payment'] == 'SUCCESS') {
|
|
|
+ foreach ($params['goodsContentList'] as $goods) {
|
|
|
+ $params['join_sheet_goods_id'] = $goods['goods_id'];
|
|
|
+ if (isset($goods['goods_classify']) && in_array($goods['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD'])) {
|
|
|
+ $params['benefitId'] = 'BF' . date('YmdHis') . random_string(6, 'up');
|
|
|
+ $params['join_sheet_goods_sku_id'] = $goods['sku_id'];
|
|
|
+ $params['goods_id'] = $goods['goods_id'];
|
|
|
+ $params['order_sheet_num'] = $goods['nbr'];
|
|
|
+
|
|
|
+ for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
+ $params['appointmentId'] = 'AP' . date('YmdHis') . random_string(6, 'up');
|
|
|
+
|
|
|
+ $this->insertAppointment($params, $writeOffDate, $applyData);
|
|
|
+ }
|
|
|
+ $goods['skuId'] = $goods['sku_id'];
|
|
|
+ $goods['category'] = $goods['goods_classify'];
|
|
|
+
|
|
|
+ $this->insertMemberBenefit($params, $goods);
|
|
|
+ } elseif (isset($goods['goods_classify']) && $goods['goods_classify'] == 'PACKAGE') {
|
|
|
+ $params['packageId'] = $goods['goods_id'];
|
|
|
+ $components = GoodsComponent::with([
|
|
|
+ 'goods' => function ($query) {
|
|
|
+ $query->select('goods_id', 'goods_name', 'goods_classify');
|
|
|
+ }
|
|
|
+ ])->where('join_component_master_goods_id', $params['packageId'])
|
|
|
+ ->get()
|
|
|
+ ->toArray();
|
|
|
+ foreach ($components as $component) {
|
|
|
+ $componentJson = json_decode($component['goods_component_json'], true);
|
|
|
+ $params['join_sheet_goods_sku_id'] = $componentJson['sku_id'];
|
|
|
+ $params['benefitId'] = 'BF' . date('YmdHis') . random_string(6, 'up');
|
|
|
+ $params['order_sheet_num'] = $goods['nbr'] * $componentJson['nbr'];
|
|
|
+ for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
+ $params['appointmentId'] = 'AP' . date('YmdHis') . random_string(8, 'up');
|
|
|
+
|
|
|
+ $this->insertAppointment($params, $writeOffDate);
|
|
|
+ }
|
|
|
+ $goods['goods_id'] = $component['join_component_goods_id'];
|
|
|
+ $goods['goods_name'] = $component['goods']['goods_name'];
|
|
|
+ $goods['goods_classify'] = $component['goods']['goods_classify'];
|
|
|
+ $goods['skuId'] = $goods['sku_id'];
|
|
|
+ $goods['category'] = 'SERVICE';
|
|
|
+
|
|
|
+ $this->insertMemberBenefit($params, $goods);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if (!empty($params['pay_category_constitute']) && in_array('CARD', $params['pay_category_constitute'])) {
|
|
|
$cardNbr = $params['card_nbr'];
|
|
|
if (!$cardNbr) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('储值卡账户异常');
|
|
|
+ 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('储值卡账户异常');
|
|
|
+ throw new BusinessException("储值卡账户异常");
|
|
|
}
|
|
|
$amount = $account->member_account_surplus + $account->member_account_added;
|
|
|
|
|
@@ -2582,8 +2626,7 @@ class WholeController extends Curd
|
|
|
$params['pay_category'] = $cardNbr;
|
|
|
}
|
|
|
if ($params['pay_constitute'] == 'N' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('储值卡账户余额不足');
|
|
|
+ throw new BusinessException("储值卡账户余额不足");
|
|
|
}
|
|
|
if ($params['pay_constitute'] == 'Y' && (!$account || $params['order_amount_pay'] > $amount)) {
|
|
|
$qrcodePayAmount = $params['order_amount_pay'] - $amount;
|
|
@@ -2647,8 +2690,7 @@ class WholeController extends Curd
|
|
|
$params['order_status_payment'] = 'SUCCESS';
|
|
|
}
|
|
|
} else {
|
|
|
- Db::rollBack();
|
|
|
- return json_fail('二维码错误');
|
|
|
+ throw new BusinessException("二维码错误");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2677,9 +2719,7 @@ class WholeController extends Curd
|
|
|
if (isset($params['delivery']) && in_array($params['delivery'], ['PICKUP', 'ARRIVAL']) && !empty($params['dept_premises_id'])) {
|
|
|
|
|
|
if (!$premises) {
|
|
|
- Db::rollBack();
|
|
|
-
|
|
|
- return json_fail('门店不存在,请重新选择');
|
|
|
+ throw new BusinessException("门店不存在,请重新选择");
|
|
|
}
|
|
|
$params['submit_premises_id'] = $premises->dept_id;
|
|
|
}
|