盲盒转盘加限制,加控盘逻辑
This commit is contained in:
@@ -1460,12 +1460,29 @@ class SendGift extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//关禁闭----限制某个房间抽奖只能抽盘里数量最多的礼物--------
|
//当前用户在本期的(补偿 防止漏洞 超过预期 把盘拉平)
|
||||||
$gift_bag_details = db::name("vs_gift_bag_detail")->where([ 'gift_bag_id' => $gift_bag_id,'remaining_number' => ['>',0]])->order('remaining_number', 'desc')->find();
|
//总抽奖金额(支出)
|
||||||
if($gift_bag_details && in_array($room_id,[49])){
|
$total_money = db::name('vs_gift_bag_receive_log')->where(['gift_bag_id' => $gift_bag_id,'user_id' => $user_id,'periods'=>$periods])->sum('bag_price');
|
||||||
$gift_bag_detail = $gift_bag_details;
|
//总礼物价值(收入)
|
||||||
|
$total_gift_money = db::name('vs_gift_bag_receive_log')->where(['gift_bag_id' => $gift_bag_id,'user_id' => $user_id,'periods'=>$periods])->sum('gift_price');
|
||||||
|
if($total_money>0 && $total_gift_money>0){
|
||||||
|
$ratio =round(($total_gift_money / $total_money),3) ?? 0;
|
||||||
|
if($ratio > 1.03){
|
||||||
|
$gift_bag_detail_duo = db::name("vs_gift_bag_detail")->where([ 'gift_bag_id' => $gift_bag_id,'remaining_number' => ['>',0]])->order('remaining_number', 'desc')->find();
|
||||||
|
if($gift_bag_detail_duo){
|
||||||
|
$gift_bag_detail = $gift_bag_detail_duo;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//关禁闭----限制某个房间抽奖只能抽盘里数量最多的礼物--------
|
||||||
|
$gift_bag_detail_duo = db::name("vs_gift_bag_detail")->where([ 'gift_bag_id' => $gift_bag_id,'remaining_number' => ['>',0]])->order('remaining_number', 'desc')->find();
|
||||||
|
if($gift_bag_detail_duo && in_array($room_id,[49])){
|
||||||
|
$gift_bag_detail = $gift_bag_detail_duo;
|
||||||
|
}
|
||||||
|
|
||||||
//关禁闭---------------------------------------------
|
//关禁闭---------------------------------------------
|
||||||
|
|
||||||
if($gift_bag_detail){
|
if($gift_bag_detail){
|
||||||
//获取开出礼物的信息
|
//获取开出礼物的信息
|
||||||
$gift = db::name("vs_gift")->where(['gid'=>$gift_bag_detail['foreign_id']])->find();
|
$gift = db::name("vs_gift")->where(['gid'=>$gift_bag_detail['foreign_id']])->find();
|
||||||
|
|||||||
Reference in New Issue
Block a user