|
|
@@ -14,6 +14,7 @@ namespace App\Services\Api;
|
|
|
use App\Models\CartModel;
|
|
|
use App\Models\GoodsModel;
|
|
|
use App\Models\GoodsSkuModel;
|
|
|
+use App\Models\MeetingModel;
|
|
|
use App\Models\MeetingRecordsModel;
|
|
|
use App\Models\MemberModel;
|
|
|
use App\Models\OrderGoodsModel;
|
|
|
@@ -287,13 +288,18 @@ class OrderService extends BaseService
|
|
|
$orderTotal = 0.1;
|
|
|
}
|
|
|
|
|
|
- // 检查是否关联为会议订单
|
|
|
+ // 检查是否关联为会议订单,先签到的会议先关联
|
|
|
+ $recordMeetingId = MeetingRecordsModel::where(['user_id'=>$userId,'mark'=>1])
|
|
|
+ ->where('expired_at','>=', date('Y-m-d H:i:s'))
|
|
|
+ ->orderBy('id', 'asc')
|
|
|
+ ->value('meeting_id');
|
|
|
|
|
|
// 订单数据
|
|
|
$order = [
|
|
|
'order_no' => $orderNo,
|
|
|
'user_id' => $userId,
|
|
|
'store_id' => $storeId,
|
|
|
+ 'meeting_id' => $recordMeetingId, // 关联会议
|
|
|
'total' => $goodsTotal, // 商品总价
|
|
|
'num' => $orderCount,
|
|
|
'pay_total' => $orderTotal, // 折扣后商品总价
|
|
|
@@ -656,6 +662,7 @@ class OrderService extends BaseService
|
|
|
$deliveryNo = isset($info['delivery_no']) ? $info['delivery_no'] : '';
|
|
|
$deliverCompany = isset($info['delivery_company']) ? $info['delivery_company'] : '';
|
|
|
$storeId = isset($info['store_id']) ? $info['store_id'] : 0;
|
|
|
+ $meetingId = isset($info['meeting_id']) ? $info['meeting_id'] : 0;
|
|
|
$orderTotal = isset($info['pay_total']) ? $info['pay_total'] : 0;
|
|
|
$bonus = isset($info['bonus']) ? $info['bonus'] : 0;
|
|
|
$status = isset($info['status']) ? $info['status'] : 0;
|
|
|
@@ -693,7 +700,6 @@ class OrderService extends BaseService
|
|
|
$updateData = ['order_count' => DB::raw('order_count+1'), 'order_total' => DB::raw("order_total + {$orderTotal}")];
|
|
|
StoreModel::where(['id' => $storeId])->update($updateData);
|
|
|
|
|
|
-
|
|
|
// 商品销量数据
|
|
|
if ($orderGoods) {
|
|
|
$counts = [];
|
|
|
@@ -717,12 +723,14 @@ class OrderService extends BaseService
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- // 订单佣金结算
|
|
|
-
|
|
|
+ // 关联会议统计
|
|
|
+ if($meetingId){
|
|
|
+ $updateData = ['order_count' => DB::raw('order_count+1'), 'order_total' => DB::raw("order_total + {$orderTotal}")];
|
|
|
+ MeetingModel::where(['id' => $meetingId])->update($updateData);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
DB::commit();
|
|
|
-
|
|
|
$this->error = '确认收货成功';
|
|
|
RedisService::clear("caches:orders:completeList");
|
|
|
return ['id' => $id, 'msg' => $this->error];
|