盲盒随机算法 随机函数更换修改
This commit is contained in:
@@ -1420,7 +1420,7 @@ class SendGift extends Model
|
||||
/*
|
||||
* 开盲盒
|
||||
*/
|
||||
public function open_box($gift_id,$user_id,$gift_user_id,$room_id,$gift_bag_id){
|
||||
public function open_box(int $gift_id, int $user_id,int $gift_user_id, int $room_id,int $gift_bag_id){
|
||||
//获取盲盒配置
|
||||
if($gift_bag_id){
|
||||
$gift_bag = db::name("vs_gift_bag")->where(['id'=>$gift_bag_id])->find();
|
||||
@@ -1446,7 +1446,7 @@ class SendGift extends Model
|
||||
foreach ($gift_bag_details as $gift) {
|
||||
$total_remaining += $gift['remaining_number'];
|
||||
}
|
||||
$rand_value = mt_rand(1, $total_remaining);
|
||||
$rand_value = random_int(1, $total_remaining);
|
||||
$current_sum = 0;
|
||||
$gift_bag_detail = null;
|
||||
foreach ($gift_bag_details as $gift) {
|
||||
|
||||
Reference in New Issue
Block a user