Compare commits

..

7 Commits
master ... qq

Author SHA1 Message Date
aozhiwei
6b5fe94573 1 2021-02-05 20:08:47 +08:00
aozhiwei
a514696ffb 1 2020-12-01 19:10:45 +08:00
aozhiwei
9828497ea9 1 2020-12-01 10:22:37 +08:00
aozhiwei
ab7e59a084 1 2020-11-20 16:19:52 +08:00
aozhiwei
b2916c51c2 1 2020-11-20 16:14:42 +08:00
aozhiwei
fb099b0f73 1 2020-11-20 14:27:11 +08:00
aozhiwei
93938eed5e 1 2020-11-20 14:06:33 +08:00
29 changed files with 1136 additions and 6251 deletions

View File

@ -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

View File

@ -1,6 +1,6 @@
<?php
ini_set('date.timezone', 'Asia/Shanghai');
ini_set('date.timezone','Asia/Shanghai');
require 'phpcommon/common.php';
define('TEAMID_KEY', 'team_uuid:');
@ -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);
@ -82,7 +77,7 @@ define('RAND_DIAMONDSHOP_TIME', 60); //钻石商店刷新次数
define('DIAMONDBOX', 61); //钻石宝箱花费钻石数
define('DIAMONDBOX10', 62); //钻石视频宝箱花费钻石数
define('REDLIMIT', 68); //红包上限
define('RECOMMEND_FOREVER_WEIGHT', 85); //精选道具概率
define('RECOMMEND_FOREVER_WEIGHT',85); //精选道具概率
define('RECOMMEND_TIME', 84); //道具精选时间
define('GAMEOVER_REWARD_TIMES', 87); //战斗结束奖励倍数
define('LOGINBOX_TIME1', 100); //登录礼包-早晨开始时间
@ -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';

View File

