Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6b5fe94573 | ||
![]() |
a514696ffb | ||
![]() |
9828497ea9 | ||
![]() |
ab7e59a084 | ||
![]() |
b2916c51c2 | ||
![]() |
fb099b0f73 | ||
![]() |
93938eed5e |
129
sql/gamedb.sql
129
sql/gamedb.sql
@ -106,7 +106,6 @@ CREATE TABLE `user` (
|
||||
`cpa_times` int(11) NOT NULL DEFAULT '0' COMMENT 'cpa看视频次数',
|
||||
|
||||
`daily_diamond_times` int(11) NOT NULL DEFAULT '0' COMMENT '兑换钻石次数',
|
||||
`init_weapon` int(11) DEFAULT 0 NOT NULL COMMENT '0:未赠送;1:已赠送',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
@ -203,7 +202,6 @@ CREATE TABLE `activity` (
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`free_times` int(11) NOT NULL DEFAULT '0' COMMENT '免费抽奖次数',
|
||||
`video_times` int(11) NOT NULL DEFAULT '0' COMMENT '视频抽奖次数',
|
||||
`diamond_times` int(11) NOT NULL DEFAULT '0' COMMENT '钻石抽奖次数',
|
||||
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品id',
|
||||
`item_num` int(11) NOT NULL DEFAULT '0' COMMENT '物品数量',
|
||||
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
@ -223,7 +221,6 @@ CREATE TABLE `passinfo` (
|
||||
`passid` int(11) NOT NULL DEFAULT '0' COMMENT 'passid',
|
||||
`active_status` int(11) NOT NULL DEFAULT '0' COMMENT '普通奖励状态',
|
||||
`honor_status` int(11) NOT NULL DEFAULT '0' COMMENT '充值奖励状态',
|
||||
`season_passport` mediumblob NOT NULL COMMENT '赛季通行证',
|
||||
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
@ -339,130 +336,4 @@ CREATE TABLE `draw` (
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid_drawid` (`accountid`, `id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
DROP TABLE IF EXISTS `recharge`;
|
||||
CREATE TABLE `recharge` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`first_data` mediumblob COMMENT '首充数据',
|
||||
`daily_purchase` mediumblob COMMENT '每日特惠礼包',
|
||||
`vip_info` mediumblob COMMENT '月卡信息',
|
||||
`activity` mediumblob COMMENT '充值活动信息',
|
||||
`adfree` int(11) NOT NULL DEFAULT '0' COMMENT '免广告券',
|
||||
`recharge_diamond` int(11) NOT NULL DEFAULT '0' COMMENT '累计充值钻石',
|
||||
`present_diamond` int(11) NOT NULL DEFAULT '0' COMMENT '充值赠送钻石总量',
|
||||
`first_purchase` mediumblob COMMENT '首充活动信息',
|
||||
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 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` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`orderid` varchar(255) NOT NULL DEFAULT '' COMMENT '订单号',
|
||||
`price` int(11) NOT NULL DEFAULT '0' COMMENT '价格,分',
|
||||
`goodsid` int(11) NOT NULL DEFAULT '0' COMMENT ' 商品id',
|
||||
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `idx_orderid` (`orderid`),
|
||||
KEY `idx_accountid` (`accountid`),
|
||||
KEY `idx_goodsid` (`goodsid`),
|
||||
KEY `idx_time` (`create_time`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
DROP TABLE IF EXISTS `buy_his`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `buy_his` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`goodsid` int(11) NOT NULL DEFAULT '0' COMMENT ' 商品id',
|
||||
`sum_times` int(11) NOT NULL DEFAULT '0' COMMENT '总次数',
|
||||
`today_times` int(11) NOT NULL DEFAULT '0' COMMENT '当天次数',
|
||||
`last_buy_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 '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid_goodsid` (`accountid`, `goodsid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
CREATE TABLE `t_mail` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`mail_id` bigint(20) NOT NULL COMMENT '邮件id',
|
||||
`mail_type` int(11) NOT NULL DEFAULT '0' COMMENT '邮件类型',
|
||||
`unikey` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT 'unikey',
|
||||
`subject` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT 'subject',
|
||||
`content` text COLLATE utf8_bin NOT NULL COMMENT '消息内容',
|
||||
`recipients` text COLLATE utf8_bin NOT NULL COMMENT '收件人列表',
|
||||
`attachments` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '附件',
|
||||
`deleted` int(11) NOT NULL DEFAULT '0' COMMENT '是否已删除',
|
||||
`sendtime` int(11) NOT NULL DEFAULT '0' COMMENT '发送时间',
|
||||
`user_reg_start_time` int(11) NOT NULL DEFAULT '0' COMMENT '用户注册开始时间',
|
||||
`user_reg_end_time` int(11) NOT NULL DEFAULT '0' COMMENT '用户注册结束时间',
|
||||
`tag1` int(11) NOT NULL DEFAULT '0' COMMENT 'tag1',
|
||||
`tag2` int(11) NOT NULL DEFAULT '0' COMMENT 'tag2',
|
||||
`expiretime` int(11) NOT NULL DEFAULT '0' COMMENT '过期时间',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
`create_address` varchar(60) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建邮件的钱包地址',
|
||||
`update_address` varchar(60) CHARACTER SET utf8 DEFAULT NULL COMMENT '更新邮件的钱包地址',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `mail_id` (`mail_id`),
|
||||
UNIQUE KEY `unikey` (`unikey`),
|
||||
KEY `idx_create_address` (`create_address`),
|
||||
KEY `idx_tag1` (`tag1`),
|
||||
KEY `idx_tag2` (`tag2`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
CREATE TABLE `t_inbox` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT '账号id',
|
||||
`mail_id` bigint(20) NOT NULL COMMENT '邮件id',
|
||||
`state` int(11) NOT NULL DEFAULT '0' COMMENT '1:已读取 2:已领取 3:已删除',
|
||||
`expiretime` int(11) NOT NULL DEFAULT '0' COMMENT '过期时间',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `idx_account_id_mail_id` (`account_id`,`mail_id`),
|
||||
KEY `idx_state` (`state`),
|
||||
KEY `idx_expiretime` (`expiretime`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10123 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
CREATE TABLE `code_his` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT '账号id',
|
||||
`code_type` bigint(20) NOT NULL COMMENT 'giftcode type',
|
||||
`code` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT 'code',
|
||||
`content` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT 'giftcode 内容',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `idx_account_id_code_type` (`account_id`,`code_type`),
|
||||
KEY `idx_code` (`code`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
CREATE TABLE `solo` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`level` int(11) NOT NULL DEFAULT '0' COMMENT '等级',
|
||||
`exp` int(11) NOT NULL DEFAULT '0' COMMENT '当前经验值',
|
||||
`medals` int(11) NOT NULL DEFAULT '0' COMMENT '体力值',
|
||||
`lastredeem` int(11) NOT NULL DEFAULT '0' COMMENT '上次自然恢复体力时间戳',
|
||||
`lastoffline` int(11) NOT NULL DEFAULT '0' COMMENT '上次计算离线收益时间戳',
|
||||
`offline` int(11) NOT NULL DEFAULT '0' COMMENT '已计算离线时长(小时)',
|
||||
`gamelevel` mediumblob NOT NULL COMMENT '关卡信息',
|
||||
`funds` mediumblob NOT NULL COMMENT '基金',
|
||||
`talent` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '[已激活最高普通天赋,已解锁最高高级天赋,已激活最高高级天赋]',
|
||||
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
-- Dump completed on 2015-08-19 18:51:22
|
||||
|
@ -17,11 +17,6 @@ define('QUEST_DAY_HARM', 71009);
|
||||
define('QUEST_DAY_KILL', 71010);
|
||||
define('QUEST_DAY_HELP', 71011);
|
||||
define('QUEST_DAY_COMPLETE', 71012);
|
||||
define('QUEST_DAY_SETTLE', 71013);
|
||||
define('QUEST_DAY_MEDALS', 71014);
|
||||
define('QUEST_DAY_SWEEP', 71015);
|
||||
define('QUEST_DAY_VIDSETTLE', 71016);
|
||||
define('QUEST_DAY_JINJIE', 71017);
|
||||
//成就
|
||||
define('QUEST_SUM_LOGIN', 72001);
|
||||
define('QUEST_SUM_SHARE', 72002);
|
||||
@ -105,13 +100,6 @@ define('CLAN_VIDEO_DIAMOND', 165); //观看视频,领取的钻石数量
|
||||
define('CLAN_DIAMOND', 164); //创建战队需要的钻石数量
|
||||
define('OPENING_SPEAR', 154); //新玩家奖励第一把武器
|
||||
define('OPENING_SPEAR2', 178); //新玩家奖励第二把武器
|
||||
define('LOTTERY_COST', 187); //每日抽奖钻石消耗
|
||||
define('DIAMONDLOTTERY_TIME', 188); //每日消耗钻石抽奖次数
|
||||
define('MEDAL_LIMIT', 189); //体力自然增长上限
|
||||
define('MEDAL_SECONDS', 190); //自然增长一点体力耗时,单位秒
|
||||
define('OFFLINE_LIMIT', 191); //离线时长上限,单位小时
|
||||
define('RECHARGE_TARGET', 198); //连续充值天数的每日达标金额(元)
|
||||
define('INITIAL_WEAPON', 201); //初始赠送武器
|
||||
|
||||
require 'config_loader.php';
|
||||
|
||||
|
@ -4,8 +4,7 @@ namespace classes;
|
||||
|
||||
use phpcommon;
|
||||
|
||||
class AddReward
|
||||
{
|
||||
class AddReward {
|
||||
protected function getMysql($account_id)
|
||||
{
|
||||
$mysql_conf = getMysqlConfig(crc32($account_id));
|
||||
@ -27,8 +26,7 @@ class AddReward
|
||||
'id' => $item_conf['id'],
|
||||
'diamond' => $item_conf['diamond'],
|
||||
'type' => $item_conf['fuction'],
|
||||
'diamond_hour' => $item_conf['diamond_hour'],
|
||||
'piece' => $item_conf['piece'],
|
||||
'diamond_hour' => $item_conf['diamond_hour']
|
||||
);
|
||||
return $it;
|
||||
}
|
||||
@ -105,34 +103,18 @@ class AddReward
|
||||
} else if ($i['type'] == 10 || $i['type'] == 11){
|
||||
$this->addweizhuang($item['item_id'], $item['item_num'], $account_id);
|
||||
} else if ($i['type'] == 12) {
|
||||
$item_list = $this->addEquip($item['item_id'], $account_id, $i['piece']);
|
||||
} else if ($i['type'] == 16 || $i['type'] == 19 ) {
|
||||
$item_list = $this->addEquip($item['item_id'], $account_id);
|
||||
} else if ($i['type'] == 16) {
|
||||
$this->addSpoilsItem($item['item_id'], $item['item_num'], $account_id);
|
||||
} else if ($i['type'] == 17) {
|
||||
$this->addAdfree($item['item_id'], $item['item_num'], $account_id);
|
||||
} else if ($i['type'] == 18) {
|
||||
$this->addMedal($item['item_id'], $item['item_num'], $account_id);
|
||||
} else if ($i['type'] == 20) {
|
||||
|
||||
} else {
|
||||
$priceid = 10003;
|
||||
$price = $i['diamond'];
|
||||
if ($time != 0) {
|
||||
$price = $i['diamond_hour'] * $time;
|
||||
}
|
||||
|
||||
if ($price == 0) {
|
||||
$strs = explode(":",$i['piece']);
|
||||
if (count($strs) > 1) {
|
||||
$priceid = intval($strs[0]);
|
||||
$price = intval($strs[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($t) {
|
||||
$item_list = $this->addItem($item['item_id'], $item['time'], $account_id, $priceid, $price, $t);
|
||||
$item_list = $this->addItem($item['item_id'], $item['time'], $account_id, $price, $t);
|
||||
} else {
|
||||
$item_list = $this->addItem($item['item_id'], $item['time'], $account_id, $priceid, $price, 0);
|
||||
$item_list = $this->addItem($item['item_id'], $item['time'], $account_id, $price, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -146,16 +128,13 @@ class AddReward
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT num FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
$row = $conn->execQueryOne('SELECT num FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':id' => $id
|
||||
)
|
||||
);
|
||||
'id' => $id
|
||||
));
|
||||
if (!$row && $id != 0) {
|
||||
$ret = $conn->execScript(
|
||||
'INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' .
|
||||
$ret = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' .
|
||||
' VALUES(:account_id, :id, 0, 1, :num, 0, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=1, num=:num, active_time=0, modify_time=:modify_time;',
|
||||
array(
|
||||
@ -164,22 +143,19 @@ class AddReward
|
||||
':num' => $num,
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if(!$ret){
|
||||
die();
|
||||
}
|
||||
} else {
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE bag SET num=:num, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE bag SET num=:num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:account_id AND id=:id;',
|
||||
array(
|
||||
':account_id' => $accountid,
|
||||
':id' => $id,
|
||||
':num' => $row['num'] + $num,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
@ -193,12 +169,10 @@ class AddReward
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT coin_num FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT coin_num FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid
|
||||
)
|
||||
);
|
||||
));
|
||||
return $row['coin_num'];
|
||||
}
|
||||
|
||||
@ -209,46 +183,13 @@ class AddReward
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT diamond_num FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT diamond_num FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid
|
||||
)
|
||||
);
|
||||
));
|
||||
return $row['diamond_num'];
|
||||
}
|
||||
|
||||
public function getAdfree($accountid)
|
||||
{
|
||||
$conn = $this->getMysql($accountid);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT adfree FROM recharge WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid
|
||||
)
|
||||
);
|
||||
return $row ? $row['adfree'] : 0;
|
||||
}
|
||||
|
||||
public function getMedals($accountid) {
|
||||
$conn = $this->getMysql($accountid);
|
||||
if (!$conn) {
|
||||
return 0;
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT medals FROM solo WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid
|
||||
)
|
||||
);
|
||||
|
||||
return $row ? $row['medals'] : 0;
|
||||
}
|
||||
|
||||
//添加钻石
|
||||
protected function addDiamond($item_id, $item_num, $accountid)
|
||||
{
|
||||
@ -257,21 +198,17 @@ class AddReward
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT diamond_num FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT diamond_num FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid
|
||||
)
|
||||
);
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET diamond_num=:diamond_num, modify_time=:modify_time ' .
|
||||
));
|
||||
$ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':diamond_num' => $item_num + $row['diamond_num'],
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
@ -284,21 +221,17 @@ class AddReward
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT coin_num FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT coin_num FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid
|
||||
)
|
||||
);
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET coin_num=:coin_num, modify_time=:modify_time ' .
|
||||
));
|
||||
$ret = $conn->execScript('UPDATE user SET coin_num=:coin_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':coin_num' => $item_num + $row['coin_num'],
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
@ -315,12 +248,10 @@ class AddReward
|
||||
$status = 1;
|
||||
$sum = 0;
|
||||
if ($it['type'] == 10) {
|
||||
$rows = $conn->execQuery(
|
||||
'SELECT id, status FROM bag WHERE accountid=:accountid;',
|
||||
$rows = $conn->execQuery('SELECT id, status FROM bag WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
)
|
||||
);
|
||||
));
|
||||
foreach ($rows as $r) {
|
||||
$it = $this->getItem($r['id']);
|
||||
if ($r['status'] == 0 && $it['type'] == 10) {
|
||||
@ -331,16 +262,13 @@ class AddReward
|
||||
$status = 0;
|
||||
}
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT status, num FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
$row = $conn->execQueryOne('SELECT status, num FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
'id' => $item_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row && $item_id != 0) {
|
||||
$ret = $conn->execScript(
|
||||
'INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' .
|
||||
$ret = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' .
|
||||
' VALUES(:account_id, :id, 0, :status, :num, :active_time, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=:status, num=:num, active_time=:active_time, modify_time=:modify_time;',
|
||||
array(
|
||||
@ -351,8 +279,7 @@ class AddReward
|
||||
':num' => $item_num,
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if(!$ret){
|
||||
die();
|
||||
}
|
||||
@ -367,8 +294,7 @@ class AddReward
|
||||
}
|
||||
}
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE bag SET num=:num, status=:status, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE bag SET num=:num, status=:status, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:account_id AND id=:id;',
|
||||
array(
|
||||
':account_id' => $accountid,
|
||||
@ -376,8 +302,7 @@ class AddReward
|
||||
':num' => $row['num'] + $item_num,
|
||||
':status' => $status,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
@ -391,21 +316,17 @@ class AddReward
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT free_lot_ticket FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT free_lot_ticket FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid
|
||||
)
|
||||
);
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET free_lot_ticket=:free_lot_ticket, modify_time=:modify_time ' .
|
||||
));
|
||||
$ret = $conn->execScript('UPDATE user SET free_lot_ticket=:free_lot_ticket, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':free_lot_ticket' => $item_num + $row['free_lot_ticket'],
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
@ -418,138 +339,41 @@ class AddReward
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT free_dou_lot_ticket FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT free_dou_lot_ticket FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid
|
||||
)
|
||||
);
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET free_dou_lot_ticket=:free_dou_lot_ticket, modify_time=:modify_time ' .
|
||||
));
|
||||
$ret = $conn->execScript('UPDATE user SET free_dou_lot_ticket=:free_dou_lot_ticket, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':free_dou_lot_ticket' => $item_num + $row['free_dou_lot_ticket'],
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
protected function addAdfree($item_id, $item_num, $accountid)
|
||||
{
|
||||
$conn = $this->getMysql($accountid);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT adfree FROM recharge WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid
|
||||
)
|
||||
);
|
||||
$ret = false;
|
||||
$nowtime = time();
|
||||
if (!$row) {
|
||||
$ret = $conn->execScript(
|
||||
'INSERT INTO recharge(accountid, adree, first_data, daily_purchase, vip_info, activity, first_purchase, create_time, modify_time) ' .
|
||||
' VALUES(:account_id, :adfree_add, :first_data, :daily_purchase, :vip_info, :activity, :first_purchase, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, adfree=adfree+:adfree_add, modify_time=:modify_time;',
|
||||
array(
|
||||
':account_id' => $accountid,
|
||||
':adfree_add' => $item_num,
|
||||
':first_data' => '',
|
||||
':daily_purchase' => '',
|
||||
':vip_info' => '',
|
||||
':activity' => '',
|
||||
':first_purchase' => '',
|
||||
':create_time' => $nowtime,
|
||||
':modify_time' => $nowtime,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE recharge SET adfree=adfree+:adfree_add, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':adfree_add' => $item_num,
|
||||
':modify_time' => $nowtime,
|
||||
)
|
||||
);
|
||||
}
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
protected function addMedal($item_id, $item_num, $accountid)
|
||||
{
|
||||
$conn = $this->getMysql($accountid);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT medals, lastredeem FROM solo WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid
|
||||
)
|
||||
);
|
||||
$ret = false;
|
||||
$nowtime = time();
|
||||
if (!$row) {
|
||||
$ret = $conn->execScript(
|
||||
'INSERT INTO rolo(accountid, medals, create_time, modify_time) ' .
|
||||
' VALUES(:account_id, :medals_add, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, medals=medals+:medals_add, modify_time=:modify_time;',
|
||||
array(
|
||||
':account_id' => $accountid,
|
||||
':medals_add' => $item_num,
|
||||
':create_time' => $nowtime,
|
||||
':modify_time' => $nowtime,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE solo SET medals=medals+:medals_add, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':medals_add' => $item_num,
|
||||
':modify_time' => $nowtime,
|
||||
)
|
||||
);
|
||||
}
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
//添加道具
|
||||
protected function addItem($itemid, $hourtime, $accountid, $priceid, $price, $t)
|
||||
protected function addItem($item_id, $time, $accountid, $price, $t)
|
||||
{
|
||||
$item_list = array();
|
||||
$item_num = 1;
|
||||
$item_id = intval($itemid);
|
||||
$time = intval($hourtime);
|
||||
$item_id = $item_id;
|
||||
$time = $time;
|
||||
$conn = $this->getMysql($accountid);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$status = 1;
|
||||
$status = 2;
|
||||
$active_time = $time * 3600 + time();
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT * FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
$row = $conn->execQueryOne('SELECT * FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
'id' => $item_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row && $item_id != 0) {
|
||||
if ($time == 0) {
|
||||
$status = 1;
|
||||
@ -561,8 +385,7 @@ class AddReward
|
||||
$status = 0;
|
||||
$this->updateStatus($item_id, $accountid);
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' .
|
||||
$ret = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' .
|
||||
' VALUES(:account_id, :id, 0, :status, 0, :active_time, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=:status, num=0, active_time=:active_time, modify_time=:modify_time;',
|
||||
array(
|
||||
@ -572,23 +395,17 @@ class AddReward
|
||||
':status' => $status,
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if(!$ret){
|
||||
die();
|
||||
}
|
||||
|
||||
} else {
|
||||
if ($row['status'] != 2 && $row['active_time'] == 0) {
|
||||
$item_id = $priceid;
|
||||
$item_id = 10003;
|
||||
$item_num = $price;
|
||||
$time = 0;
|
||||
if ($price > 0) {
|
||||
if ($priceid == 10003) {
|
||||
$this->addDiamond($item_id, $item_num, $accountid);
|
||||
} else {
|
||||
$this->addweizhuang($item_id, $item_num, $accountid);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$nowTime = $row['active_time'];
|
||||
$status = $row['status'];
|
||||
@ -601,9 +418,6 @@ class AddReward
|
||||
if ($row['active_time'] < time() + $time * 3600) {
|
||||
$nowTime = time() + $time * 3600;
|
||||
}
|
||||
if ($status == 2) {
|
||||
$status = 1;
|
||||
}
|
||||
}
|
||||
if ($t == 0) {
|
||||
$status = $this->getStatus($item_id, $status,$accountid);
|
||||
@ -611,8 +425,7 @@ class AddReward
|
||||
$status = 0;
|
||||
$this->updateStatus($item_id, $accountid);
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE bag SET active_time=:active_time, status=:status, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE bag SET active_time=:active_time, status=:status, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:account_id AND id=:id;',
|
||||
array(
|
||||
':account_id' => $accountid,
|
||||
@ -620,8 +433,7 @@ class AddReward
|
||||
':active_time' => $nowTime,
|
||||
':status' => $status,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
@ -654,14 +466,12 @@ class AddReward
|
||||
if ($bag['fuction'] != $b['fuction']) {
|
||||
continue;
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT status FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
$row = $conn->execQueryOne('SELECT status FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':id' => $id,
|
||||
)
|
||||
);
|
||||
if (!$row || $row['status'] != 0) {
|
||||
));
|
||||
if ($row['status'] != 0 || !$row) {
|
||||
continue;
|
||||
}
|
||||
$flag = 1;
|
||||
@ -680,13 +490,11 @@ class AddReward
|
||||
if ($bag['fuction'] != $b['fuction']) {
|
||||
continue;
|
||||
}
|
||||
$row_emoji = $conn->execQueryOne(
|
||||
'SELECT status FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
$row_emoji = $conn->execQueryOne('SELECT status FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':id' => $id,
|
||||
)
|
||||
);
|
||||
));
|
||||
if ($row_emoji['status'] == 0) {
|
||||
$emoji_num++;
|
||||
}
|
||||
@ -717,30 +525,26 @@ class AddReward
|
||||
if ($bag['fuction'] != $b['fuction']) {
|
||||
continue;
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT status, active_time FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
$row = $conn->execQueryOne('SELECT status, active_time FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':id' => $id,
|
||||
)
|
||||
);
|
||||
if (!$row || $row['status'] != 0) {
|
||||
));
|
||||
if ($row['status'] != 0 || !$row) {
|
||||
continue;
|
||||
}
|
||||
$status = 2;
|
||||
if ($row['active_time'] == 0) {
|
||||
$status = 1;
|
||||
}
|
||||
$using_ret = $conn->execScript(
|
||||
'UPDATE bag SET status=:status, color_id=0, modify_time=:modify_time ' .
|
||||
$using_ret = $conn->execScript('UPDATE bag SET status=:status, color_id=0, modify_time=:modify_time ' .
|
||||
' WHERE accountid = :account_id AND id = :id;',
|
||||
array(
|
||||
':account_id' => $accountid,
|
||||
':id' => $id,
|
||||
':status' => $status,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if(!$using_ret){
|
||||
die();
|
||||
return;
|
||||
@ -749,7 +553,7 @@ class AddReward
|
||||
}
|
||||
}
|
||||
|
||||
protected function addEquip($item_id, $accountid, $piecestr)
|
||||
protected function addEquip($item_id, $accountid)
|
||||
{
|
||||
$conn = $this->getMysql($accountid);
|
||||
if(!$conn){
|
||||
@ -757,30 +561,25 @@ class AddReward
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT id FROM equip WHERE accountid=:accountid AND id=:id;',
|
||||
$row = $conn->execQueryOne('SELECT id FROM equip WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':id' => $item_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
//没有装备解锁装备
|
||||
$item_list = array();
|
||||
if (!$row) {
|
||||
$rows = $conn->execQuery(
|
||||
'SELECT using_id FROM equip WHERE accountid=:accountid;',
|
||||
$rows = $conn->execQuery('SELECT using_id FROM equip WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
)
|
||||
);
|
||||
));
|
||||
$using_id = $item_id;
|
||||
if ($rows) {
|
||||
foreach ($rows as $r) {
|
||||
$using_id = $r['using_id'];
|
||||
}
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'INSERT INTO equip(accountid, id, lv, active_time, sub_time, create_time, modify_time, using_id, exp) ' .
|
||||
$ret = $conn->execScript('INSERT INTO equip(accountid, id, lv, active_time, sub_time, create_time, modify_time, using_id, exp) ' .
|
||||
' VALUES(:account_id, :id, 0, :active_time, :sub_time, :create_time, :modify_time, :using_id, :exp) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, lv=0, active_time=:active_time, sub_time=:sub_time, modify_time=:modify_time, using_id=:using_id, exp=:exp;',
|
||||
array(
|
||||
@ -792,8 +591,7 @@ class AddReward
|
||||
':sub_time' => 0,
|
||||
':using_id' => $using_id,
|
||||
':exp' => 0,
|
||||
)
|
||||
);
|
||||
));
|
||||
if(!$ret){
|
||||
die();
|
||||
return;
|
||||
@ -811,11 +609,10 @@ class AddReward
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$piecestrs = explode(':', $piecestr);
|
||||
$this->addweizhuang($piecestrs[0], $piecestrs[1], $accountid);
|
||||
$this->addweizhuang(18006, $e['equip_material'], $accountid);
|
||||
array_push($item_list, array(
|
||||
'item_id' => $piecestrs[0],
|
||||
'item_num' => $piecestrs[1],
|
||||
'item_id' => 18006,
|
||||
'item_num' => $e['equip_material'],
|
||||
'time' => 0,
|
||||
));
|
||||
}
|
||||
@ -823,8 +620,7 @@ class AddReward
|
||||
}
|
||||
|
||||
|
||||
public function getRealIndexid($id, $accountid)
|
||||
{
|
||||
public function getRealIndexid($id, $accountid) {
|
||||
$e = $this->getEquip($id);
|
||||
if (!$e || $e['real_index_id'] == '' || !$e['real_index_id']) {
|
||||
return intval($id);
|
||||
@ -832,3 +628,4 @@ class AddReward
|
||||
return intval($e['real_index_id']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace classes;
|
||||
|
||||
use phpcommon;
|
||||
|
||||
class GameLog
|
||||
{
|
||||
private static function writeStrToFile($filename, $str)
|
||||
{
|
||||
$fp = fopen($filename, 'a');
|
||||
if (!$fp) {
|
||||
return;
|
||||
}
|
||||
if (flock($fp, LOCK_EX)) {
|
||||
fwrite($fp, date("Y-m-d H:i:s ",time()));
|
||||
fwrite($fp, $str . "\n");
|
||||
flock($fp, LOCK_UN);
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
private static function writeToLog($pro_name, $gameid, $str)
|
||||
{
|
||||
$log_dir = "/data/logs/$pro_name/$gameid/upload/";
|
||||
$log_file_name_fmt = $log_dir . 'log_000%d_%s.log';
|
||||
if (!is_dir($log_dir)) {
|
||||
mkdir($log_dir, 0766, true);
|
||||
}
|
||||
|
||||
$log_file_name = sprintf($log_file_name_fmt, posix_getppid(), date('YmdH'));
|
||||
GameLog::writeStrToFile($log_file_name, $str);
|
||||
}
|
||||
|
||||
public static function Log($content)
|
||||
{
|
||||
GameLog::writeToLog('game2004api', 2004, $content);
|
||||
}
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace classes;
|
||||
|
||||
use phpcommon;
|
||||
use metatable;
|
||||
|
||||
require_once 'metatable/privilegecard.php';
|
||||
|
||||
class Privilege
|
||||
{
|
||||
|
||||
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 getBattlePlus($account_id)
|
||||
{
|
||||
return 0; //$this->getPrivilegePlus($account_id, 'battleplus');
|
||||
}
|
||||
|
||||
public function getOfflineLimitPlus($account_id) {
|
||||
return $this->getPrivilegePlus($account_id, 'offline_times');
|
||||
}
|
||||
|
||||
public function getMedalLimitPlus($account_id) {
|
||||
return $this->getPrivilegePlus($account_id, 'medal_limit_up');
|
||||
}
|
||||
|
||||
public function getCoinTimesPlus($account_id)
|
||||
{
|
||||
return $this->getPrivilegePlus($account_id, 'dailycoin_times');
|
||||
}
|
||||
|
||||
protected function getPrivilegePlus($account_id, $name)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT * FROM recharge WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
|
||||
if (!$row || is_null($row['vip_info']) || empty($row['vip_info'])) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$plus = 0;
|
||||
$nowtime = time();
|
||||
$vip_info = json_decode($row['vip_info'], true);
|
||||
foreach ($vip_info as $carditem) {
|
||||
if ($carditem['expire'] == 0 || $carditem['expire'] > $nowtime) {
|
||||
$privilegecard_conf = metatable\getPrivilegeCardById($carditem['id']);
|
||||
if ($privilegecard_conf) {
|
||||
$plus += $privilegecard_conf[$name];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $plus;
|
||||
}
|
||||
}
|
@ -1,175 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace classes;
|
||||
|
||||
use phpcommon;
|
||||
use metatable;
|
||||
|
||||
require_once 'metatable/rechargeActivity.php';
|
||||
require_once 'metatable/parameter.php';
|
||||
class RechargeActivity
|
||||
{
|
||||
|
||||
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 triggerConsume($account_id, $num)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
return;
|
||||
}
|
||||
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT activity FROM recharge WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
|
||||
$activity = array();
|
||||
if ($row && !is_null($row['activity']) && !empty($row['activity'])) {
|
||||
$activity = json_decode($row['activity'], true);
|
||||
}
|
||||
|
||||
if ($this->updateActivityCur($activity, $num, false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$nowTime = time();
|
||||
if ($row) {
|
||||
$conn->execScript(
|
||||
'UPDATE recharge SET activity=:activity, modify_time=:modify_time' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':activity' => json_encode($activity),
|
||||
':modify_time' => $nowTime,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$conn->execScript(
|
||||
'INSERT recharge(accountid,activity,create_time,modify_time) VALUES(:accountid,:activity, :create_time, :modify_time); ',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':activity' => json_encode($activity),
|
||||
':create_time' => $nowTime,
|
||||
':modify_time' => $nowTime,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateActivityCur(&$activity, $num, $isrecharge)
|
||||
{
|
||||
$activityconf = metatable\getRechargeActivityConf();
|
||||
if (!$activityconf) {
|
||||
return;
|
||||
}
|
||||
$nowTime = time();
|
||||
$todaysecs = phpcommon\getdayseconds($nowTime);
|
||||
$daysumtarget = intval(metatable\getParameterById(RECHARGE_TARGET)['param_value']) * 10;
|
||||
foreach ($activityconf as $itemconf) {
|
||||
if ($nowTime < strtotime($itemconf['time1']) || $nowTime > strtotime($itemconf['time2'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($isrecharge == ($itemconf['type'] == 2)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$found = false;
|
||||
foreach ($activity as $key => $item) {
|
||||
if ($itemconf['shop_id'] != $item['id']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$found = true;
|
||||
if ($itemconf['type'] == 3) {
|
||||
if ($item['time'] < $todaysecs) {
|
||||
$activity[$key]['cur'] = $num;
|
||||
$activity[$key]['award'] = 0;
|
||||
} else {
|
||||
if ($item['cur'] >= $item['target']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$activity[$key]['cur'] += $num;
|
||||
}
|
||||
$activity[$key]['time'] = $nowTime;
|
||||
}
|
||||
if ($itemconf['type'] == 4) {
|
||||
if ($item['time'] > 0 || $item['cur'] >= $item['target'] || $item['update_cur_time'] >= $todaysecs) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($item['recharge_time'] < $todaysecs) {
|
||||
$activity[$key]['recharge_sum'] = $num;
|
||||
} else {
|
||||
$activity[$key]['recharge_sum'] += $num;
|
||||
}
|
||||
$activity[$key]['recharge_time'] = $nowTime;
|
||||
|
||||
if ($daysumtarget <= $activity[$key]['recharge_sum']) {
|
||||
$activity[$key]['cur']++;
|
||||
$activity[$key]['update_cur_time'] = $nowTime;
|
||||
}
|
||||
} else {
|
||||
if ($item['cur'] >= $item['target']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$activity[$key]['cur'] += $num;
|
||||
}
|
||||
if ($activity[$key]['cur'] > $activity[$key]['target']) {
|
||||
$activity[$key]['cur'] = $activity[$key]['target'];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
$item = array();
|
||||
if ($itemconf['type'] == 4) {
|
||||
$item = array(
|
||||
'id' => $itemconf['shop_id'],
|
||||
'cur' => $num < $daysumtarget ? 0 : 1,
|
||||
'target' => $itemconf['target'],
|
||||
'time' => 0,
|
||||
"recharge_sum" => $num, //当天充值总额
|
||||
"recharge_time" => $nowTime, //最近充值时间戳
|
||||
"update_cur_time" => $num < $daysumtarget ? 0 : $nowTime, //最近更新cur时间戳
|
||||
);
|
||||
} else {
|
||||
$item = array(
|
||||
'id' => $itemconf['shop_id'],
|
||||
'cur' => $num,
|
||||
'target' => $itemconf['target'],
|
||||
'time' => 0,
|
||||
);
|
||||
|
||||
if ($num > $itemconf['target']) {
|
||||
$item['cur'] = $itemconf['target'];
|
||||
}
|
||||
|
||||
if ($itemconf['type'] == 3) {
|
||||
$item['time'] = $nowTime;
|
||||
$item['award'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
array_push($activity, $item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,11 @@
|
||||
<?php
|
||||
|
||||
use classes\GameLog;
|
||||
|
||||
require 'classes/Quest.php';
|
||||
require 'classes/AddReward.php';
|
||||
require 'classes/RechargeActivity.php';
|
||||
require 'classes/GameLog.php';
|
||||
require_once 'metatable/draw.php';
|
||||
require_once 'metatable/parameter.php';
|
||||
require_once 'metatable/drop.php';
|
||||
class ActivityController
|
||||
{
|
||||
class ActivityController{
|
||||
|
||||
private $actTableCache = null;
|
||||
protected function getMysql($account_id)
|
||||
@ -194,31 +189,23 @@ class ActivityController
|
||||
//刷新次数
|
||||
$p_free = $this->getParameter(FREELOTTERY_TIME);
|
||||
$p_video = $this->getParameter(VIDEOLOTTERY_TIME);
|
||||
$p_diamond = $this->getParameter(DIAMONDLOTTERY_TIME);
|
||||
$costlist = $this->getParameter(LOTTERY_COST);
|
||||
$free_times = $p_free['value'];
|
||||
$video_times = $p_video['value'];
|
||||
$diamond_times = $p_diamond['value'];
|
||||
$flush_flag = 0;
|
||||
$now_days = 1;
|
||||
$cur_cost = -1;
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT free_times, video_times, diamond_times, now_days, modify_time FROM activity WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT free_times, video_times, now_days, modify_time FROM activity WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row) {
|
||||
$ret = $conn->execScript(
|
||||
'INSERT INTO activity(accountid, free_times, video_times, diamond_times, item_id, item_num, create_time, modify_time, now_days) ' .
|
||||
' VALUES(:accountid, 0, 0, 0, 0, 0, :create_time, :modify_time, 1) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:accountid, free_times=0, video_times=0, diamond_times=0, item_id=0, item_num=0, modify_time=:modify_time, now_days=1;',
|
||||
$ret = $conn->execScript('INSERT INTO activity(accountid, free_times, video_times, item_id, item_num, create_time, modify_time, now_days) ' .
|
||||
' VALUES(:accountid, 0, 0, 0, 0, :create_time, :modify_time, 1) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:accountid, free_times=0, video_times=0, item_id=0, item_num=0, modify_time=:modify_time, now_days=1;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -226,41 +213,25 @@ class ActivityController
|
||||
$now_days = 1;
|
||||
$free_times = $p_free['value'];
|
||||
$video_times = $p_video['value'];
|
||||
$diamond_times = $p_diamond['value'];
|
||||
} else {
|
||||
$free_times = $p_free['value'] - $row['free_times'];
|
||||
$video_times = $p_video['value'] - $row['video_times'];
|
||||
$diamond_times = $p_diamond['value'] - $row['diamond_times'];
|
||||
$now_days = $row['now_days'];
|
||||
//刷新抽奖活动奖励
|
||||
if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($row['modify_time']) > 0) {
|
||||
$flush_flag = 1;
|
||||
$lottery_ret = $conn->execScript(
|
||||
'UPDATE activity SET free_times=0, video_times=0, diamond_times=0, modify_time=:modify_time ' .
|
||||
$lottery_ret = $conn->execScript('UPDATE activity SET free_times=0, video_times=0, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time(),
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$lottery_ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$free_times = $p_free['value'];
|
||||
$video_times = $p_video['value'];
|
||||
$diamond_times = $p_diamond['value'];
|
||||
$now_days = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($diamond_times > 0) {
|
||||
$coststrs = explode("|", $costlist['value']);
|
||||
$costlen = sizeof($coststrs);
|
||||
if ($costlen >= $diamond_times) {
|
||||
$cur_cost = $coststrs[$costlen - $diamond_times];
|
||||
} else {
|
||||
$cur_cost = $coststrs[$costlen - 1];
|
||||
}
|
||||
}
|
||||
//道具物品
|
||||
@ -321,8 +292,6 @@ class ActivityController
|
||||
'draw_uuid' => $draw_uuid,
|
||||
'free_times' => $free_times,
|
||||
'video_times' => $video_times,
|
||||
'diamond_times' => $diamond_times,
|
||||
'cur_price' => $cur_cost,
|
||||
'item_list' => $draw_list,
|
||||
));
|
||||
}
|
||||
@ -341,27 +310,14 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT free_times, video_times, diamond_times, now_days FROM activity WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT free_times, video_times, now_days FROM activity WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$p_free = $this->getParameter(FREELOTTERY_TIME);
|
||||
$p_video = $this->getParameter(VIDEOLOTTERY_TIME);
|
||||
$p_diamond = $this->getParameter(DIAMONDLOTTERY_TIME);
|
||||
$costlist = $this->getParameter(LOTTERY_COST);
|
||||
$left = $p_free['value'] + $p_video['value'] + $p_diamond['value'] - $row['free_times'] - $row['video_times'] - $row['diamond_times'];
|
||||
if ($left < 1) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
//随机确认奖励
|
||||
$weight_sum = 0;
|
||||
$g_conf_lot_cluster = require('../res/lottery@lottery.php');
|
||||
@ -383,13 +339,12 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 1,'session失效');
|
||||
return;
|
||||
}
|
||||
if ($row['free_times'] + $row['video_times'] + $row['diamond_times'] + 1 == 5) {
|
||||
if ($row['free_times'] + $row['video_times'] + 1 == 6) {
|
||||
$day = 1;
|
||||
if (
|
||||
phpcommon\extractChannel($account_id) == 6001 ||
|
||||
if (phpcommon\extractChannel($account_id) == 6001 ||
|
||||
phpcommon\extractChannel($account_id) == 6000 ||
|
||||
phpcommon\extractChannel($account_id) == 6006
|
||||
) {
|
||||
phpcommon\extractChannel($account_id) == 6006 ||
|
||||
phpcommon\extractChannel($account_id) == 6007) {
|
||||
$day = $row['now_days'];
|
||||
}
|
||||
$g_conf_lot_cluster = require('../res/lottery@lottery.php');
|
||||
@ -453,135 +408,6 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个物品');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($_REQUEST['type'] == 0) {
|
||||
$p_flush = $this->getParameter(FREELOTTERY_TIME);
|
||||
if ($p_flush['value'] <= $row['free_times']) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '今日刷新次数已满');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE activity SET free_times=:free_times, item_id=:item_id, item_num=:item_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':free_times' => $row['free_times'] + 1,
|
||||
':item_id' => $item_id,
|
||||
':item_num' => $item_num,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
} else if ($_REQUEST['type'] == 1) {
|
||||
$p_flush = $this->getParameter(VIDEOLOTTERY_TIME);
|
||||
if ($p_flush['value'] <= $row['video_times']) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '今日刷新次数已满');
|
||||
return;
|
||||
}
|
||||
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE activity SET video_times=:video_times,item_id=:item_id, item_num=:item_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':video_times' => $row['video_times'] + 1,
|
||||
':item_id' => $item_id,
|
||||
':item_num' => $item_num,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
} else if ($_REQUEST['type'] == 2) {
|
||||
//扣钻石
|
||||
$cur_cost = 0;
|
||||
$coststrs = explode("|", $costlist['value']);
|
||||
$costlen = sizeof($coststrs);
|
||||
if ($costlen >= $left) {
|
||||
$cur_cost = intval($coststrs[$costlen - $left]);
|
||||
} else if ($costlen > 0) {
|
||||
$cur_cost = intval($coststrs[$costlen - 1]);
|
||||
}
|
||||
|
||||
if ($cur_cost > 0) {
|
||||
$userrow = $conn->execQueryOne(
|
||||
'SELECT diamond_num, first_gift, free_coin, free_diamond FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
if (!$userrow) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
//扣除钻石
|
||||
if ($userrow['diamond_num'] < $cur_cost) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '钻石不足');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET diamond_num=:diamond_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':diamond_num' => $userrow['diamond_num'] - $cur_cost,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
GameLog::Log('diamond cost: 1,'.$account_id.','.$cur_cost);
|
||||
|
||||
$rechargeactivity = new classes\RechargeActivity();
|
||||
$rechargeactivity->triggerConsume($account_id, $cur_cost);
|
||||
|
||||
$p_flush = $this->getParameter(DIAMONDLOTTERY_TIME);
|
||||
$now_days = $row['now_days'];
|
||||
if ($p_flush['value'] <= $row['diamond_times']) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '今日刷新次数已满');
|
||||
return;
|
||||
}
|
||||
if ($p_flush['value'] == $row['diamond_times'] + 1) {
|
||||
$last_conf = $this->getLottery(count($g_conf_lot_cluster));
|
||||
$now_days++;
|
||||
if ($last_conf && $now_days >= $last_conf['day']) {
|
||||
$now_days = $last_conf['day'];
|
||||
}
|
||||
if (!$now_days) {
|
||||
$now_days = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE activity SET diamond_times=:diamond_times,item_id=:item_id, item_num=:item_num, modify_time=:modify_time, now_days=:now_days ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':diamond_times' => $row['diamond_times'] + 1,
|
||||
':item_id' => $item_id,
|
||||
':item_num' => $item_num,
|
||||
':modify_time' => time(),
|
||||
':now_days' => $now_days
|
||||
)
|
||||
);
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
//增加奖励
|
||||
$addreward = new classes\AddReward();
|
||||
$all_item_list = $addreward->addReward($item_id, $item_num, $account_id, $time, 0);
|
||||
@ -597,6 +423,59 @@ class ActivityController
|
||||
'time' => $time
|
||||
));
|
||||
|
||||
if ($_REQUEST['type'] == 0) {
|
||||
$p_flush = $this->getParameter(FREELOTTERY_TIME);
|
||||
if ($p_flush['value'] <= $row['free_times']) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '今日刷新次数已满');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE activity SET free_times=:free_times, item_id=:item_id, item_num=:item_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':free_times' => $row['free_times'] + 1,
|
||||
':item_id' => $item_id,
|
||||
':item_num' => $item_num,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ($_REQUEST['type'] == 1) {
|
||||
$p_flush = $this->getParameter(VIDEOLOTTERY_TIME);
|
||||
$now_days = $row['now_days'];
|
||||
if ($p_flush['value'] <= $row['video_times']) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '今日刷新次数已满');
|
||||
return;
|
||||
}
|
||||
if ($p_flush['value'] == $row['video_times'] + 1) {
|
||||
$last_conf = $this->getLottery(count($g_conf_lot_cluster));
|
||||
$now_days++;
|
||||
if ($last_conf && $now_days >= $last_conf['day']) {
|
||||
$now_days = $last_conf['day'];
|
||||
}
|
||||
if (!$now_days) {
|
||||
$now_days = 1;
|
||||
}
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE activity SET video_times=:video_times,item_id=:item_id, item_num=:item_num, modify_time=:modify_time, now_days=:now_days ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':video_times' => $row['video_times'] + 1,
|
||||
':item_id' => $item_id,
|
||||
':item_num' => $item_num,
|
||||
':modify_time' => time(),
|
||||
':now_days' => $now_days
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
@ -652,7 +531,7 @@ class ActivityController
|
||||
));
|
||||
}
|
||||
|
||||
private function luckDrawInfo()
|
||||
public function luckDrawInfo()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
@ -678,57 +557,46 @@ class ActivityController
|
||||
//刷新次数
|
||||
$p_free = $this->getParameter(FREELOTTERY_TIME);
|
||||
$p_video = $this->getParameter(VIDEOLOTTERY_TIME);
|
||||
$p_diamond = $this->getParameter(DIAMONDLOTTERY_TIME);
|
||||
$free_times = $p_free['value'];
|
||||
$video_times = $p_video['value'];
|
||||
$diamond_times = $p_diamond['value'];
|
||||
$flush_flag = 0;
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT free_times, video_times, diamond_times, modify_time FROM activity WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT free_times, video_times, modify_time FROM activity WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row) {
|
||||
$ret = $conn->execScript(
|
||||
'INSERT INTO activity(accountid, free_times, video_times, diamond_times, item_id, item_num, create_time, modify_time) ' .
|
||||
' VALUES(:accountid, 0, 0, 0, 0, 0, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:accountid, free_times=0, video_times=0, diamond_times=0, item_id=0, item_num=0, modify_time=:modify_time;',
|
||||
$ret = $conn->execScript('INSERT INTO activity(accountid, free_times, video_times, item_id, item_num, create_time, modify_time) ' .
|
||||
' VALUES(:accountid, 0, 0, 0, 0, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:accountid, free_times=0, video_times=0, item_id=0, item_num=0, modify_time=:modify_time;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$free_times = $p_free['value'];
|
||||
$video_times = $p_video['value'];
|
||||
$diamond_times = $p_diamond['value'];
|
||||
} else {
|
||||
$free_times = $p_free['value'] - $row['free_times'];
|
||||
$video_times = $p_video['value'] - $row['video_times'];
|
||||
$diamond_times = $p_diamond['value'] - $row['diamond_times'];
|
||||
//刷新抽奖活动奖励
|
||||
if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($row['modify_time']) > 0) {
|
||||
$flush_flag = 1;
|
||||
$lottery_ret = $conn->execScript(
|
||||
'UPDATE activity SET free_times=0, video_times=0, diamond_times=0, modify_time=:modify_time ' .
|
||||
$lottery_ret = $conn->execScript('UPDATE activity SET free_times=0, video_times=0, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time(),
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$lottery_ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$free_times = $p_free['value'];
|
||||
$video_times = $p_video['value'];
|
||||
$diamond_times = $p_diamond['value'];
|
||||
}
|
||||
}
|
||||
//道具物品
|
||||
@ -782,12 +650,12 @@ class ActivityController
|
||||
'draw_uuid' => $draw_uuid,
|
||||
'free_times' => $free_times,
|
||||
'video_times' => $video_times,
|
||||
'diamond_times' => $diamond_times,
|
||||
'item_list' => $draw_list,
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
private function getDrawTable()
|
||||
public function getDrawTable()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
@ -851,15 +719,13 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个物品');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE activity SET item_id=:item_id, item_num=:item_num ' .
|
||||
$ret = $conn->execScript('UPDATE activity SET item_id=:item_id, item_num=:item_num ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':item_id' => $item_id,
|
||||
':item_num' => $item_num,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -899,12 +765,10 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT free_times, video_times, diamond_times FROM activity WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT free_times, video_times FROM activity WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
@ -931,13 +795,12 @@ class ActivityController
|
||||
return;
|
||||
}
|
||||
|
||||
if ($row['free_times'] + $row['video_times'] + $row['diamond_times'] + 1 == 5) {
|
||||
if ($row['free_times'] + $row['video_times'] + 1 == 5) {
|
||||
$day = 1;
|
||||
if (
|
||||
phpcommon\extractChannel($account_id) == DOUYIN_CHANNEL ||
|
||||
if (phpcommon\extractChannel($account_id) == DOUYIN_CHANNEL ||
|
||||
phpcommon\extractChannel($account_id) == 6001 ||
|
||||
phpcommon\extractChannel($account_id) == 6000
|
||||
) {
|
||||
phpcommon\extractChannel($account_id) == 6000 ||
|
||||
phpcommon\extractChannel($account_id) == 6007) {
|
||||
$day = date('w', time());
|
||||
if ($day == 0) {
|
||||
$day = 7;
|
||||
@ -962,7 +825,7 @@ class ActivityController
|
||||
} else {
|
||||
$key = $lot_array[1]['key'];
|
||||
}
|
||||
} else if ($row['free_times'] + $row['video_times'] + $row['diamond_times'] + 1 == 6) {
|
||||
} else if ($row['free_times'] + $row['video_times'] + 1 == 6) {
|
||||
foreach ($user_db['draw_list'] as $draw) {
|
||||
if (isset($draw['status']) && $draw['status'] != 0) {
|
||||
continue;
|
||||
@ -1044,8 +907,7 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '今日刷新次数已满');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE activity SET free_times=:free_times, item_id=:item_id, item_num=:item_num, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE activity SET free_times=:free_times, item_id=:item_id, item_num=:item_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
@ -1053,8 +915,7 @@ class ActivityController
|
||||
':item_id' => $item_id,
|
||||
':item_num' => $item_num,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1066,8 +927,7 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '今日刷新次数已满');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE activity SET video_times=:video_times,item_id=:item_id, item_num=:item_num, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE activity SET video_times=:video_times,item_id=:item_id, item_num=:item_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
@ -1075,8 +935,7 @@ class ActivityController
|
||||
':item_id' => $item_id,
|
||||
':item_num' => $item_num,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1111,12 +970,10 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT item_id, item_num FROM activity WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT item_id, item_num FROM activity WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
@ -1145,10 +1002,9 @@ class ActivityController
|
||||
|
||||
$day = 1;
|
||||
if ($type == 1) {
|
||||
if (
|
||||
phpcommon\extractChannel($accountid) == 6001 ||
|
||||
phpcommon\extractChannel($accountid) == 6000
|
||||
) {
|
||||
if (phpcommon\extractChannel($accountid) == 6001 ||
|
||||
phpcommon\extractChannel($accountid) == 6000 ||
|
||||
phpcommon\extractChannel($accountid) == 6007) {
|
||||
$day = $days;
|
||||
}
|
||||
}
|
||||
@ -1213,11 +1069,10 @@ class ActivityController
|
||||
}
|
||||
$day = 1;
|
||||
if ($type == 1) {
|
||||
if (
|
||||
phpcommon\extractChannel($accountid) == 6001 ||
|
||||
if (phpcommon\extractChannel($accountid) == 6001 ||
|
||||
phpcommon\extractChannel($accountid) == 6006 ||
|
||||
phpcommon\extractChannel($accountid) == 6000
|
||||
) {
|
||||
phpcommon\extractChannel($accountid) == 6000 ||
|
||||
phpcommon\extractChannel($accountid) == 6007) {
|
||||
$day = date('w', time());
|
||||
if ($day == 0) {
|
||||
$day = 7;
|
||||
@ -1427,12 +1282,10 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT daily_order1, daily_order2, daily_order3 FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT daily_order1, daily_order2, daily_order3 FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
@ -1540,16 +1393,14 @@ class ActivityController
|
||||
'status' => $status
|
||||
));
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET daily_order1=:daily_order1, daily_order2=:daily_order2, daily_order3=:daily_order3 ' .
|
||||
$ret = $conn->execScript('UPDATE user SET daily_order1=:daily_order1, daily_order2=:daily_order2, daily_order3=:daily_order3 ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':daily_order1' => $daily_order1,
|
||||
':daily_order2' => $daily_order2,
|
||||
':daily_order3' => $daily_order3
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1576,12 +1427,10 @@ class ActivityController
|
||||
return;
|
||||
}
|
||||
$id = $_REQUEST['id'];
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT daily_order1, daily_order2, daily_order3 FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT daily_order1, daily_order2, daily_order3 FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
@ -1591,13 +1440,11 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '奖励不可领');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET daily_order1=2 ' .
|
||||
$ret = $conn->execScript('UPDATE user SET daily_order1=2 ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1607,13 +1454,11 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '奖励不可领');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET daily_order2=2 ' .
|
||||
$ret = $conn->execScript('UPDATE user SET daily_order2=2 ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1623,13 +1468,11 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '奖励不可领');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET daily_order3=2 ' .
|
||||
$ret = $conn->execScript('UPDATE user SET daily_order3=2 ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1702,8 +1545,7 @@ class ActivityController
|
||||
protected function insertDrawDB($account_id, $id )
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
$ret = $conn->execScript(
|
||||
'INSERT INTO draw(accountid, id, cd_time, createtime, modifytime) ' .
|
||||
$ret = $conn->execScript('INSERT INTO draw(accountid, id, cd_time, createtime, modifytime) ' .
|
||||
' VALUES(:account_id, :id, 0, :createtime, :modifytime) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, cd_time=0, modifytime=:modifytime;',
|
||||
array(
|
||||
@ -1711,8 +1553,7 @@ class ActivityController
|
||||
':id' => $id,
|
||||
':createtime' => time(),
|
||||
':modifytime' => time(),
|
||||
)
|
||||
);
|
||||
));
|
||||
if(!$ret){
|
||||
die();
|
||||
return;
|
||||
@ -1733,12 +1574,10 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$rows = $conn->execQuery(
|
||||
'SELECT id, cd_time FROM draw WHERE accountid=:accountid;',
|
||||
$rows = $conn->execQuery('SELECT id, cd_time FROM draw WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
$info_list = array();
|
||||
if (!$rows) {
|
||||
$draw_conf = metatable\getDrawConf();
|
||||
@ -1752,16 +1591,14 @@ class ActivityController
|
||||
} else {
|
||||
foreach ($rows as $row) {
|
||||
if ($row['cd_time'] <= time()) {
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE draw SET cd_time=:cd_time, modifytime=:modifytime ' .
|
||||
$ret = $conn->execScript('UPDATE draw SET cd_time=:cd_time, modifytime=:modifytime ' .
|
||||
' WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':cd_time' => 0,
|
||||
':id' => $row['id'],
|
||||
':modifytime' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1801,18 +1638,16 @@ class ActivityController
|
||||
return;
|
||||
}
|
||||
$id = $_REQUEST['id'];
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT cd_time FROM draw WHERE accountid=:accountid AND id=:id;',
|
||||
$row = $conn->execQueryOne('SELECT cd_time FROM draw WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':id' => $id,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
if ($row['cd_time'] > time()) {
|
||||
if ($row['cd_time'] < time() && $row['cd_time'] != 0) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '冷却时间未到');
|
||||
return;
|
||||
}
|
||||
@ -1822,113 +1657,30 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$onedraw = !isset($_REQUEST['type']) || $_REQUEST['type'] == 0;
|
||||
$cost_strings = $onedraw ? explode(":", $dr["onecost"]) : explode(":", $dr['tencost']);
|
||||
if (sizeof($cost_strings) > 1) {
|
||||
$costid = $cost_strings[0];
|
||||
$count = $cost_strings[1];
|
||||
if ($costid == 10003) {
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT diamond_num, first_gift, free_coin, free_diamond FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
//扣除钻石
|
||||
if ($row['diamond_num'] < $count) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '钻石不足');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET diamond_num=:diamond_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':diamond_num' => $row['diamond_num'] - $count,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
GameLog::Log('diamond cost: 2,'.$account_id.','.$count);
|
||||
$rechargeactivity = new classes\RechargeActivity();
|
||||
$rechargeactivity->triggerConsume($account_id, $count);
|
||||
} else {
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT num FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':id' => $costid
|
||||
)
|
||||
);
|
||||
|
||||
if (!$row || $row['num'] < $count) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '道具不足');
|
||||
return;
|
||||
}
|
||||
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE bag SET num=:num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':id' => $costid,
|
||||
':num' => $row['num'] - $count,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
$drop_id = $dr['one_drop'];
|
||||
$times = $dr['one_count'];
|
||||
$item_list = array();
|
||||
$extra_id = $dr['ten_drop'];
|
||||
$extra_times = $dr['ten_count'];
|
||||
$cdtime = $dr['time_cd'];
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE draw SET cd_time=:cd_time, modifytime=:modifytime ' .
|
||||
$ret = $conn->execScript('UPDATE draw SET cd_time=:cd_time, modifytime=:modifytime ' .
|
||||
' WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':cd_time' => time() + $cdtime,
|
||||
':id' => $id,
|
||||
':modifytime' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
if ($onedraw) {
|
||||
$item_list = metatable\getDropAllListById($drop_id, $item_list);
|
||||
} else {
|
||||
for ($j = 0; $j < 10; $j++) {
|
||||
for ($j = 0; $j < $extra_times; $j++) {
|
||||
$item_list = metatable\getDropAllListById($extra_id, $item_list);
|
||||
}
|
||||
for ($i = 0; $i < $times; $i++) {
|
||||
$item_list = metatable\getDropAllListById($drop_id, $item_list);
|
||||
}
|
||||
// for ($j = 0; $j < $extra_times; $j++) {
|
||||
// $item_list = metatable\getDropAllListById($extra_id, $item_list);
|
||||
// }
|
||||
// for ($i = 0; $i < $times; $i++) {
|
||||
// $item_list = metatable\getDropAllListById($drop_id, $item_list);
|
||||
// }
|
||||
|
||||
$all_item_list = array();
|
||||
$addreward = new classes\AddReward();
|
||||
@ -1970,12 +1722,10 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$rowuser = $conn->execQueryOne(
|
||||
'SELECT diamond_num, coin_num FROM user WHERE accountid=:accountid;',
|
||||
$rowuser = $conn->execQueryOne('SELECT diamond_num, coin_num FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$rowuser) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
@ -1995,7 +1745,7 @@ class ActivityController
|
||||
}
|
||||
|
||||
if ($costid == 10003) {
|
||||
if ($cost > $rowuser['diamond_num']) {
|
||||
if($cost >= $rowuser['diamond_num']) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '钻石不足');
|
||||
return;
|
||||
} else {
|
||||
@ -2003,33 +1753,23 @@ class ActivityController
|
||||
}
|
||||
}
|
||||
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET coin_num=:coin_num, diamond_num=:diamond_num, modify_time=:modifytime ' .
|
||||
$ret = $conn->execScript('UPDATE user SET coin_num=:coin_num, diamond_num=:diamond_num, modify_time=:modifytime ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':coin_num' => $coin_num,
|
||||
':diamond_num' => $diamond_num,
|
||||
':modifytime' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
if ($costid == 10003) {
|
||||
$rechargeactivity = new classes\RechargeActivity();
|
||||
$rechargeactivity->triggerConsume($account_id, $cost);
|
||||
GameLog::Log('diamond cost: 3,'.$account_id.','.$cost);
|
||||
}
|
||||
}
|
||||
$rows = $conn->execQuery(
|
||||
'SELECT id, cd_time FROM draw WHERE accountid=:accountid;',
|
||||
$rows = $conn->execQuery('SELECT id, cd_time FROM draw WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$rows) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
@ -2043,16 +1783,14 @@ class ActivityController
|
||||
if ($cd_time <= time()) {
|
||||
$cd_time = 0;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE draw SET cd_time=:cd_time, modifytime=:modifytime ' .
|
||||
$ret = $conn->execScript('UPDATE draw SET cd_time=:cd_time, modifytime=:modifytime ' .
|
||||
' WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':cd_time' => $cd_time,
|
||||
':id' => $row['id'],
|
||||
':modifytime' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -2080,12 +1818,10 @@ class ActivityController
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$rowuser = $conn->execQueryOne(
|
||||
'SELECT daily_diamond_times FROM user WHERE accountid=:accountid;',
|
||||
$rowuser = $conn->execQueryOne('SELECT daily_diamond_times FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$rowuser) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
@ -2099,15 +1835,13 @@ class ActivityController
|
||||
}
|
||||
$addreward->addReward(10003, $num, $account_id, 0, 0);
|
||||
$diamond_times = $rowuser['daily_diamond_times'] + 1;
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET daily_diamond_times=:daily_diamond_times, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET daily_diamond_times=:daily_diamond_times, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':daily_diamond_times' => $diamond_times,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -2131,3 +1865,4 @@ class ActivityController
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
require 'classes/RechargeActivity.php';
|
||||
class AdditemController{
|
||||
protected function getMysql($account_id)
|
||||
{
|
||||
@ -67,10 +66,6 @@ class AdditemController{
|
||||
|
||||
public function additem()
|
||||
{
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$item_id = $_REQUEST['item_id'];
|
||||
$item_num = $_REQUEST['item_num'];
|
||||
$accountid = $_REQUEST['account_id'];
|
||||
@ -134,14 +129,10 @@ class AdditemController{
|
||||
//添加钻石
|
||||
public function addDiamond()
|
||||
{
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$item_id = $_REQUEST['item_id'];
|
||||
$item_num = $_REQUEST['item_num'];
|
||||
$accountid = $_REQUEST['account_id'];
|
||||
// $time = $_REQUEST['time'];
|
||||
$time = $_REQUEST['time'];
|
||||
// if (phpcommon\getIPv4() != '124.78.1.111') {
|
||||
// return;
|
||||
// }
|
||||
@ -173,10 +164,6 @@ class AdditemController{
|
||||
//添加金币
|
||||
public function addCoin()
|
||||
{
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$item_id = $_REQUEST['item_id'];
|
||||
$item_num = $_REQUEST['item_num'];
|
||||
$accountid = $_REQUEST['account_id'];
|
||||
|
@ -3,8 +3,7 @@
|
||||
require 'classes/Quest.php';
|
||||
require 'classes/AddReward.php';
|
||||
|
||||
class BagController
|
||||
{
|
||||
class BagController{
|
||||
|
||||
protected function getMysql($account_id)
|
||||
{
|
||||
@ -72,27 +71,23 @@ class BagController
|
||||
return;
|
||||
}
|
||||
$bag_list = array();
|
||||
$rows = $conn->execQuery(
|
||||
'SELECT * FROM bag WHERE accountid=:account_id;',
|
||||
$rows = $conn->execQuery('SELECT * FROM bag WHERE accountid=:account_id;',
|
||||
array(
|
||||
':account_id' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if ($rows) {
|
||||
foreach ($rows as $row){
|
||||
$active_time = 0;
|
||||
$color_id = 0;
|
||||
$status = $row['status'];
|
||||
if (time() >= $row['active_time'] && $row['active_time'] != 0) {
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE bag SET active_time=0, color_id=0, status=2, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE bag SET active_time=0, color_id=0, status=2, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:account_id AND id=:id;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':id' => $row['id'],
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -123,8 +118,7 @@ class BagController
|
||||
));
|
||||
}
|
||||
|
||||
public function exchangeBagItem()
|
||||
{
|
||||
public function exchangeBagItem() {
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
@ -141,93 +135,70 @@ class BagController
|
||||
}
|
||||
$b = $this->getBag($item_id);
|
||||
$bag_meta_table = require('../res/bag@bag.php');
|
||||
$rsp = array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'item_id' => $item_id,
|
||||
'color_id' => $color_id
|
||||
);
|
||||
//正在装备的道具
|
||||
if ($b['fuction'] != 5 && $b['fuction'] != 6) {
|
||||
foreach ($bag_meta_table as $bag_info) {
|
||||
if ($bag_info['fuction'] != $b['fuction']) {
|
||||
$id = $bag_info['id'];
|
||||
$bag = $this->getBag($id);
|
||||
if ($bag['fuction'] != $b['fuction']) {
|
||||
continue;
|
||||
}
|
||||
$id = $bag_info['id'];
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT status, active_time, color_id FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
$row = $conn->execQueryOne('SELECT status, active_time FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':id' => $id,
|
||||
)
|
||||
);
|
||||
if (!$row || $row['status'] != 0) {
|
||||
));
|
||||
if ($row['status'] != 0 || !$row) {
|
||||
continue;
|
||||
}
|
||||
$status = 2;
|
||||
if ($row['active_time'] == 0 || $row['active_time'] > time()) {
|
||||
if ($row['active_time'] == 0) {
|
||||
$status = 1;
|
||||
}
|
||||
$colorid = 0;
|
||||
if ($id == $item_id) {
|
||||
//仅改变颜色
|
||||
if ($color_id == $row['color_id']) {
|
||||
echo json_encode($rsp);
|
||||
return;
|
||||
}
|
||||
$status = 0;
|
||||
$colorid = $color_id;
|
||||
}
|
||||
$using_ret = $conn->execScript(
|
||||
'UPDATE bag SET status=:status, color_id=:colorid, modify_time=:modify_time ' .
|
||||
$using_ret = $conn->execScript('UPDATE bag SET status=:status, color_id=0, modify_time=:modify_time ' .
|
||||
' WHERE accountid = :account_id AND id = :id;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':id' => $id,
|
||||
':status' => $status,
|
||||
':colorid' => $colorid,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if(!$using_ret){
|
||||
die();
|
||||
return;
|
||||
}
|
||||
if ($id == $item_id) {
|
||||
echo json_encode($rsp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
//要装备的道具
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT status, active_time FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
$row = $conn->execQueryOne('SELECT status FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':id' => $item_id,
|
||||
)
|
||||
);
|
||||
if (!$row || $row['status'] != 1 || ($row['active_time'] > 0 && $row['active_time'] < time())) {
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个道具');
|
||||
return;
|
||||
}
|
||||
|
||||
$exchange_ret = $conn->execScript(
|
||||
'UPDATE bag SET status=0, color_id=:color_id, modify_time=:modify_time ' .
|
||||
$exchange_ret = $conn->execScript('UPDATE bag SET status=0, color_id=:color_id, modify_time=:modify_time ' .
|
||||
' WHERE accountid = :account_id AND id = :id;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':id' => $item_id,
|
||||
':color_id' => $color_id,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if(!$exchange_ret){
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
echo json_encode($rsp);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'item_id' => $item_id,
|
||||
'color_id' => $color_id
|
||||
));
|
||||
}
|
||||
|
||||
public function downItem()
|
||||
@ -247,31 +218,27 @@ class BagController
|
||||
}
|
||||
$b = $this->getBag($item_id);
|
||||
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT status,active_time FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
$row = $conn->execQueryOne('SELECT status,active_time FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':id' => $item_id,
|
||||
)
|
||||
);
|
||||
if (!$row || $row['status'] != 0) {
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个道具');
|
||||
return;
|
||||
}
|
||||
$status = 2;
|
||||
if ($row['active_time'] == 0 || $row['active_time'] > time()) {
|
||||
if ($row['active_time'] == 0) {
|
||||
$status = 1;
|
||||
}
|
||||
$exchange_ret = $conn->execScript(
|
||||
'UPDATE bag SET status=:status, color_id=0, modify_time=:modify_time ' .
|
||||
$exchange_ret = $conn->execScript('UPDATE bag SET status=:status, color_id=0, modify_time=:modify_time ' .
|
||||
' WHERE accountid = :account_id AND id = :id;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':id' => $item_id,
|
||||
':status' => $status,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if(!$exchange_ret){
|
||||
die();
|
||||
return;
|
||||
@ -301,15 +268,13 @@ class BagController
|
||||
return;
|
||||
}
|
||||
|
||||
$exchange_ret = $conn->execScript(
|
||||
'UPDATE bag SET color_id=0, modify_time=:modify_time ' .
|
||||
$exchange_ret = $conn->execScript('UPDATE bag SET color_id=0, modify_time=:modify_time ' .
|
||||
' WHERE accountid = :account_id AND id = :id;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':id' => $item_id,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if(!$exchange_ret){
|
||||
die();
|
||||
return;
|
||||
@ -414,13 +379,11 @@ class BagController
|
||||
}
|
||||
$arr = json_decode($_REQUEST['arr'], true);
|
||||
foreach ($arr as $a) {
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT status FROM bag WHERE accountid=:account_id AND id=:id;',
|
||||
$row = $conn->execQueryOne('SELECT status FROM bag WHERE accountid=:account_id AND id=:id;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':id' => $a['id']
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row) {
|
||||
continue;
|
||||
}
|
||||
@ -428,8 +391,7 @@ class BagController
|
||||
if ($a['count'] == 0) {
|
||||
$status = 2;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE bag SET status=:status, num=:num, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE bag SET status=:status, num=:num, modify_time=:modify_time ' .
|
||||
' WHERE accountid = :account_id AND id = :id;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
@ -437,8 +399,7 @@ class BagController
|
||||
':status' => $status,
|
||||
':num' => $a['count'],
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if(!$ret){
|
||||
die();
|
||||
return;
|
||||
@ -450,3 +411,4 @@ class BagController
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once 'metatable/shopGoods.php';
|
||||
require_once 'metatable/privilegecard.php';
|
||||
require_once 'metatable/rechargeActivity.php';
|
||||
require_once 'metatable/item.php';
|
||||
|
||||
class ConfController
|
||||
{
|
||||
public function get()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
|
||||
$type = $_REQUEST['type'];
|
||||
$conf = array();
|
||||
|
||||
switch ($type) {
|
||||
case 1:
|
||||
$conf = metatable\getRechargeActivityConf();
|
||||
break;
|
||||
case 2:
|
||||
$conf = metatable\getPrivilegeCardConf();
|
||||
break;
|
||||
case 3:
|
||||
$conf = metatable\getShopGoodsConf();
|
||||
break;
|
||||
case 4:
|
||||
$conf = metatable\getItemConf();
|
||||
break;
|
||||
default:
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '参数无效');
|
||||
return;
|
||||
}
|
||||
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'type' => $type,
|
||||
'conf' => $conf,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,11 +1,7 @@
|
||||
<?php
|
||||
|
||||
use classes\GameLog;
|
||||
|
||||
require 'classes/Quest.php';
|
||||
require 'classes/AddReward.php';
|
||||
require 'classes/RechargeActivity.php';
|
||||
require 'classes/GameLog.php';
|
||||
|
||||
class EquipController{
|
||||
|
||||
@ -588,9 +584,6 @@ class EquipController{
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$rechargeactivity = new classes\RechargeActivity();
|
||||
$rechargeactivity->triggerConsume($account_id, $diamond_cost);
|
||||
GameLog::Log('diamond cost: 3,'.$account_id.','.$diamond_cost);
|
||||
}
|
||||
$active_time = $row['active_time'];
|
||||
if ($active_time + $sub_time <= time() ||
|
||||
@ -911,8 +904,6 @@ class EquipController{
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$rechargeactivity = new classes\RechargeActivity();
|
||||
$rechargeactivity->triggerConsume($account_id, $item_num);
|
||||
} else if ($it['type'] == 11) {
|
||||
$rowbag = $conn->execQueryOne('SELECT num FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
@ -1013,18 +1004,9 @@ class EquipController{
|
||||
return;
|
||||
}
|
||||
|
||||
$jinjieinfo = explode('|', $e['promote_material']);
|
||||
if ($key >= count($jinjieinfo)) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 4, '已经满阶');
|
||||
return;
|
||||
}
|
||||
|
||||
$curjinjie = explode(';', $jinjieinfo[$key]);
|
||||
$jinjieitems = array();
|
||||
foreach( $curjinjie as $jinjieitemstr) {
|
||||
$mar_array = explode(':', $jinjieitemstr);
|
||||
$mid = $mar_array[0];
|
||||
$mnum = $mar_array[1];
|
||||
$mar_array = $this->getExplode($e['promote_material']);
|
||||
$mid = $mar_array[$key][0];
|
||||
$mnum = $mar_array[$key][1];
|
||||
$rbag = $conn->execQueryOne('SELECT num FROM bag WHERE accountid=:account_id AND id=:id;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
@ -1036,22 +1018,12 @@ class EquipController{
|
||||
return;
|
||||
}
|
||||
|
||||
$jinjieitems[] = array(
|
||||
"item_id" => $mid,
|
||||
"item_num" => $mnum,
|
||||
);
|
||||
}
|
||||
|
||||
$this->subCoin(10001, $coin_num, $account_id);
|
||||
foreach($jinjieitems as $jinjie_item) {
|
||||
$mid = $jinjie_item['item_id'];
|
||||
$mnum = $jinjie_item['item_num'];
|
||||
$this->subCoin($mid, $mnum, $account_id);
|
||||
}
|
||||
|
||||
$active_time = time();
|
||||
$sub_list = $this->getExplode($e['equip_upgradetime']);
|
||||
$sub_time = 0;//$sub_list[$lv][0];
|
||||
$sub_time = $sub_list[$lv][0];
|
||||
if ($sub_time == 0) {
|
||||
$active_time = 0;
|
||||
$flag = 1;
|
||||
@ -1071,9 +1043,6 @@ class EquipController{
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
$quest = new classes\Quest();
|
||||
$quest->triggerQuest(QUEST_DAY_JINJIE, 1, 1, $account_id);
|
||||
$addreward = new classes\AddReward();
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$num = $addreward->getDiamondNum($account_id);
|
||||
|
@ -1,13 +1,9 @@
|
||||
<?php
|
||||
|
||||
use classes\GameLog;
|
||||
|
||||
require 'classes/AddReward.php';
|
||||
require 'classes/Quest.php';
|
||||
require 'classes/RechargeActivity.php';
|
||||
require 'classes/GameLog.php';
|
||||
require_once 'metatable/activity.php';
|
||||
require_once 'metatable/activityplus.php';
|
||||
require 'classes/Quest.php';
|
||||
|
||||
class FesActivityController{
|
||||
|
||||
@ -201,45 +197,9 @@ class FesActivityController{
|
||||
foreach ($user_db['info_list'] as &$us) {
|
||||
if ($us['id'] == $id) {
|
||||
if ($us['status'] != 1) {
|
||||
if ($us['type'] == '2') {
|
||||
//扣除钻石
|
||||
$userrow = $conn->execQueryOne(
|
||||
'SELECT diamond_num FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
if (!$userrow) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($userrow['diamond_num'] < $us['condition']) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '钻石不足');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET diamond_num=:diamond_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':diamond_num' => $userrow['diamond_num'] - $us['condition'],
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$rechargeactivity = new classes\RechargeActivity();
|
||||
$rechargeactivity->triggerConsume($account_id, $us['condition']);
|
||||
GameLog::Log('diamond cost: 4,'.$account_id.','.$us['condition']);
|
||||
} else {
|
||||
phpcommon\sendError(ERR_USER_BASE + 4, '奖励不可领');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$us['status'] = 2;
|
||||
$status = 2;
|
||||
$reward = metatable\getRewardInfo($user_db['act_id'], $id, 0);
|
||||
@ -315,10 +275,6 @@ class FesActivityController{
|
||||
$times = 0;
|
||||
foreach ($user_db['info_list'] as &$us) {
|
||||
if ($us['id'] == $id) {
|
||||
if ($us['type'] != '1') {
|
||||
phpcommon\sendError(ERR_USER_BASE + 4, '奖励不可领');
|
||||
return;
|
||||
}
|
||||
if ($us['status'] != 0) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 4, '奖励不可领');
|
||||
return;
|
||||
|
@ -58,7 +58,8 @@ class FriendController{
|
||||
}
|
||||
}
|
||||
$avatar_url = $row['avatar_url'];
|
||||
if (phpcommon\extractChannel($row['accountid']) != 6001) {
|
||||
if (phpcommon\extractChannel($row['accountid']) != 6001 &&
|
||||
phpcommon\extractChannel($row['accountid']) != 6007) {
|
||||
$avatar_url = "https://wx.qlogo.cn/mmopen/vi_32/q4oRsMFYBwPEVAeVI7tiasWSqaibr0GPQia432JhibGRYhqqEJofpWDYxJPq6q0hQ0j7icdACdHL78hrjYYHSjZQ3YA/132";
|
||||
}
|
||||
|
||||
|
@ -2,10 +2,8 @@
|
||||
|
||||
require 'classes/Quest.php';
|
||||
require 'classes/AddReward.php';
|
||||
require 'classes/RechargeActivity.php';
|
||||
|
||||
class GameOverController
|
||||
{
|
||||
class GameOverController{
|
||||
|
||||
protected function getMysql($account_id)
|
||||
{
|
||||
@ -166,22 +164,19 @@ class GameOverController
|
||||
}
|
||||
//道具物品
|
||||
$first_list = array();
|
||||
// if (
|
||||
// phpcommon\extractChannel($account_id) == 6001 ||
|
||||
// phpcommon\extractChannel($account_id) == 6007 ||
|
||||
// phpcommon\extractChannel($account_id) == 6008 ||
|
||||
// phpcommon\extractChannel($account_id) == 6000
|
||||
// ) {
|
||||
// array_push($first_list, array(
|
||||
// 'item_id' => 18006,
|
||||
// 'item_num' => $num,
|
||||
// 'time' => 0,
|
||||
// ));
|
||||
// $first_list = $this->randomBox($first_list, 8);
|
||||
// $first_list = $this->randomBox($first_list, 9);
|
||||
// } else {
|
||||
// $first_list = $this->randomReward($rank, $type);
|
||||
// }
|
||||
if (phpcommon\extractChannel($account_id) == 6001 ||
|
||||
phpcommon\extractChannel($account_id) == 6000 ||
|
||||
phpcommon\extractChannel($account_id) == 6007) {
|
||||
array_push($first_list, array(
|
||||
'item_id' => 18006,
|
||||
'item_num' => $num,
|
||||
'time' => 0,
|
||||
));
|
||||
$first_list = $this->randomBox($first_list, 8);
|
||||
$first_list = $this->randomBox($first_list, 9);
|
||||
} else {
|
||||
$first_list = $this->randomReward($rank, $type);
|
||||
}
|
||||
$first_db = array(
|
||||
'first_uuid' => $first_uuid,
|
||||
'first_list' => $first_list,
|
||||
@ -218,15 +213,6 @@ class GameOverController
|
||||
$all_item_list = array();
|
||||
if ($type == 0) {
|
||||
$item_list = $this->fixReward($item_list, 5);
|
||||
$privilege = new classes\Privilege();
|
||||
$coinplus = $privilege->getBattlePlus($account_id);
|
||||
if ($coinplus > 0) {
|
||||
foreach ($item_list as $key => $val) {
|
||||
if ($val['item_id'] == 10001) {
|
||||
$item_list[$key]['item_num'] = $val['item_num'] * (100 + $coinplus) / 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$r = $this->getRedis($first_uuid);
|
||||
$user_db_str = $r->get($first_uuid);
|
||||
@ -301,8 +287,7 @@ class GameOverController
|
||||
return $item_list;
|
||||
}
|
||||
|
||||
protected function randomBox($item_list, $type)
|
||||
{
|
||||
protected function randomBox($item_list, $type) {
|
||||
$b1 = $this->getbox($type);
|
||||
if (!$b1) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励');
|
||||
@ -333,6 +318,7 @@ class GameOverController
|
||||
'item_num' => $fixed_num[$j][0],
|
||||
'time' => $fixed_time[$j][0]
|
||||
));
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -527,12 +513,10 @@ class GameOverController
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$rowUser = $conn->execQueryOne(
|
||||
'SELECT diamond_num FROM user WHERE accountid=:accountid;',
|
||||
$rowUser = $conn->execQueryOne('SELECT diamond_num FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$rowUser) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
@ -544,10 +528,6 @@ class GameOverController
|
||||
}
|
||||
$addreward = new classes\AddReward();
|
||||
$items = $addreward->addReward(10003, -$par, $account_id, 0, 0);
|
||||
if ($par > 0) {
|
||||
$rechargeactivity = new classes\RechargeActivity();
|
||||
$rechargeactivity->triggerConsume($account_id, $par);
|
||||
}
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
require_once 'metatable/shopGoods.php';
|
||||
class HangController{
|
||||
|
||||
protected function getMysql($account_id)
|
||||
@ -142,7 +141,6 @@ class HangController{
|
||||
$open_time = 0;
|
||||
$end_time = 0;
|
||||
$sea_reward = array();
|
||||
$passport_reward = array();
|
||||
$rank_status = 0;
|
||||
$season_meta_table = require('../res/season@season.php');
|
||||
for ($i = 1; $i <= count($season_meta_table); $i++) {
|
||||
@ -152,9 +150,8 @@ class HangController{
|
||||
$end_time = strtotime($season['end_time']);
|
||||
$number = $i;
|
||||
$item_multiply = $this->getExplode($season['reward']);
|
||||
$passportaward = array();
|
||||
for($ii = 1; $ii <= count($item_multiply); $ii++) {
|
||||
$rowpass = $conn->execQueryOne('SELECT active_status, honor_status, season_passport ' .
|
||||
$rowpass = $conn->execQueryOne('SELECT active_status, honor_status ' .
|
||||
' FROM passinfo WHERE accountid=:accountid AND passid=:passid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
@ -162,13 +159,12 @@ class HangController{
|
||||
));
|
||||
$rank_status = 0;
|
||||
if (!$rowpass) {
|
||||
$ret = $conn->execScript('INSERT INTO passinfo(accountid, passid, active_status, honor_status, season_passport, create_time, modify_time) ' .
|
||||
' VALUES(:accountid, :passid, 0, 0, :season_passport, :create_time, :modify_time) ' .
|
||||
$ret = $conn->execScript('INSERT INTO passinfo(accountid, passid, active_status, honor_status, create_time, modify_time) ' .
|
||||
' VALUES(:accountid, :passid, 0, 0, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:accountid, passid=:passid, active_status=0, honor_status=0, modify_time=:modify_time;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $ii,
|
||||
':season_passport' => '',
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
));
|
||||
@ -179,22 +175,6 @@ class HangController{
|
||||
$rank_status = 0;
|
||||
} else {
|
||||
$rank_status = $rowpass['active_status'];
|
||||
if (!is_null($rowpass['season_passport']) && !empty($rowpass['season_passport'])) {
|
||||
$passportawardinfo = json_decode($rowpass['season_passport'], true);
|
||||
foreach($passportawardinfo as $key => $status) {
|
||||
if (!array_key_exists($key, $passportaward)) {
|
||||
$passportaward[$key] = $this->getExplode($season_meta_table[$i][$key]);
|
||||
$passport_reward[$key] = array();
|
||||
}
|
||||
|
||||
$passport_reward[$key][] = array(
|
||||
'item_id' => $passportaward[$key][$ii - 1][0],
|
||||
'item_num' => $passportaward[$key][$ii - 1][1],
|
||||
'time' => $passportaward[$key][$ii - 1][2],
|
||||
'status' => $status,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$key = $ii - 1;
|
||||
@ -451,29 +431,6 @@ class HangController{
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
$shopgoods = metatable\getShopGoodsConf();
|
||||
foreach($shopgoods as $key => $goodsitem) {
|
||||
if ($goodsitem['type'] != 9) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$keyname = 'shop_'.$key;
|
||||
if (array_key_exists($keyname, $passport_reward)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$passport_reward[$keyname] = array();
|
||||
$passportawardinfo = $this->getExplode($season_meta_table[$number][$keyname]);
|
||||
foreach($passportawardinfo as $awarditem) {
|
||||
$passport_reward[$keyname][] = array(
|
||||
'item_id' => $awarditem[0],
|
||||
'item_num' => $awarditem[1],
|
||||
'time' => $awarditem[2],
|
||||
'status' => -1,
|
||||
);
|
||||
}
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
@ -494,7 +451,6 @@ class HangController{
|
||||
'daily_first_login' => $rowuser['daily_first_login'] + 1,
|
||||
'game_times' => $rowuser['game_times'],
|
||||
'min_rank_score' => $min_rank_score,
|
||||
'passport_reward' => $passport_reward,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -1,502 +0,0 @@
|
||||
<?php
|
||||
|
||||
require 'classes/Quest.php';
|
||||
require 'classes/AddReward.php';
|
||||
require 'classes/Privilege.php';
|
||||
require 'classes/RechargeActivity.php';
|
||||
require_once 'metatable/shopGoods.php';
|
||||
require_once 'metatable/privilegecard.php';
|
||||
require_once 'metatable/rechargeActivity.php';
|
||||
require_once 'metatable/item.php';
|
||||
|
||||
class MailController
|
||||
{
|
||||
protected function getRedis($key)
|
||||
{
|
||||
$redis_conf = getRedisConfig(crc32($key));
|
||||
$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 getMailMysql()
|
||||
{
|
||||
$mysql_conf = getMysqlConfig(1);
|
||||
$conn = new phpcommon\Mysql(array(
|
||||
'host' => $mysql_conf['host'],
|
||||
'port' => $mysql_conf['port'],
|
||||
'user' => $mysql_conf['user'],
|
||||
'passwd' => $mysql_conf['passwd'],
|
||||
'dbname' => MAILDBNAME
|
||||
));
|
||||
return $conn;
|
||||
}
|
||||
|
||||
public function listmail()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$mailconn = $this->getMailMysql();
|
||||
if (!$mailconn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1');
|
||||
return;
|
||||
}
|
||||
|
||||
$userrow = $conn->execQueryOne(
|
||||
'SELECT create_time FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
if (!$userrow) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$usercreate = $userrow['create_time'];
|
||||
$nowtime = time();
|
||||
|
||||
$mailrows = $mailconn->execQuery(
|
||||
' SELECT mail_id, subject, content, attachments, expiretime FROM t_mail WHERE 1=1 AND deleted=0 ' .
|
||||
' AND (user_reg_start_time=0 OR user_reg_end_time=0 OR (user_reg_start_time<:createtime AND user_reg_end_time>:createtime)) ' .
|
||||
' AND expiretime>:nowtime ' .
|
||||
' AND (recipients="" OR recipients="[]" OR recipients LIKE "%'.$account_id.'%");',
|
||||
array(
|
||||
':createtime' => $usercreate,
|
||||
':nowtime' => $nowtime
|
||||
)
|
||||
);
|
||||
|
||||
$usermails = array();
|
||||
$newmails = array();
|
||||
if ($mailrows) {
|
||||
$usermailrows = $conn->execQuery(
|
||||
'SELECT * FROM t_inbox WHERE account_id=:accountid AND expiretime>:nowtime AND createtime>:nowtime-86400*30 ORDER BY idx DESC LIMIT 30;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':nowtime' => $nowtime,
|
||||
)
|
||||
);
|
||||
|
||||
foreach ($mailrows as $mailitem) {
|
||||
$mailstatus = 0;
|
||||
$found = false;
|
||||
if ($usermailrows) {
|
||||
foreach ($usermailrows as $usermailitem) {
|
||||
if ($mailitem['mail_id'] != $usermailitem['mail_id']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$found = true;
|
||||
if ($usermailitem['state'] > 2) { //user deleted
|
||||
continue;
|
||||
}
|
||||
$mailstatus = $usermailitem['state'];
|
||||
}
|
||||
}
|
||||
|
||||
$tmpmail = array(
|
||||
'id' => $mailitem['mail_id'],
|
||||
'status' => $mailstatus,
|
||||
'title' => $mailitem['subject'],
|
||||
'from' => 'system',
|
||||
'content' => $mailitem['content'],
|
||||
'attachment' => json_decode($mailitem['attachments'])
|
||||
);
|
||||
array_push($usermails, $tmpmail);
|
||||
if (!$found) {
|
||||
array_push($newmails, array(
|
||||
'mail_id' => $mailitem['mail_id'],
|
||||
'expiretime' => $mailitem['expiretime']
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'mails' => $usermails,
|
||||
));
|
||||
|
||||
foreach ($newmails as $newitem) {
|
||||
$ret = $conn->execScript(
|
||||
'INSERT INTO t_inbox(account_id, mail_id, state, expiretime, createtime, modifytime) ' .
|
||||
' VALUES(:account_id, :mailid, 0, :expiretime, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE account_id=:account_id, mail_id=:mailid, state=0, expiretime=:expiretime, modifytime=:modify_time;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':mailid' => $newitem['mail_id'],
|
||||
':expiretime' => $newitem['expiretime'],
|
||||
':create_time' => $nowtime,
|
||||
':modify_time' => $nowtime
|
||||
)
|
||||
);
|
||||
if (!$ret) {
|
||||
error_log("insert new mail error:" . $account_id . "," . $newitem['mail_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function action()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
$act = $_REQUEST['type'];
|
||||
if ($act < 1 || $act > 3) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'type无效');
|
||||
return;
|
||||
}
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$mailconn = $this->getMailMysql();
|
||||
if (!$mailconn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1');
|
||||
return;
|
||||
}
|
||||
|
||||
$userrow = $conn->execQueryOne(
|
||||
'SELECT create_time FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
if (!$userrow) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$usercreate = $userrow['create_time'];
|
||||
$nowtime = time();
|
||||
$mailid = $_REQUEST['mailid'];
|
||||
|
||||
$querystr = 'SELECT mail_id, subject, content, attachments FROM t_mail WHERE 1=1 AND deleted=0 ' .
|
||||
' AND (user_reg_start_time=0 OR user_reg_end_time=0 OR (user_reg_start_time<:createtime AND user_reg_end_time>:createtime)) ' .
|
||||
' AND expiretime>:nowtime ' .
|
||||
' AND (recipients="" OR recipients="[]" OR recipients LIKE "%'.$account_id.'%")';
|
||||
$params = array(
|
||||
':createtime' => $usercreate,
|
||||
':nowtime' => $nowtime
|
||||
);
|
||||
if ($mailid > 0) {
|
||||
$querystr = $querystr . ' AND mail_id=:mailid';
|
||||
$params[':mailid'] = $mailid;
|
||||
}
|
||||
|
||||
$mailrows = $mailconn->execQuery(
|
||||
$querystr . ';',
|
||||
$params
|
||||
);
|
||||
|
||||
if ($mailrows) {
|
||||
$querystr = 'SELECT * FROM t_inbox WHERE account_id=:accountid AND state<:state AND expiretime>:nowtime AND createtime>:nowtime-86400*30 ';
|
||||
$params = array(
|
||||
':accountid' => $account_id,
|
||||
':nowtime' => $nowtime,
|
||||
':state' => $act
|
||||
);
|
||||
|
||||
if ($mailid > 0) {
|
||||
$querystr = $querystr . ' AND mail_id=:mailid';
|
||||
$params[':mailid'] = $mailid;
|
||||
}
|
||||
|
||||
$usermailrows = $conn->execQuery(
|
||||
$querystr . ' ORDER BY idx DESC LIMIT 30;',
|
||||
$params
|
||||
);
|
||||
|
||||
if ($usermailrows) {
|
||||
$mailidlist = '(';
|
||||
$all_attachments = array();
|
||||
foreach ($mailrows as $mailitem) {
|
||||
foreach ($usermailrows as $usermailitem) {
|
||||
if ($mailitem['mail_id'] != $usermailitem['mail_id']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$mailidlist = $mailidlist . $mailitem['mail_id'] . ',';
|
||||
if ($act == 2 && $mailitem['attachments'] != '') { //提取附件
|
||||
$attachments = json_decode($mailitem['attachments'], true);
|
||||
$all_attachments = array_merge($all_attachments, $attachments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mailidlist = $mailidlist . '0)';
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE t_inbox SET state=:state, modifytime=:modify_time ' .
|
||||
' WHERE account_id=:account_id AND mail_id IN '.$mailidlist.';',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':state' => $act,
|
||||
':modify_time' => $nowtime
|
||||
)
|
||||
);
|
||||
if (!$ret) {
|
||||
error_log('update mail state error:' . $account_id . ',' . $act . ',' . $mailidlist);
|
||||
phpcommon\sendError(ERR_INTERNAL + 1, '系统繁忙');
|
||||
return;
|
||||
}
|
||||
|
||||
$item_list = array();
|
||||
if ($act == 2) {
|
||||
foreach ($all_attachments as $attachment_item) {
|
||||
$itemid = $attachment_item['item_id'];
|
||||
$itemexists = false;
|
||||
foreach ($item_list as $key => $item) {
|
||||
if ($item['item_id'] == $itemid) {
|
||||
$itemexists = true;
|
||||
$item_list[$key]['item_num'] += $attachment_item['item_num'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$itemexists) {
|
||||
$item_list[] = array(
|
||||
'item_id' => $attachment_item['item_id'],
|
||||
'item_num' => $attachment_item['item_num']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$addreward = new classes\AddReward();
|
||||
$all_item_list = array();
|
||||
foreach ($item_list as $item) {
|
||||
$items = $addreward->addReward($item['item_id'], $item['item_num'], $account_id, 0, 0);
|
||||
foreach ($items as $i) {
|
||||
array_push($all_item_list, array(
|
||||
'item_id' => $i['item_id'],
|
||||
'item_num' => $i['item_num'],
|
||||
'time' => 0,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
$adfree = $addreward->getAdfree($account_id);
|
||||
$privilege = new classes\Privilege();
|
||||
$plustimes = $privilege->getCoinTimesPlus($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'mailid' => $mailid,
|
||||
'type' => $act,
|
||||
'coin_nums' => $coin_num,
|
||||
'diamond_nums' => $diamond_num,
|
||||
'adfree' => $adfree,
|
||||
'vip_plustime' => $plustimes,
|
||||
'item_list' => $item_list,
|
||||
'all_item_list' => $all_item_list,
|
||||
));
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有邮件');
|
||||
}
|
||||
|
||||
public function usecode()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$giftcode = $_REQUEST['code'];
|
||||
|
||||
$url = '';
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
$url = 'https://adminapi.kingsome.cn/api/v1/giftcode/query';
|
||||
} else {
|
||||
$url = 'https://adminapi-test.kingsome.cn/api/v1/giftcode/query';
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'gameid' => 2004,
|
||||
'code' => $giftcode,
|
||||
);
|
||||
$rsp = '';
|
||||
if (!phpcommon\HttpClient::post($url, json_encode($params), $rsp)) {
|
||||
phpcommon\sendError(ERR_RETRY, '系统繁忙');
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_null($rsp) || empty($rsp)) {
|
||||
phpcommon\sendError(ERR_RETRY, '系统繁忙2');
|
||||
return;
|
||||
}
|
||||
|
||||
$response = json_decode($rsp, true);
|
||||
if ($response['errcode'] != 0) {
|
||||
phpcommon\sendError($response['errcode'], $response['errmsg']);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($response['status'] != 0) {
|
||||
phpcommon\sendError(ERR_RETRY + 1, '不可用');
|
||||
return;
|
||||
}
|
||||
|
||||
$codetype = $response['type'];
|
||||
$coderow = $conn->execQueryOne(
|
||||
'SELECT * FROM code_his WHERE account_id=:accountid AND code_type=:codetype;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':codetype' => $codetype
|
||||
)
|
||||
);
|
||||
|
||||
if ($coderow) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '已用过');
|
||||
return;
|
||||
}
|
||||
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
$url = 'https://adminapi.kingsome.cn/api/v1/giftcode/use';
|
||||
} else {
|
||||
$url = 'https://adminapi-test.kingsome.cn/api/v1/giftcode/use';
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'gameid' => 2004,
|
||||
'account_id' => $account_id,
|
||||
'code' => $giftcode,
|
||||
);
|
||||
|
||||
if (!phpcommon\HttpClient::post($url, json_encode($params), $rsp)) {
|
||||
phpcommon\sendError(ERR_RETRY, '系统繁忙3');
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_null($rsp) || empty($rsp)) {
|
||||
phpcommon\sendError(ERR_RETRY, '系统繁忙4');
|
||||
return;
|
||||
}
|
||||
|
||||
$response = json_decode($rsp, true);
|
||||
if ($response['errcode'] != 0) {
|
||||
phpcommon\sendError($response['errcode'], $response['errmsg']);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($response['status'] != 0) {
|
||||
phpcommon\sendError(ERR_RETRY + 1, '不可用');
|
||||
return;
|
||||
}
|
||||
|
||||
$nowtime = time();
|
||||
$ret = $conn->execScript(
|
||||
'INSERT INTO code_his(account_id, code_type, code, content, ' .
|
||||
' createtime, modifytime)' .
|
||||
' VALUES(:accountid, :codetype, :code, :content, ' .
|
||||
' :create_time, :modify_time);',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':codetype' => $codetype,
|
||||
':code' => $giftcode,
|
||||
':content' => $response['content'],
|
||||
':create_time' => $nowtime,
|
||||
':modify_time' => $nowtime
|
||||
)
|
||||
);
|
||||
if (!$ret) {
|
||||
echo json_encode(array(
|
||||
'errcode' => 2,
|
||||
'errmsg' => '服务器内部错误'
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
$item_list = array();
|
||||
$str_list = explode('|', $response['content']);
|
||||
foreach ($str_list as $stritem) {
|
||||
$itemstrs = explode(':', $stritem);
|
||||
if (count($itemstrs) < 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$item_list[] = array(
|
||||
'item_id' => $itemstrs[0],
|
||||
'item_num' => $itemstrs[1],
|
||||
);
|
||||
}
|
||||
|
||||
$addreward = new classes\AddReward();
|
||||
$all_item_list = array();
|
||||
foreach ($item_list as $item) {
|
||||
$items = $addreward->addReward($item['item_id'], $item['item_num'], $account_id, 0, 0);
|
||||
foreach ($items as $i) {
|
||||
array_push($all_item_list, array(
|
||||
'item_id' => $i['item_id'],
|
||||
'item_num' => $i['item_num'],
|
||||
'time' => 0,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
$adfree = $addreward->getAdfree($account_id);
|
||||
$privilege = new classes\Privilege();
|
||||
$plustimes = $privilege->getCoinTimesPlus($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'code' => $giftcode,
|
||||
'coin_nums' => $coin_num,
|
||||
'diamond_nums' => $diamond_num,
|
||||
'adfree' => $adfree,
|
||||
'vip_plustime' => $plustimes,
|
||||
'item_list' => $item_list,
|
||||
'all_item_list' => $all_item_list,
|
||||
));
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
|
||||
require 'classes/Quest.php';
|
||||
require 'classes/AddReward.php';
|
||||
require_once 'metatable/shopGoods.php';
|
||||
|
||||
class PassController{
|
||||
|
||||
@ -81,7 +80,6 @@ class PassController{
|
||||
$open_time = 0;
|
||||
$end_time = 0;
|
||||
$sea_reward = array();
|
||||
$passport_reward = array();
|
||||
$rank_status = 0;
|
||||
$season_meta_table = require('../res/season@season.php');
|
||||
for ($i = 1; $i <= count($season_meta_table); $i++) {
|
||||
@ -91,10 +89,9 @@ class PassController{
|
||||
$end_time = strtotime($season['end_time']);
|
||||
$number = $i;
|
||||
$item_multiply = $this->getExplode($season['reward']);
|
||||
$passportaward = array();
|
||||
//$ii = 0;
|
||||
for($ii = 1; $ii <= count($item_multiply); $ii++) {
|
||||
$rowpass = $conn->execQueryOne('SELECT active_status, honor_status, season_passport ' .
|
||||
$rowpass = $conn->execQueryOne('SELECT active_status, honor_status ' .
|
||||
' FROM passinfo WHERE accountid=:accountid AND passid=:passid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
@ -102,13 +99,12 @@ class PassController{
|
||||
));
|
||||
$rank_status = 0;
|
||||
if (!$rowpass) {
|
||||
$ret = $conn->execScript('INSERT INTO passinfo(accountid, passid, active_status, honor_status, season_passport, create_time, modify_time) ' .
|
||||
' VALUES(:accountid, :passid, 0, 0, :season_passport, :create_time, :modify_time) ' .
|
||||
$ret = $conn->execScript('INSERT INTO passinfo(accountid, passid, active_status, honor_status, create_time, modify_time) ' .
|
||||
' VALUES(:accountid, :passid, 0, 0, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:accountid, passid=:passid, active_status=0, honor_status=0, modify_time=:modify_time;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $ii,
|
||||
':season_passport' => '',
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
));
|
||||
@ -119,22 +115,6 @@ class PassController{
|
||||
$rank_status = 0;
|
||||
} else {
|
||||
$rank_status = $rowpass['active_status'];
|
||||
if (!is_null($rowpass['season_passport']) && !empty($rowpass['season_passport'])) {
|
||||
$passportawardinfo = json_decode($rowpass['season_passport'], true);
|
||||
foreach($passportawardinfo as $key => $status) {
|
||||
if (!array_key_exists($key, $passportaward)) {
|
||||
$passportaward[$key] = $this->getExplode($season_meta_table[$i][$key]);
|
||||
$passport_reward[$key] = array();
|
||||
}
|
||||
|
||||
$passport_reward[$key][] = array(
|
||||
'item_id' => $passportaward[$key][$ii - 1][0],
|
||||
'item_num' => $passportaward[$key][$ii - 1][1],
|
||||
'time' => $passportaward[$key][$ii - 1][2],
|
||||
'status' => $status,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$key = $ii - 1;
|
||||
@ -212,28 +192,6 @@ class PassController{
|
||||
return;
|
||||
}
|
||||
|
||||
$shopgoods = metatable\getShopGoodsConf();
|
||||
foreach($shopgoods as $key => $goodsitem) {
|
||||
if ($goodsitem['type'] != 9) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$keyname = 'shop_'.$key;
|
||||
if (array_key_exists($keyname, $passport_reward)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$passport_reward[$keyname] = array();
|
||||
$passportawardinfo = $this->getExplode($season_meta_table[$number][$keyname]);
|
||||
foreach($passportawardinfo as $awarditem) {
|
||||
$passport_reward[$keyname][] = array(
|
||||
'item_id' => $awarditem[0],
|
||||
'item_num' => $awarditem[1],
|
||||
'time' => $awarditem[2],
|
||||
'status' => -1,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
@ -249,7 +207,6 @@ class PassController{
|
||||
'week' => $week_reward,
|
||||
'seareward' => $sea_reward,
|
||||
'min_rank_score' => $min_rank_score,
|
||||
'passport_reward' => $passport_reward,
|
||||
));
|
||||
}
|
||||
|
||||
@ -335,103 +292,6 @@ class PassController{
|
||||
));
|
||||
}
|
||||
|
||||
public function getPassportReward() {
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$passid = $_REQUEST['id'];
|
||||
$name = $_REQUEST['name'];
|
||||
$status = 0;
|
||||
$rowPass = $conn->execQueryOne('SELECT season_passport ' .
|
||||
' FROM passinfo WHERE accountid=:accountid AND passid=:passid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $passid
|
||||
));
|
||||
if ($rowPass) {
|
||||
$statusinfo = $rowPass['season_passport'];
|
||||
if (is_null($statusinfo) || empty($statusinfo)) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有该奖励');
|
||||
return;
|
||||
}
|
||||
|
||||
$statusobj = json_decode($statusinfo, true);
|
||||
if (!array_key_exists($name, $statusobj)) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有该奖励 2');
|
||||
return;
|
||||
}
|
||||
|
||||
$status = $statusobj[$name];
|
||||
if ($status == 1) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '该奖励已领取');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$statusobj[$name] = 1;
|
||||
$ret = $conn->execScript('UPDATE passinfo SET season_passport=:season_passport, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid AND passid=:passid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $passid,
|
||||
':season_passport' => json_encode($statusobj),
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
$season = array();
|
||||
$season_meta_table = require('../res/season@season.php');
|
||||
$number = 0;
|
||||
for ($i = 1; $i <= count($season_meta_table); $i++) {
|
||||
$season = $this->getSeason($i);
|
||||
if (time() >= strtotime($season['open_time']) && time() <= strtotime($season['end_time'])) {
|
||||
$number = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($number == 0) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有该奖励 3');
|
||||
return;
|
||||
}
|
||||
|
||||
$item_multiply = $this->getExplode($season_meta_table[$number][$name]);
|
||||
$items = $item_multiply[$passid - 1];
|
||||
|
||||
$reward = array();
|
||||
array_push($reward, array(
|
||||
'item_id' => $items[0],
|
||||
'item_num' => $items[1],
|
||||
'time' => $items[2],
|
||||
));
|
||||
$addreward = new classes\AddReward();
|
||||
$all_item_list = $addreward->addReward($items[0], $items[1], $account_id, $items[2],0);
|
||||
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'status' => 1,
|
||||
'item_list' => $reward,
|
||||
'coin_nums' => $coin_num,
|
||||
'diamond_nums' => $diamond_num,
|
||||
'all_item_list' => $all_item_list
|
||||
));
|
||||
}
|
||||
|
||||
protected function updateStatus($accountid, $passid)
|
||||
{
|
||||
$conn = $this->getMysql($accountid);
|
||||
|
@ -1,11 +1,7 @@
|
||||
<?php
|
||||
|
||||
use classes\GameLog;
|
||||
|
||||
require 'classes/Quest.php';
|
||||
require 'classes/AddReward.php';
|
||||
require 'classes/RechargeActivity.php';
|
||||
require 'classes/GameLog.php';
|
||||
|
||||
class PayController{
|
||||
|
||||
@ -603,9 +599,6 @@ class PayController{
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$rechargeactivity = new classes\RechargeActivity();
|
||||
$rechargeactivity->triggerConsume($account_id, $diamond['coin_num']);
|
||||
GameLog::Log('diamond cost: 5,'.$account_id.','.$diamond['coin_num']);
|
||||
}
|
||||
//首充礼包奖励
|
||||
if ($diamond['shop_type'] == 4) {
|
||||
@ -840,9 +833,6 @@ class PayController{
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$rechargeactivity = new classes\RechargeActivity();
|
||||
$rechargeactivity->triggerConsume($account_id, $item['dprice']);
|
||||
GameLog::Log('diamond cost: 6,'.$account_id.','.$item['dprice']);
|
||||
//添加通行证
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward(10005, 1, $account_id);
|
||||
|
@ -1,574 +0,0 @@
|
||||
<?php
|
||||
|
||||
trait RechargeActivity
|
||||
{
|
||||
protected function getFirstPurchaseActivity($shopid)
|
||||
{
|
||||
$conf = require('../res/firstchargeactivity@firstchargeactivity.php');
|
||||
return array_key_exists($shopid, $conf) ? $conf[$shopid] : null;
|
||||
}
|
||||
public function activityInfo()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$rechargerow = $conn->execQueryOne(
|
||||
'SELECT * FROM recharge WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
|
||||
$firstrecharge = '';
|
||||
$vipinfo = array();
|
||||
$dailypurchase = array();
|
||||
$daysecs = phpcommon\getdayseconds(time());
|
||||
$firstpurchase = (object)array();
|
||||
if ($rechargerow) {
|
||||
if (!is_null($rechargerow['first_data'])) {
|
||||
$firstrecharge = $rechargerow['first_data'];
|
||||
}
|
||||
if (!is_null($rechargerow['vip_info']) && !empty($rechargerow['vip_info'])) {
|
||||
$vipinfo = json_decode($rechargerow['vip_info'], true);
|
||||
foreach ($vipinfo as $key => $val) {
|
||||
$vipinfo[$key]['award'] = $val['daily_time'] < $daysecs ? 0 : 1;
|
||||
unset($vipinfo[$key]['daily_time']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_null($rechargerow['daily_purchase']) && !empty($rechargerow['daily_purchase'])) {
|
||||
$dailypurchase = json_decode($rechargerow['daily_purchase'], true);
|
||||
$packtime = 0;
|
||||
foreach ($dailypurchase as $key => $val) {
|
||||
if ($val['id'] == 10 && $val['time'] > $daysecs) {
|
||||
$packtime = $val['time'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($packtime > 0) {
|
||||
$shopconf = metatable\getShopGoodsConf();
|
||||
foreach ($shopconf as $itemconf) {
|
||||
if ($itemconf['type'] != 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($itemconf['shop_id'] == 10) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$found = false;
|
||||
foreach ($dailypurchase as $key => $val) {
|
||||
if ($val['id'] == $itemconf['shop_id']) {
|
||||
$found = true;
|
||||
$dailypurchase[$key]['time'] = $packtime;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
array_push($dailypurchase, array(
|
||||
'id' => $itemconf['shop_id'],
|
||||
'time' => $packtime,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$daily = array();
|
||||
foreach ($dailypurchase as $key => $val) {
|
||||
if ($val['time'] < $daysecs) {
|
||||
unset($dailypurchase[$key]);
|
||||
} else {
|
||||
array_push($daily, $val);
|
||||
}
|
||||
}
|
||||
$dailypurchase = $daily;
|
||||
}
|
||||
|
||||
if (!is_null($rechargerow['first_purchase']) && !empty($rechargerow['first_purchase'])) {
|
||||
$firstpurchase = json_decode($rechargerow['first_purchase']);
|
||||
}
|
||||
}
|
||||
|
||||
$activityconf = metatable\getRechargeActivityConf();
|
||||
$recharge_activity = array();
|
||||
$activity = array();
|
||||
if (!is_null($rechargerow['activity']) && $rechargerow['activity'] != '') {
|
||||
$activity = json_decode($rechargerow['activity'], true);
|
||||
}
|
||||
$needupdate = false;
|
||||
$time1 = '';
|
||||
$time2 = '';
|
||||
foreach ($activityconf as $key => $itemconf) {
|
||||
$time1 = $itemconf['time1'];
|
||||
$time2 = $itemconf['time2'];
|
||||
if (time() < strtotime($itemconf['time1']) || time() > strtotime($itemconf['time2'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$found = false;
|
||||
$itemarray = array();
|
||||
foreach ($activity as $itemkey => $item) {
|
||||
if ($itemconf['shop_id'] == $item['id']) {
|
||||
$found = true;
|
||||
|
||||
switch ($itemconf['type']) {
|
||||
case 1: //累积充值
|
||||
case 2: //累计消耗
|
||||
case 4: //充值达标天数
|
||||
$itemarray = array(
|
||||
'id' => $item['id'],
|
||||
'cur' => $item['cur'],
|
||||
'target' => $item['target'],
|
||||
'award' => $item['time'] > 0 ? 1 : 0,
|
||||
);
|
||||
break;
|
||||
case 3: //每日累积充值
|
||||
$itemarray['id'] = $item['id'];
|
||||
$itemarray['target'] = $item['target'];
|
||||
if ($item['time'] < $daysecs) {
|
||||
$itemarray['cur'] = 0;
|
||||
$itemarray['award'] = 0;
|
||||
$needupdate = true;
|
||||
$activity[$itemkey]['cur'] = 0;
|
||||
$activity[$itemkey]['award'] = 0;
|
||||
} else {
|
||||
$itemarray['cur'] = $item['cur'];
|
||||
$itemarray['award'] = $item['award'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
$itemarray = array(
|
||||
'id' => $itemconf['shop_id'],
|
||||
'cur' => 0,
|
||||
'target' => $itemconf['target'],
|
||||
'award' => 0,
|
||||
);
|
||||
}
|
||||
if (
|
||||
$itemconf['type'] == 1 ||
|
||||
$itemconf['type'] == 3
|
||||
) {
|
||||
$itemarray['cur'] /= 10;
|
||||
$itemarray['target'] /= 10;
|
||||
}
|
||||
array_push($recharge_activity, $itemarray);
|
||||
}
|
||||
|
||||
if ($needupdate) {
|
||||
$conn->execScript(
|
||||
'UPDATE recharge SET activity=:activity, modify_time=:modify_time' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':activity' => json_encode($activity),
|
||||
':modify_time' => time(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'first_recharge' => $firstrecharge,
|
||||
'vip_info' => $vipinfo,
|
||||
'daily_purchase' => $dailypurchase,
|
||||
'recharge_activity' => $recharge_activity,
|
||||
'time1' => $time1,
|
||||
'time2' => $time2,
|
||||
'first_purchase' => $firstpurchase,
|
||||
));
|
||||
}
|
||||
|
||||
public function getVipDailyAward()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$rechargerow = $conn->execQueryOne(
|
||||
'SELECT vip_info FROM recharge WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
|
||||
if (is_null($rechargerow['vip_info']) || empty($rechargerow['vip_info'])) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没月卡');
|
||||
return;
|
||||
}
|
||||
|
||||
$vipinfo = json_decode($rechargerow['vip_info'], true);
|
||||
$item_list = array();
|
||||
$found = false;
|
||||
$nowTime = time();
|
||||
foreach ($vipinfo as $key => $val) {
|
||||
if ($val['id'] == $_REQUEST['id']) {
|
||||
if ($val['expire'] > 0 && $val['expire'] < $nowTime) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '月卡过期');
|
||||
return;
|
||||
}
|
||||
|
||||
if (phpcommon\getdayseconds($val['daily_time']) >= phpcommon\getdayseconds($nowTime)) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '月卡奖励已领');
|
||||
return;
|
||||
}
|
||||
|
||||
$privilegecard_conf = metatable\getPrivilegeCardById($_REQUEST['id']);
|
||||
if (!$privilegecard_conf) {
|
||||
error_log('game2004api payNotify privilege card goods config error:' + json_encode($_REQUEST));
|
||||
echo json_encode(array(
|
||||
'errcode' => 4,
|
||||
'errmsg' => 'privilege card error'
|
||||
));
|
||||
die();
|
||||
}
|
||||
|
||||
$itemconf = metatable\getItemById($privilegecard_conf['item_id']);
|
||||
if (!$itemconf) {
|
||||
error_log('game2004api payNotify privilege card goods config error 2:' + json_encode($_REQUEST));
|
||||
echo json_encode(array(
|
||||
'errcode' => 4,
|
||||
'errmsg' => 'privilege card error 2'
|
||||
));
|
||||
die();
|
||||
}
|
||||
|
||||
$dropconf = $this->getDrop($itemconf['fuctionindex']);
|
||||
if (!$dropconf) {
|
||||
error_log('game2004api payNotify privilege card goods config error 3:' + json_encode($_REQUEST));
|
||||
echo json_encode(array(
|
||||
'errcode' => 4,
|
||||
'errmsg' => 'privilege card error 3'
|
||||
));
|
||||
die();
|
||||
}
|
||||
|
||||
$vipinfo[$key]['daily_time'] = $nowTime;
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE recharge SET vip_info=:vip_info, modify_time=:modify_time' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':vip_info' => json_encode($vipinfo),
|
||||
':modify_time' => time(),
|
||||
)
|
||||
);
|
||||
|
||||
if (!$ret) {
|
||||
echo json_encode(array(
|
||||
'errcode' => 2,
|
||||
'errmsg' => '服务器内部错误'
|
||||
));
|
||||
die();
|
||||
}
|
||||
|
||||
$itemidlist = explode('|', $dropconf['item_id']);
|
||||
$itemnumlist = explode('|', $dropconf['num']);
|
||||
$addreward = new classes\AddReward();
|
||||
$all_item_list = array();
|
||||
foreach ($itemidlist as $key => $itemid) {
|
||||
array_push($item_list, array(
|
||||
'item_id' => $itemid,
|
||||
'item_num' => $itemnumlist[$key],
|
||||
'time' => 0,
|
||||
));
|
||||
$items = $addreward->addReward($itemid, $itemnumlist[$key], $account_id, 0, 0);
|
||||
foreach ($items as $i) {
|
||||
array_push($all_item_list, array(
|
||||
'item_id' => $i['item_id'],
|
||||
'item_num' => $i['item_num'],
|
||||
'time' => $i['time'],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$found = true;
|
||||
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
$adfree = $addreward->getAdfree($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'coin_nums' => $coin_num,
|
||||
'diamond_nums' => $diamond_num,
|
||||
'adfree' => $adfree,
|
||||
'id' => $_REQUEST['id'],
|
||||
'item_list' => $item_list,
|
||||
'vip_info' => json_encode($vipinfo),
|
||||
'all_item_list' => $all_item_list,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没月卡 2');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public function getActivityAward()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$rechargerow = $conn->execQueryOne(
|
||||
'SELECT activity FROM recharge WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
|
||||
if (is_null($rechargerow['activity']) || empty($rechargerow['activity'])) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没参与活动');
|
||||
return;
|
||||
}
|
||||
|
||||
$activity = json_decode($rechargerow['activity'], true);
|
||||
$item_list = array();
|
||||
$found = false;
|
||||
$nowTime = time();
|
||||
foreach ($activity as $key => $val) {
|
||||
if ($val['id'] == $_REQUEST['id']) {
|
||||
if ($val['cur'] < $val['target']) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没完成');
|
||||
return;
|
||||
}
|
||||
|
||||
$activity_conf = metatable\getRechargeActivityById($_REQUEST['id']);
|
||||
if (!$activity_conf) {
|
||||
error_log('game2004api payNotify recharge activity config error:' + json_encode($_REQUEST));
|
||||
echo json_encode(array(
|
||||
'errcode' => 4,
|
||||
'errmsg' => 'activity error'
|
||||
));
|
||||
die();
|
||||
}
|
||||
|
||||
if ($activity_conf['type'] == 3) { //每日充值活动
|
||||
if ($val['time'] < phpcommon\getdayseconds($nowTime) || $val['award'] != 0) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '已领');
|
||||
return;
|
||||
}
|
||||
$activity[$key]['award'] = 1;
|
||||
} else {
|
||||
if ($val['time'] > 0) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '已领');
|
||||
return;
|
||||
}
|
||||
$activity[$key]['time'] = $nowTime;
|
||||
}
|
||||
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE recharge SET activity=:activity, modify_time=:modify_time' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':activity' => json_encode($activity),
|
||||
':modify_time' => $nowTime,
|
||||
)
|
||||
);
|
||||
|
||||
if (!$ret) {
|
||||
echo json_encode(array(
|
||||
'errcode' => 2,
|
||||
'errmsg' => '服务器内部错误'
|
||||
));
|
||||
die();
|
||||
}
|
||||
|
||||
$itemidlist = explode('|', $activity_conf['item_id']);
|
||||
$itemnumlist = explode('|', $activity_conf['item_num']);
|
||||
$addreward = new classes\AddReward();
|
||||
$all_item_list = array();
|
||||
foreach ($itemidlist as $itemkey => $itemid) {
|
||||
array_push($item_list, array(
|
||||
'item_id' => $itemid,
|
||||
'item_num' => $itemnumlist[$itemkey],
|
||||
'time' => 0,
|
||||
));
|
||||
$items = $addreward->addReward($itemid, $itemnumlist[$itemkey], $account_id, 0, 0);
|
||||
foreach ($items as $i) {
|
||||
array_push($all_item_list, array(
|
||||
'item_id' => $i['item_id'],
|
||||
'item_num' => $i['item_num'],
|
||||
'time' => $i['time'],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($activity as $key => $val) {
|
||||
$activity[$key]['award'] = $val['time'] > 0 ? 1 : 0;
|
||||
unset($activity[$key]['time']);
|
||||
}
|
||||
|
||||
$found = true;
|
||||
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
$adfree = $addreward->getAdfree($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'coin_nums' => $coin_num,
|
||||
'diamond_nums' => $diamond_num,
|
||||
'adfree' => $adfree,
|
||||
'id' => $_REQUEST['id'],
|
||||
'item_list' => $item_list,
|
||||
'recharge_activity' => json_encode($activity),
|
||||
'all_item_list' => $all_item_list,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没活动 2');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public function getFirstPurchaseAward()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$rechargerow = $conn->execQueryOne(
|
||||
'SELECT first_purchase FROM recharge WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
|
||||
if (is_null($rechargerow['first_purchase']) || empty($rechargerow['first_purchase'])) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没购买');
|
||||
return;
|
||||
}
|
||||
|
||||
$activitycfg = $this->getFirstPurchaseActivity($_REQUEST['id']);
|
||||
if (!$activitycfg) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没购买 1');
|
||||
return;
|
||||
}
|
||||
|
||||
$firstpurchaseinfo = json_decode($rechargerow['first_purchase'], true);
|
||||
$infokey = 'shop_' . $_REQUEST['id'];
|
||||
if (!array_key_exists($infokey, $firstpurchaseinfo)) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没购买 2');
|
||||
return;
|
||||
}
|
||||
|
||||
$getcount = $firstpurchaseinfo[$infokey]['count'] + 1;
|
||||
$awardkey = 'item_' . $getcount;
|
||||
if (!array_key_exists($awardkey, $activitycfg)) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '已领完');
|
||||
return;
|
||||
}
|
||||
|
||||
$nowtime = time();
|
||||
if (phpcommon\getdayseconds($nowtime) == phpcommon\getdayseconds($firstpurchaseinfo[$infokey]['time'])) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '今日已领');
|
||||
return;
|
||||
}
|
||||
|
||||
$firstpurchaseinfo[$infokey]['time'] = $nowtime;
|
||||
$firstpurchaseinfo[$infokey]['count'] = $getcount;
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE recharge SET first_purchase=:first_purchase, modify_time=:modify_time' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':first_purchase' => json_encode($firstpurchaseinfo),
|
||||
':modify_time' => $nowtime
|
||||
)
|
||||
);
|
||||
|
||||
if (!$ret) {
|
||||
phpcommon\sendError(ERR_RETRY + 1, '系统繁忙');
|
||||
return;
|
||||
}
|
||||
|
||||
$item_list = array();
|
||||
$all_item_list = array();
|
||||
$firstpurchaseawards = explode('|', $activitycfg[$awardkey]);
|
||||
$addreward = new classes\AddReward();
|
||||
foreach ($firstpurchaseawards as $awarditem) {
|
||||
$itemstrs = explode(':', $awarditem);
|
||||
if (count($itemstrs) < 2) {
|
||||
continue;
|
||||
}
|
||||
$item_list[] = array(
|
||||
"item_id" => $itemstrs[0],
|
||||
"item_num" => $itemstrs[1],
|
||||
"time" => 0,
|
||||
);
|
||||
$items = $addreward->addReward($itemstrs[0], $itemstrs[1], $account_id, 0, 0);
|
||||
foreach ($items as $i) {
|
||||
array_push($all_item_list, array(
|
||||
'item_id' => $i['item_id'],
|
||||
'item_num' => $i['item_num'],
|
||||
'time' => $i['time'],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
$adfree = $addreward->getAdfree($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'coin_nums' => $coin_num,
|
||||
'diamond_nums' => $diamond_num,
|
||||
'adfree' => $adfree,
|
||||
'id' => $_REQUEST['id'],
|
||||
'item_list' => $item_list,
|
||||
'all_item_list' => $all_item_list,
|
||||
'first_purchase' => $firstpurchaseinfo,
|
||||
));
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -2,10 +2,8 @@
|
||||
|
||||
require 'classes/Quest.php';
|
||||
require 'classes/AddReward.php';
|
||||
require 'classes/Privilege.php';
|
||||
require_once 'metatable/parameter.php';
|
||||
class RoleController
|
||||
{
|
||||
class RoleController{
|
||||
|
||||
protected function getMysql($account_id)
|
||||
{
|
||||
@ -186,14 +184,11 @@ class RoleController
|
||||
|
||||
$this->updateSwitch($account_id, $switch_id);
|
||||
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT * FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
//$newInfo = array();
|
||||
$needinitweapon = !$row || $row['init_weapon'] == 0;
|
||||
if (!$row) {
|
||||
$season_time = 0;
|
||||
$season_meta_table = require('../res/season@season.php');
|
||||
@ -204,8 +199,7 @@ class RoleController
|
||||
break;
|
||||
}
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'INSERT INTO user(accountid, user_name, avatar_url, game_times, win_times, kills, harm, add_HP, alive_time, coin_num, integral, kill_his, alive_time_his, harm_his, add_HP_his, act_share_time, act_share_status, create_time, modify_time, first_fight, collect_status, keys_num, battle_re_times, shop_flush_times, kefu_status, sign_sum, box_num, diamond_num, sum_coin, pass_status, score, season_status, recharge_times_total, first_gift, season_time, free_coin, free_diamond, season_end_score, kill_modifytime, win_modifytime, rank_modifytime, vip_score, first_login, daily_first_login, daily_time, free_box, update_time, season_games, season_win, sea_max_kill, sea_max_hart, sea_avg_kill, free_lot_ticket, free_dou_lot_ticket, daily_order1, daily_order2, daily_order3, first_bee, newhand, coin_times, newInfo, first_day_ad, share_video_times, share_video_sums, act_video_status, act_ad_status, biogame_times, shop_view_times, new_first_equip, newhand2,game_times2, view_times2, guildcoin_num, new_second_equip, blobdata, cpa_times, daily_diamond_times) ' .
|
||||
$ret = $conn->execScript('INSERT INTO user(accountid, user_name, avatar_url, game_times, win_times, kills, harm, add_HP, alive_time, coin_num, integral, kill_his, alive_time_his, harm_his, add_HP_his, act_share_time, act_share_status, create_time, modify_time, first_fight, collect_status, keys_num, battle_re_times, shop_flush_times, kefu_status, sign_sum, box_num, diamond_num, sum_coin, pass_status, score, season_status, recharge_times_total, first_gift, season_time, free_coin, free_diamond, season_end_score, kill_modifytime, win_modifytime, rank_modifytime, vip_score, first_login, daily_first_login, daily_time, free_box, update_time, season_games, season_win, sea_max_kill, sea_max_hart, sea_avg_kill, free_lot_ticket, free_dou_lot_ticket, daily_order1, daily_order2, daily_order3, first_bee, newhand, coin_times, newInfo, first_day_ad, share_video_times, share_video_sums, act_video_status, act_ad_status, biogame_times, shop_view_times, new_first_equip, newhand2,game_times2, view_times2, guildcoin_num, new_second_equip, blobdata, cpa_times, daily_diamond_times) ' .
|
||||
' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 10000, 0, 0, 0, 0, 0, 0, 0, :create_time, :modify_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, :season_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, :daily_time, 0,:update_time,0,0,0,0,0,0,0,0,0,0,0,0,0,:newInfo,0,0,0,0,0,0,0,0,0,0,0,0,2,:blobdata, 0, 0) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:accountid, user_name=:user_name, avatar_url=:avatar_url, game_times=0, win_times=0, kills=0, harm=0, add_HP=0, alive_time=0, coin_num=0, integral=0, kill_his=0, alive_time_his=0, harm_his=0, add_HP_his=0, act_share_time=0, act_share_status=0, modify_time=:modify_time, first_fight=0, collect_status=0, keys_num=0, battle_re_times=0, shop_flush_times=0, kefu_status=0, sign_sum=0, box_num=0, diamond_num=0, sum_coin=0, pass_status=0, score=0, season_status=1, recharge_times_total=0, first_gift=0, season_time=:season_time, free_coin=0, free_diamond=0, season_end_score=0, kill_modifytime=0, win_modifytime=0, rank_modifytime=0, vip_score=0, first_login=0, daily_first_login=0, daily_time=:daily_time, free_box=0, update_time=:update_time, season_games=0, season_win=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, free_lot_ticket=0, free_dou_lot_ticket=0, daily_order1=0, daily_order2=0, daily_order3=0, first_bee=0, newhand=0, coin_times=0, newInfo=:newInfo, first_day_ad=0, share_video_times=0, share_video_sums=0, act_video_status=0, act_ad_status=0, biogame_times=0, shop_view_times=0, new_first_equip=0, newhand2=0, game_times2=0,view_times2=0, guildcoin_num=0, new_second_equip=2, blobdata=:blobdata, cpa_times=0, daily_diamond_times=0;',
|
||||
array(
|
||||
@ -219,8 +213,7 @@ class RoleController
|
||||
':newInfo' => '',
|
||||
':season_time' => $season_time,
|
||||
':blobdata' => '',
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -284,32 +277,26 @@ class RoleController
|
||||
'blobdata' => '',
|
||||
'cpa_times' => 0,
|
||||
'daily_diamond_times' => 0,
|
||||
'adfree' => 0,
|
||||
'vip_plustime' => 0,
|
||||
));
|
||||
} else {
|
||||
if ($avatar_url != '') {
|
||||
if ($user_name != $row['user_name']) {
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET user_name=:user_name, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET user_name=:user_name, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':user_name' => $user_name,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
if ($avatar_url != $row['avatar_url']) {
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET avatar_url=:avatar_url, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET avatar_url=:avatar_url, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':avatar_url' => $avatar_url,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
$nowTime = phpcommon\getdayseconds(time());
|
||||
@ -328,13 +315,11 @@ class RoleController
|
||||
}
|
||||
if ($row['vip_score'] >= 5 && $act_ad_status != 2) {
|
||||
$act_ad_status = 1;
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET act_ad_status=:act_ad_status WHERE accountid=:accountid;',
|
||||
$ret = $conn->execScript('UPDATE user SET act_ad_status=:act_ad_status WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':act_ad_status' => $act_ad_status
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -347,8 +332,7 @@ class RoleController
|
||||
$cpa_list = $this->getCpa($row['blobdata'], $cpa_times);
|
||||
$blobdata = $cpa_list['cpastr'];
|
||||
$cpa_times = $cpa_list['cpa_times'];
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET daily_first_login=0, kefu_status=0, coin_times=0, ' .
|
||||
$ret = $conn->execScript('UPDATE user SET daily_first_login=0, kefu_status=0, coin_times=0, ' .
|
||||
'modify_time=:modify_time, first_day_ad=0, share_video_times=0, new_second_equip=:new_second_equip, cpa_times=:cpa_times, blobdata=:blobdata, daily_diamond_times=0 WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
@ -356,8 +340,7 @@ class RoleController
|
||||
':new_second_equip' => $new_second_equip,
|
||||
':blobdata' => $blobdata,
|
||||
':cpa_times' => $cpa_times,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -372,22 +355,10 @@ class RoleController
|
||||
$this->updateSeasonStatus($account_id);
|
||||
}
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT * FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
$rechargerow = $conn->execQueryOne(
|
||||
'SELECT * FROM recharge WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
|
||||
$privilege = new classes\Privilege();
|
||||
$plustimes = $privilege->getCoinTimesPlus($account_id);
|
||||
|
||||
));
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
@ -446,32 +417,8 @@ class RoleController
|
||||
'blobdata' => $blobdata,
|
||||
'cpa_times' => $cpa_times,
|
||||
'daily_diamond_times' => $daily_diamond_times,
|
||||
'adfree' => $rechargerow ? $rechargerow['adfree'] : 0,
|
||||
'vip_plustime' => $plustimes,
|
||||
));
|
||||
}
|
||||
|
||||
if ($needinitweapon) {
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET modify_time=:modify_time, init_weapon=1 WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time(),
|
||||
)
|
||||
);
|
||||
|
||||
if ($ret) {
|
||||
$p1 = $this->getParameter(INITIAL_WEAPON);
|
||||
$weapons = explode('|', $p1['param_value']);
|
||||
$addreward = new classes\AddReward();
|
||||
foreach ($weapons as $itemstr) {
|
||||
$strs = explode(':', $itemstr);
|
||||
$itemid = $strs[0];
|
||||
$itemnum = count($strs) > 1 ? $strs[1] : 1;
|
||||
$addreward->addReward($itemid, $itemnum, $account_id, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function getCpa($cpastr, $cpa_times)
|
||||
@ -522,8 +469,7 @@ class RoleController
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$ret1 = $conn->execScript(
|
||||
'INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' .
|
||||
$ret1 = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' .
|
||||
' VALUES(:account_id, :id, 0, :status, 200, :active_time, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=:status, num=200, active_time=:active_time, modify_time=:modify_time;',
|
||||
array(
|
||||
@ -533,10 +479,8 @@ class RoleController
|
||||
':status' => 0,
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
$ret2 = $conn->execScript(
|
||||
'INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' .
|
||||
));
|
||||
$ret2 = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' .
|
||||
' VALUES(:account_id, :id, 0, :status, 0, :active_time, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=:status, num=0, active_time=:active_time, modify_time=:modify_time;',
|
||||
array(
|
||||
@ -546,8 +490,7 @@ class RoleController
|
||||
':status' => 0,
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
protected function updateSeasonStatus($account_id)
|
||||
{
|
||||
@ -557,13 +500,11 @@ class RoleController
|
||||
die();
|
||||
}
|
||||
//刷新赛季奖励状态
|
||||
$rowUser = $conn->execQueryOne(
|
||||
'SELECT season_time, pass_status, integral ' .
|
||||
$rowUser = $conn->execQueryOne('SELECT season_time, pass_status, integral ' .
|
||||
' FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (time() > $rowUser['season_time'] && $rowUser['season_time'] != 0) {
|
||||
$season_meta_table = require('../res/season@season.php');
|
||||
$end_time = 0;
|
||||
@ -578,16 +519,13 @@ class RoleController
|
||||
$integral = 0;
|
||||
for ($j = 1; $j <= count($season_point_table); $j++) {
|
||||
$seasonpoint = $this->getSeasonPoint($j);
|
||||
if (
|
||||
$rowUser['integral'] <= $seasonpoint['max'] ||
|
||||
$seasonpoint['max'] == -1
|
||||
) {
|
||||
if ($rowUser['integral'] <= $seasonpoint['max'] ||
|
||||
$seasonpoint['max'] == -1) {
|
||||
$integral = $seasonpoint['topoint'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$user_ret = $conn->execScript(
|
||||
'UPDATE user SET pass_status=0, score=0, season_status=0, integral=:integral, season_end_score=:season_end_score, modify_time=:modify_time, season_games=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, season_win=0, season_time=:season_time ' .
|
||||
$user_ret = $conn->execScript('UPDATE user SET pass_status=0, score=0, season_status=0, integral=:integral, season_end_score=:season_end_score, modify_time=:modify_time, season_games=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, season_win=0, season_time=:season_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
@ -595,20 +533,16 @@ class RoleController
|
||||
':modify_time' => time(),
|
||||
':season_time' => $end_time,
|
||||
':integral' => $integral
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$user_ret) {
|
||||
die();
|
||||
}
|
||||
$pass_ret = $conn->execScript(
|
||||
'UPDATE passinfo SET active_status=0, honor_status=0, season_passport=:passportinfo, modify_time=:modify_time ' .
|
||||
$pass_ret = $conn->execScript('UPDATE passinfo SET active_status=0, honor_status=0, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passportinfo' => '',
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$pass_ret) {
|
||||
die();
|
||||
}
|
||||
@ -624,15 +558,13 @@ class RoleController
|
||||
if ($daily_time == 0 || ($nowTime - phpcommon\getdayseconds($daily_time) > 0)) {
|
||||
$daily_first_login = 0;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET daily_first_login=:daily_first_login, ' .
|
||||
$ret = $conn->execScript('UPDATE user SET daily_first_login=:daily_first_login, ' .
|
||||
'modify_time=:modify_time WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time(),
|
||||
':daily_first_login' => $daily_first_login,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
@ -658,12 +590,10 @@ class RoleController
|
||||
$coin_num = $_REQUEST['coin_num']; //金币
|
||||
$integral = $_REQUEST['rank_score']; //排位积分
|
||||
$team_status = $_REQUEST['team_status'];
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT * FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1');
|
||||
return;
|
||||
@ -676,10 +606,8 @@ class RoleController
|
||||
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
|
||||
for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) {
|
||||
$seaPoint = $this->getSeasonPoint($ii);
|
||||
if (
|
||||
$row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|
||||
|| $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1
|
||||
) {
|
||||
if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|
||||
|| $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) {
|
||||
$is_pro = $seaPoint['is_protect'];
|
||||
$min_score = $seaPoint['min'];
|
||||
}
|
||||
@ -687,15 +615,13 @@ class RoleController
|
||||
if ($is_pro == 1 && $min_score > $update_score) {
|
||||
$update_score = $min_score;
|
||||
}
|
||||
$inret = $conn->execScript(
|
||||
'UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' .
|
||||
$inret = $conn->execScript('UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':integral' => $update_score,
|
||||
':rank_modifytime' => time(),
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$inret) {
|
||||
die();
|
||||
return;
|
||||
@ -707,14 +633,12 @@ class RoleController
|
||||
$k = $row['kill_his'] / $row['game_times'];
|
||||
}
|
||||
if (($row['kill_his'] + $kills) / ($row['game_times'] + 1) != $k) {
|
||||
$killret = $conn->execScript(
|
||||
'UPDATE user SET kill_modifytime=:kill_modifytime ' .
|
||||
$killret = $conn->execScript('UPDATE user SET kill_modifytime=:kill_modifytime ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':kill_modifytime' => time(),
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$killret) {
|
||||
die();
|
||||
return;
|
||||
@ -722,16 +646,14 @@ class RoleController
|
||||
}
|
||||
//更新胜场信息时间
|
||||
if ($rank == 1) {
|
||||
$winret = $conn->execScript(
|
||||
'UPDATE user SET win_times=:win_times, season_win=:season_win, win_modifytime=:win_modifytime ' .
|
||||
$winret = $conn->execScript('UPDATE user SET win_times=:win_times, season_win=:season_win, win_modifytime=:win_modifytime ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':win_times' => $row['win_times'] + 1,
|
||||
':season_win' => $row['season_win'] + 1,
|
||||
':win_modifytime' => time(),
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$winret) {
|
||||
die();
|
||||
return;
|
||||
@ -784,8 +706,7 @@ class RoleController
|
||||
}
|
||||
$game_times2++;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET game_times=:game_times, kills=:kills, harm=:harm, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, daily_time=:daily_time, season_games=:season_games, sea_max_kill=:sea_max_kill, sea_max_hart=:sea_max_hart, sea_avg_kill=:sea_avg_kill, newhand=:newhand, newhand2=:newhand2, game_times2=:game_times2 ' .
|
||||
$ret = $conn->execScript('UPDATE user SET game_times=:game_times, kills=:kills, harm=:harm, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, daily_time=:daily_time, season_games=:season_games, sea_max_kill=:sea_max_kill, sea_max_hart=:sea_max_hart, sea_avg_kill=:sea_avg_kill, newhand=:newhand, newhand2=:newhand2, game_times2=:game_times2 ' .
|
||||
'WHERE accountid=:accountid;',
|
||||
array(
|
||||
':game_times' => $row['game_times'] + 1,
|
||||
@ -806,8 +727,7 @@ class RoleController
|
||||
':newhand' => $newhand,
|
||||
':newhand2' => $newhand2,
|
||||
':game_times2' => $game_times2,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -835,6 +755,7 @@ class RoleController
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
public function battleReport()
|
||||
@ -857,12 +778,10 @@ class RoleController
|
||||
$rank = $_REQUEST['rank'];
|
||||
$ar = $this->getRankReward($rank);
|
||||
$coin_num = $ar['zbmode_param'];
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT daily_time, coin_num, biogame_times FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT daily_time, coin_num, biogame_times FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1');
|
||||
return;
|
||||
@ -881,8 +800,7 @@ class RoleController
|
||||
if ($daily_time == 0 || ($nowTime - phpcommon\getdayseconds($daily_time) > 0)) {
|
||||
$daily_time = time();
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET coin_num=:coin_num, modify_time=:modify_time, daily_time=:daily_time, biogame_times=:biogame_times ' .
|
||||
$ret = $conn->execScript('UPDATE user SET coin_num=:coin_num, modify_time=:modify_time, daily_time=:daily_time, biogame_times=:biogame_times ' .
|
||||
'WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
@ -890,8 +808,7 @@ class RoleController
|
||||
':modify_time' => time(),
|
||||
':daily_time' => $daily_time,
|
||||
':biogame_times' => $row['biogame_times'] + 1,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -950,12 +867,10 @@ class RoleController
|
||||
if (!$map_tpl_name) {
|
||||
$map_tpl_name = '';
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT * FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1');
|
||||
return;
|
||||
@ -966,14 +881,12 @@ class RoleController
|
||||
$k = $row['kill_his'] / $row['game_times'];
|
||||
}
|
||||
if (($row['kill_his'] + $kills) / ($row['game_times'] + 1) != $k) {
|
||||
$killret = $conn->execScript(
|
||||
'UPDATE user SET kill_modifytime=:kill_modifytime ' .
|
||||
$killret = $conn->execScript('UPDATE user SET kill_modifytime=:kill_modifytime ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':kill_modifytime' => time(),
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$killret) {
|
||||
die();
|
||||
return;
|
||||
@ -981,16 +894,14 @@ class RoleController
|
||||
}
|
||||
//更新胜场信息时间
|
||||
if ($rank == 1) {
|
||||
$winret = $conn->execScript(
|
||||
'UPDATE user SET win_times=:win_times, season_win=:season_win, win_modifytime=:win_modifytime ' .
|
||||
$winret = $conn->execScript('UPDATE user SET win_times=:win_times, season_win=:season_win, win_modifytime=:win_modifytime ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':win_times' => $row['win_times'] + 1,
|
||||
':season_win' => $row['season_win'] + 1,
|
||||
':win_modifytime' => time(),
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$winret) {
|
||||
die();
|
||||
return;
|
||||
@ -1004,10 +915,8 @@ class RoleController
|
||||
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
|
||||
for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) {
|
||||
$seaPoint = $this->getSeasonPoint($ii);
|
||||
if (
|
||||
$row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|
||||
|| $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1
|
||||
) {
|
||||
if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|
||||
|| $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) {
|
||||
$is_pro = $seaPoint['is_protect'];
|
||||
$min_score = $seaPoint['min'];
|
||||
}
|
||||
@ -1015,15 +924,13 @@ class RoleController
|
||||
if ($is_pro == 1 && $min_score > $update_score) {
|
||||
$update_score = $min_score;
|
||||
}
|
||||
$inret = $conn->execScript(
|
||||
'UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' .
|
||||
$inret = $conn->execScript('UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':integral' => $update_score,
|
||||
':rank_modifytime' => time(),
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$inret) {
|
||||
die();
|
||||
return;
|
||||
@ -1090,8 +997,7 @@ class RoleController
|
||||
$game_times2++;
|
||||
}
|
||||
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET game_times=:game_times, kills=:kills, harm=:harm, add_HP=:add_HP, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, add_HP_his=:add_HP_his, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, box_num=:box_num, score=:score, daily_time=:daily_time, season_games=:season_games, sea_max_kill=:sea_max_kill, sea_max_hart=:sea_max_hart, sea_avg_kill=:sea_avg_kill, newhand=:newhand, newhand2=:newhand2, game_times2=:game_times2 ' .
|
||||
$ret = $conn->execScript('UPDATE user SET game_times=:game_times, kills=:kills, harm=:harm, add_HP=:add_HP, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, add_HP_his=:add_HP_his, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, box_num=:box_num, score=:score, daily_time=:daily_time, season_games=:season_games, sea_max_kill=:sea_max_kill, sea_max_hart=:sea_max_hart, sea_avg_kill=:sea_avg_kill, newhand=:newhand, newhand2=:newhand2, game_times2=:game_times2 ' .
|
||||
'WHERE accountid=:accountid;',
|
||||
array(
|
||||
':game_times' => $row['game_times'] + 1,
|
||||
@ -1116,8 +1022,7 @@ class RoleController
|
||||
':newhand' => $newhand,
|
||||
':newhand2' => $newhand2,
|
||||
':game_times2' => $game_times2,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1167,19 +1072,15 @@ class RoleController
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$rowCount = $conn->execQueryRowCount(
|
||||
'SELECT * FROM history_record WHERE accountid=:accountid;',
|
||||
$rowCount = $conn->execQueryRowCount('SELECT * FROM history_record WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if ($rowCount != 0) {
|
||||
$rows = $conn->execQuery(
|
||||
'SELECT * FROM history_record WHERE accountid=:account_id order by game_time desc limit 0,10;',
|
||||
$rows = $conn->execQuery('SELECT * FROM history_record WHERE accountid=:account_id order by game_time desc limit 0,10;',
|
||||
array(
|
||||
':account_id' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
foreach ($rows as $row) {
|
||||
array_push($record_list, array(
|
||||
'map_name' => $row['map_name'],
|
||||
@ -1236,12 +1137,10 @@ class RoleController
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT * FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
@ -1272,14 +1171,12 @@ class RoleController
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET collect_status=1, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET collect_status=1, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':modify_time' => time(),
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1428,6 +1325,7 @@ class RoleController
|
||||
$switch_uuid = 'game2004api_switch:' . $account_id;
|
||||
$r -> set($switch_uuid, $switch_id);
|
||||
$r -> pexpire($switch_uuid, 1000 * 3600 * 24);
|
||||
|
||||
}
|
||||
|
||||
protected function getSwitch($account_id)
|
||||
@ -1484,12 +1382,10 @@ class RoleController
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT newhand, newhand2 FROM user WHERE accountid=:account_id;',
|
||||
$row = $conn->execQueryOne('SELECT newhand, newhand2 FROM user WHERE accountid=:account_id;',
|
||||
array(
|
||||
':account_id' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
$type = 1;
|
||||
if (isset($_REQUEST['type'])) {
|
||||
$type = $_REQUEST['type'];
|
||||
@ -1501,14 +1397,12 @@ class RoleController
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '未达到领取条件');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET newhand=2, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET newhand=2, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':modify_time' => time(),
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1519,14 +1413,12 @@ class RoleController
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '未达到领取条件');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET newhand2=2, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET newhand2=2, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':modify_time' => time(),
|
||||
':accountid' => $account_id
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1598,8 +1490,7 @@ class RoleController
|
||||
. '_'
|
||||
. md5($accountid . 'f3a6a9a5-217a-4079-ab99-b5d69b8212be' . $registertime . $nowtime)
|
||||
. '_'
|
||||
. md5(
|
||||
'f3a6a9a5-217a-4079-ab99-b5d69b8212be'
|
||||
. md5('f3a6a9a5-217a-4079-ab99-b5d69b8212be'
|
||||
. $accountid
|
||||
. $session_key
|
||||
. time()
|
||||
@ -1623,12 +1514,10 @@ class RoleController
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$rowUser = $conn->execQueryOne(
|
||||
'SELECT coin_times, coin_num FROM user WHERE accountid=:accountid;',
|
||||
$rowUser = $conn->execQueryOne('SELECT coin_times, coin_num FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
|
||||
if (!$rowUser) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
@ -1640,20 +1529,17 @@ class RoleController
|
||||
$id = $_REQUEST['id'];
|
||||
}
|
||||
|
||||
$rowEquip = $conn->execQueryOne(
|
||||
'SELECT id, lv FROM equip WHERE accountid=:accountid AND id=:id;',
|
||||
$rowEquip = $conn->execQueryOne('SELECT id, lv FROM equip WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':id' => $id,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$rowEquip) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个装备');
|
||||
return;
|
||||
}
|
||||
|
||||
$privilege = new classes\Privilege();
|
||||
$plustimes = $privilege->getCoinTimesPlus($account_id);
|
||||
|
||||
$coin_times = $rowUser['coin_times'];
|
||||
$p1 = $this->getParameter(DAILYCOIN_TIMES);
|
||||
$max_times = $p1['param_value'];
|
||||
@ -1675,23 +1561,21 @@ class RoleController
|
||||
$coin_arr = $this->getExplode($eg['promote_gold']);
|
||||
$coin_num = $coin_list[$rowEquip['lv']][0] * $coin_arr[$rowEquip['lv']][0];
|
||||
}
|
||||
if ($coin_times >= $max_times + $plustimes) {
|
||||
if ($coin_times >= $max_times) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '今日次数达到上限');
|
||||
return;
|
||||
}
|
||||
//$coin_num = $_REQUEST['num'];
|
||||
//$coin_num = round($num * pow($val, $coin_times));
|
||||
//error_log($coin_num);
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET coin_times=:coin_times, coin_num=:coin_num, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET coin_times=:coin_times, coin_num=:coin_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':coin_times' => $coin_times + 1,
|
||||
':coin_num' => $coin_num + $rowUser['coin_num'],
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1721,12 +1605,10 @@ class RoleController
|
||||
}
|
||||
//$info = array();
|
||||
$id = $_REQUEST['id'];
|
||||
$rowUser = $conn->execQueryOne(
|
||||
'SELECT newInfo FROM user WHERE accountid=:accountid;',
|
||||
$rowUser = $conn->execQueryOne('SELECT newInfo FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
|
||||
if (!$rowUser) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
@ -1737,15 +1619,13 @@ class RoleController
|
||||
$info = array();
|
||||
}
|
||||
array_push($info, (int)$id);
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET newInfo=:newInfo,modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET newInfo=:newInfo,modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':newInfo' => json_encode($info),
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1772,15 +1652,13 @@ class RoleController
|
||||
return;
|
||||
}
|
||||
$num = $_REQUEST['num'];
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET first_day_ad=:first_day_ad,modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET first_day_ad=:first_day_ad,modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':first_day_ad' => $num,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1807,12 +1685,10 @@ class RoleController
|
||||
return;
|
||||
}
|
||||
|
||||
$rowUser = $conn->execQueryOne(
|
||||
'SELECT diamond_num, share_video_times FROM user WHERE accountid=:accountid;',
|
||||
$rowUser = $conn->execQueryOne('SELECT diamond_num, share_video_times FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
|
||||
if (!$rowUser) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
@ -1821,16 +1697,14 @@ class RoleController
|
||||
$p = $this->getParameter(SHARE_VIDEO_REWARD);
|
||||
$num = $p['param_value'];
|
||||
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET diamond_num=:diamond_num, share_video_times=:share_video_times, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, share_video_times=:share_video_times, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':diamond_num' => $rowUser['diamond_num'] + $num,
|
||||
':share_video_times' => $rowUser['share_video_times'] + 1,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1862,26 +1736,22 @@ class RoleController
|
||||
return;
|
||||
}
|
||||
|
||||
$rowUser = $conn->execQueryOne(
|
||||
'SELECT first_gift FROM user WHERE accountid=:accountid;',
|
||||
$rowUser = $conn->execQueryOne('SELECT first_gift FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
|
||||
if (!$rowUser) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET first_gift=1, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET first_gift=1, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -1946,12 +1816,10 @@ class RoleController
|
||||
return;
|
||||
}
|
||||
|
||||
$rowUser = $conn->execQueryOne(
|
||||
'SELECT act_video_status FROM user WHERE accountid=:accountid;',
|
||||
$rowUser = $conn->execQueryOne('SELECT act_video_status FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
|
||||
if (!$rowUser) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
@ -1962,14 +1830,12 @@ class RoleController
|
||||
return;
|
||||
}
|
||||
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET act_video_status=2, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET act_video_status=2, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -2031,12 +1897,10 @@ class RoleController
|
||||
return;
|
||||
}
|
||||
|
||||
$rowUser = $conn->execQueryOne(
|
||||
'SELECT act_ad_status FROM user WHERE accountid=:accountid;',
|
||||
$rowUser = $conn->execQueryOne('SELECT act_ad_status FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
)
|
||||
);
|
||||
));
|
||||
|
||||
if (!$rowUser) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
@ -2047,14 +1911,12 @@ class RoleController
|
||||
return;
|
||||
}
|
||||
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET act_ad_status=2, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET act_ad_status=2, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -2110,37 +1972,36 @@ class RoleController
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
|
||||
}
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
|
||||
}
|
||||
$row = $conn->execQueryOne(
|
||||
'SELECT share_video_sums, act_video_status FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT share_video_sums, act_video_status FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
|
||||
}
|
||||
$status = $row['act_video_status'];
|
||||
if ($row['share_video_sums'] + 1 >= 3 && $row['act_video_status'] < 1){
|
||||
$status = 1;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET share_video_sums=:share_video_sums, modify_time=:modify_time, act_video_status=:act_video_status ' .
|
||||
$ret = $conn->execScript('UPDATE user SET share_video_sums=:share_video_sums, modify_time=:modify_time, act_video_status=:act_video_status ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time(),
|
||||
':share_video_sums' => $row['share_video_sums'] + 1,
|
||||
':act_video_status' => $status,
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -2165,6 +2026,7 @@ class RoleController
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
|
||||
}
|
||||
$addreward = new classes\AddReward();
|
||||
$item_list = array();
|
||||
@ -2179,40 +2041,34 @@ class RoleController
|
||||
$p2 = $this->getParameter(OPENING_SPEAR2);
|
||||
$equip2 = $p2['param_value'];
|
||||
if ($equip1 == $id) {
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET new_first_equip=1, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET new_first_equip=1, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time(),
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE equip SET using_id=:using_id, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE equip SET using_id=:using_id, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':using_id' => $id,
|
||||
':modify_time' => time(),
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
} else if ($equip2 == $id) {
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET new_second_equip=1, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET new_second_equip=1, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time(),
|
||||
)
|
||||
);
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -2226,3 +2082,4 @@ class RoleController
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
require 'classes/AddReward.php';
|
||||
require 'classes/Quest.php';
|
||||
require 'classes/RechargeActivity.php';
|
||||
|
||||
class ShareController{
|
||||
|
||||
@ -120,8 +119,6 @@ class ShareController{
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
$rechargeactivity = new classes\RechargeActivity();
|
||||
$rechargeactivity->triggerConsume($account_id, $num);
|
||||
}
|
||||
|
||||
protected function randBoxReward($drop_id, $times)
|
||||
|
@ -1,10 +1,6 @@
|
||||
<?php
|
||||
|
||||
use classes\GameLog;
|
||||
|
||||
require 'classes/AddReward.php';
|
||||
require 'classes/RechargeActivity.php';
|
||||
require 'classes/GameLog.php';
|
||||
require_once 'metatable/shop.php';
|
||||
require_once 'metatable/shopGoods.php';
|
||||
|
||||
@ -50,6 +46,7 @@ class ShopController{
|
||||
'type' => $item_conf['fuction'],
|
||||
'bug_groupnum' => $item_conf['bug_groupnum'],
|
||||
'shop_list' => $item_conf['shop_list'],
|
||||
'bug_groupnum' => $item_conf['bug_groupnum'],
|
||||
'Isbug_again' => $item_conf['Isbug_again'],
|
||||
'fuctionindex' => $item_conf['fuctionindex'],
|
||||
);
|
||||
@ -68,6 +65,7 @@ class ShopController{
|
||||
'type' => $item_conf['fuction'],
|
||||
'bug_groupnum' => $item_conf['bug_groupnum'],
|
||||
'shop_list' => $item_conf['shop_list'],
|
||||
'bug_groupnum' => $item_conf['bug_groupnum'],
|
||||
'Isbug_again' => $item_conf['Isbug_again'],
|
||||
);
|
||||
return $it;
|
||||
@ -327,9 +325,6 @@ class ShopController{
|
||||
//扣除货币
|
||||
if ($redis_goods['buy'] != 0) {
|
||||
$this->subCoin($price, $account_id, $redis_goods['buy'], $shop_conf['istodayad']);
|
||||
if ($redis_goods['buy'] == 2) {
|
||||
GameLog::Log('diamond cost: 7,'.$account_id.','.$price.','.$id.','.$type);
|
||||
}
|
||||
}
|
||||
//增加奖励
|
||||
$addreward = new classes\AddReward();
|
||||
@ -373,15 +368,11 @@ class ShopController{
|
||||
}
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
$adfree = $addreward->getAdfree($account_id);
|
||||
$medals = $addreward->getMedals($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'coin_nums' => $coin_num,
|
||||
'diamond_nums' => $diamond_num,
|
||||
'adfree' => $adfree,
|
||||
'medals' => $medals,
|
||||
'item_list' => $item_list,
|
||||
'all_item_list' => $all_item_list,
|
||||
'id' => $id,
|
||||
@ -1310,8 +1301,6 @@ class ShopController{
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
$rechargeactivity = new classes\RechargeActivity();
|
||||
$rechargeactivity->triggerConsume($account_id, $coin_num);
|
||||
}
|
||||
|
||||
if ($tips == 3) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@ function getItemConf()
|
||||
return _internalGetItemConf();
|
||||
}
|
||||
|
||||
function getItemById($item_id)
|
||||
function getItemById($param_id)
|
||||
{
|
||||
$conf = getItemConf();
|
||||
$item_id = (int)$item_id;
|
||||
|
@ -12,7 +12,7 @@ function getParameterConf()
|
||||
function getParameterById($param_id)
|
||||
{
|
||||
$conf = getParameterConf();
|
||||
$parameter_id = (int)$param_id;
|
||||
$parameter_id = (int)$parameter_id;
|
||||
return array_key_exists($parameter_id, $conf) ? $conf[$parameter_id] : null;
|
||||
}
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace metatable;
|
||||
|
||||
/*
|
||||
配置表规范
|
||||
getXXXConf:获取表所有数据
|
||||
getXxxById():通过id获取单个数据
|
||||
_internalGetXXXConf:获取表所有数据内部实现不对外开放
|
||||
|
||||
使用方式
|
||||
require_once 'metatable/XXXX.php';
|
||||
|
||||
!!!注意必须使用require_once
|
||||
*/
|
||||
|
||||
function getPrivilegeCardConf()
|
||||
{
|
||||
return _internalGetPrivilegeCardConf();
|
||||
}
|
||||
|
||||
function getPrivilegeCardById($shop_id)
|
||||
{
|
||||
$conf = getPrivilegeCardConf();
|
||||
$shop_id = (int)$shop_id;
|
||||
return array_key_exists($shop_id, $conf) ? $conf[$shop_id] : null;
|
||||
}
|
||||
|
||||
function _internalGetPrivilegeCardConf()
|
||||
{
|
||||
global $g_privilegeCard_table;
|
||||
if (!$g_privilegeCard_table) {
|
||||
$g_privilegeCard_table = require(getConfigBaseDir() . 'privilegecard@privilegecard.php');
|
||||
}
|
||||
return $g_privilegeCard_table;
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace metatable;
|
||||
|
||||
/*
|
||||
配置表规范
|
||||
getXXXConf:获取表所有数据
|
||||
getXxxById():通过id获取单个数据
|
||||
_internalGetXXXConf:获取表所有数据内部实现不对外开放
|
||||
|
||||
使用方式
|
||||
require_once 'metatable/XXXX.php';
|
||||
|
||||
!!!注意必须使用require_once
|
||||
*/
|
||||
|
||||
function getRechargeActivityConf()
|
||||
{
|
||||
return _internalGetRechargeActivityConf();
|
||||
}
|
||||
|
||||
function getRechargeActivityById($shop_id)
|
||||
{
|
||||
$conf = getRechargeActivityConf();
|
||||
$shop_id = (int)$shop_id;
|
||||
return array_key_exists($shop_id, $conf) ? $conf[$shop_id] : null;
|
||||
}
|
||||
|
||||
function _internalGetRechargeActivityConf()
|
||||
{
|
||||
global $g_rechargeActivity_table;
|
||||
if (!$g_rechargeActivity_table) {
|
||||
$g_rechargeActivity_table = require(getConfigBaseDir() . 'rechargeactivity@rechargeactivity.php');
|
||||
}
|
||||
return $g_rechargeActivity_table;
|
||||
}
|
@ -32,7 +32,7 @@ function _internalGetShopGoodsConf()
|
||||
{
|
||||
global $g_shopGoods_table;
|
||||
if (!$g_shopGoods_table) {
|
||||
$g_shopGoods_table = require(getConfigBaseDir() . 'shopGoods@shopGoods.php');
|
||||
$g_shopG_table = require(getConfigBaseDir() . 'shopGoods@shopGoods.php');
|
||||
}
|
||||
return $g_shopGoods_table;
|
||||
return $g_shopG_table;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user