1
This commit is contained in:
commit
895a4557fa
@ -7,8 +7,8 @@ function add(name) {
|
|||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
add('season');
|
add('season');
|
||||||
add('dailyTask');
|
//add('dailyTask');
|
||||||
add('hourlyTask');
|
//add('hourlyTask');
|
||||||
add('rankings');
|
add('rankings');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,8 +13,12 @@ class Season {
|
|||||||
await this.doRoutine(utils.getUtcTime());
|
await this.doRoutine(utils.getUtcTime());
|
||||||
const nowTime = utils.getUtcTime();
|
const nowTime = utils.getUtcTime();
|
||||||
const daySeconds = utils.getDaySeconds(nowTime, constant.TIME_ZONE);
|
const daySeconds = utils.getDaySeconds(nowTime, constant.TIME_ZONE);
|
||||||
const sleepTime = daySeconds + 3600 * 24 - nowTime;
|
// const sleepTime = daySeconds + 3600 * 24 - nowTime;
|
||||||
console.log('Season.sleepTime:' + sleepTime, new Date(), sleepTime /60);
|
let sleepTime = 120;
|
||||||
|
if (utils.isOnlineEnv()) {
|
||||||
|
sleepTime = daySeconds + 3600 * 25 - nowTime;
|
||||||
|
}
|
||||||
|
console.log('Season.sleepTime:' + sleepTime, new Date(), sleepTime / 60);
|
||||||
await utils.sleep(sleepTime*1000);
|
await utils.sleep(sleepTime*1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,7 +116,7 @@ class Season {
|
|||||||
|
|
||||||
async getRecords(conn, lastIdx, limit) {
|
async getRecords(conn, lastIdx, limit) {
|
||||||
const {err, rows} = await conn.execQuery(
|
const {err, rows} = await conn.execQuery(
|
||||||
'select idx,account_id,channel,rank,score,createtime, score_modifytime from t_user where idx > ? order by idx LIMIT ?',
|
'select idx,account_id,`address`,channel,`rank`,`score`,createtime, score_modifytime from t_user where idx > ? order by idx LIMIT ?',
|
||||||
[
|
[
|
||||||
lastIdx,
|
lastIdx,
|
||||||
limit
|
limit
|
||||||
@ -139,7 +143,7 @@ class Season {
|
|||||||
|
|
||||||
// console.time("inserNewRecords");
|
// console.time("inserNewRecords");
|
||||||
for (let element of records) {
|
for (let element of records) {
|
||||||
if (element.score>=2800) {
|
// if (element.score>=2800) {
|
||||||
sorted.push(element);
|
sorted.push(element);
|
||||||
sorted.sort(function(a,b) {
|
sorted.sort(function(a,b) {
|
||||||
let r = b.score - a.score;
|
let r = b.score - a.score;
|
||||||
@ -151,7 +155,7 @@ class Season {
|
|||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
});
|
});
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
// if (sorted.length>10000) {
|
// if (sorted.length>10000) {
|
||||||
// sorted.length = 10000;
|
// sorted.length = 10000;
|
||||||
@ -170,11 +174,15 @@ class Season {
|
|||||||
async (element, index) => {
|
async (element, index) => {
|
||||||
let ranking = index+1;
|
let ranking = index+1;
|
||||||
let TopX = FormulaService.celTopX(ranking);
|
let TopX = FormulaService.celTopX(ranking);
|
||||||
let ponit = FormulaService.celUserRankingPoint(ranking,TopX).toFixed(0);
|
let ponit = 0;
|
||||||
|
if (element['score'] >= 2800){
|
||||||
|
ponit = FormulaService.celUserRankingPoint(ranking,TopX).toFixed(0);
|
||||||
|
}
|
||||||
await conn.insert(
|
await conn.insert(
|
||||||
't_season_ranking',
|
't_season_ranking',
|
||||||
[
|
[
|
||||||
['account_id', element['account_id']],
|
['account_id', element['account_id']],
|
||||||
|
['address', element['address']],
|
||||||
['channel', element['channel']],
|
['channel', element['channel']],
|
||||||
['rank', element['rank']],
|
['rank', element['rank']],
|
||||||
['score', element['score']],
|
['score', element['score']],
|
||||||
|
21
sql/game2006db_migrate_230823_01.sql
Normal file
21
sql/game2006db_migrate_230823_01.sql
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
CREATE TABLE `t_ranking_settlement_record` (
|
||||||
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
|
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||||
|
`state` int(11) NOT NULL DEFAULT '0' COMMENT '是否重置',
|
||||||
|
`last_rank` int(11) NOT NULL DEFAULT '0' COMMENT '上赛季段位',
|
||||||
|
`current_rank` int(11) NOT NULL DEFAULT '0' COMMENT '新段位',
|
||||||
|
`last_score` int(11) NOT NULL DEFAULT '0' COMMENT '上赛季段位分',
|
||||||
|
`current_score` int(11) NOT NULL DEFAULT '0' COMMENT '新段位分',
|
||||||
|
`awards` mediumblob COMMENT '奖励',
|
||||||
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
|
PRIMARY KEY (`idx`),
|
||||||
|
KEY `account_id` (`account_id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
|
||||||
|
|
||||||
|
insert into version (version) values(2023081501);
|
||||||
|
|
||||||
|
commit;
|
@ -808,6 +808,7 @@ DROP TABLE IF EXISTS `t_season_ranking`;
|
|||||||
CREATE TABLE `t_season_ranking` (
|
CREATE TABLE `t_season_ranking` (
|
||||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
||||||
|
`address` varchar(60) COMMENT 'address',
|
||||||
`channel` int(11) NOT NULL DEFAULT '0' COMMENT 'channel',
|
`channel` int(11) NOT NULL DEFAULT '0' COMMENT 'channel',
|
||||||
`rank` int(11) NOT NULL DEFAULT '0' COMMENT '段位',
|
`rank` int(11) NOT NULL DEFAULT '0' COMMENT '段位',
|
||||||
`score` int(11) NOT NULL DEFAULT '0' COMMENT '积分',
|
`score` int(11) NOT NULL DEFAULT '0' COMMENT '积分',
|
||||||
@ -1615,3 +1616,18 @@ CREATE TABLE `t_hash_rate_reward` (
|
|||||||
KEY `account_id` (`account_id`)
|
KEY `account_id` (`account_id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
CREATE TABLE `t_ranking_settlement_record` (
|
||||||
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
|
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||||
|
`state` int(11) NOT NULL DEFAULT '0' COMMENT '是否重置',
|
||||||
|
`last_rank` int(11) NOT NULL DEFAULT '0' COMMENT '上赛季段位',
|
||||||
|
`current_rank` int(11) NOT NULL DEFAULT '0' COMMENT '新段位',
|
||||||
|
`last_score` int(11) NOT NULL DEFAULT '0' COMMENT '上赛季段位分',
|
||||||
|
`current_score` int(11) NOT NULL DEFAULT '0' COMMENT '新段位分',
|
||||||
|
`awards` mediumblob COMMENT '奖励',
|
||||||
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
|
PRIMARY KEY (`idx`),
|
||||||
|
KEY `account_id` (`account_id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
@ -100,8 +100,35 @@ class BagController extends BaseAuthedController {
|
|||||||
$this->_rspErr(4, 'The prop function has not been realized yet');
|
$this->_rspErr(4, 'The prop function has not been realized yet');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rename()
|
public function rename()
|
||||||
|
{
|
||||||
|
$itemDto = Bag::findByType(mt\Item::FUNC_TYPE, mt\Item::FUNC_RENAME_CARD_SUBTYPE);
|
||||||
|
if (!$itemDto || $itemDto['item_num'] < 0) {
|
||||||
|
$this->_rspErr(1, 'Not enough item');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$errCode = 0;
|
||||||
|
$errMsg = '';
|
||||||
|
$this->internalRename(getReqVal('name', ''), getReqVal('name_sign', ''), $errCode, $errMsg);
|
||||||
|
if ($errCode) {
|
||||||
|
$this->_rspErr($errCode, $errMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->_decItems(array(
|
||||||
|
array(
|
||||||
|
'item_id' => $itemDto['item_id'],
|
||||||
|
'item_num' => 1
|
||||||
|
)
|
||||||
|
));
|
||||||
|
$this->propertyChgService->addBagChg();
|
||||||
|
$this->propertyChgService->addUserChg();
|
||||||
|
$this->_rspData(array(
|
||||||
|
'property_chg' => $this->propertyChgService->toDto(),
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function oldRename()
|
||||||
{
|
{
|
||||||
$itemDto = Bag::findByType(mt\Item::FUNC_TYPE, mt\Item::FUNC_RENAME_CARD_SUBTYPE);
|
$itemDto = Bag::findByType(mt\Item::FUNC_TYPE, mt\Item::FUNC_RENAME_CARD_SUBTYPE);
|
||||||
$userInfo = $this->_getOrmUserInfo();
|
$userInfo = $this->_getOrmUserInfo();
|
||||||
|
@ -9,10 +9,12 @@ require_once('mt/RankSeason.php');
|
|||||||
|
|
||||||
require_once('models/RealtimeData.php');
|
require_once('models/RealtimeData.php');
|
||||||
require_once('models/Season.php');
|
require_once('models/Season.php');
|
||||||
|
require_once('models/RankingSetRecord.php');
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
|
|
||||||
use models\RealtimeData;
|
use models\RealtimeData;
|
||||||
use models\Season;
|
use models\Season;
|
||||||
|
use models\RankingSetRecord;
|
||||||
|
|
||||||
class DailyRequestController extends BaseAuthedController {
|
class DailyRequestController extends BaseAuthedController {
|
||||||
private $awardService = null;
|
private $awardService = null;
|
||||||
@ -79,9 +81,12 @@ class DailyRequestController extends BaseAuthedController {
|
|||||||
*/
|
*/
|
||||||
public function battleRankingSeasonSettlement(){
|
public function battleRankingSeasonSettlement(){
|
||||||
$currSeasonMeta = mt\RankSeason::getCurrentSeason();
|
$currSeasonMeta = mt\RankSeason::getCurrentSeason();
|
||||||
|
$lastSeasonMeta = mt\RankSeason::getLastSeason();
|
||||||
$season = RealtimeData::getRankSeason();
|
$season = RealtimeData::getRankSeason();
|
||||||
if ($currSeasonMeta && $currSeasonMeta['id'] > $season) {
|
|
||||||
if ($season > 1){
|
// if ($currSeasonMeta && $currSeasonMeta['id'] > $season) {
|
||||||
|
if (!$currSeasonMeta && $lastSeasonMeta && $lastSeasonMeta['id'] > $season) {
|
||||||
|
if ($lastSeasonMeta > 1){
|
||||||
$SeasonMeta = mt\RankSeason::get($season-1);
|
$SeasonMeta = mt\RankSeason::get($season-1);
|
||||||
$time = strtotime($SeasonMeta['start_time']);
|
$time = strtotime($SeasonMeta['start_time']);
|
||||||
$rows = myself()->_getMysql('')->execQuery(
|
$rows = myself()->_getMysql('')->execQuery(
|
||||||
@ -116,15 +121,25 @@ class DailyRequestController extends BaseAuthedController {
|
|||||||
$award = Season::seasonReward($currRankMeta);
|
$award = Season::seasonReward($currRankMeta);
|
||||||
myself()->switchAccount($row['account_id']);
|
myself()->switchAccount($row['account_id']);
|
||||||
myself()->_addItems($award, null, $this->propertyChgService);
|
myself()->_addItems($award, null, $this->propertyChgService);
|
||||||
|
$data = array(
|
||||||
|
'state' => 1,
|
||||||
|
'last_rank' => $row['rank'],
|
||||||
|
'current_rank' => $dropRankMeta['id'],
|
||||||
|
'last_score' => $row['score'],
|
||||||
|
'current_score' => $dropRankMeta['rank_score'],
|
||||||
|
'awards' => json_encode($award),
|
||||||
|
);
|
||||||
|
RankingSetRecord::upsert($data);
|
||||||
myself()->_updateUserInfo(array(
|
myself()->_updateUserInfo(array(
|
||||||
'last_season_id' => $currSeasonMeta['id'],
|
'last_season_id' => $lastSeasonMeta['id'],
|
||||||
'rank' => $dropRankMeta['id'],
|
'rank' => $dropRankMeta['id'],
|
||||||
'score' => $dropRankMeta['rank_score'],
|
'score' => $dropRankMeta['rank_score'],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
error_log("DailyRequestController : Battle Ranking Season ".$season." Settlement Success !" . " Request Time : ". date('Y-M-D h:i:s',time()));
|
error_log("DailyRequestController : Battle Ranking Season ".$season." Settlement Success !" . " Request Time : ". date('Y-M-D h:i:s',time()));
|
||||||
RealtimeData::setRankSeason($currSeasonMeta['id']);
|
RealtimeData::setRankSeason($lastSeasonMeta['id']);
|
||||||
}
|
}
|
||||||
|
$this->_rspOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -8,12 +8,14 @@ require_once('models/Mission.php');
|
|||||||
require_once('models/Fragment.php');
|
require_once('models/Fragment.php');
|
||||||
require_once('models/Season.php');
|
require_once('models/Season.php');
|
||||||
require_once('models/SignLog.php');
|
require_once('models/SignLog.php');
|
||||||
|
require_once('models/RankingSetRecord.php');
|
||||||
|
|
||||||
use models\SignLog;
|
use models\SignLog;
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
use models\Mission;
|
use models\Mission;
|
||||||
use models\Fragment;
|
use models\Fragment;
|
||||||
use models\Season;
|
use models\Season;
|
||||||
|
use models\RankingSetRecord;
|
||||||
class OtherController extends BaseAuthedController {
|
class OtherController extends BaseAuthedController {
|
||||||
const MISSION = 1;
|
const MISSION = 1;
|
||||||
const PIECE = 2;
|
const PIECE = 2;
|
||||||
@ -97,4 +99,18 @@ class OtherController extends BaseAuthedController {
|
|||||||
'data'=>$data
|
'data'=>$data
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRankingState(){
|
||||||
|
$recordDb = RankingSetRecord::find();
|
||||||
|
$data = array(
|
||||||
|
'state' => 0 ,
|
||||||
|
);
|
||||||
|
if ($recordDb){
|
||||||
|
$data = RankingSetRecord::toDto($recordDb);;
|
||||||
|
}
|
||||||
|
$this->_rspData(array(
|
||||||
|
'data'=>$data
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ class SeasonController extends BaseAuthedController {
|
|||||||
private $userInfo = null;
|
private $userInfo = null;
|
||||||
private $currRankSeasonMeta = null;
|
private $currRankSeasonMeta = null;
|
||||||
private $myRankedInfo = null;
|
private $myRankedInfo = null;
|
||||||
|
private $rankingState = true;
|
||||||
|
|
||||||
private $redis_key_account = 'account';
|
private $redis_key_account = 'account';
|
||||||
private $redis_key_ranking = 'ranking';
|
private $redis_key_ranking = 'ranking';
|
||||||
@ -40,10 +41,12 @@ class SeasonController extends BaseAuthedController {
|
|||||||
parent::_handlePre();
|
parent::_handlePre();
|
||||||
$this->currRankSeasonMeta = mt\RankSeason::getCurrentSeason();
|
$this->currRankSeasonMeta = mt\RankSeason::getCurrentSeason();
|
||||||
if (!$this->currRankSeasonMeta) {
|
if (!$this->currRankSeasonMeta) {
|
||||||
|
$this->rankingState = false;
|
||||||
$this->currRankSeasonMeta = mt\RankSeason::getLastSeason();
|
$this->currRankSeasonMeta = mt\RankSeason::getLastSeason();
|
||||||
}
|
}
|
||||||
if (!$this->currRankSeasonMeta){
|
if (!$this->currRankSeasonMeta) {
|
||||||
$this->_rspErr(10,'server internal error');
|
$this->_rspErr(10, 'server internal error');
|
||||||
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->propertyChgService = new services\PropertyChgService();
|
// $this->propertyChgService = new services\PropertyChgService();
|
||||||
@ -59,7 +62,7 @@ class SeasonController extends BaseAuthedController {
|
|||||||
'score' => $this->userInfo['score'],
|
'score' => $this->userInfo['score'],
|
||||||
'point' => 0,
|
'point' => 0,
|
||||||
);
|
);
|
||||||
if ($this->redisService->exists(RANKING_KEY.$this->redis_key_account)){
|
if ($this->rankingState && $this->redisService->exists(RANKING_KEY.$this->redis_key_account)){
|
||||||
$myInfo = $this->userInfo;
|
$myInfo = $this->userInfo;
|
||||||
if ($this->redisService->hexists(RANKING_KEY.$this->redis_key_account,$myInfo['account_id'])){
|
if ($this->redisService->hexists(RANKING_KEY.$this->redis_key_account,$myInfo['account_id'])){
|
||||||
$redisData= json_decode($this->redisService->hget(RANKING_KEY.$this->redis_key_account,$myInfo['account_id']),true);//$myInfo['account_id']
|
$redisData= json_decode($this->redisService->hget(RANKING_KEY.$this->redis_key_account,$myInfo['account_id']),true);//$myInfo['account_id']
|
||||||
@ -96,13 +99,14 @@ class SeasonController extends BaseAuthedController {
|
|||||||
'season_reward' => Season::seasonReward($rankMeta),
|
'season_reward' => Season::seasonReward($rankMeta),
|
||||||
'current_point' => $this->myRankedInfo['point'],
|
'current_point' => $this->myRankedInfo['point'],
|
||||||
'total_point' => $totalPoint,
|
'total_point' => $totalPoint,
|
||||||
|
'celCecVal' => $totalPoint * 0.15,
|
||||||
);
|
);
|
||||||
$this->_rspData(['info'=>$info]);
|
$this->_rspData(['info'=>$info]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRankingInfo(){
|
public function getRankingInfo(){
|
||||||
$rankList = array();
|
$rankList = array();
|
||||||
if ($this->redisService->exists(RANKING_KEY.$this->redis_key_ranking)){
|
if ( $this->rankingState && $this->redisService->exists(RANKING_KEY.$this->redis_key_ranking)){
|
||||||
for ($i=1;$i<=100;$i++){
|
for ($i=1;$i<=100;$i++){
|
||||||
if ($this->redisService->hexists(RANKING_KEY.$this->redis_key_ranking,$i)){
|
if ($this->redisService->hexists(RANKING_KEY.$this->redis_key_ranking,$i)){
|
||||||
$redisData = json_decode($this->redisService->hget(RANKING_KEY.$this->redis_key_ranking,$i),true);
|
$redisData = json_decode($this->redisService->hget(RANKING_KEY.$this->redis_key_ranking,$i),true);
|
||||||
@ -167,11 +171,13 @@ class SeasonController extends BaseAuthedController {
|
|||||||
public function getSeasonPoint(){
|
public function getSeasonPoint(){
|
||||||
$list = array();
|
$list = array();
|
||||||
SeasonRanking::getSeasonList(function ($row) use (&$list) {
|
SeasonRanking::getSeasonList(function ($row) use (&$list) {
|
||||||
|
if ($row['ranking_point'] > 0){
|
||||||
array_push($list,array(
|
array_push($list,array(
|
||||||
'season' => $row['season'],
|
'season' => $row['season'],
|
||||||
'ranking' => $row['ranking'],
|
'ranking' => $row['ranking'],
|
||||||
'ranking_point' => $row['ranking_point'],
|
'ranking_point' => $row['ranking_point'],
|
||||||
));
|
));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
'data' => $list,
|
'data' => $list,
|
||||||
|
81
webapp/models/RankingSetRecord.php
Normal file
81
webapp/models/RankingSetRecord.php
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace models;
|
||||||
|
|
||||||
|
use mt;
|
||||||
|
use phpcommon;
|
||||||
|
use phpcommon\SqlHelper;
|
||||||
|
class RankingSetRecord
|
||||||
|
{
|
||||||
|
public static function find(){
|
||||||
|
$row = SqlHelper::ormSelectOne
|
||||||
|
(myself()->_getSelfMysql(),
|
||||||
|
't_ranking_settlement_record',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (!$row){
|
||||||
|
$row = array();
|
||||||
|
}
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function toDto($row){
|
||||||
|
$data = array(
|
||||||
|
'state' => $row['state'],
|
||||||
|
'last_rank' => $row['last_rank'],
|
||||||
|
'current_rank' => $row['current_rank'],
|
||||||
|
'last_score' => $row['last_score'],
|
||||||
|
'current_score' => $row['current_score'],
|
||||||
|
'awards' => json_decode($row['awards']),
|
||||||
|
);
|
||||||
|
self::updateState();
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function updateState(){
|
||||||
|
SqlHelper::update
|
||||||
|
(myself()->_getSelfMysql(),
|
||||||
|
't_ranking_settlement_record',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'state' => 0,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function upsert($fieldKv){
|
||||||
|
SqlHelper::upsert
|
||||||
|
(myself()->_getSelfMysql(),
|
||||||
|
't_ranking_settlement_record',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'state' => $fieldKv['state'],
|
||||||
|
'last_rank' => $fieldKv['last_rank'],
|
||||||
|
'current_rank' => $fieldKv['current_rank'],
|
||||||
|
'last_score' => $fieldKv['last_score'],
|
||||||
|
'current_score' => $fieldKv['current_score'],
|
||||||
|
'awards' => $fieldKv['awards'],
|
||||||
|
'modifytime' => myself()->_getNowTime(),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'state' => $fieldKv['state'],
|
||||||
|
'last_rank' => $fieldKv['last_rank'],
|
||||||
|
'current_rank' => $fieldKv['current_rank'],
|
||||||
|
'last_score' => $fieldKv['last_score'],
|
||||||
|
'current_score' => $fieldKv['current_score'],
|
||||||
|
'awards' => $fieldKv['awards'],
|
||||||
|
'createtime' => myself()->_getNowTime(),
|
||||||
|
'modifytime' => myself()->_getNowTime()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -91,7 +91,7 @@ class RealtimeData extends BaseModel {
|
|||||||
//获取排位的赛季
|
//获取排位的赛季
|
||||||
public static function getRankSeason(){
|
public static function getRankSeason(){
|
||||||
$db = self::internalGet('ranking_season');
|
$db = self::internalGet('ranking_season');
|
||||||
return max(1, $db ? $db['value1']: 0);
|
return max(0, $db ? $db['value1']: 0);
|
||||||
}
|
}
|
||||||
//设置排位的赛季
|
//设置排位的赛季
|
||||||
public static function setRankSeason($value){
|
public static function setRankSeason($value){
|
||||||
|
@ -24,12 +24,11 @@ class RankSeason
|
|||||||
$metaList = self::getMetaList();
|
$metaList = self::getMetaList();
|
||||||
$count = count($metaList);
|
$count = count($metaList);
|
||||||
foreach ($metaList as $key => $meta) {
|
foreach ($metaList as $key => $meta) {
|
||||||
if (myself()->_getNowTime() >= strtotime($metaList[$key]['end_time']) &&
|
|
||||||
myself()->_getNowTime() <= strtotime($metaList[$key+1]['start_time'])) {
|
|
||||||
return $meta;
|
|
||||||
}
|
|
||||||
if ($key == $count && myself()->_getNowTime() >= strtotime($meta['end_time'])) {
|
if ($key == $count && myself()->_getNowTime() >= strtotime($meta['end_time'])) {
|
||||||
return $meta;
|
return $meta;
|
||||||
|
}elseif (myself()->_getNowTime() >= strtotime($metaList[$key]['end_time']) &&
|
||||||
|
myself()->_getNowTime() <= strtotime($metaList[$key+1]['start_time'])) {
|
||||||
|
return $meta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return array();
|
return array();
|
||||||
@ -73,6 +72,5 @@ class RankSeason
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected static $metaList;
|
protected static $metaList;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user