1
This commit is contained in:
parent
c509b17a78
commit
687bdadbfa
31
doc/OutAppCircuit.py
Normal file
31
doc/OutAppCircuit.py
Normal file
@ -0,0 +1,31 @@
|
||||
import _common
|
||||
|
||||
class OutAppTools(object):
|
||||
|
||||
def __init__(self):
|
||||
self.apis = [
|
||||
{
|
||||
'name': 'getCircuitRewardHistory',
|
||||
'desc': '获取巡回赛奖励记录',
|
||||
'group': 'OutAppCircuit',
|
||||
'url': 'webapp/index.php?c=OutAppCircuit&a=getCircuitRewardHistory',
|
||||
'params': [
|
||||
['address', '0', 'address'],
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
['!data', [rewardInfo()], '奖励信息'],
|
||||
]
|
||||
},
|
||||
|
||||
]
|
||||
|
||||
|
||||
class rewardInfo(object):
|
||||
|
||||
def __init__(self):
|
||||
self.fields = [
|
||||
['start_time', 0, '阶段开始时间'],
|
||||
['end_time', 0, '阶段结束时间'],
|
||||
['reward', 0, '-1:未结算 0:结算无奖励'],
|
||||
]
|
@ -17,6 +17,37 @@ use models\Circuit;
|
||||
use models\User;
|
||||
class OutAppCircuitController extends BaseController {
|
||||
|
||||
public function getCircuitRewardHistory(){
|
||||
$address = getReqVal('address', '');
|
||||
if (empty($address)){
|
||||
myself()->_rspErr(1, 'param error');
|
||||
return;
|
||||
}
|
||||
$user = User::findByAddress($address);
|
||||
if (!$user){
|
||||
myself()->_rspErr(1, 'user not found');
|
||||
return;
|
||||
}
|
||||
$data = array();
|
||||
$currentCircuitMeta = mt\CircuitTime::getCurrentCircuit();
|
||||
if ($currentCircuitMeta){
|
||||
$metas = mt\CircuitTime::getListBySeason($currentCircuitMeta['circuit_season']);
|
||||
foreach ($metas as $meta){
|
||||
$info = array(
|
||||
'start_time' => strtotime($meta['start_time']),
|
||||
'end_time' => strtotime($meta['end_time']),
|
||||
'reward' => -1,
|
||||
);
|
||||
$rewardDb = CircuitReward::find($address,$currentCircuitMeta['circuit_season'],$meta['circuit_phase']);
|
||||
if ($rewardDb){
|
||||
$info['reward'] = $rewardDb['reward_num'];
|
||||
}
|
||||
array_push($data,$info);
|
||||
}
|
||||
}
|
||||
$this->_rspData(array('data' => $data));
|
||||
}
|
||||
|
||||
|
||||
public function circuitSettlement(){
|
||||
$currentStageMeta = \mt\CircuitTime::getCurrentStage();
|
||||
|
@ -7,6 +7,18 @@ use mt;
|
||||
use phpcommon\SqlHelper;
|
||||
class CircuitReward extends BaseModel
|
||||
{
|
||||
public static function find($address, $season, $stage){
|
||||
return SqlHelper::ormSelectOne(
|
||||
myself()->_getMysql(''),
|
||||
't_circuit_reward',
|
||||
array(
|
||||
'address' => $address,
|
||||
'season' => $season,
|
||||
'stage' => $stage
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function _verifySettlement($season,$stage){
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
myself()->_getMysql(''),
|
||||
|
@ -60,7 +60,7 @@ class CircuitTime {
|
||||
return $metas;
|
||||
}
|
||||
|
||||
private static function getListBySeason($season){
|
||||
public static function getListBySeason($season){
|
||||
$metas =array();
|
||||
foreach (self::getMetaList() as $meta){
|
||||
if ($meta['circuit_season'] == $season && $meta['circuit_time_type'] == self::STAGE_SEASON_TYPE){
|
||||
|
Loading…
x
Reference in New Issue
Block a user