From a0593a21da437f94f7430c3c9741928cbe008969 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Tue, 23 Apr 2024 20:34:45 +0800 Subject: [PATCH] 1 --- doc/Other.py | 18 +-- .../gamedb2006_migrate_231228_01.sql | 0 .../gamedb2006_migrate_240129_01.sql | 0 .../gamedb2006_migrate_240201_01.sql | 0 .../gamedb2006_migrate_240305_01.sql | 0 sql/gamedb.sql | 4 + sql/gamedb2006_migrate_240423_01.sql | 11 ++ webapp/bootstrap/constant.php | 1 + webapp/controller/OtherController.class.php | 115 ++++++++++++------ webapp/services/HashRateService.php | 1 + 10 files changed, 108 insertions(+), 42 deletions(-) rename sql/{ => archived}/gamedb2006_migrate_231228_01.sql (100%) rename sql/{ => archived}/gamedb2006_migrate_240129_01.sql (100%) rename sql/{ => archived}/gamedb2006_migrate_240201_01.sql (100%) rename sql/{ => archived}/gamedb2006_migrate_240305_01.sql (100%) create mode 100644 sql/gamedb2006_migrate_240423_01.sql diff --git a/doc/Other.py b/doc/Other.py index 44978eab..d77cfc4c 100644 --- a/doc/Other.py +++ b/doc/Other.py @@ -11,17 +11,11 @@ class Other(object): 'url': 'webapp/index.php?c=Other&a=tag', 'params': [ _common.ReqHead(), - ['param', '0', '1:任务 2:碎片'], + ['types', '', '红点类型(!!!注意由于红点的计算量较大,最好并发分批取红点状态)","分割 1:英雄 2:芯片 3:背包 4:签到 5:算力'], ], 'response': [ _common.RspHead(), - ['!data', [ - ['mission',0,'任务: 1 提示, 0 不提示'], - ['piece',[ - ['hero',0,'英雄碎片: 1 提示, 0 不提示'], - ['gun',0,'枪械碎片: 1 提示, 0 不提示'], - ],'碎片'] - ], '提示信息'], + ['!list', [Tag()], '红点列表'] ] }, { @@ -77,3 +71,11 @@ class Other(object): ] }, ] + +class Tag(object): + + def __init__(self): + self.fields = [ + ['type', 0, '红点类型'], + ['state', 0, '红点状态 0:无 1:有'], + ] diff --git a/sql/gamedb2006_migrate_231228_01.sql b/sql/archived/gamedb2006_migrate_231228_01.sql similarity index 100% rename from sql/gamedb2006_migrate_231228_01.sql rename to sql/archived/gamedb2006_migrate_231228_01.sql diff --git a/sql/gamedb2006_migrate_240129_01.sql b/sql/archived/gamedb2006_migrate_240129_01.sql similarity index 100% rename from sql/gamedb2006_migrate_240129_01.sql rename to sql/archived/gamedb2006_migrate_240129_01.sql diff --git a/sql/gamedb2006_migrate_240201_01.sql b/sql/archived/gamedb2006_migrate_240201_01.sql similarity index 100% rename from sql/gamedb2006_migrate_240201_01.sql rename to sql/archived/gamedb2006_migrate_240201_01.sql diff --git a/sql/gamedb2006_migrate_240305_01.sql b/sql/archived/gamedb2006_migrate_240305_01.sql similarity index 100% rename from sql/gamedb2006_migrate_240305_01.sql rename to sql/archived/gamedb2006_migrate_240305_01.sql diff --git a/sql/gamedb.sql b/sql/gamedb.sql index abe7c054..899817db 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -174,6 +174,7 @@ CREATE TABLE `t_hero` ( `wealth_attr` mediumblob COMMENT '财富值属性', `seal_type` int(11) NOT NULL DEFAULT '0' COMMENT '0:未封存 1:已封存', `unseal_time` int(11) NOT NULL DEFAULT '0' COMMENT '解开封时间', + `is_new` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0:展示红点 1:不用展示 ', PRIMARY KEY (`idx`), UNIQUE KEY `token_id` (`token_id`), @@ -220,6 +221,7 @@ CREATE TABLE `t_bag` ( `rand_attr` mediumblob COMMENT '随机属性', `today_get_gold` bigint NOT NULL DEFAULT '0' COMMENT '金币', `last_get_gold_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后获取金币的时间', + `is_new` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0:展示红点 1:不用展示 ', `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`idx`), @@ -256,8 +258,10 @@ CREATE TABLE `t_chip` ( `activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活', `quality` int(11) NOT NULL DEFAULT '0' COMMENT '品阶', `wealth_attr` mediumblob COMMENT '财富值属性', + `is_new` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0:展示红点 1:不用展示 ', `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), UNIQUE KEY `token_id` (`token_id`), KEY `item_id` (`item_id`), diff --git a/sql/gamedb2006_migrate_240423_01.sql b/sql/gamedb2006_migrate_240423_01.sql new file mode 100644 index 00000000..286e13c3 --- /dev/null +++ b/sql/gamedb2006_migrate_240423_01.sql @@ -0,0 +1,11 @@ +begin; + +alter table t_hero add column `is_new` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0:展示红点 1:不用展示 '; +alter table t_chip add column `is_new` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0:展示红点 1:不用展示 '; +alter table t_bag add column `is_new` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0:展示红点 1:不用展示 '; + + + +insert into version (version) values(2024042301); + +commit; diff --git a/webapp/bootstrap/constant.php b/webapp/bootstrap/constant.php index 7d87b45a..e2a3d17e 100644 --- a/webapp/bootstrap/constant.php +++ b/webapp/bootstrap/constant.php @@ -44,6 +44,7 @@ define('TN_TOTAL_DIAMOND_CONSUME', 8016);//钻石消耗 define('TN_TOTAL_CEG_CONSUME', 8017);//ceg消耗 define('TN_TOTAL_GATHER_GOLD', 8018);//收集金币 define('TN_TOTAL_LOOT_TIMES', 8019);//掉落包操作计数 0总计数 1循环计数 +define('TN_TOTAL_HASH_RATE_REWARD', 8020); define('TN_DAILY_BEGIN', 9001); define('TN_DAILY_LOGINS', 9001); diff --git a/webapp/controller/OtherController.class.php b/webapp/controller/OtherController.class.php index cde447e4..4468850f 100644 --- a/webapp/controller/OtherController.class.php +++ b/webapp/controller/OtherController.class.php @@ -6,6 +6,7 @@ require_once('mt/HashRateCommon.php'); require_once('mt/ActivityRewards.php'); require_once('mt/MapMode.php'); require_once('mt/ServerTaskTime.php'); +require_once('mt/AchievementsCycle.php'); require_once('models/Mission.php'); require_once('models/Fragment.php'); @@ -16,6 +17,7 @@ require_once('models/Staking.php'); require_once('models/SeasonRanking.php'); require_once('models/RewardsCec.php'); require_once('models/GlobalData.php'); +require_once('models/HashRate.php'); use models\SignLog; use phpcommon\SqlHelper; @@ -27,50 +29,95 @@ use models\Staking; use models\SeasonRanking; use models\RewardsCec; use models\GlobalData; +use models\HashRate; class OtherController extends BaseAuthedController { - const MISSION = 1; - const PIECE = 2; + const HERO = 1; + const CHIP = 2; + const BAG = 3; + const SIGN = 4; + const HASH_RATE = 5; public function tag() { - $param = getReqVal('param', 0); - $req = array( - 'mission' => 0, - 'piece' => array(), - ); - switch ($param){ - case self::MISSION : { - $userInfo = $this->_safeGetOrmUserInfo(); -// $currRankSeasonMeta = mt\RankSeason::getCurrentSeason(); -// $seasonDb = Season::find($currRankSeasonMeta['id']); - $missionService = new services\MissionService(); - $missionService->init($userInfo, null);; - $missionMetaList = mt\Task::getCustomTypeMetaList(1, $missionService); - $missionHash = Mission::allToHash(); - foreach ($missionMetaList as $missionMeta) { - $missionDb = getXVal($missionHash, $missionMeta['id'], null); - $missionDto = $missionService->getMissionDto('', '', $missionDb, $missionMeta); - if ($missionDto['state'] == Mission::RECEIVEABLE_STATE){ - $req['mission'] = 1; - break; + $types = getReqVal('types', 0); + $typeArr = explode(",",$types); + $list = array(); + foreach ($typeArr as $type){ + $state = 0; + switch ($type){ + case self::HERO : { + $res = myself()->_getSelfMysql()->execQueryOne("SELECT COUNT(idx) as totalNum FROM t_hero WHERE account_id=:account AND is_new=:is_new LIMIT 1",array( + 'account' => myself()->_getAccountId(), + 'is_new' => 0, + )); + if ($res['totalNum']){ + $state = 1; } + array_push($list,array( + 'type' => self::HERO, + 'state' => $state, + )); + } + break; + case self::CHIP :{ + $res = myself()->_getSelfMysql()->execQueryOne("SELECT COUNT(idx) as totalNum FROM t_chip WHERE account_id=:account AND is_new=:is_new LIMIT 1",array( + 'account' => myself()->_getAccountId(), + 'is_new' => 0, + )); + if ($res['totalNum']){ + $state = 1; + } + array_push($list,array( + 'type' => self::CHIP, + 'state' => $state, + )); + } + break; + case self::BAG :{ + $res = myself()->_getSelfMysql()->execQueryOne("SELECT COUNT(idx) as totalNum FROM t_bag WHERE account_id=:account AND is_new=:is_new LIMIT 1",array( + 'account' => myself()->_getAccountId(), + 'is_new' => 0, + )); + if ($res['totalNum']){ + $state = 1; + } + array_push($list,array( + 'type' => self::BAG, + 'state' => $state, + )); + } + break; + case self::SIGN :{ + $signDb = SignLog::find(); + if ($signDb && $signDb['is_receive'] == 0){ + $state = 1; + } + array_push($list,array( + 'type' => self::SIGN, + 'state' => $state, + )); + } + break; + case self::HASH_RATE :{ + $currentPeriod= \mt\AchievementsCycle::getCurrentPeriod(); + if ($currentPeriod){ + $myHashRate = HashRate::getMyHashRate($currentPeriod['id']); + $rewardNum = myself()->_getV(TN_TOTAL_HASH_RATE_REWARD,$currentPeriod['id']); + if ($rewardNum>0 && $rewardNum>$myHashRate){ + $state = 1; + } + } + array_push($list,array( + 'type' => self::HASH_RATE, + 'state' => $state, + )); } } - break; - case self::PIECE : { - $req['piece'] = Fragment::isSatisfy(); - } - break; - default:{ - $req = array( - 'mission' => 0, - 'piece' => array(), - ); - } } + $this->_rspData(array( - 'data'=>$req + 'list'=>$list )); } diff --git a/webapp/services/HashRateService.php b/webapp/services/HashRateService.php index 1a786e01..18cddc55 100644 --- a/webapp/services/HashRateService.php +++ b/webapp/services/HashRateService.php @@ -182,6 +182,7 @@ class HashRateService extends BaseService 'modifytime' => myself()->_getNowTime() ); HashRate::add($fieldKv); + myself()->_incV(TN_TOTAL_HASH_RATE_REWARD,$currentPeriod['id'], $taskMate['Reward_quantity']); } } }