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