1
This commit is contained in:
commit
01a6a452db
@ -144,6 +144,7 @@ CREATE TABLE `sign` (
|
|||||||
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
`sign_time` int(11) NOT NULL DEFAULT '0' COMMENT '签到时间',
|
`sign_time` int(11) NOT NULL DEFAULT '0' COMMENT '签到时间',
|
||||||
PRIMARY KEY (`idx`),
|
PRIMARY KEY (`idx`),
|
||||||
|
KEY `accountid` (`accountid`),
|
||||||
UNIQUE KEY `account_sign_id` (`accountid`, `sign_id`)
|
UNIQUE KEY `account_sign_id` (`accountid`, `sign_id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) 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 '创建时间',
|
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
PRIMARY KEY (`idx`),
|
PRIMARY KEY (`idx`),
|
||||||
|
KEY `accountid` (`accountid`),
|
||||||
UNIQUE KEY `quest_uuid` (`accountid`, `quest_id`)
|
UNIQUE KEY `quest_uuid` (`accountid`, `quest_id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) 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 '创建时间',
|
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
PRIMARY KEY (`idx`),
|
PRIMARY KEY (`idx`),
|
||||||
|
KEY `accountid` (`accountid`),
|
||||||
UNIQUE KEY `accountid_ach_id` (`accountid`, `ach_id`)
|
UNIQUE KEY `accountid_ach_id` (`accountid`, `ach_id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) 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 '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
PRIMARY KEY (`idx`),
|
PRIMARY KEY (`idx`),
|
||||||
|
KEY `accountid` (`accountid`),
|
||||||
UNIQUE KEY `account_add_id_add_time` (`accountid`, `add_id` , `add_time`)
|
UNIQUE KEY `account_add_id_add_time` (`accountid`, `add_id` , `add_time`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) 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',
|
`using_id` int(11) NOT NULL DEFAULT '0' COMMENT '上阵id',
|
||||||
`exp` int(11) NOT NULL DEFAULT '0' COMMENT '当前经验',
|
`exp` int(11) NOT NULL DEFAULT '0' COMMENT '当前经验',
|
||||||
PRIMARY KEY (`idx`),
|
PRIMARY KEY (`idx`),
|
||||||
|
KEY `accountid` (`accountid`),
|
||||||
UNIQUE KEY `accountid_id` (`accountid`, id)
|
UNIQUE KEY `accountid_id` (`accountid`, id)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
|
||||||
|
8
sql/gamedb2004_n_migrate_201111_01.sql
Normal file
8
sql/gamedb2004_n_migrate_201111_01.sql
Normal file
@ -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;
|
@ -12,11 +12,12 @@ import pprint
|
|||||||
argv = sys.argv
|
argv = sys.argv
|
||||||
host = argv[1]
|
host = argv[1]
|
||||||
port = argv[2]
|
port = argv[2]
|
||||||
script_name = argv[3]
|
passwd = argv[3]
|
||||||
|
script_name = argv[4]
|
||||||
|
|
||||||
def writeToRedis(conn, cmdline):
|
def writeToRedis(conn, cmdline):
|
||||||
assert len(cmdline) > 1
|
assert len(cmdline) > 1
|
||||||
# print(cmdline)
|
print(cmdline)
|
||||||
if cmdline[0] == 'hset':
|
if cmdline[0] == 'hset':
|
||||||
conn.hset(cmdline[1], cmdline[2], cmdline[3])
|
conn.hset(cmdline[1], cmdline[2], cmdline[3])
|
||||||
elif cmdline[0] == 'zadd':
|
elif cmdline[0] == 'zadd':
|
||||||
@ -24,14 +25,19 @@ def writeToRedis(conn, cmdline):
|
|||||||
elif cmdline[0] == 'sadd':
|
elif cmdline[0] == 'sadd':
|
||||||
conn.sadd(cmdline[1], cmdline[2])
|
conn.sadd(cmdline[1], cmdline[2])
|
||||||
elif cmdline[0] == 'set':
|
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':
|
elif cmdline[0] == 'expire':
|
||||||
conn.expire(cmdline[1], cmdline[2])
|
if int(cmdline[2]) >= 0:
|
||||||
|
conn.expire(cmdline[1], cmdline[2])
|
||||||
else:
|
else:
|
||||||
assert False
|
assert False
|
||||||
|
|
||||||
conn = redis.Redis(host = host,
|
conn = redis.Redis(host = host,
|
||||||
port = port,
|
port = port,
|
||||||
|
password = passwd,
|
||||||
db = 0,
|
db = 0,
|
||||||
decode_responses = True
|
decode_responses = True
|
||||||
)
|
)
|
||||||
|
@ -254,23 +254,30 @@ class ActivityController{
|
|||||||
} else {
|
} else {
|
||||||
$user_db_str = $r->get($draw_uuid);
|
$user_db_str = $r->get($draw_uuid);
|
||||||
$user_db = json_decode($user_db_str, true);
|
$user_db = json_decode($user_db_str, true);
|
||||||
if (empty($user_db)) {
|
if (empty($user_db) || empty($user_db['draw_list'])) {
|
||||||
phpcommon\sendError(ERR_USER_BASE + 1,'session失效');
|
$user_db_str = $r->get($draw_uuid);
|
||||||
return;
|
$draw_list = $this->randomNewReward(1,$account_id,$now_days);
|
||||||
}
|
$draw_db = json_decode($user_db_str, true);
|
||||||
|
$draw_db = array(
|
||||||
foreach ($user_db['draw_list'] as $draw) {
|
'draw_uuid' => $draw_uuid,
|
||||||
$status = 0;
|
'draw_list' => $draw_list,
|
||||||
if (isset($draw['status'])) {
|
);
|
||||||
$status = $draw['status'];
|
$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'];
|
$weight_sum += $l['jilv'];
|
||||||
}
|
}
|
||||||
$random = Rand(1, $weight_sum);
|
$random = Rand(1, $weight_sum);
|
||||||
// error_log($random);
|
|
||||||
for ($ii = 0; $ii < count($lot_array); $ii++) {
|
for ($ii = 0; $ii < count($lot_array); $ii++) {
|
||||||
|
|
||||||
$l = $this->getLottery($lot_array[$ii]['key']);
|
$l = $this->getLottery($lot_array[$ii]['key']);
|
||||||
@ -853,7 +859,6 @@ class ActivityController{
|
|||||||
$weight_sum += $l['jilv'];
|
$weight_sum += $l['jilv'];
|
||||||
}
|
}
|
||||||
$random = Rand(1, $weight_sum);
|
$random = Rand(1, $weight_sum);
|
||||||
// error_log($random);
|
|
||||||
for ($ii = 0; $ii < count($lot_array); $ii++) {
|
for ($ii = 0; $ii < count($lot_array); $ii++) {
|
||||||
$l = $this->getLottery($lot_array[$ii]['key']);
|
$l = $this->getLottery($lot_array[$ii]['key']);
|
||||||
$weight += $l['jilv'];
|
$weight += $l['jilv'];
|
||||||
@ -1179,7 +1184,7 @@ class ActivityController{
|
|||||||
}
|
}
|
||||||
//固定奖励
|
//固定奖励
|
||||||
$delim2 = ":";
|
$delim2 = ":";
|
||||||
$re_multiply = explode($delim2, $rec['re_reward']);;
|
$re_multiply = explode($delim2, $rec['re_reward']);
|
||||||
array_push($item_list, array(
|
array_push($item_list, array(
|
||||||
'item_id' => $re_multiply[0],
|
'item_id' => $re_multiply[0],
|
||||||
'item_num' => $re_multiply[1],
|
'item_num' => $re_multiply[1],
|
||||||
|
@ -133,6 +133,7 @@ class FesActivityController{
|
|||||||
protected function getfesActInfo($account_id)
|
protected function getfesActInfo($account_id)
|
||||||
{
|
{
|
||||||
$user_db = $this->readFesActDB($account_id);
|
$user_db = $this->readFesActDB($account_id);
|
||||||
|
$act_id = $user_db['act_id'];
|
||||||
$act = metatable\getNowActivity();
|
$act = metatable\getNowActivity();
|
||||||
$info_list = array();
|
$info_list = array();
|
||||||
if (!$act) {
|
if (!$act) {
|
||||||
@ -145,7 +146,7 @@ class FesActivityController{
|
|||||||
$this->saveFesActDB($account_id, $act_db);
|
$this->saveFesActDB($account_id, $act_db);
|
||||||
} else {
|
} 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']);
|
$info_list = $this->getActItem($act['id']);
|
||||||
$act_db = array(
|
$act_db = array(
|
||||||
'isopen' => 1,
|
'isopen' => 1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user