diff --git a/server/game2006service/tasks/factory.js b/server/game2006service/tasks/factory.js index 0ff3a34b..8345ea4d 100644 --- a/server/game2006service/tasks/factory.js +++ b/server/game2006service/tasks/factory.js @@ -8,6 +8,7 @@ function add(name) { function init() { add('fragment'); add('damping'); + add('season'); } exports.init = init; diff --git a/server/game2006service/tasks/season.js b/server/game2006service/tasks/season.js new file mode 100644 index 00000000..0da9c51c --- /dev/null +++ b/server/game2006service/tasks/season.js @@ -0,0 +1,32 @@ +const app = require('j7/app'); +const utils = require('j7/utils'); +const metaFactory = require('../metadata/factory'); + +const constant = require('../constant'); + +class Season { + async start() { + while (true) { + await this.doRoutine(utils.getUtcTime()); + const nowTime = utils.getUtcTime(); + const daySeconds = utils.getDaySeconds(nowTime, constant.TIME_ZONE); + const sleepTime = daySeconds + 3600 * 24 - nowTime; + await utils.sleep(sleepTime*1000); + } + } + + async doRoutine(nowTime) { + try { + + } + catch(err) { + console.log(err); + } + } +} + +function init() { + (new Season()).start(); +} + +exports.init = init; \ No newline at end of file diff --git a/webapp/controller/GuideController.class.php b/webapp/controller/GuideController.class.php index 6fbf1ab8..2ea9b723 100644 --- a/webapp/controller/GuideController.class.php +++ b/webapp/controller/GuideController.class.php @@ -6,12 +6,40 @@ class GuideController extends BaseAuthedController { public function getData() { - + $row = SqlHelper::ormSelectOne( + $this->_getSelfMysql(), + 't_guide_data', + array( + 'account_id' => $this->_getAccountId() + ) + ); + echo json_encode(array( + 'errcode' => 0, + 'errmsg' => "OK", + 'data' => $row ? $row['data'] : null + )); } public function setData() { - + $data = getReqVal('data', ''); + SqlHelper::upsert( + $this->_getSelfMysql(), + 't_guide_data', + array( + 'account_id' => $this->_getAccountId(), + ), + array( + 'data' => $data, + 'modifytime' => $this->_getNowTime(), + ), + array( + 'account_id' => $this->_getAccountId(), + 'data' => $data, + 'createtime' => $this->_getNowTime(), + 'modifytime' => $this->_getNowTime() + ) + ); } } diff --git a/webapp/controller/RankingController.class.php b/webapp/controller/RankingController.class.php index 234e223c..f4cfbebb 100644 --- a/webapp/controller/RankingController.class.php +++ b/webapp/controller/RankingController.class.php @@ -35,6 +35,7 @@ class RankingController extends BaseAuthedController { $rank_status = $this->_getV(TN_RANK_STATUS, 0 ); $is_rank = $this->_getV(TN_RANK_STATUS, 1 ); + $is_rank = 0; $this->_rspData(array( 'status' => $rank_status, // 0:常规状态 1:引导初始排位 2:赛季初,需结算上个赛季 'is_rank' => $is_rank //赛季是否空挡期