1
This commit is contained in:
parent
623a7b0bbd
commit
a7f15e2f9b
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once('mt/Parameter.php');
|
||||
require_once('mt/Bigwheel.php');
|
||||
|
||||
require_once('services/LogService.php');
|
||||
require_once('services/AwardService.php');
|
||||
@ -10,22 +11,59 @@ use phpcommon\SqlHelper;
|
||||
use models\User;
|
||||
use services\LogService;
|
||||
|
||||
/*
|
||||
{
|
||||
"grid_list":
|
||||
{
|
||||
"grid_id": 123,
|
||||
"grid_state": 0,
|
||||
"item_id": 123,
|
||||
"item_num": 314,
|
||||
"buy_price": 314
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
class BigwheelController extends BaseAuthedController
|
||||
{
|
||||
|
||||
public function info(){
|
||||
echo myself()->_getModelConstant('MidData', 'BIG_WHEEL_TYPE');
|
||||
$key = $this->getMidDataKey();
|
||||
$data = $this->getAndCreateData($key);
|
||||
mt\Bigwheel::traverseMeta(
|
||||
function ($meta) use(&$data) {
|
||||
return true;
|
||||
});
|
||||
myself()->_rspData($data);
|
||||
}
|
||||
|
||||
public function drawS(){
|
||||
$key = $this->getMidDataKey();
|
||||
$data = $this->getAndCreateData($key);
|
||||
}
|
||||
|
||||
public function buyS(){
|
||||
$key = $this->getMidDataKey();
|
||||
$data = $this->getAndCreateData($key);
|
||||
}
|
||||
|
||||
private function getMidDataKey()
|
||||
{
|
||||
return myself()->_getServiceConstant();
|
||||
return myself()->_getModelConstant('MidData', 'BIG_WHEEL_TYPE');
|
||||
}
|
||||
|
||||
private function getAndCreateData($key)
|
||||
{
|
||||
$data = myself()->_callModelStatic('MidData', 'getData', $key);
|
||||
if (!empty($data)) {
|
||||
$data = json_decode($data, true);
|
||||
}
|
||||
if (empty($data)) {
|
||||
$data = array(
|
||||
"grid_list" => array()
|
||||
);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,5 +20,14 @@ class Bigwheel
|
||||
return self::$metaList;
|
||||
}
|
||||
|
||||
public static function traverseMeta($cb)
|
||||
{
|
||||
foreach (self::getMetaList() as $meta) {
|
||||
if (!$cb($meta)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static $metaList;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user