1
This commit is contained in:
parent
7cb302e41a
commit
e888ef4268
@ -15,9 +15,10 @@ class HashRate(object):
|
|||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
['!list', [HashRateList()], '行为列表'],
|
['!list', [HashRateList()], '行为列表'],
|
||||||
|
['obtain_start_time', 0, '获得期开始时间'],
|
||||||
['obtain_end_time', 0, '获得期结束时间'],
|
['obtain_end_time', 0, '获得期结束时间'],
|
||||||
['income_end_time', 0, '盈利期结束时间'],
|
['income_end_time', 0, '盈利期结束时间'],
|
||||||
['state', 0, '0:获得期 1:盈利期'],
|
['state', 0, '0:未开始 1:获得期 2:盈利期'],
|
||||||
['myHashRate', 0, '我的算力'],
|
['myHashRate', 0, '我的算力'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -815,7 +815,10 @@ class BaseAuthedController extends BaseController {
|
|||||||
|
|
||||||
public function _getPeriodV($x, $y, $decVal = 0){
|
public function _getPeriodV($x, $y, $decVal = 0){
|
||||||
$currentPeriod= \mt\AchievementsCycle::getCurrentPeriod();
|
$currentPeriod= \mt\AchievementsCycle::getCurrentPeriod();
|
||||||
|
if ($currentPeriod){
|
||||||
return DynData::getPeriodV($x, $y,strtotime($currentPeriod['obtain_start_time']), $decVal);
|
return DynData::getPeriodV($x, $y,strtotime($currentPeriod['obtain_start_time']), $decVal);
|
||||||
}
|
}
|
||||||
|
return $decVal;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,21 +19,25 @@ class HashRateController extends BaseAuthedController
|
|||||||
|
|
||||||
public function info(){
|
public function info(){
|
||||||
$mateList = \mt\AchievementsPower::getMetaList();
|
$mateList = \mt\AchievementsPower::getMetaList();
|
||||||
$currentPeriod= \mt\AchievementsCycle::getCurrentPeriod();
|
$currentPeriod= \mt\AchievementsCycle::getPeriod();
|
||||||
$hashRateDtoList = array();
|
$hashRateDtoList = array();
|
||||||
foreach ($mateList as $mate) {
|
foreach ($mateList as $mate) {
|
||||||
$temp = $this->hashRateService->hashRateTaskDto($mate ,$currentPeriod);
|
$temp = $this->hashRateService->hashRateTaskDto($mate ,$currentPeriod);
|
||||||
array_push($hashRateDtoList, $temp);
|
array_push($hashRateDtoList, $temp);
|
||||||
}
|
}
|
||||||
|
$obtain_start_time = strtotime($currentPeriod['obtain_start_time']);
|
||||||
$obtain_end_time = strtotime($currentPeriod['obtain_end_time']);
|
$obtain_end_time = strtotime($currentPeriod['obtain_end_time']);
|
||||||
$income_end_time = strtotime($currentPeriod['income_end_time']);
|
$income_end_time = strtotime($currentPeriod['income_end_time']);
|
||||||
$state = 0;
|
$state = 0;
|
||||||
if ($obtain_end_time < myself()->_getNowTime()){
|
if(myself()->_getNowTime() >= $obtain_start_time && myself()->_getNowTime() <= $obtain_end_time){
|
||||||
$state = 1;
|
$state = 1;
|
||||||
|
}elseif ($obtain_end_time < myself()->_getNowTime()){
|
||||||
|
$state = 2;
|
||||||
}
|
}
|
||||||
$myHashRate = HashRate::getMyHashRate($currentPeriod['id']);
|
$myHashRate = HashRate::getMyHashRate($currentPeriod['id']);
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
'list' => $hashRateDtoList,
|
'list' => $hashRateDtoList,
|
||||||
|
'obtain_start_time' => $obtain_start_time,
|
||||||
'obtain_end_time' => $obtain_end_time,
|
'obtain_end_time' => $obtain_end_time,
|
||||||
'income_end_time' => $income_end_time,
|
'income_end_time' => $income_end_time,
|
||||||
'state' => $state,
|
'state' => $state,
|
||||||
|
@ -17,6 +17,18 @@ class AchievementsCycle {
|
|||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getPeriod()
|
||||||
|
{
|
||||||
|
$metaList = self::getMetaList();
|
||||||
|
foreach ($metaList as $key => $meta) {
|
||||||
|
if (myself()->_getNowTime() >= strtotime($meta['obtain_start_time']) &&
|
||||||
|
myself()->_getNowTime() <= strtotime($meta['income_end_time'])) {
|
||||||
|
return $meta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $metaList[1];
|
||||||
|
}
|
||||||
|
|
||||||
public static function getMetaList()
|
public static function getMetaList()
|
||||||
{
|
{
|
||||||
if (!self::$metaList) {
|
if (!self::$metaList) {
|
||||||
|
@ -33,7 +33,7 @@ class HashRateService extends BaseService
|
|||||||
'modifytime' => myself()->_getNowTime(),
|
'modifytime' => myself()->_getNowTime(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$currentPeriod= \mt\AchievementsCycle::getCurrentPeriod();
|
$currentPeriod= \mt\AchievementsCycle::getPeriod();
|
||||||
if (myself()->_getDaySeconds(getXVal($this->hashRateData, 'modifytime', 0)) <
|
if (myself()->_getDaySeconds(getXVal($this->hashRateData, 'modifytime', 0)) <
|
||||||
myself()->_getDaySeconds(strtotime($currentPeriod['obtain_start_time']))) {
|
myself()->_getDaySeconds(strtotime($currentPeriod['obtain_start_time']))) {
|
||||||
$this->hashRateData = array(
|
$this->hashRateData = array(
|
||||||
|
@ -1220,6 +1220,7 @@ class TameBattleDataService extends BaseService {
|
|||||||
error_log("_addHashRateTask");
|
error_log("_addHashRateTask");
|
||||||
$hisBattleData = HashRateBattleData::getMyBattleData();
|
$hisBattleData = HashRateBattleData::getMyBattleData();
|
||||||
$currentPeriod= \mt\AchievementsCycle::getCurrentPeriod();
|
$currentPeriod= \mt\AchievementsCycle::getCurrentPeriod();
|
||||||
|
if ($currentPeriod){
|
||||||
if (!isset($hisBattleData['data'])) {
|
if (!isset($hisBattleData['data'])) {
|
||||||
$hisBattleData['data'] = array(
|
$hisBattleData['data'] = array(
|
||||||
'pvpData' => array(),
|
'pvpData' => array(),
|
||||||
@ -1256,6 +1257,7 @@ class TameBattleDataService extends BaseService {
|
|||||||
}
|
}
|
||||||
HashRateBattleData::add(json_encode($hisBattleData));
|
HashRateBattleData::add(json_encode($hisBattleData));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function applyEx(&$battleData)
|
private function applyEx(&$battleData)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user