bug修改
This commit is contained in:
@@ -60,7 +60,7 @@ class Auth extends \fast\Auth
|
|||||||
}
|
}
|
||||||
$admin->loginfailure = 0;
|
$admin->loginfailure = 0;
|
||||||
$admin->logintime = time();
|
$admin->logintime = time();
|
||||||
$admin->loginip = request()->ip();
|
$admin->loginip = request()->server('HTTP_X_REAL_IP') ?: request()->server('HTTP_X_FORWARDED_FOR') ?: request()->ip();
|
||||||
$admin->token = Random::uuid();
|
$admin->token = Random::uuid();
|
||||||
$admin->save();
|
$admin->save();
|
||||||
Session::set("admin", $admin->toArray());
|
Session::set("admin", $admin->toArray());
|
||||||
|
|||||||
@@ -1645,6 +1645,7 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
|
|||||||
$precomputed_results = [];
|
$precomputed_results = [];
|
||||||
$available_giftss = [];
|
$available_giftss = [];
|
||||||
$inventory_updates = [];
|
$inventory_updates = [];
|
||||||
|
$old_gift_num = 0;
|
||||||
|
|
||||||
// 先处理上期剩余的礼物
|
// 先处理上期剩余的礼物
|
||||||
if (!empty($remaining_gifts)) {
|
if (!empty($remaining_gifts)) {
|
||||||
@@ -1662,6 +1663,18 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
|
|||||||
// $this_gift_quantity = Db::name('vs_gift_bag_detail')->where(['gift_bag_id' => $gift_bag_id,'foreign_id' => $gift_id])->value('quantity');
|
// $this_gift_quantity = Db::name('vs_gift_bag_detail')->where(['gift_bag_id' => $gift_bag_id,'foreign_id' => $gift_id])->value('quantity');
|
||||||
//上期这个礼物抽走数量与礼物上限数量相同剔除这个礼物
|
//上期这个礼物抽走数量与礼物上限数量相同剔除这个礼物
|
||||||
if ($count_num >= $remaining_gift['quantity']){
|
if ($count_num >= $remaining_gift['quantity']){
|
||||||
|
//错误日志记录--------
|
||||||
|
$key = 'blind_box_draw_shengyu1_errors_' . date('Y-m-d-H-i-s');
|
||||||
|
$errorData=[
|
||||||
|
'gift_bag_id' => $gift_bag_id,
|
||||||
|
'available_gifts' => $available_gifts,
|
||||||
|
'remaining_gifts' => $remaining_gifts,
|
||||||
|
'num' => $num,
|
||||||
|
'gift_id' => $gift_id,
|
||||||
|
'periods' => $periods,
|
||||||
|
];
|
||||||
|
$this->redis->setex($key, 86400 * 7, "礼物数量超出限制 ".json_encode($errorData));
|
||||||
|
//错误日志记录--------end
|
||||||
//剔除该礼物
|
//剔除该礼物
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1675,19 +1688,34 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
|
|||||||
'gift_user_id' => 0,
|
'gift_user_id' => 0,
|
||||||
'periods' => $periods,
|
'periods' => $periods,
|
||||||
];
|
];
|
||||||
|
$old_gift_num++;
|
||||||
}
|
}
|
||||||
//防止上把数据错误
|
//防止上把数据错误
|
||||||
foreach ($drawn_gifts as $gift_id => $count){
|
foreach ($drawn_gifts as $gift_id => $count){
|
||||||
//正常数量
|
//正常数量
|
||||||
$normal_num = $error_gifts[$gift_id]['quantity'] - $error_gifts[$gift_id]['count_num'];
|
$normal_num = $error_gifts[$gift_id]['quantity'] - $error_gifts[$gift_id]['count_num'];
|
||||||
if($count > $normal_num){
|
if($count > $normal_num){
|
||||||
|
//错误日志记录--------
|
||||||
|
$key = 'blind_box_draw_shengyu2_errors_' . date('Y-m-d-H-i-s');
|
||||||
|
$errorData=[
|
||||||
|
'gift_bag_id' => $gift_bag_id,
|
||||||
|
'available_gifts' => $available_gifts,
|
||||||
|
'remaining_gifts' => $remaining_gifts,
|
||||||
|
'num' => $num,
|
||||||
|
'gift_id' => $gift_id,
|
||||||
|
'periods' => $periods,
|
||||||
|
'error_gifts'=>$error_gifts,
|
||||||
|
'normal_num'=>$normal_num
|
||||||
|
];
|
||||||
|
$this->redis->setex($key, 86400 * 7, "礼物数量超出限制 ".json_encode($errorData));
|
||||||
|
//错误日志记录--------end
|
||||||
$drawn_gifts[$gift_id] = $normal_num;
|
$drawn_gifts[$gift_id] = $normal_num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算还需要抽取的数量
|
// 计算还需要抽取的数量
|
||||||
$remaining_count = $num - count($remaining_gifts);
|
$remaining_count = $num - $old_gift_num;
|
||||||
|
|
||||||
// 抽取新礼物
|
// 抽取新礼物
|
||||||
for ($i = 0; $i < $remaining_count; $i++) {
|
for ($i = 0; $i < $remaining_count; $i++) {
|
||||||
@@ -1718,7 +1746,6 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
|
|||||||
'gift_user_id' => 0,
|
'gift_user_id' => 0,
|
||||||
'periods' => $periods,
|
'periods' => $periods,
|
||||||
];
|
];
|
||||||
|
|
||||||
$available_giftss[] = $result_entry;
|
$available_giftss[] = $result_entry;
|
||||||
$precomputed_results[] = $result_entry;
|
$precomputed_results[] = $result_entry;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user