|
|
@@ -7,6 +7,7 @@ use think\facade\Log;
|
|
|
use app\common\enum\WorkEnum;
|
|
|
use app\common\model\equity\UserEquity;
|
|
|
use app\common\model\works\ServiceWork;
|
|
|
+use app\common\model\recharge\OrderGoods;
|
|
|
use app\common\model\equity\UserEquityLog;
|
|
|
use app\common\model\orders\RechargeOrder;
|
|
|
use app\common\model\group_activity\GroupOrder;
|
|
|
@@ -19,9 +20,16 @@ class AddServiceWorkJob
|
|
|
|
|
|
$group_order_id = $data['id'];//拼团订单ID
|
|
|
$goods = [];
|
|
|
+ $category = GroupOrder::alias('a')
|
|
|
+ ->leftJoin('group_activity_category b','a.group_category_id=b.id')
|
|
|
+ ->where('a.id', $group_order_id)
|
|
|
+ ->field('b.service_time,b.master_worker_id')
|
|
|
+ ->findOrEmpty()
|
|
|
+ ->toArray();
|
|
|
try {
|
|
|
//查询拼团用户订单
|
|
|
- $userOrder = GroupUserOrder::alias('a')->leftJoin('user b','a.user_id=b.id')
|
|
|
+ $userOrder = GroupUserOrder::alias('a')
|
|
|
+ ->leftJoin('user b','a.user_id=b.id')
|
|
|
->where('group_order_id', $group_order_id)
|
|
|
->where('pay_status', 1)
|
|
|
->where('refund_status', 0)
|
|
|
@@ -38,7 +46,7 @@ class AddServiceWorkJob
|
|
|
if (empty($goods)) {
|
|
|
$goods = UserEquity::alias('a')->leftJoin('goods b','a.goods_id=b.id')
|
|
|
->where('a.id', $item['user_equity_id'])
|
|
|
- ->field('a.number,b.goods_name,b.category_type,b.goods_category_ids,b.goods_category_id,b.base_service_fee')
|
|
|
+ ->field('a.number,a.goods_id,b.*')
|
|
|
->findOrEmpty()
|
|
|
->toArray();
|
|
|
}
|
|
|
@@ -58,7 +66,8 @@ class AddServiceWorkJob
|
|
|
'base_service_fee' => $goods['base_service_fee'],
|
|
|
'service_fee' => $item['paid_amount'],
|
|
|
'work_pay_status'=>WorkEnum::IS_PAY_STATUS,
|
|
|
- 'appointment_time' => time(),
|
|
|
+ 'master_worker_id' => $category['master_worker_id'],
|
|
|
+ 'appointment_time' => $category['service_time'],
|
|
|
'dispatch_time' => time(),
|
|
|
'receive_time' => time(),
|
|
|
'user_id'=>$item['user_id'],
|
|
|
@@ -71,7 +80,6 @@ class AddServiceWorkJob
|
|
|
'work_status' => 5,
|
|
|
'user_confirm_status' => 3,
|
|
|
'service_status' => 1,
|
|
|
- 'master_worker_id' => 7,
|
|
|
'remark' => '拼团单:'.$item['id'],
|
|
|
'user_equity_id' => $item['user_equity_id'],
|
|
|
'group_order_id' => $item['id'],
|
|
|
@@ -88,10 +96,38 @@ class AddServiceWorkJob
|
|
|
'user_id' => $item['user_id'],
|
|
|
'pay_status' => $item['pay_status'],
|
|
|
'pay_way' => $item['pay_way'],
|
|
|
+ 'pay_time' => time(),
|
|
|
'order_total' => 0,
|
|
|
'order_amount' => 0,
|
|
|
];
|
|
|
$order = RechargeOrder::create($data);
|
|
|
+
|
|
|
+ //生成订单服务详情
|
|
|
+ OrderGoods::create([
|
|
|
+ 'sn' => $order['sn'],
|
|
|
+ 'goods_id' => $goods['goods_id'],
|
|
|
+ 'category_type' => $goods['category_type'],
|
|
|
+ 'goods_category_ids' => $goods['goods_category_ids'],
|
|
|
+ 'goods_category_id' => $goods['goods_category_id'],
|
|
|
+ 'goods_name' => $goods['goods_name'],
|
|
|
+ 'goods_image' => $goods['goods_image'],
|
|
|
+ 'goods_video' => $goods['goods_video'],
|
|
|
+ 'goods_number' => $goods['goods_number'],
|
|
|
+ 'good_unit' => $goods['good_unit'],
|
|
|
+ 'goods_size' => $goods['goods_size'],
|
|
|
+ 'goods_type' => $goods['goods_type'],
|
|
|
+ 'goods_brand' => $goods['goods_brand'],
|
|
|
+ 'install_guide' => $goods['install_guide'],
|
|
|
+ 'goods_payment_type'=>$goods['goods_payment_type'],
|
|
|
+ 'base_service_fee' => $goods['base_service_fee'],
|
|
|
+ 'service_total' => $goods['service_total'],
|
|
|
+ 'service_fee' => $goods['service_fee'],
|
|
|
+ 'service_image' => $goods['service_image'],
|
|
|
+ 'warranty_period'=>$goods['warranty_period'],
|
|
|
+ 'fee_schedule' => $goods['fee_schedule'],
|
|
|
+ 'goods_status' => $goods['goods_status'],
|
|
|
+ ]);
|
|
|
+
|
|
|
//更新用户的权益卡剩余次数
|
|
|
UserEquity::where('id', $item['user_equity_id'])->update(['number' => 0, 'update_time' => time()]);
|
|
|
|