1
This commit is contained in:
parent
2b266d045a
commit
9d327bcaad
@ -88,24 +88,26 @@ class BigwheelController extends BaseAuthedController {
|
||||
mt\Bigwheel::traverseMeta(
|
||||
function ($meta) use(&$data, &$item1Hash, &$item2Hash, &$item1Arr, &$item2Arr) {
|
||||
$gridRef = null;
|
||||
$this->getGridRefByGridId($data, $meta['id'], $girdRef);
|
||||
switch ($meta['Wheel_type']) {
|
||||
case 1:{
|
||||
$item1Hash[$meta['id']] = $meta;
|
||||
array_push($item1Arr, array(
|
||||
'weight' => 0,
|
||||
'meta' => $meta
|
||||
));
|
||||
}
|
||||
break;
|
||||
case 2:{
|
||||
$item2Hash[$meta['id']] = $meta;
|
||||
array_push($item2Arr, array(
|
||||
'weight' => 0,
|
||||
'meta' => $meta
|
||||
));
|
||||
}
|
||||
break;
|
||||
$this->getGridRefByGridId($data, $meta['id'], $gridRef);
|
||||
if (empty($gridRef)) {
|
||||
switch ($meta['Wheel_type']) {
|
||||
case 1:{
|
||||
$item1Hash[$meta['id']] = $meta;
|
||||
array_push($item1Arr, array(
|
||||
'weight' => 0,
|
||||
'meta' => $meta
|
||||
));
|
||||
}
|
||||
break;
|
||||
case 2:{
|
||||
$item2Hash[$meta['id']] = $meta;
|
||||
array_push($item2Arr, array(
|
||||
'weight' => 0,
|
||||
'meta' => $meta
|
||||
));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
@ -141,7 +143,7 @@ class BigwheelController extends BaseAuthedController {
|
||||
{
|
||||
$rnd = rand(0, $randSpace1 - 1);
|
||||
foreach ($item1Arr as $item) {
|
||||
if ($item['weight'] <= $rnd) {
|
||||
if ($rnd <= $item['weight']) {
|
||||
$item1 = $item;
|
||||
break;
|
||||
}
|
||||
@ -151,7 +153,7 @@ class BigwheelController extends BaseAuthedController {
|
||||
{
|
||||
$rnd = rand(0, $randSpace2 - 2);
|
||||
foreach ($item2Arr as $item) {
|
||||
if ($item['weight'] <= $rnd) {
|
||||
if ($rnd <= $item['weight']) {
|
||||
$item2 = $item;
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user