bug修改
This commit is contained in:
@@ -138,6 +138,10 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
|
|||||||
*/
|
*/
|
||||||
private function precomputeDrawResults($gift_bag_id, $total_num, $gift_user_ids,$periods,$user_id)
|
private function precomputeDrawResults($gift_bag_id, $total_num, $gift_user_ids,$periods,$user_id)
|
||||||
{
|
{
|
||||||
|
//查询需要关禁闭的用户user_code
|
||||||
|
$pan_xian_userids = get_system_config_value('pan_xian_userids');
|
||||||
|
$pan_xian_userids_id = db::name('user')->where(['user_code'=>['in',$pan_xian_userids]])->column('id');//用户user_code转Id
|
||||||
|
|
||||||
$pan_total_draw_times = $this->getCachedPanDrawTimes($gift_bag_id); //总抽奖次数
|
$pan_total_draw_times = $this->getCachedPanDrawTimes($gift_bag_id); //总抽奖次数
|
||||||
$pan_total_remaining = $this->getCachedPanTotalRemaining($gift_bag_id); //剩余数量
|
$pan_total_remaining = $this->getCachedPanTotalRemaining($gift_bag_id); //剩余数量
|
||||||
//获取可用礼物
|
//获取可用礼物
|
||||||
@@ -245,6 +249,14 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
|
|||||||
}
|
}
|
||||||
$gift = $giftInfoMap[$selectedGift['foreign_id']]??[];
|
$gift = $giftInfoMap[$selectedGift['foreign_id']]??[];
|
||||||
|
|
||||||
|
//关禁闭
|
||||||
|
if(in_array($user_id,$pan_xian_userids_id)){
|
||||||
|
$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 = $giftInfoMap[$gift_bag_detail_duo['foreign_id']]??[];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//防止过高爆率,检查本期用户概率
|
//防止过高爆率,检查本期用户概率
|
||||||
//当前用户在本期的(补偿 防止漏洞 超过预期 把盘拉平)
|
//当前用户在本期的(补偿 防止漏洞 超过预期 把盘拉平)
|
||||||
//总抽奖金额(支出)
|
//总抽奖金额(支出)
|
||||||
@@ -409,17 +421,12 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
|
|||||||
{
|
{
|
||||||
$gift_bag_detail_data = $this->getCachedGiftBagDetail($gift_bag_id);
|
$gift_bag_detail_data = $this->getCachedGiftBagDetail($gift_bag_id);
|
||||||
$gift_detail_data = [];
|
$gift_detail_data = [];
|
||||||
$pan_xian_userids = get_system_config_value('pan_xian_userids');
|
|
||||||
$pan_xian_userids_id = db::name('user')->where(['user_code'=>['in',$pan_xian_userids]])->column('id');
|
|
||||||
foreach ($gift_bag_detail_data as $item) {
|
foreach ($gift_bag_detail_data as $item) {
|
||||||
// if(in_array($user_id,[21222,21259,24208,24224,28393,22538,22986]) && $item['quantity']<500){
|
|
||||||
if(in_array($user_id,$pan_xian_userids_id) && $item['quantity']<500){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if($item['remaining_number'] > 0 && $item['weight']<=$pan_total_draw_times && $item['quantity'] > 0){
|
if($item['remaining_number'] > 0 && $item['weight']<=$pan_total_draw_times && $item['quantity'] > 0){
|
||||||
$gift_detail_data[] = $item;
|
$gift_detail_data[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $gift_detail_data;
|
return $gift_detail_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1141,6 +1148,10 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//查询需要关禁闭的用户user_code
|
||||||
|
$pan_xian_userids = get_system_config_value('pan_xian_userids');
|
||||||
|
$pan_xian_userids_id = db::name('user')->where(['user_code'=>['in',$pan_xian_userids]])->column('id');//用户user_code转Id
|
||||||
|
|
||||||
// 处理当前批次的抽奖
|
// 处理当前批次的抽奖
|
||||||
$inventory_updates = []; // 用于记录库存变化
|
$inventory_updates = []; // 用于记录库存变化
|
||||||
for ($i = 0; $i < $current_batch; $i++) {
|
for ($i = 0; $i < $current_batch; $i++) {
|
||||||
@@ -1165,6 +1176,16 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
|
|||||||
$inventory_updates[$selected_gift['id']] = ($inventory_updates[$selected_gift['id']] ?? 0) + 1;
|
$inventory_updates[$selected_gift['id']] = ($inventory_updates[$selected_gift['id']] ?? 0) + 1;
|
||||||
// 记录抽中结果
|
// 记录抽中结果
|
||||||
$gift_id = $selected_gift['foreign_id'];
|
$gift_id = $selected_gift['foreign_id'];
|
||||||
|
|
||||||
|
//关禁闭
|
||||||
|
if(in_array($user_id,$pan_xian_userids_id)){
|
||||||
|
$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_id = $gift_bag_detail_duo['foreign_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//关禁闭-end
|
||||||
|
|
||||||
$drawn_gifts[$gift_id] = ($drawn_gifts[$gift_id] ?? 0) + 1;
|
$drawn_gifts[$gift_id] = ($drawn_gifts[$gift_id] ?? 0) + 1;
|
||||||
// 处理主奖品
|
// 处理主奖品
|
||||||
if ($gift_id == $ext['locking_condition']['selected_gift_id']) {
|
if ($gift_id == $ext['locking_condition']['selected_gift_id']) {
|
||||||
@@ -1548,7 +1569,8 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
|
|||||||
$available_gifts,
|
$available_gifts,
|
||||||
$remaining_available_gifts,
|
$remaining_available_gifts,
|
||||||
$num,
|
$num,
|
||||||
$periods
|
$periods,
|
||||||
|
$user_id
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($draw_result['code'] !== 1) {
|
if ($draw_result['code'] !== 1) {
|
||||||
@@ -1678,8 +1700,12 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
|
|||||||
/**
|
/**
|
||||||
* 执行礼物抽取
|
* 执行礼物抽取
|
||||||
*/
|
*/
|
||||||
private function performGiftDrawing($gift_bag_id, $available_gifts, $remaining_gifts, $num, $periods)
|
private function performGiftDrawing($gift_bag_id, $available_gifts, $remaining_gifts, $num, $periods,$user_id=0)
|
||||||
{
|
{
|
||||||
|
//查询需要关禁闭的用户user_code
|
||||||
|
$pan_xian_userids = get_system_config_value('pan_xian_userids');
|
||||||
|
$pan_xian_userids_id = db::name('user')->where(['user_code'=>['in',$pan_xian_userids]])->column('id');//用户user_code转Id
|
||||||
|
|
||||||
$drawn_gifts = [];
|
$drawn_gifts = [];
|
||||||
$precomputed_results = [];
|
$precomputed_results = [];
|
||||||
$available_giftss = [];
|
$available_giftss = [];
|
||||||
@@ -1697,6 +1723,15 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
|
|||||||
foreach ($remaining_gifts as $remaining_gift) {
|
foreach ($remaining_gifts as $remaining_gift) {
|
||||||
$gift_id = $remaining_gift['foreign_id'];//礼物ID
|
$gift_id = $remaining_gift['foreign_id'];//礼物ID
|
||||||
|
|
||||||
|
//关禁闭
|
||||||
|
if(in_array($user_id,$pan_xian_userids_id)){
|
||||||
|
$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_id = $gift_bag_detail_duo['foreign_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//关禁闭-end
|
||||||
|
|
||||||
//查询上期这个礼物抽取数量----------------
|
//查询上期这个礼物抽取数量----------------
|
||||||
$count_num = Db::name('vs_gift_bag_receive_pan_log')->where(['gift_bag_id' => $gift_bag_id,'gift_id' => $gift_id,'periods'=>$periods-1])->count();
|
$count_num = Db::name('vs_gift_bag_receive_pan_log')->where(['gift_bag_id' => $gift_bag_id,'gift_id' => $gift_id,'periods'=>$periods-1])->count();
|
||||||
$error_gifts[$gift_id] =[
|
$error_gifts[$gift_id] =[
|
||||||
|
|||||||
@@ -1567,6 +1567,11 @@ class SendGift extends Model
|
|||||||
db::name("vs_gift_bag_detail")->where('gift_bag_id',$gift_bag_id)->update(['remaining_number'=>db::raw('quantity')]);
|
db::name("vs_gift_bag_detail")->where('gift_bag_id',$gift_bag_id)->update(['remaining_number'=>db::raw('quantity')]);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
$gift_bag_num = db::name("vs_gift_bag_detail")->where('gift_bag_id',$gift_bag_id)->lock(true)->sum('remaining_number');
|
||||||
|
if($gift_bag_num <= 0){
|
||||||
|
db::name("vs_gift_bag")->where('id',$gift_bag_id)->setInc('periods');
|
||||||
|
db::name("vs_gift_bag_detail")->where('gift_bag_id',$gift_bag_id)->update(['remaining_number'=>db::raw('quantity')]);
|
||||||
|
}
|
||||||
return ['code' => 0, 'msg' => '失败!', 'data' => []];
|
return ['code' => 0, 'msg' => '失败!', 'data' => []];
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
Reference in New Issue
Block a user