From 67d424b199888113a4ae519a02c2729224104aad Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Tue, 13 Aug 2024 11:02:28 +0800 Subject: [PATCH 1/5] 1 --- webapp/bootstrap/config_loader.php | 7 +++++++ webapp/controller/AnncController.class.php | 20 +++++++++++++++++++- webapp/controller/BaseController.class.php | 17 +++++++++++++++++ webapp/services/HashRateService.php | 5 +++-- 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/webapp/bootstrap/config_loader.php b/webapp/bootstrap/config_loader.php index f293e7c6..9400e20a 100644 --- a/webapp/bootstrap/config_loader.php +++ b/webapp/bootstrap/config_loader.php @@ -8,6 +8,7 @@ $g_conf_relation_mysql_cluster = require('../config/game2006relation.mysql.clust $g_conf_mail_mysql_cluster = require('../config/mail.mysql.cluster.php'); $g_conf_log_mysql_cluster = require('../config/log.mysql.cluster.php'); $g_conf_redis_cluster = require('../config/game2006api.redis.cluster.php'); +$g_conf_confdb_mysql_cluster = require('../config/confdb.mysql.cluster.php'); $g_metatables = array(); function checkMysqlConfig() @@ -89,6 +90,12 @@ function getLogMysqlConfig() return $g_conf_log_mysql_cluster; } +function getConfDbMysqlConfig() +{ + global $g_conf_confdb_mysql_cluster; + return $g_conf_confdb_mysql_cluster; +} + function getServerSwitchConfig() { global $g_conf_server_switch_cluster; diff --git a/webapp/controller/AnncController.class.php b/webapp/controller/AnncController.class.php index e11a2e4d..d91df85d 100644 --- a/webapp/controller/AnncController.class.php +++ b/webapp/controller/AnncController.class.php @@ -1,10 +1,28 @@ _rspData(require('../config/annc.php')); +// myself()->_rspData(require('../config/annc.php')); + $data = array(); + $row = myself()->_getConfDbMysql()->execQueryOne( + 'SELECT * FROM t_game_annc WHERE begin_time < :star_time AND end_time > :end_time AND is_open = :open_state', + array( + ':star_time' => myself()->_getNowTime(), + ':end_time' => myself()->_getNowTime(), + ':open_state' => 1, + ) + ); + if ($row){ + $data = array( + 'id' => $row['uniid'], + 'title' => $row['title'], + 'content' => $row['content'] + ); + } + myself()->_rspData($data); } } diff --git a/webapp/controller/BaseController.class.php b/webapp/controller/BaseController.class.php index b154086c..cb8e8325 100644 --- a/webapp/controller/BaseController.class.php +++ b/webapp/controller/BaseController.class.php @@ -10,6 +10,7 @@ class BaseController { private $relationDbConn = null; private $mailDbConn = null; private $logDbConn = null; + private $confDbConn = null; private $timeOffset = 0; private $moduleHash = array(); @@ -208,6 +209,22 @@ class BaseController { return $this->logDbConn; } + public function _getConfDbMysql() + { + if ($this->confDbConn) { + return $this->confDbConn; + } + $mysql_conf = getConfDbMysqlConfig(); + $this->confDbConn = new phpcommon\Mysql(array( + 'host' => $mysql_conf['host'], + 'port' => $mysql_conf['port'], + 'user' => $mysql_conf['user'], + 'passwd' => $mysql_conf['passwd'], + 'dbname' => $mysql_conf['dbname'], + )); + return $this->confDbConn; + } + public function _getRelationDbMysql() { if ($this->relationDbConn) { diff --git a/webapp/services/HashRateService.php b/webapp/services/HashRateService.php index f5434b5d..11ad2ddd 100644 --- a/webapp/services/HashRateService.php +++ b/webapp/services/HashRateService.php @@ -237,7 +237,7 @@ class HashRateService extends BaseService ':account' => myself()->_getAccountId(), ':address' => myself()->_getAddress(), ':type' => 0, - ':star_time' => $task['createtime'], + ':star_time' => $task['modifytime'], ) ); $taskDto['current'] = $row[0]; @@ -280,7 +280,7 @@ class HashRateService extends BaseService array( ':account' => myself()->_getAccountId(), ':activated' => 1, - ':star_time' => $task['createtime'], + ':star_time' => $task['modifytime'], ) ); $taskDto['current'] = $row[0]; @@ -408,6 +408,7 @@ class HashRateService extends BaseService foreach ($taskList as &$task){ if ($task['task_id'] == $taskMate['id']){ $task['current'] = 0; + $task['modifytime'] = myself()->_getNowTime(); } } $this->hashRateTask['task'.$taskMate['task_type']] = $taskList; From 56394d840bf9a622f0fd5075df84807e69c9d7f8 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Tue, 13 Aug 2024 14:48:47 +0800 Subject: [PATCH 2/5] 1 --- webapp/controller/HeroController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/HeroController.class.php b/webapp/controller/HeroController.class.php index 45bd9639..e549c924 100644 --- a/webapp/controller/HeroController.class.php +++ b/webapp/controller/HeroController.class.php @@ -111,7 +111,7 @@ class HeroController extends BaseAuthedController { $res= Hero::addSyntheticHero($heroMeta,2); if ($res){ $lastIdx = SqlHelper::getLastInsertId( myself()->_getSelfMysql()); - $awardService->addChip($itemId,$lastIdx); + $awardService->addHero($itemId,$lastIdx); } } $propertyChgService->addHeroChg(); From 86a61c5c7c8e7dbc235f0ad55463205fec1bfc63 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Tue, 13 Aug 2024 15:03:03 +0800 Subject: [PATCH 3/5] 1 --- webapp/controller/HeroController.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/controller/HeroController.class.php b/webapp/controller/HeroController.class.php index e549c924..d87cfd4f 100644 --- a/webapp/controller/HeroController.class.php +++ b/webapp/controller/HeroController.class.php @@ -106,12 +106,13 @@ class HeroController extends BaseAuthedController { $this->_decItems($costItems); $propertyChgService = new services\PropertyChgService(); $awardService = new services\AwardService(); + $propertyChgService->addBagChg(); for ($i=0; $i<$number; $i++){ $res= Hero::addSyntheticHero($heroMeta,2); if ($res){ $lastIdx = SqlHelper::getLastInsertId( myself()->_getSelfMysql()); - $awardService->addHero($itemId,$lastIdx); + $awardService->addHero($heroMeta['id'],$lastIdx); } } $propertyChgService->addHeroChg(); From a2b448ed1d89d77e67cf888ffae058d7904e362e Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Tue, 13 Aug 2024 15:10:52 +0800 Subject: [PATCH 4/5] 1 --- webapp/services/AddItemsService.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/webapp/services/AddItemsService.php b/webapp/services/AddItemsService.php index 2d222ea5..c6ab6607 100644 --- a/webapp/services/AddItemsService.php +++ b/webapp/services/AddItemsService.php @@ -16,6 +16,18 @@ use models\Avatar; use phpcommon\SqlHelper; class AddItemsService extends BaseService { + + private function _isAddAwardItem($itemId){ + if (!in_array($itemId,array( + Item::HERO_TYPE, + Item::CHIP_TYPE, + Item::APPOINT_PROP_TYPE + ))){ + return true; + } + return false; + } + public function addItems($items, $awardService, $propertyService){ myself()->_checkS(); $heads = array(); @@ -23,7 +35,7 @@ class AddItemsService extends BaseService foreach ($items as $item) { //道具产出埋点 LogService::productItem($item); - if ($awardService){ + if ($awardService && $this->_isAddAwardItem($item['item_id'])){ $awardService->addItem($item['item_id'], $item['item_num']); } if (myself()->_isVirtualItem($item['item_id'])) { From ca5264d557618fc0d06b0914e40ca6e44a945896 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Tue, 13 Aug 2024 15:28:19 +0800 Subject: [PATCH 5/5] 1 --- webapp/services/AddItemsService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/services/AddItemsService.php b/webapp/services/AddItemsService.php index c6ab6607..6458e750 100644 --- a/webapp/services/AddItemsService.php +++ b/webapp/services/AddItemsService.php @@ -35,7 +35,7 @@ class AddItemsService extends BaseService foreach ($items as $item) { //道具产出埋点 LogService::productItem($item); - if ($awardService && $this->_isAddAwardItem($item['item_id'])){ + if ($awardService && !$this->_isAddAwardItem($item['item_id'])){ $awardService->addItem($item['item_id'], $item['item_num']); } if (myself()->_isVirtualItem($item['item_id'])) {