|
|
@@ -208,17 +208,16 @@ class AuctionOrder extends BaseModel
|
|
|
|
|
|
$auction = Auction::where('id', $product['auction_id'])->find();
|
|
|
|
|
|
- $booking = AuctionBooking::whereBetweenTime('create_time',date('Y-m-d H:i:s', strtotime(date('Y-m-d', time()))), date('Y-m-d H:i:s', strtotime(date('Y-m-d', strtotime('+1 day')))))
|
|
|
- ->where([['uid', '=', $v['uid']], ['status', '=', 1], ['auction_id', '=', $auction['id']]])->where('status', '=', 1)->find();
|
|
|
- $user = \app\models\user\User::where('uid', $v['collection_id'])->find();
|
|
|
-
|
|
|
- $user['anticipate'] = $user['anticipate'] + $auction['anticipate'];
|
|
|
- UserBill::income('增加预约卷', $v['collection_id'], 'anticipate', 'add_anticipate', $auction['anticipate'], $v['uid'], $user['anticipate'], '卖出订单未上传支付凭证,增加'.$auction['anticipate'].'预约卷');
|
|
|
-
|
|
|
- $user->save();
|
|
|
- AuctionBooking::where('id', $booking['id'])->update(['status' => 0]);
|
|
|
- AuctionOrder::where('create_time', '<', $hour)->where('status', '=', 1)->update(['status' => 2]); // 修改为已过期订单
|
|
|
+ $booking = AuctionBooking::where([['uid', '=', $v['uid']], ['status', '=', 1], ['auction_id', '=', $auction['id']]])->where('status', '=', 1)->find(); // 找到预约订单
|
|
|
+ if ($booking){
|
|
|
+ $user = \app\models\user\User::where('uid', $v['collection_id'])->find();
|
|
|
+ $user['anticipate'] = $user['anticipate'] + $auction['anticipate']; // 增加预约卷
|
|
|
+ UserBill::income('增加预约卷', $v['collection_id'], 'anticipate', 'add_anticipate', $auction['anticipate'], $v['uid'], $user['anticipate'], '卖出订单未上传支付凭证,增加'.$auction['anticipate'].'预约卷');
|
|
|
|
|
|
+ $user->save();
|
|
|
+ AuctionBooking::where('id', $booking['id'])->update(['status' => 2]); // 修改预约订单状态 为扣除
|
|
|
+ }
|
|
|
+ AuctionOrder::where('create_time', '<', $hour)->where('status', '=', 1)->update(['status' => 0]); // 修改为已过期订单
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -236,13 +235,20 @@ class AuctionOrder extends BaseModel
|
|
|
$auction = Auction::where('rend_time', '<', time())->select();
|
|
|
if ($auction){
|
|
|
foreach ($auction as $k => $v){
|
|
|
- $booking = AuctionBooking::where('auction_id', $v['id'])->whereBetweenTime('create_time',date('Y-m-d H:i:s', strtotime(date('Y-m-d', time()))), date('Y-m-d H:i:s', strtotime(date('Y-m-d', strtotime('+1 day')))))->select();
|
|
|
+
|
|
|
+ $booking = AuctionBooking::where([['auction_id', '=', $v['id']], ['status','=' , 1]])->select();
|
|
|
if ($booking){
|
|
|
- $user = User::where('uid', $booking['uid'])->find();
|
|
|
- $user['anticipate'] = $user['anticipate'] + $booking['anticipate'];
|
|
|
- $user->save();
|
|
|
- UserBill::income('预约卷增加',$user['uid'], 'anticipate', 'add_anticipate', $booking['anticipate'], 0, $user['anticipate'], '预约卷退回');
|
|
|
+ foreach ($booking as $key => $value){
|
|
|
+ $find = AuctionBooking::find($value['id']);
|
|
|
+ $find['status'] = 0;
|
|
|
+
|
|
|
+ $user = User::where('uid', $value['uid'])->find();
|
|
|
+ $user['anticipate'] = $user['anticipate'] + $value['anticipate'];
|
|
|
|
|
|
+ $user->save();
|
|
|
+ $find->save();
|
|
|
+ UserBill::income('预约卷增加',$user['uid'], 'anticipate', 'add_anticipate', $value['anticipate'], 0, $user['anticipate'], '预约卷退回');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|