|
@@ -776,16 +776,14 @@ class OrderService extends BaseService
|
|
|
|
|
|
|
|
// 订单信息
|
|
// 订单信息
|
|
|
$info = $this->model->with(['orderGoods'])->where(['id' => $id, 'mark' => 1])
|
|
$info = $this->model->with(['orderGoods'])->where(['id' => $id, 'mark' => 1])
|
|
|
- ->select(['id', 'order_no','user_id', 'store_id','meeting_id', 'pay_total', 'bonus', 'delivery_no', 'delivery_company', 'delivery_code', 'status'])
|
|
|
|
|
|
|
+ ->select(['id', 'order_no','user_id', 'store_id', 'pay_total', 'delivery_no', 'delivery_company', 'delivery_code', 'status'])
|
|
|
->first();
|
|
->first();
|
|
|
$orderNo = isset($info['order_no']) ? $info['order_no'] : '';
|
|
$orderNo = isset($info['order_no']) ? $info['order_no'] : '';
|
|
|
$deliveryNo = isset($info['delivery_no']) ? $info['delivery_no'] : '';
|
|
$deliveryNo = isset($info['delivery_no']) ? $info['delivery_no'] : '';
|
|
|
$deliverCompany = isset($info['delivery_company']) ? $info['delivery_company'] : '';
|
|
$deliverCompany = isset($info['delivery_company']) ? $info['delivery_company'] : '';
|
|
|
$orderUserId = isset($info['user_id']) ? $info['user_id'] : 0;
|
|
$orderUserId = isset($info['user_id']) ? $info['user_id'] : 0;
|
|
|
$storeId = isset($info['store_id']) ? $info['store_id'] : 0;
|
|
$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;
|
|
$orderTotal = isset($info['pay_total']) ? $info['pay_total'] : 0;
|
|
|
- $bonus = isset($info['bonus']) ? $info['bonus'] : 0;
|
|
|
|
|
$status = isset($info['status']) ? $info['status'] : 0;
|
|
$status = isset($info['status']) ? $info['status'] : 0;
|
|
|
$orderGoods = isset($info['order_goods']) ? $info['order_goods'] : [];
|
|
$orderGoods = isset($info['order_goods']) ? $info['order_goods'] : [];
|
|
|
if (empty($info) || empty($orderNo)) {
|
|
if (empty($info) || empty($orderNo)) {
|
|
@@ -817,10 +815,6 @@ class OrderService extends BaseService
|
|
|
}
|
|
}
|
|
|
$this->model->where(['id' => $id])->update($updateData);
|
|
$this->model->where(['id' => $id])->update($updateData);
|
|
|
|
|
|
|
|
- // 商家订单数据统计
|
|
|
|
|
- $updateData = ['order_count' => DB::raw('order_count+1'), 'order_total' => DB::raw("order_total + {$orderTotal}")];
|
|
|
|
|
- StoreModel::where(['id' => $storeId])->update($updateData);
|
|
|
|
|
-
|
|
|
|
|
// 商品销量数据
|
|
// 商品销量数据
|
|
|
if ($orderGoods) {
|
|
if ($orderGoods) {
|
|
|
$counts = [];
|
|
$counts = [];
|
|
@@ -836,24 +830,8 @@ class OrderService extends BaseService
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 结算商家收益
|
|
|
|
|
- if (SettleService::make()->storeBonus($storeId, $bonus, $info) < 0) {
|
|
|
|
|
- DB::rollBack();
|
|
|
|
|
- $this->error = SettleService::make()->getError();
|
|
|
|
|
- RedisService::clear($cacheLockKey);
|
|
|
|
|
- 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);
|
|
|
|
|
-
|
|
|
|
|
- // 签到用户成交统计
|
|
|
|
|
- $updateData = ['order_count' => DB::raw('order_count+1'), 'order_total' => DB::raw("order_total + {$orderTotal}")];
|
|
|
|
|
- MeetingRecordsModel::where(['meeting_id' => $meetingId,'user_id'=>$orderUserId])->update($updateData);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 订单结算
|
|
|
|
|
+ SettleService::make()->commissionSettle($id);
|
|
|
|
|
|
|
|
|
|
|
|
|
DB::commit();
|
|
DB::commit();
|