From 25f1a54ca4e640c5cca3c7758e20fc4977114203 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 4 Nov 2020 14:02:30 +0800 Subject: [PATCH 1/8] 1 --- tools/migratedb/import_redis.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/migratedb/import_redis.py b/tools/migratedb/import_redis.py index ab587d6..1e1abda 100644 --- a/tools/migratedb/import_redis.py +++ b/tools/migratedb/import_redis.py @@ -24,7 +24,10 @@ def writeToRedis(conn, cmdline): elif cmdline[0] == 'sadd': conn.sadd(cmdline[1], cmdline[2]) elif cmdline[0] == 'set': - conn.set(cmdline[1], cmdline[2]) + if cmdline[2] != None: + conn.set(cmdline[1], cmdline[2]) + else: + print('[warning]', cmdline) elif cmdline[0] == 'expire': conn.expire(cmdline[1], cmdline[2]) else: From 0d34261a90f36c6e89f24ef0a109a99cb76777a6 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 4 Nov 2020 14:06:38 +0800 Subject: [PATCH 2/8] 1 --- tools/migratedb/import_redis.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/migratedb/import_redis.py b/tools/migratedb/import_redis.py index 1e1abda..52888c2 100644 --- a/tools/migratedb/import_redis.py +++ b/tools/migratedb/import_redis.py @@ -12,11 +12,12 @@ import pprint argv = sys.argv host = argv[1] port = argv[2] -script_name = argv[3] +passwd = argv[3] +script_name = argv[4] def writeToRedis(conn, cmdline): assert len(cmdline) > 1 -# print(cmdline) + print(cmdline) if cmdline[0] == 'hset': conn.hset(cmdline[1], cmdline[2], cmdline[3]) elif cmdline[0] == 'zadd': @@ -35,6 +36,7 @@ def writeToRedis(conn, cmdline): conn = redis.Redis(host = host, port = port, + password = passwd, db = 0, decode_responses = True ) From c4ef7f47c120a1dbbc1ecf2b4f2adafa6688db98 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 5 Nov 2020 14:46:48 +0800 Subject: [PATCH 3/8] 1 --- tools/migratedb/import_redis.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/migratedb/import_redis.py b/tools/migratedb/import_redis.py index 52888c2..45a6eeb 100644 --- a/tools/migratedb/import_redis.py +++ b/tools/migratedb/import_redis.py @@ -30,7 +30,8 @@ def writeToRedis(conn, cmdline): else: print('[warning]', cmdline) elif cmdline[0] == 'expire': - conn.expire(cmdline[1], cmdline[2]) + if int(cmdline[2]) >= 0: + conn.expire(cmdline[1], cmdline[2]) else: assert False From fc1e60801cfe58ef02a523c0f0bf3ab89114c108 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 10 Nov 2020 19:05:38 +0800 Subject: [PATCH 4/8] 1 --- sql/gamedb.sql | 24 ----------- .../controller/ActivityController.class.php | 43 +++++++++++-------- webapp/controller/HangController.class.php | 12 ------ webapp/metatable/item.php | 26 +++++++++++ 4 files changed, 50 insertions(+), 55 deletions(-) create mode 100644 webapp/metatable/item.php diff --git a/sql/gamedb.sql b/sql/gamedb.sql index dc7249b..7b77702 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -102,12 +102,6 @@ CREATE TABLE `user` ( `new_second_equip` int(11) NOT NULL DEFAULT '2' COMMENT '新玩家隔天结算武器', `sum_coin` double NOT NULL DEFAULT '0' COMMENT '累计充值金额', `recharge_times_total` int(11) NOT NULL DEFAULT '0' COMMENT '累计充值次数', - - /* - `rmb_num` int(11) NOT NULL DEFAULT '0' COMMENT '点券数量', - `max_single_recharge` int(11) NOT NULL DEFAULT '0' COMMENT '最大单次充值数量', - `passcard` int(11) NOT NULL DEFAULT '0' COMMENT '购买进阶手册状态', - */ PRIMARY KEY (`idx`), UNIQUE KEY `accountid` (`accountid`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; @@ -306,22 +300,4 @@ CREATE TABLE `festival_activity` ( UNIQUE KEY `accountid` (`accountid`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*DROP TABLE IF EXISTS `orderinfo`;*/ -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -/* -CREATE TABLE `orderinfo` ( - `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id', - `accountid` varchar(60) DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', - `orderid` varchar(60) DEFAULT '' COMMENT '订单id', - `rmb_num` int(11) NOT NULL DEFAULT '0' COMMENT '点券数量', - `money` int(11) NOT NULL DEFAULT '0' COMMENT '金钱数量', - `custom_data` mediumblob COMMENT '其他字段', - `itemid` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', - `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - PRIMARY KEY (`idx`), - UNIQUE KEY `account_orderid` (`accountid`, `orderid`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -*/ -- Dump completed on 2015-08-19 18:51:22 diff --git a/webapp/controller/ActivityController.class.php b/webapp/controller/ActivityController.class.php index 79b51bf..4703236 100644 --- a/webapp/controller/ActivityController.class.php +++ b/webapp/controller/ActivityController.class.php @@ -254,23 +254,30 @@ class ActivityController{ } else { $user_db_str = $r->get($draw_uuid); $user_db = json_decode($user_db_str, true); - if (empty($user_db)) { - phpcommon\sendError(ERR_USER_BASE + 1,'session失效'); - return; - } - - foreach ($user_db['draw_list'] as $draw) { - $status = 0; - if (isset($draw['status'])) { - $status = $draw['status']; + if (empty($user_db) || empty($user_db['draw_list'])) { + $user_db_str = $r->get($draw_uuid); + $draw_list = $this->randomNewReward(1,$account_id,$now_days); + $draw_db = json_decode($user_db_str, true); + $draw_db = array( + 'draw_uuid' => $draw_uuid, + 'draw_list' => $draw_list, + ); + $r -> set($draw_uuid, json_encode($draw_db)); + $r -> pexpire($draw_uuid, 1000 * 3600 * 24); + } else { + foreach ($user_db['draw_list'] as $draw) { + $status = 0; + if (isset($draw['status'])) { + $status = $draw['status']; + } + array_push($draw_list, array( + 'item_id' => $draw['item_id'], + 'item_num' => $draw['item_num'], + 'quailty' => $draw['quailty'], + 'time' => $draw['time'], + 'status' => $status, + )); } - array_push($draw_list, array( - 'item_id' => $draw['item_id'], - 'item_num' => $draw['item_num'], - 'quailty' => $draw['quailty'], - 'time' => $draw['time'], - 'status' => $status, - )); } } } @@ -376,7 +383,6 @@ class ActivityController{ $weight_sum += $l['jilv']; } $random = Rand(1, $weight_sum); - // error_log($random); for ($ii = 0; $ii < count($lot_array); $ii++) { $l = $this->getLottery($lot_array[$ii]['key']); @@ -853,7 +859,6 @@ class ActivityController{ $weight_sum += $l['jilv']; } $random = Rand(1, $weight_sum); - // error_log($random); for ($ii = 0; $ii < count($lot_array); $ii++) { $l = $this->getLottery($lot_array[$ii]['key']); $weight += $l['jilv']; @@ -1179,7 +1184,7 @@ class ActivityController{ } //固定奖励 $delim2 = ":"; - $re_multiply = explode($delim2, $rec['re_reward']);; + $re_multiply = explode($delim2, $rec['re_reward']); array_push($item_list, array( 'item_id' => $re_multiply[0], 'item_num' => $re_multiply[1], diff --git a/webapp/controller/HangController.class.php b/webapp/controller/HangController.class.php index 8bcd956..5059f91 100644 --- a/webapp/controller/HangController.class.php +++ b/webapp/controller/HangController.class.php @@ -148,20 +148,8 @@ class HangController{ if (time() >= strtotime($season['open_time']) && time() <= strtotime($season['end_time'])) { $open_time = strtotime($season['open_time']); $end_time = strtotime($season['end_time']); - /*$ret = $conn->execScript('UPDATE user SET season_time=:season_time, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':season_time' => $end_time, - ':modify_time' => time() - )); - if (!$ret) { - die(); - return; - }*/ $number = $i; $item_multiply = $this->getExplode($season['reward']); - //$ii = 0; for($ii = 1; $ii <= count($item_multiply); $ii++) { $rowpass = $conn->execQueryOne('SELECT active_status, honor_status ' . ' FROM passinfo WHERE accountid=:accountid AND passid=:passid;', diff --git a/webapp/metatable/item.php b/webapp/metatable/item.php new file mode 100644 index 0000000..a266624 --- /dev/null +++ b/webapp/metatable/item.php @@ -0,0 +1,26 @@ + Date: Tue, 10 Nov 2020 19:48:27 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/gamedb.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sql/gamedb.sql b/sql/gamedb.sql index dc7249b..8d3cad6 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -150,6 +150,7 @@ CREATE TABLE `sign` ( `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', `sign_time` int(11) NOT NULL DEFAULT '0' COMMENT '签到时间', PRIMARY KEY (`idx`), + KEY `accountid` (`accountid`), UNIQUE KEY `account_sign_id` (`accountid`, `sign_id`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; @@ -171,6 +172,7 @@ CREATE TABLE `quest` ( `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`idx`), + KEY `accountid` (`accountid`), UNIQUE KEY `quest_uuid` (`accountid`, `quest_id`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; @@ -189,6 +191,7 @@ CREATE TABLE `share_achievement` ( `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`idx`), + KEY `accountid` (`accountid`), UNIQUE KEY `accountid_ach_id` (`accountid`, `ach_id`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; @@ -257,6 +260,7 @@ CREATE TABLE `additem_log` ( `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`idx`), + KEY `accountid` (`accountid`), UNIQUE KEY `account_add_id_add_time` (`accountid`, `add_id` , `add_time`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; @@ -277,6 +281,7 @@ CREATE TABLE `equip` ( `using_id` int(11) NOT NULL DEFAULT '0' COMMENT '上阵id', `exp` int(11) NOT NULL DEFAULT '0' COMMENT '当前经验', PRIMARY KEY (`idx`), + KEY `accountid` (`accountid`), UNIQUE KEY `accountid_id` (`accountid`, id) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; From c988bdc6ef26fb12fa684134bc623617acfbbb23 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 10 Nov 2020 20:09:30 +0800 Subject: [PATCH 6/8] 1 --- sql/gamedb2004_n_migrate_201111_01.sql | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 sql/gamedb2004_n_migrate_201111_01.sql diff --git a/sql/gamedb2004_n_migrate_201111_01.sql b/sql/gamedb2004_n_migrate_201111_01.sql new file mode 100644 index 0000000..a4588e5 --- /dev/null +++ b/sql/gamedb2004_n_migrate_201111_01.sql @@ -0,0 +1,8 @@ +start transaction; + +alter table `sign` add index accountid (`accountid`); +alter table `quest` add index accountid (`accountid`); +alter table `share_achievement` add index accountid (`accountid`); +alter table `equip` add index accountid (`accountid`); + +commit; From a72a97fd21c603f1dd3e670903f2d84ebdb5affe Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 30 Nov 2020 18:51:09 +0800 Subject: [PATCH 7/8] 1 --- webapp/controller/FesActivityController.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/controller/FesActivityController.class.php b/webapp/controller/FesActivityController.class.php index e58c654..3c0f9d8 100644 --- a/webapp/controller/FesActivityController.class.php +++ b/webapp/controller/FesActivityController.class.php @@ -133,6 +133,7 @@ class FesActivityController{ protected function getfesActInfo($account_id) { $user_db = $this->readFesActDB($account_id); + $act_id = $user_db['act_id']; $act = metatable\getNowActivity(); $info_list = array(); if (!$act) { @@ -145,7 +146,7 @@ class FesActivityController{ $this->saveFesActDB($account_id, $act_db); } else { //活动开启 - if (empty($user_db) || empty($user_db['info_list'])) { + if (empty($user_db) || empty($user_db['info_list']) || $act_id != $act['id']) { $info_list = $this->getActItem($act['id']); $act_db = array( 'isopen' => 1, From 0507739fbc8c17fd1634de29a18ce91d0563706c Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 30 Nov 2020 18:55:07 +0800 Subject: [PATCH 8/8] 1 --- sql/gamedb.sql | 5 +++++ sql/gamedb2004_n_migrate_201111_01.sql | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 sql/gamedb2004_n_migrate_201111_01.sql diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 7b77702..e4b1c1e 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -144,6 +144,7 @@ CREATE TABLE `sign` ( `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', `sign_time` int(11) NOT NULL DEFAULT '0' COMMENT '签到时间', PRIMARY KEY (`idx`), + KEY `accountid` (`accountid`), UNIQUE KEY `account_sign_id` (`accountid`, `sign_id`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; @@ -165,6 +166,7 @@ CREATE TABLE `quest` ( `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`idx`), + KEY `accountid` (`accountid`), UNIQUE KEY `quest_uuid` (`accountid`, `quest_id`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; @@ -183,6 +185,7 @@ CREATE TABLE `share_achievement` ( `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`idx`), + KEY `accountid` (`accountid`), UNIQUE KEY `accountid_ach_id` (`accountid`, `ach_id`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; @@ -251,6 +254,7 @@ CREATE TABLE `additem_log` ( `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`idx`), + KEY `accountid` (`accountid`), UNIQUE KEY `account_add_id_add_time` (`accountid`, `add_id` , `add_time`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; @@ -271,6 +275,7 @@ CREATE TABLE `equip` ( `using_id` int(11) NOT NULL DEFAULT '0' COMMENT '上阵id', `exp` int(11) NOT NULL DEFAULT '0' COMMENT '当前经验', PRIMARY KEY (`idx`), + KEY `accountid` (`accountid`), UNIQUE KEY `accountid_id` (`accountid`, id) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/sql/gamedb2004_n_migrate_201111_01.sql b/sql/gamedb2004_n_migrate_201111_01.sql new file mode 100644 index 0000000..a4588e5 --- /dev/null +++ b/sql/gamedb2004_n_migrate_201111_01.sql @@ -0,0 +1,8 @@ +start transaction; + +alter table `sign` add index accountid (`accountid`); +alter table `quest` add index accountid (`accountid`); +alter table `share_achievement` add index accountid (`accountid`); +alter table `equip` add index accountid (`accountid`); + +commit;