|
@@ -1324,61 +1324,19 @@ class GoodsController extends Curd
|
|
|
$appointment->save();
|
|
|
}
|
|
|
|
|
|
- // // 买的单个服务
|
|
|
- if ($order->order_status_payment == 'SUCCESS' && empty($appointment)) {
|
|
|
- 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('ymdHi') . random_string(4, 'up');
|
|
|
- $params['order_sheet_num'] = $goods['nbr'];
|
|
|
- // 预约表
|
|
|
- for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
- $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, '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('ymdHi') . random_string(4, 'up');
|
|
|
- $params['order_sheet_num'] = $goods['nbr'] * $componentJson['nbr'];
|
|
|
- for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
- $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, '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);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
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'){
|
|
|
+ // 上级提成
|
|
|
+ Event::dispatch('commission.order',$params);
|
|
|
+ }
|
|
|
|
|
|
// 打小票
|
|
|
if ($order->order_status_payment == 'SUCCESS') {
|
|
@@ -1407,7 +1365,6 @@ class GoodsController extends Curd
|
|
|
if (!is_array($couponUseJson)) {
|
|
|
$couponUseJson = json_decode($couponUseJson, true);
|
|
|
}
|
|
|
-
|
|
|
// 如果下单时就填了,不用恢复
|
|
|
if (empty($discountJson)) {
|
|
|
$this->changeOrderCouponStatus($couponUseJson, 'WAITING');
|
|
@@ -1743,59 +1700,18 @@ class GoodsController extends Curd
|
|
|
|
|
|
$appointment->save();
|
|
|
}
|
|
|
- // 买单个服务
|
|
|
- if ($order->order_status_payment == 'SUCCESS' && empty($appointment)) {
|
|
|
- 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('ymdHi') . random_string(4, 'up');
|
|
|
- $params['order_sheet_num'] = $goods['nbr'];
|
|
|
- // 预约表
|
|
|
- for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
- $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, '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('ymdHi') . random_string(4, 'up');
|
|
|
- $params['order_sheet_num'] = $goods['nbr'] * $componentJson['nbr'];
|
|
|
- for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
|
|
|
- $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, '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);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
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'){
|
|
|
+ // 上级提成
|
|
|
+ Event::dispatch('commission.order',$params);
|
|
|
+ }
|
|
|
|
|
|
// 打小票
|
|
|
if ($order->order_status_payment == 'SUCCESS') {
|