@ -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;
}
@ -94,45 +92,29 @@ class AddReward
foreach ($item_list as $item) {
$i = $this->getItem($item['item_id']);
if ($i['type'] == 1) {
if ($i['type'] == 1){
$this->addCoin($item['item_id'], $item['item_num'], $account_id);
} else if ($i['type'] == 2) {
$this->addDiamond($item['item_id'], $item['item_num'], $account_id);
} else if ($i['type'] == 8) {
} else if ($i['type'] == 8){
$this->addticket($item['item_id'], $item['item_num'], $account_id);
} else if ($i['type'] == 9) {
} else if ($i['type'] == 9){
$this->addtenticket($item['item_id'], $item['item_num'], $account_id);
} else if ($i['type'] == 10 || $i['type'] == 11) {
} 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,40 +128,34 @@ class AddReward
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
die();
}
$row = $conn->execQueryOne(
'SELECT num FROM bag WHERE accountid=:accountid AND id=:id;',
array(
':accountid' => $accountid,
':id' => $id
)
);
$row = $conn->execQueryOne('SELECT num FROM bag WHERE accountid=:accountid AND id=:id;',
array(
':accountid' => $accountid,
'id' => $id
));
if (!$row && $id != 0) {
$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(
':account_id' => $accountid,
':id' => $id,
':num' => $num,
':create_time' => time(),
':modify_time' => time()
)
);
if (!$ret) {
$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(
':account_id' => $accountid,
':id' => $id,
':num' => $num,
':create_time' => time(),
':modify_time' => time()
));
if(!$ret){
die();
}
} else {
$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()
)
);
$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;',
array(
':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;',
array(
':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;',
array(
':accountid' => $accountid
)
);
$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()
)
);
$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 ' .
' 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;',
array(
':accountid' => $accountid
)
);
$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()
)
);
$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 ' .
' 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;',
array(
':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,29 +262,25 @@ class AddReward
$status = 0;
}
}
$row = $conn->execQueryOne(
'SELECT status, num FROM bag WHERE accountid=:accountid AND id=:id;',
array(
':accountid' => $accountid,
'id' => $item_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) ' .
' 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(
':account_id' => $accountid,
':id' => $item_id,
':active_time' => 0,
':status' => $status,
':num' => $item_num,
':create_time' => time(),
':modify_time' => time()
)
);
if (!$ret) {
$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(
':account_id' => $accountid,
':id' => $item_id,
':active_time' => 0,
':status' => $status,
':num' => $item_num,
':create_time' => time(),
':modify_time' => time()
));
if(!$ret){
die();
}
} else {
@ -367,17 +294,15 @@ class AddReward
}
}
}
$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,
':id' => $item_id,
':num' => $row['num'] + $item_num,
':status' => $status,
':modify_time' => 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,
':id' => $item_id,
':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;',
array(
':accountid' => $accountid
)
);
$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()
)
);
$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 ' .
' WHERE accountid=:accountid;',
array(
':accountid' => $accountid,
':free_lot_ticket' => $item_num + $row['free_lot_ticket'],
':modify_time' => time()
));
if (!$ret) {
die();
}
@ -418,177 +339,73 @@ class AddReward
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
die();
}
$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 ' .
' 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,
)
);
}
$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 ' .
' 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 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;',
array(
':accountid' => $accountid,
'id' => $item_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;
$active_time = 0;
}
if ($t == 0) {
$status = $this->getStatus($item_id, $status, $accountid);
} else if ($t == 1) {
$status = $this->getStatus($item_id, $status,$accountid);
} else if ($t == 1){
$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) ' .
' 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(
':account_id' => $accountid,
':id' => $item_id,
':active_time' => $active_time,
':status' => $status,
':create_time' => time(),
':modify_time' => time()
)
);
if (!$ret) {
$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(
':account_id' => $accountid,
':id' => $item_id,
':active_time' => $active_time,
':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);
}
}
$this->addDiamond($item_id, $item_num, $accountid);
} else {
$nowTime = $row['active_time'];
$status = $row['status'];
@ -601,27 +418,22 @@ 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);
} else if ($t == 1) {
$status = $this->getStatus($item_id, $status,$accountid);
} else if ($t == 1){
$status = 0;
$this->updateStatus($item_id, $accountid);
}
$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,
':id' => $item_id,
':active_time' => $nowTime,
':status' => $status,
':modify_time' => 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,
':id' => $item_id,
':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;',
array(
':accountid' => $accountid,
':id' => $id,
)
);
if (!$row || $row['status'] != 0) {
$row = $conn->execQueryOne('SELECT status FROM bag WHERE accountid=:accountid AND id=:id;',
array(
':accountid' => $accountid,
':id' => $id,
));
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;',
array(
':accountid' => $accountid,
':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++;
}
@ -703,7 +511,7 @@ class AddReward
public function updateStatus($item_id, $accountid)
{
$conn = $this->getMysql($accountid);
if (!$conn) {
if(!$conn){
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
@ -717,31 +525,27 @@ class AddReward
if ($bag['fuction'] != $b['fuction']) {
continue;
}
$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) {
$row = $conn->execQueryOne('SELECT status, active_time FROM bag WHERE accountid=:accountid AND id=:id;',
array(
':accountid' => $accountid,
':id' => $id,
));
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 ' .
' WHERE accountid = :account_id AND id = :id;',
array(
':account_id' => $accountid,
':id' => $id,
':status' => $status,
':modify_time' => time()
)
);
if (!$using_ret) {
$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,56 +553,50 @@ class AddReward
}
}
protected function addEquip($item_id, $accountid, $piecestr)
protected function addEquip($item_id, $accountid)
{
$conn = $this->getMysql($accountid);
if (!$conn) {
if(!$conn){
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
die();
return;
}
$row = $conn->execQueryOne(
'SELECT id FROM equip WHERE accountid=:accountid AND id=:id;',
array(
':accountid' => $accountid,
':id' => $item_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;',
array(
':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) ' .
' 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(
':account_id' => $accountid,
':id' => $item_id,
':active_time' => 0,
':create_time' => time(),
':modify_time' => time(),
':sub_time' => 0,
':using_id' => $using_id,
':exp' => 0,
)
);
if (!$ret) {
$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(
':account_id' => $accountid,
':id' => $item_id,
':active_time' => 0,
':create_time' => time(),
':modify_time' => time(),
':sub_time' => 0,
':using_id' => $using_id,
':exp' => 0,
));
if(!$ret){
die();
return;
}
array_push($item_list, array(
array_push($item_list,array(
'item_id' => $item_id,
'item_num' => 1,
'time' => 0,
@ -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']);
}
}
?>

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -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'];

View File

@ -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;',
array(
':account_id' => $account_id
)
);
$rows = $conn->execQuery('SELECT * FROM bag WHERE accountid=:account_id;',
array(
':account_id' => $account_id
));
if ($rows) {
foreach ($rows as $row) {
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 ' .
' WHERE accountid=:account_id AND id=:id;',
array(
':account_id' => $account_id,
':id' => $row['id'],
':modify_time' => 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']);
@ -135,99 +129,76 @@ class BagController
$item_id = $_REQUEST['item_id'];
$color_id = $_REQUEST['color_id'];
$conn = $this->getMysql($account_id);
if (!$conn) {
if(!$conn){
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
$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;',
array(
':accountid' => $account_id,
':id' => $id,
)
);
if (!$row || $row['status'] != 0) {
$row = $conn->execQueryOne('SELECT status, active_time FROM bag WHERE accountid=:accountid AND id=:id;',
array(
':accountid' => $account_id,
':id' => $id,
));
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 ' .
' WHERE accountid = :account_id AND id = :id;',
array(
':account_id' => $account_id,
':id' => $id,
':status' => $status,
':colorid' => $colorid,
':modify_time' => time()
)
);
if (!$using_ret) {
$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,
':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;',
array(
':accountid' => $account_id,
':id' => $item_id,
)
);
if (!$row || $row['status'] != 1 || ($row['active_time'] > 0 && $row['active_time'] < time())) {
$row = $conn->execQueryOne('SELECT status FROM bag WHERE accountid=:accountid AND id=:id;',
array(
':accountid' => $account_id,
':id' => $item_id,
));
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 ' .
' 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) {
$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()
@ -241,38 +212,34 @@ class BagController
}
$item_id = $_REQUEST['item_id'];
$conn = $this->getMysql($account_id);
if (!$conn) {
if(!$conn){
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
$b = $this->getBag($item_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) {
$row = $conn->execQueryOne('SELECT status,active_time FROM bag WHERE accountid=:accountid AND id=:id;',
array(
':accountid' => $account_id,
':id' => $item_id,
));
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 ' .
' WHERE accountid = :account_id AND id = :id;',
array(
':account_id' => $account_id,
':id' => $item_id,
':status' => $status,
':modify_time' => time()
)
);
if (!$exchange_ret) {
$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;
}
@ -285,7 +252,7 @@ class BagController
));
}
public function downItemColor()
public function downItemColor()
{
$account_id = $_REQUEST['account_id'];
//登录校验
@ -296,21 +263,19 @@ class BagController
}
$item_id = $_REQUEST['item_id'];
$conn = $this->getMysql($account_id);
if (!$conn) {
if(!$conn){
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
$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) {
$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;
}
@ -334,7 +299,7 @@ class BagController
}
$item_id = $_REQUEST['item_id'];
$conn = $this->getMysql($account_id);
if (!$conn) {
if(!$conn){
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
@ -380,7 +345,7 @@ class BagController
'time' => 1,
));
$items = $addreward->addReward($i, 1, $account_id, $time, 1);
foreach ($items as $it) {
foreach($items as $it) {
array_push($all_item_list, array(
'item_id' => $it['item_id'],
'item_num' => $it['item_num'],
@ -408,19 +373,17 @@ class BagController
return;
}
$conn = $this->getMysql($account_id);
if (!$conn) {
if(!$conn){
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
$arr = json_decode($_REQUEST['arr'], true);
foreach ($arr as $a) {
$row = $conn->execQueryOne(
'SELECT status FROM bag WHERE accountid=:account_id AND id=:id;',
array(
':account_id' => $account_id,
':id' => $a['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,18 +391,16 @@ class BagController
if ($a['count'] == 0) {
$status = 2;
}
$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,
':id' => $a['id'],
':status' => $status,
':num' => $a['count'],
':modify_time' => time()
)
);
if (!$ret) {
$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,
':id' => $a['id'],
':status' => $status,
':num' => $a['count'],
':modify_time' => time()
));
if(!$ret){
die();
return;
}
@ -450,3 +411,4 @@ class BagController
));
}
}
?>

View File

@ -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,
));
}
}

View File

@ -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,45 +1004,26 @@ class EquipController{
return;
}
$jinjieinfo = explode('|', $e['promote_material']);
if ($key >= count($jinjieinfo)) {
phpcommon\sendError(ERR_USER_BASE + 4, '已经满阶');
$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,
':id' => $mid,
));
if (!$rbag || $rbag['num'] < $mnum) {
phpcommon\sendError(ERR_USER_BASE + 6, '材料不足');
return;
}
$curjinjie = explode(';', $jinjieinfo[$key]);
$jinjieitems = array();
foreach( $curjinjie as $jinjieitemstr) {
$mar_array = explode(':', $jinjieitemstr);
$mid = $mar_array[0];
$mnum = $mar_array[1];
$rbag = $conn->execQueryOne('SELECT num FROM bag WHERE accountid=:account_id AND id=:id;',
array(
':account_id' => $account_id,
':id' => $mid,
));
if (!$rbag || $rbag['num'] < $mnum) {
phpcommon\sendError(ERR_USER_BASE + 6, '材料不足');
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);
}
$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);

View File

@ -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;
}
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;

View File

@ -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";
}

View File

@ -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)
{
@ -76,7 +74,7 @@ class GameOverController
'equip_upgradetime' => $equip_conf['equip_upgradetime'],
'diamond_cost' => $equip_conf['diamond_cost'],
'drop_id' => $equip_conf['drop_id']
);
);
return $e;
}
@ -166,32 +164,29 @@ 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,
);
$r->set($first_uuid, json_encode($first_db));
$r->pexpire($first_uuid, 1000 * 3600 * 2);
$r -> set($first_uuid, json_encode($first_db));
$r -> pexpire($first_uuid, 1000 * 3600 * 2);
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'errmsg'=> '',
'first_uuid' => $first_uuid,
'item_list' => $first_list,
'coin' => $coin,
@ -218,25 +213,16 @@ 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);
if (empty($user_db_str)) {
phpcommon\sendError(ERR_USER_BASE + 1, 'session失效');
phpcommon\sendError(ERR_USER_BASE + 1,'session失效');
return;
}
$user_db = json_decode($user_db_str, true);
if (empty($user_db)) {
phpcommon\sendError(ERR_USER_BASE + 1, 'session失效');
phpcommon\sendError(ERR_USER_BASE + 1,'session失效');
return;
}
$item_list = $user_db['first_list'];
@ -254,9 +240,9 @@ class GameOverController
}
}
}
foreach ($item_list as $it) {
foreach($item_list as $it) {
$items = $addreward->addReward($it['item_id'], $it['item_num'], $account_id, $it['time'], 0);
foreach ($items as $j) {
foreach($items as $j) {
array_push($all_item_list, array(
'item_id' => $j['item_id'],
'item_num' => $j['item_num'],
@ -268,7 +254,7 @@ class GameOverController
$diamond_num = $addreward->getDiamondNum($account_id);
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'errmsg'=> '',
'coin_nums' => $coin_num,
'diamond_nums' => $diamond_num,
'item_list' => $item_list,
@ -288,7 +274,7 @@ class GameOverController
$fixed_num = $this->getExplode($b1['num']);
$fixed_array = $this->getExplode($b1['weight']);
for ($i = 0; $i < count($fixed_id); $i++) {
for($i = 0; $i < count($fixed_id); $i++) {
$random = Rand(0, 10000);
if ($fixed_array[$i][0] >= $random) {
array_push($item_list, array(
@ -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, '没有这个奖励');
@ -313,13 +298,13 @@ class GameOverController
$fixed_num = $this->getExplode($b1['num']);
$fixed_array = $this->getExplode($b1['weight']);
$sum = 0;
for ($i = 0; $i < count($fixed_array); $i++) {
for($i = 0; $i < count($fixed_array); $i++) {
$sum = $fixed_array[$i][0] + $sum;
}
$rm = Rand(0, $sum);
$key = 0;
for ($j = 0; $j < count($fixed_array); $j++) {
for($j = 0; $j < count($fixed_array); $j++) {
$key = $fixed_array[$j][0] + $key;
if ($key >= $rm) {
array_push($item_list, array(
@ -333,13 +318,14 @@ class GameOverController
'item_num' => $fixed_num[$j][0],
'time' => $fixed_time[$j][0]
));
}
break;
}
}
return $item_list;
}
protected function randomReward($rank, $type)
protected function randomReward($rank,$type)
{
//随机奖励
$r = $this->getRankReward($rank);
@ -421,9 +407,9 @@ class GameOverController
$all_item_list = array();
$item_list = $this->randomBoxNew($id);
$addreward = new classes\AddReward();
foreach ($item_list as $it) {
foreach($item_list as $it) {
$items = $addreward->addReward($it['item_id'], $it['item_num'], $account_id, $it['time'], 0);
foreach ($items as $j) {
foreach($items as $j) {
array_push($all_item_list, array(
'item_id' => $j['item_id'],
'item_num' => $j['item_num'],
@ -435,7 +421,7 @@ class GameOverController
$diamond_num = $addreward->getDiamondNum($account_id);
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'errmsg'=> '',
'coin_nums' => $coin_num,
'diamond_nums' => $diamond_num,
'item_list' => $item_list,
@ -508,7 +494,7 @@ class GameOverController
$diamond_num = $addreward->getDiamondNum($account_id);
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'errmsg'=> '',
'diamond_nums' => $diamond_num,
));
}
@ -527,12 +513,10 @@ class GameOverController
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
return;
}
$rowUser = $conn->execQueryOne(
'SELECT diamond_num FROM user WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
)
);
$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,14 +528,10 @@ 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,
'errmsg' => '',
'errmsg'=> '',
'diamond_nums' => $diamond_num,
));
}
@ -586,7 +566,7 @@ class GameOverController
'time' => 0,
));
$items = $addreward->addReward($val[0], $val[1], $account_id, 0, 0);
foreach ($items as $it) {
foreach($items as $it) {
array_push($all_item_list, array(
'item_id' => $it['item_id'],
'item_num' => $it['item_num'],
@ -598,7 +578,7 @@ class GameOverController
$diamond_num = $addreward->getDiamondNum($account_id);
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'errmsg'=> '',
'coin_nums' => $coin_num,
'diamond_nums' => $diamond_num,
'item_list' => $item_list,

View File

@ -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,
));
}
}

View File

@ -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,
));
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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)

View File

@ -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

View File

@ -9,7 +9,7 @@ function getItemConf()
return _internalGetItemConf();
}
function getItemById($item_id)
function getItemById($param_id)
{
$conf = getItemConf();
$item_id = (int)$item_id;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}