|
@@ -190,6 +190,33 @@ class AuctionOrder extends BaseModel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static function deduction()
|
|
|
+ {
|
|
|
+ $hour = strtotime(date('Y-m-d H:i:s', strtotime('-1 hour')));
|
|
|
+
|
|
|
+ $order = AuctionOrder::where('create_time', '<', $hour)->where('status', '=', 1)->select();
|
|
|
+ if ($order){
|
|
|
+ foreach ($order as $K => $v){
|
|
|
+ $product = AuctionProduct::where('id', $v['product_id'])->find();
|
|
|
+
|
|
|
+ $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]);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|