|
@@ -160,16 +160,20 @@ class AuctionOrder extends BaseModel
|
|
|
|
|
|
if ($booking){
|
|
|
foreach ($booking as $key => $value){
|
|
|
- $userBok = AuctionBooking::where('uid', '=',$value['uid'])->where('deduct_advert', '>', 0)->count(); //预约未购买退回的次数
|
|
|
- $bf = (0.1*$userBok >= 1)? 1: 0.1*$userBok; // 0.1 * 退回次数
|
|
|
- $find = AuctionBooking::find($value['id']);
|
|
|
- $find['status'] = 0;
|
|
|
- $find['deduct_advert'] = $value['advert']*$bf; // 扣除广告书
|
|
|
- $user = User::where('uid', $value['uid'])->find();
|
|
|
- $user['aid_val'] = $user['aid_val'] + ($value['advert'] - ($value['advert'] * $bf)); // 增加用户广告值
|
|
|
- $user->save();
|
|
|
- $find->save();
|
|
|
- UserBill::income('未购买解冻但扣除'. $find['deduct_advert'].'广告值',$user['uid'], 'aid_val', 'add_aid_val',$value['advert'] - ($value['advert'] * $bf), 0, $user['aid_val'], '未购买解冻但扣除'. $find['deduct_advert'].'广告值');
|
|
|
+ $product = AuctionProduct::where('auction_id', $value['auction_id'])->column('id');
|
|
|
+ $order = AuctionOrder::where([['product_id', 'in', $product], ['frequency', '=', $value['frequency']], ['uid', '=', $value['uid']]])->find();
|
|
|
+ if (!$order){
|
|
|
+ $userBok = AuctionBooking::where('uid', '=',$value['uid'])->where('deduct_advert', '>', 0)->count(); //预约未购买退回的次数
|
|
|
+ $bf = (0.1*$userBok >= 1)? 1: 0.1*$userBok == 0? 0.1 : 0.1*$userBok; // 0.1 * 退回次数
|
|
|
+ $find = AuctionBooking::find($value['id']);
|
|
|
+ $find['status'] = 0;
|
|
|
+ $find['deduct_advert'] = $value['advert']*$bf; // 扣除广告书
|
|
|
+ $user = User::where('uid', $value['uid'])->find();
|
|
|
+ $user['aid_val'] = $user['aid_val'] + ($value['advert'] - ($value['advert'] * $bf)); // 增加用户广告值
|
|
|
+ $user->save();
|
|
|
+ $find->save();
|
|
|
+ UserBill::income('未购买解冻但扣除'. $find['deduct_advert'].'广告值',$user['uid'], 'aid_val', 'add_aid_val',$value['advert'] - ($value['advert'] * $bf), 0, $user['aid_val'], '未购买解冻但扣除'. $find['deduct_advert'].'广告值');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|