70 lines
1.4 KiB
PHP
70 lines
1.4 KiB
PHP
<?php
|
|
|
|
require_once('mt/Parameter.php');
|
|
require_once('mt/Bigwheel.php');
|
|
|
|
require_once('services/LogService.php');
|
|
require_once('services/AwardService.php');
|
|
require_once('services/PropertyChgService.php');
|
|
|
|
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(){
|
|
$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()->_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;
|
|
}
|
|
|
|
}
|