完成redis mysql改造

This commit is contained in:
aozhiwei 2021-01-04 14:09:49 +08:00
parent eac7b0195b
commit b43911bc30
22 changed files with 1 additions and 363 deletions

View File

@ -7,30 +7,7 @@ require_once 'metatable/draw.php';
class ActivityController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getRedis($shop_uuid)
{
$redis_conf = getRedisConfig(crc32($shop_uuid));
$r = new phpcommon\Redis(array(
'host' => $redis_conf['host'],
'port' => $redis_conf['port'],
'passwd' => $redis_conf['passwd']
));
return $r;
}
protected function getBox($box_id)
{

View File

@ -1,18 +1,6 @@
<?php
class AdditemController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getItem($item_id)
{

View File

@ -5,18 +5,6 @@ require 'classes/AddReward.php';
class BagController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getBag($bag_id)
{

View File

@ -5,18 +5,6 @@ require 'classes/AddReward.php';
class EquipController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getItem($item_id)
{

View File

@ -5,30 +5,7 @@ require_once 'metatable/activity.php';
class FesActivityController extends BaseAuthedController {
protected function getRedis($act_uuid)
{
$redis_conf = getRedisConfig(crc32($act_uuid));
$r = new phpcommon\Redis(array(
'host' => $redis_conf['host'],
'port' => $redis_conf['port'],
'passwd' => $redis_conf['passwd']
));
return $r;
}
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getParameter($para_id)
{

View File

@ -5,18 +5,6 @@ require 'classes/AddReward.php';
require_once 'metatable/parameter.php';
class FriendController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getAllMysql()
{

View File

@ -11,18 +11,6 @@ class GMController extends BaseController {
}
}
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
public function clearDB()
{

View File

@ -5,30 +5,7 @@ require 'classes/AddReward.php';
require_once 'metatable/parameter.php';
class GameOverController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getRedis($shop_uuid)
{
$redis_conf = getRedisConfig(crc32($shop_uuid));
$r = new phpcommon\Redis(array(
'host' => $redis_conf['host'],
'port' => $redis_conf['port'],
'passwd' => $redis_conf['passwd']
));
return $r;
}
protected function getBox($box_id)

View File

@ -6,18 +6,6 @@ require_once 'metatable/drop.php';
require 'classes/AddReward.php';
class HangController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getExplode($string)
{

View File

@ -7,18 +7,6 @@ require_once 'metatable/season.php';
require_once 'metatable/seasoncard.php';
class PassController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getExplode($string)
{

View File

@ -11,18 +11,6 @@ require_once 'metatable/parameter.php';
class PayActivityController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
function getExplode($string)
{

View File

@ -5,18 +5,6 @@ require 'classes/AddReward.php';
class PayController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getItem($item_id)
{

View File

@ -4,18 +4,6 @@ require 'classes/AddReward.php';
class PayNotifyController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
private function insertNewOrder($conn, $nowtime, $item_list)
{

View File

@ -5,18 +5,6 @@ require 'classes/AddReward.php';
class QuestController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getQuest($quest_id)
{

View File

@ -2,30 +2,7 @@
require 'classes/AddReward.php';
class RankController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getRedis()
{
$key = 'game2005api';
$redis_conf = getRedisConfig($key);
$r = new phpcommon\Redis(array(
'host' => $redis_conf['host'],
'port' => $redis_conf['port'],
'passwd' => $redis_conf['passwd'],
));
return $r;
}
protected function getSeasonPoint($seaPoint_id)
{
@ -121,7 +98,7 @@ class RankController extends BaseAuthedController {
}
ini_set('memory_limit','3072M');
//击杀榜
$r = $this->getRedis();
$r = $this->getRedis('');
//胜场榜
$channel = phpcommon\extractChannel($account_id);
$win_rank_db = $r->get("game2005api:win_rank_" . $channel);

View File

@ -5,30 +5,7 @@ require 'classes/AddReward.php';
class RoleController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getRedis($account_id)
{
$redis_conf = getRedisConfig(crc32($account_id));
$r = new phpcommon\Redis(array(
'host' => $redis_conf['host'],
'port' => $redis_conf['port'],
'passwd' => $redis_conf['passwd']
));
return $r;
}
protected function getParameter($para_id)
{

View File

@ -2,18 +2,6 @@
class ServerSwitchController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
private function isForbidCity()
{

View File

@ -5,30 +5,7 @@ require 'classes/Quest.php';
class ShareController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getRedis($shop_uuid)
{
$redis_conf = getRedisConfig(crc32($shop_uuid));
$r = new phpcommon\Redis(array(
'host' => $redis_conf['host'],
'port' => $redis_conf['port'],
'passwd' => $redis_conf['passwd']
));
return $r;
}
protected function getDrop($drop_id)
{

View File

@ -6,30 +6,7 @@ require_once 'metatable/shopGoods.php';
require_once 'metatable/parameter.php';
class ShopController extends BaseAuthedController {
protected function getRedis($shop_uuid)
{
$redis_conf = getRedisConfig(crc32($shop_uuid));
$r = new phpcommon\Redis(array(
'host' => $redis_conf['host'],
'port' => $redis_conf['port'],
'passwd' => $redis_conf['passwd']
));
return $r;
}
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getItem($item_id)
{
$g_conf_item_cluster = require('../res/item@item.php');

View File

@ -5,18 +5,6 @@ require 'classes/AddReward.php';
class SignController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getSign($sign_id)
{

View File

@ -3,30 +3,7 @@
class TeamController extends BaseAuthedController {
protected function getRedis($team_uuid)
{
$redis_conf = getRedisConfig(crc32($team_uuid));
$r = new phpcommon\Redis(array(
'host' => $redis_conf['host'],
'port' => $redis_conf['port'],
'passwd' => $redis_conf['passwd']
));
return $r;
}
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
public function createTeam()
{

View File

@ -2,29 +2,7 @@
class VoiceController extends BaseAuthedController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
));
return $conn;
}
protected function getRedis($accountid)
{
$redis_conf = getRedisConfig(crc32($accountid));
$r = new phpcommon\Redis(array(
'host' => $redis_conf['host'],
'port' => $redis_conf['port'],
'passwd' => $redis_conf['passwd']
));
return $r;
}
public function upload()
{