|
|
@@ -102,32 +102,31 @@ class Auction extends BaseModel
|
|
|
foreach ($auction as $k => $v) {
|
|
|
if (strtotime($v['rend_time'])-600 < time()){
|
|
|
//关闭场次五分钟前
|
|
|
- $orderCount = AuctionOrder::where('auction_id', '=', $v['id'])->where('frequency', '=', $v['frequency'])->where('status', '>',0)->where('price', '<', $recovery)->count();// 当前订单数量
|
|
|
- $bok = AuctionBooking::where([['auction_id', '=', $v['id']], ['frequency', '=', $v['frequency']]])->count();
|
|
|
- $count = ceil($bok * ($v['dispatch']/100));
|
|
|
+// $orderCount = AuctionOrder::where('auction_id', '=', $v['id'])->where('frequency', '=', $v['frequency'])->where('status', '>',0)->where('price', '<', $recovery)->count();// 当前订单数量
|
|
|
+// $bok = AuctionBooking::where([['auction_id', '=', $v['id']], ['frequency', '=', $v['frequency']]])->count();
|
|
|
+// $count = ceil($bok * ($v['dispatch']/100));
|
|
|
$orderId = AuctionOrder::where([['auction_id', '=', $v['id']], ['frequency', '=', $v['frequency']], ['status', '>', 0]])->column('product_id');
|
|
|
- if ($orderCount < $count){;
|
|
|
- // 如果购买人数没有到放单人数
|
|
|
- $dayo = AuctionOrder::where('auction_id', '=', $v['id'])->where('frequency', '=', $v['frequency'])->where('status', '>',0)->where('price', '<', $recovery)->column('product_id');// 当前出售商品
|
|
|
- $product = AuctionProduct::where([['id', 'notIn', $dayo], ['uid', '>', 1], ['price', '<', $recovery], ['auction_id', '=', $v['id']]])->select();
|
|
|
- if ($product){
|
|
|
- foreach ($product as &$item){
|
|
|
- $orderData = [
|
|
|
- 'uid' => 1,
|
|
|
- 'collection_id' => $item['uid']? $item['uid']: 0,
|
|
|
- 'order_id' => getNewOrderId(),
|
|
|
- 'auction_id' => $v['id'],
|
|
|
- 'product_id' => $item['id'],
|
|
|
- 'name' => $item['name'],
|
|
|
- 'image' => $item['image'],
|
|
|
- 'price' => $item['hanging_price'],
|
|
|
- 'actual_price' => $item['hanging_price'] - $item['price'],
|
|
|
- 'create_time' => time(),
|
|
|
- 'frequency' => $v['frequency']
|
|
|
- ];
|
|
|
- AuctionOrder::create($orderData);
|
|
|
- unset($orderData);// 清空数组
|
|
|
- }
|
|
|
+ // 如果购买人数没有到放单人数
|
|
|
+ $dayo = AuctionOrder::where('auction_id', '=', $v['id'])->where('frequency', '=', $v['frequency'])->where('status', '>',0)->where('price', '<', $recovery)->column('product_id');// 当前出售商品
|
|
|
+ $product = AuctionProduct::where([['id', 'notIn', $dayo], ['uid', '>', 1], ['price', '<', $recovery], ['auction_id', '=', $v['id']]])->select();
|
|
|
+ if ($product){
|
|
|
+ // 存在挂售没卖出的订单
|
|
|
+ foreach ($product as &$item){
|
|
|
+ $orderData = [
|
|
|
+ 'uid' => 1,
|
|
|
+ 'collection_id' => $item['uid']? $item['uid']: 0,
|
|
|
+ 'order_id' => getNewOrderId(),
|
|
|
+ 'auction_id' => $v['id'],
|
|
|
+ 'product_id' => $item['id'],
|
|
|
+ 'name' => $item['name'],
|
|
|
+ 'image' => $item['image'],
|
|
|
+ 'price' => $item['hanging_price'],
|
|
|
+ 'actual_price' => $item['hanging_price'] - $item['price'],
|
|
|
+ 'create_time' => time(),
|
|
|
+ 'frequency' => $v['frequency']
|
|
|
+ ];
|
|
|
+ AuctionOrder::create($orderData);
|
|
|
+ unset($orderData);// 清空数组
|
|
|
}
|
|
|
}
|
|
|
$auctionProduct = AuctionProduct::where([['auction_id', '=', $v['id']], ['is_show', '=', 1],['id', 'notIn', $orderId],['hanging_price', '>', $recovery]])->select();// 如果又商品成功回收价格
|