diff --git a/webapp/bootstrap/config_loader.php b/webapp/bootstrap/config_loader.php index b3204f33..9cf24091 100644 --- a/webapp/bootstrap/config_loader.php +++ b/webapp/bootstrap/config_loader.php @@ -3,6 +3,7 @@ $g_conf_market_mysql_cluster = require('../config/game2006market.mysql.cluster.php'); $g_conf_mysql_cluster = require('../config/game2006api.mysql.cluster.php'); $g_conf_relation_mysql_cluster = require('../config/game2006relation.mysql.cluster.php'); +$g_conf_mail_mysql_cluster = require('../config/mail.mysql.cluster.php'); $g_conf_redis_cluster = require('../config/game2006api.redis.cluster.php'); $g_metatables = array(); @@ -63,6 +64,12 @@ function getRelationMysqlConfig($hash_value) return $g_conf_relation_mysql_cluster; } +function getMailMysqlConfig() +{ + global $g_conf_mail_mysql_cluster; + return $g_conf_mail_mysql_cluster; +} + function getRedisConfig($hash_value) { if ($hash_value < 0) { diff --git a/webapp/controller/BaseController.class.php b/webapp/controller/BaseController.class.php index bf57fce0..6fae2bfa 100644 --- a/webapp/controller/BaseController.class.php +++ b/webapp/controller/BaseController.class.php @@ -7,6 +7,7 @@ class BaseController { private $nowtime = 0; private $marketDbConn = null; private $relationDbConn = null; + private $mailDbConn = null; private $timeOffset = 0; private $serviceHash = array(); @@ -151,6 +152,22 @@ class BaseController { return $this->marketDbConn; } + public function _getMailMysql() + { + if ($this->mailDbConn) { + return $this->mailDbConn; + } + $mysql_conf = getMailMysqlConfig(); + $this->marketDbConn = 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->marketDbConn; + } + public function _getRelationDbMysql() { if ($this->relationDbConn) {