mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 14:01:07 +00:00
update crmeb/app/services/activity/lottery/LuckPrizeServices.php.
抽奖随机bug,当随机数=$totalChance时,无法取到随机,应减1。
0到$totalChance-1
这样才能跟“if ($prizeChance >= $startChance && $prizeChance < $newStartChance) {” 这行的$prizeChance < $newStartChance 匹配为true
This commit is contained in:
parent
db681497a0
commit
a8d0d4c9d5
@ -173,7 +173,7 @@ class LuckPrizeServices extends BaseServices
|
||||
if (!$totalChance) return $prize;
|
||||
$startChance = 0;
|
||||
mt_srand();
|
||||
$prizeChance = rand(0, $totalChance);
|
||||
$prizeChance = rand(0, $totalChance-1);
|
||||
$newPrize = array_combine(array_column($data, 'type'), $data);
|
||||
foreach ($data as $item) {
|
||||
$newStartChance = $item['chance'] + $startChance;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user