Compare commits

...

186 Commits
qq ... master

Author SHA1 Message Date
2f5bcaddf3 fix 2025-05-17 11:14:59 +08:00
41669f574d adjust 2025-05-04 09:50:02 +08:00
a5f306fd8a fix 2025-04-30 16:49:43 +08:00
88d426dc6b fix 2025-04-30 15:28:49 +08:00
0f21a61814 fix 2025-04-30 15:23:44 +08:00
b2c07ce8c0 fix 2025-04-30 15:18:52 +08:00
919b4d2875 fix 2025-04-30 15:12:45 +08:00
c38299e917 fix 2025-04-29 19:13:20 +08:00
48cf18615d fix 2025-04-29 19:12:14 +08:00
c23e4917db fix 2025-04-29 19:06:58 +08:00
f0061bf487 fix 2025-04-29 17:41:35 +08:00
9be5466e77 fix 2025-04-29 17:38:27 +08:00
5e11dc0393 diamond cost log 2025-04-21 18:41:46 +08:00
12c78a5b75 adjust 2025-04-21 17:50:28 +08:00
769552d092 adjust 2025-04-21 17:32:54 +08:00
d5137ebd1c medal cost log 2025-04-21 17:10:41 +08:00
c01e596a77 adjust 2025-04-21 16:47:58 +08:00
20e001b5b0 add 2025-04-18 17:50:04 +08:00
6549b2bf4b adjust 2025-04-18 16:42:44 +08:00
4a50603db9 fix 2025-04-15 23:21:46 +08:00
1920b2ec8d talent 2025-04-15 23:14:25 +08:00
d71b656ca2 fix 2025-04-14 17:50:37 +08:00
fb4ab9e5c8 adjust 2025-04-14 16:48:55 +08:00
60a026f6ee fix 2025-04-11 15:20:17 +08:00
64e37a19bf fix 2025-04-10 17:35:07 +08:00
67334fe5ee fix 2025-04-10 12:39:58 +08:00
4af2775cd8 fix 2025-04-09 19:35:43 +08:00
ca272e2ed8 fix 2025-04-09 19:33:42 +08:00
ab03ffd29a 新增日常任务 2025-04-09 19:29:16 +08:00
1a9b90b907 取消吃鸡模式额外奖励 2025-04-09 16:18:32 +08:00
9536771481 adjust 2025-04-09 14:58:21 +08:00
7d4dcbd479 adjust 2025-04-09 14:46:18 +08:00
a5d422cc36 取消装备进阶冷却时间 2025-04-09 13:59:14 +08:00
097715c4a7 adjust 2025-04-09 13:52:12 +08:00
8cbef41006 adjust 2025-04-09 13:44:36 +08:00
cb65cf2100 fix 2025-04-09 12:19:09 +08:00
70fa8ef886 adjust 2025-04-09 11:26:19 +08:00
0f13cc8ff2 adjust 2025-04-09 11:20:17 +08:00
edc567c9a6 fix 2025-04-09 10:59:31 +08:00
dff259168d adjust 2025-04-09 10:48:28 +08:00
5c4ed788de init weapon 2025-04-09 10:38:08 +08:00
a5a3d77f38 fix 2025-04-08 18:42:36 +08:00
ac304dacca fix 2025-04-08 18:41:36 +08:00
134607115b fix 2025-04-08 18:35:36 +08:00
110ac60883 adjust medal cost 2025-04-08 18:02:11 +08:00
3eac8b091b fix 2025-04-07 21:06:49 +08:00
fa8a45acce fix 2025-04-07 20:11:24 +08:00
6e25549f42 fix 2025-04-02 17:11:11 +08:00
b128626739 adjust 2025-04-02 17:07:07 +08:00
9703df5358 fix 2025-04-01 23:03:58 +08:00
bf8775797e fix 2025-04-01 22:51:40 +08:00
d2cd7f34f6 adjust 2025-04-01 22:43:23 +08:00
3249e00ad2 fix 2025-04-01 22:27:24 +08:00
bad56687e8 fix 2025-04-01 22:13:27 +08:00
af7b784897 fix 2025-04-01 22:12:21 +08:00
a5821ee112 fix 2025-04-01 22:06:57 +08:00
148805fb7d adjust 2025-04-01 18:46:15 +08:00
f2b52f6a52 adjust 2025-04-01 18:35:41 +08:00
3581081bc0 adjust 2025-04-01 18:09:58 +08:00
2b62bdc82b vidsettle 2025-04-01 17:44:14 +08:00
1b3c33b4b8 season passport 2025-04-01 00:24:02 +08:00
f01c661ad8 fix 2025-03-31 22:01:32 +08:00
3683917eb2 fix 2025-03-31 18:18:21 +08:00
61d44110af fix 2025-03-31 18:01:40 +08:00
350c6a9d74 fix 2025-03-31 17:27:10 +08:00
d65820dc46 fix 2025-03-31 17:20:53 +08:00
18b85d8c5d fix 2025-03-31 17:01:36 +08:00
b5f5fd1f04 fix 2025-03-31 16:51:38 +08:00
60cfb23e40 fix 2025-03-31 16:44:25 +08:00
f359f9bae8 adjust draw award 2025-03-27 15:38:18 +08:00
5a9f7230c7 adjust 2025-03-20 16:16:03 +08:00
a71724dd1d adjust 2025-03-20 14:19:30 +08:00
03aced4de9 adjust exp 2025-03-20 14:14:27 +08:00
880662aeee 基金 2025-03-20 13:40:43 +08:00
53ea4022c7 充值天数活动 2025-03-17 21:40:36 +08:00
40d4bfb057 first purchase 2025-03-16 22:49:29 +08:00
fdc7b7f814 solo api 2025-03-16 17:17:46 +08:00
b2fd2a24d3 1 2025-02-21 19:36:13 +08:00
4d26de02e0 fix 2025-02-21 19:34:45 +08:00
a1e8fd2b66 adjust 2025-02-21 13:57:57 +08:00
3a2aa5fbd6 fix 2025-02-19 15:07:07 +08:00
108c115996 增加获取配置接口 2025-02-19 14:37:40 +08:00
516dd7be52 adjust 2025-02-18 10:28:53 +08:00
59996cc33e js api pay 2025-02-18 10:16:54 +08:00
1ebc1c8317 fix 2025-02-13 15:56:08 +08:00
6b7002e0f9 fix 2025-02-13 14:42:17 +08:00
20776fcb3f fix 2025-02-11 15:12:56 +08:00
7e739059ba fix 2025-02-11 15:01:20 +08:00
937d1f3f83 adjust 2025-02-11 11:31:16 +08:00
382310f7ac adjust 2025-02-10 16:26:09 +08:00
abb1da6401 fix 2025-02-10 16:19:23 +08:00
355b5f079c adjust 2025-02-10 16:16:52 +08:00
92b38404e2 fix 2025-02-10 16:10:17 +08:00
44998b7575 fix 2025-02-10 16:07:19 +08:00
2cb0b2e2df fix 2025-02-10 15:51:32 +08:00
fbfbf6bad6 fix 2025-02-10 15:45:34 +08:00
6ad456f8a7 giftcode 2025-02-07 12:31:39 +08:00
76526f4e56 mail 2025-02-07 11:03:20 +08:00
a494eb1851 fix 2025-01-17 09:11:52 +08:00
ab40e9f27c fix 2025-01-16 18:39:56 +08:00
8521df0fa6 1 2025-01-16 18:32:09 +08:00
575d4312ee 1 2025-01-16 18:27:56 +08:00
c9acff8aa7 fix 2025-01-16 18:22:51 +08:00
523a487162 adjust 2025-01-16 17:44:39 +08:00
de80491b8a fix 2025-01-16 17:38:01 +08:00
e1bb2cc715 adjust 2025-01-16 17:33:09 +08:00
c6218d797e fix 2025-01-16 17:11:03 +08:00
d2bdabdb13 fix 2025-01-16 16:52:51 +08:00
b573e2e67b vip plustimes 2025-01-16 16:42:33 +08:00
95a5e815b6 adjust 2025-01-16 15:50:20 +08:00
1177640675 fix 2025-01-16 15:00:17 +08:00
ac98faf2c0 fix 2025-01-16 14:39:19 +08:00
dab7d4df81 adjust 2025-01-15 17:58:59 +08:00
59637c1dbf adjust 2025-01-15 17:47:45 +08:00
6456272eb7 fix 2025-01-15 17:01:58 +08:00
109f7478d6 adjust 2025-01-15 15:35:05 +08:00
01f5495096 免广告券 2025-01-15 15:15:52 +08:00
921148d632 fix 2025-01-15 11:42:51 +08:00
a45c227e65 adjust 2025-01-15 11:40:38 +08:00
e8c93156df purchasedone 2025-01-15 00:25:25 +08:00
deaea1a59d 1 2025-01-14 17:54:21 +08:00
7c8d785ecd adjust 2025-01-14 17:51:24 +08:00
4cbf851340 fix 2025-01-14 16:37:28 +08:00
42e13c9a24 fix 2025-01-14 16:35:20 +08:00
72e5894447 fix 2025-01-14 15:56:54 +08:00
6833673bd2 fix 2025-01-14 15:38:36 +08:00
859c4ecc56 fix 2025-01-14 15:14:05 +08:00
ace399c903 fix 2025-01-14 15:09:05 +08:00
625a2335b4 fix 2025-01-14 14:56:28 +08:00
2b9ac51612 1 2025-01-14 14:34:34 +08:00
d042247372 1 2025-01-14 14:23:04 +08:00
c59db09ed9 adjust 2025-01-14 14:19:23 +08:00
dbd068c407 1 2025-01-14 11:54:49 +08:00
bb01b992dc 1 2025-01-14 11:52:50 +08:00
09b2aec5b9 1 2025-01-14 11:28:48 +08:00
06fb290383 adjust 2025-01-13 14:55:45 +08:00
d137d78165 fix 2025-01-13 11:04:28 +08:00
e30dc1d8aa fix 2025-01-13 10:49:51 +08:00
1581e58642 purchase 2025-01-10 20:13:24 +08:00
ef834d99cd fix 2025-01-09 18:09:35 +08:00
268bd8ce9b fix 2025-01-09 18:07:45 +08:00
4f813d2227 fix 2025-01-09 17:49:46 +08:00
c83e63554a fix 2025-01-09 17:38:41 +08:00
16e2e1af55 adjust 2025-01-09 14:51:55 +08:00
78c114fd03 adjust 2025-01-09 14:42:49 +08:00
f4df747b87 fix 2025-01-09 12:27:40 +08:00
31bffed345 fix 2025-01-09 12:14:41 +08:00
655a77fd89 fix 2025-01-09 11:57:45 +08:00
75ccb7a4f3 recharge & consume activity 2025-01-08 23:45:52 +08:00
8d795e1b6a adjust 2025-01-08 17:42:32 +08:00
527571146c get activity award & vip daily award 2025-01-08 14:59:21 +08:00
9a149a1950 privilege 2025-01-08 11:21:14 +08:00
2105b305b0 record daily_purchase 2025-01-07 11:47:33 +08:00
92ce83a436 adjust 2025-01-07 10:58:11 +08:00
10cb4e9464 adjust 2025-01-06 20:07:27 +08:00
0004645b90 adjust 2025-01-06 14:47:37 +08:00
499586b8a9 adjust 2025-01-06 14:27:00 +08:00
2d852ad3c8 purchase type 2 2025-01-06 12:55:30 +08:00
e81e597b1b recharge activity 2025-01-06 11:03:50 +08:00
a1b92f6758 fix 2025-01-03 13:49:22 +08:00
6affe6be19 1 2025-01-03 13:32:04 +08:00
f12d82c18a fix 2025-01-03 13:29:49 +08:00
4be7492b72 fix 2025-01-03 13:24:55 +08:00
d307091784 1 2025-01-03 11:34:09 +08:00
74f44e72f1 recharge activity 2025-01-03 10:48:56 +08:00
63786c78a4 1 2024-12-31 17:48:47 +08:00
dcaab66a00 record recharge 2024-12-31 17:03:02 +08:00
8302a392ce first recharge info 2024-12-31 16:45:44 +08:00
87ca99a9e1 adjust 2024-12-31 16:34:57 +08:00
98b1abbd12 recharge present 2024-12-31 16:22:36 +08:00
78dc2ee5f3 adjust 2024-12-30 14:17:47 +08:00
054f084542 activity cost diamond 2024-12-30 11:31:02 +08:00
4650d0d2d6 fix 2024-12-27 11:57:36 +08:00
15f55d4755 adjust 2024-12-27 11:09:07 +08:00
01405b09cb 1 2024-12-25 16:57:56 +08:00
2ac6b8d577 1 2024-12-25 12:31:27 +08:00
65f003a909 fix 2024-12-25 12:05:16 +08:00
7ffdd1db8e fix 2024-12-25 11:44:32 +08:00
2b37e81fee fix 2024-12-25 10:50:09 +08:00
ff61ee3a0a wx pay 2024-12-24 15:01:36 +08:00
408367bf6f fix 2024-12-19 15:14:30 +08:00
ccf9bf261a fix 2024-12-19 15:09:54 +08:00
b45ff3a35c fix 2024-12-19 11:35:06 +08:00
47b1222d4d 每日福利 改钻石抽 2024-12-19 00:09:56 +08:00
9a72912fa1 改幸运宝箱 钻石抽 2024-12-18 14:17:21 +08:00
aozhiwei
70bf81ada0 添加华为特殊处理 2021-03-17 11:07:06 +08:00
28 changed files with 6248 additions and 1128 deletions

View File

@ -106,6 +106,7 @@ 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;
@ -202,6 +203,7 @@ 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 '创建时间',
@ -221,6 +223,7 @@ 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`),
@ -336,4 +339,130 @@ 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,6 +17,11 @@ 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);
@ -77,7 +82,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); //登录礼包-早晨开始时间
@ -100,6 +105,13 @@ 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,7 +4,8 @@ namespace classes;
use phpcommon;
class AddReward {
class AddReward
{
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
@ -26,7 +27,8 @@ class AddReward {
'id' => $item_conf['id'],
'diamond' => $item_conf['diamond'],
'type' => $item_conf['fuction'],
'diamond_hour' => $item_conf['diamond_hour']
'diamond_hour' => $item_conf['diamond_hour'],
'piece' => $item_conf['piece'],
);
return $it;
}
@ -92,29 +94,45 @@ 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);
} else if ($i['type'] == 16) {
$item_list = $this->addEquip($item['item_id'], $account_id, $i['piece']);
} else if ($i['type'] == 16 || $i['type'] == 19 ) {
$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, $price, $t);
$item_list = $this->addItem($item['item_id'], $item['time'], $account_id, $priceid, $price, $t);
} else {
$item_list = $this->addItem($item['item_id'], $item['time'], $account_id, $price, 0);
$item_list = $this->addItem($item['item_id'], $item['time'], $account_id, $priceid, $price, 0);
}
}
}
@ -128,34 +146,40 @@ 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();
}
@ -169,10 +193,12 @@ 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'];
}
@ -183,13 +209,46 @@ 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)
{
@ -198,17 +257,21 @@ 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();
}
@ -221,17 +284,21 @@ 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();
}
@ -248,10 +315,12 @@ 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) {
@ -262,25 +331,29 @@ 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 {
@ -294,15 +367,17 @@ 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();
}
@ -316,17 +391,21 @@ 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();
}
@ -339,73 +418,177 @@ 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()
));
$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,
)
);
}
if (!$ret) {
die();
}
}
//添加道具
protected function addItem($item_id, $time, $accountid, $price, $t)
protected function addItem($itemid, $hourtime, $accountid, $priceid, $price, $t)
{
$item_list = array();
$item_num = 1;
$item_id = $item_id;
$time = $time;
$item_id = intval($itemid);
$time = intval($hourtime);
$conn = $this->getMysql($accountid);
if (!$conn) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
die();
}
$status = 2;
$status = 1;
$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 = 10003;
$item_id = $priceid;
$item_num = $price;
$time = 0;
$this->addDiamond($item_id, $item_num, $accountid);
if ($price > 0) {
if ($priceid == 10003) {
$this->addDiamond($item_id, $item_num, $accountid);
} else {
$this->addweizhuang($item_id, $item_num, $accountid);
}
}
} else {
$nowTime = $row['active_time'];
$status = $row['status'];
@ -418,22 +601,27 @@ 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();
}
@ -466,12 +654,14 @@ 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['status'] != 0 || !$row) {
$row = $conn->execQueryOne(
'SELECT status FROM bag WHERE accountid=:accountid AND id=:id;',
array(
':accountid' => $accountid,
':id' => $id,
)
);
if (!$row || $row['status'] != 0) {
continue;
}
$flag = 1;
@ -490,11 +680,13 @@ 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++;
}
@ -511,7 +703,7 @@ class AddReward {
public function updateStatus($item_id, $accountid)
{
$conn = $this->getMysql($accountid);
if(!$conn){
if (!$conn) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
@ -525,27 +717,31 @@ 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['status'] != 0 || !$row) {
$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) {
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;
}
@ -553,50 +749,56 @@ class AddReward {
}
}
protected function addEquip($item_id, $accountid)
protected function addEquip($item_id, $accountid, $piecestr)
{
$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,
@ -609,10 +811,11 @@ class AddReward {
die();
return;
}
$this->addweizhuang(18006, $e['equip_material'], $accountid);
$piecestrs = explode(':', $piecestr);
$this->addweizhuang($piecestrs[0], $piecestrs[1], $accountid);
array_push($item_list, array(
'item_id' => 18006,
'item_num' => $e['equip_material'],
'item_id' => $piecestrs[0],
'item_num' => $piecestrs[1],
'time' => 0,
));
}
@ -620,7 +823,8 @@ 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);
@ -628,4 +832,3 @@ class AddReward {
return intval($e['real_index_id']);
}
}
?>

View File

@ -0,0 +1,39 @@
<?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

@ -0,0 +1,76 @@
<?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

@ -0,0 +1,175 @@
<?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,5 +1,6 @@
<?php
require 'classes/RechargeActivity.php';
class AdditemController{
protected function getMysql($account_id)
{
@ -66,6 +67,10 @@ 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'];
@ -129,10 +134,14 @@ 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;
// }
@ -164,6 +173,10 @@ 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,7 +3,8 @@
require 'classes/Quest.php';
require 'classes/AddReward.php';
class BagController{
class BagController
{
protected function getMysql($account_id)
{
@ -71,23 +72,27 @@ 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;
@ -118,7 +123,8 @@ class BagController{
));
}
public function exchangeBagItem() {
public function exchangeBagItem()
{
$account_id = $_REQUEST['account_id'];
//登录校验
$login = loginVerify($account_id, $_REQUEST['session_id']);
@ -129,76 +135,99 @@ 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) {
$id = $bag_info['id'];
$bag = $this->getBag($id);
if ($bag['fuction'] != $b['fuction']) {
if ($bag_info['fuction'] != $b['fuction']) {
continue;
}
$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) {
$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) {
continue;
}
$status = 2;
if ($row['active_time'] == 0) {
if ($row['active_time'] == 0 || $row['active_time'] > time()) {
$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' => $account_id,
':id' => $id,
':status' => $status,
':modify_time' => time()
));
if(!$using_ret){
$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) {
die();
return;
}
if ($id == $item_id) {
echo json_encode($rsp);
return;
}
}
}
//要装备的道具
$row = $conn->execQueryOne('SELECT status FROM bag WHERE accountid=:accountid AND id=:id;',
array(
':accountid' => $account_id,
':id' => $item_id,
));
if (!$row) {
$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())) {
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(array(
'errcode' => 0,
'errmsg' => '',
'item_id' => $item_id,
'color_id' => $color_id
));
echo json_encode($rsp);
}
public function downItem()
@ -212,34 +241,38 @@ 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 = $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) {
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个道具');
return;
}
$status = 2;
if ($row['active_time'] == 0) {
if ($row['active_time'] == 0 || $row['active_time'] > time()) {
$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;
}
@ -252,7 +285,7 @@ class BagController{
));
}
public function downItemColor()
public function downItemColor()
{
$account_id = $_REQUEST['account_id'];
//登录校验
@ -263,19 +296,21 @@ 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;
}
@ -299,7 +334,7 @@ class BagController{
}
$item_id = $_REQUEST['item_id'];
$conn = $this->getMysql($account_id);
if(!$conn){
if (!$conn) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
@ -345,7 +380,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'],
@ -373,17 +408,19 @@ 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;
}
@ -391,16 +428,18 @@ 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;
}
@ -411,4 +450,3 @@ class BagController{
));
}
}
?>

View File

@ -0,0 +1,48 @@
<?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,7 +1,11 @@
<?php
use classes\GameLog;
require 'classes/Quest.php';
require 'classes/AddReward.php';
require 'classes/RechargeActivity.php';
require 'classes/GameLog.php';
class EquipController{
@ -584,6 +588,9 @@ 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() ||
@ -904,6 +911,8 @@ 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(
@ -1003,27 +1012,46 @@ class EquipController{
phpcommon\sendError(ERR_USER_BASE + 3, '金币不足');
return;
}
$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, '材料不足');
$jinjieinfo = explode('|', $e['promote_material']);
if ($key >= count($jinjieinfo)) {
phpcommon\sendError(ERR_USER_BASE + 4, '已经满阶');
return;
}
$curjinjie = explode(';', $jinjieinfo[$key]);
$jinjieitems = array();
foreach( $curjinjie as $jinjieitemstr) {
$mar_array = explode(':', $jinjieitemstr);
$mid = $mar_array[0];
$mnum = $mar_array[1];
$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);
$this->subCoin($mid, $mnum, $account_id);
foreach($jinjieitems as $jinjie_item) {
$mid = $jinjie_item['item_id'];
$mnum = $jinjie_item['item_num'];
$this->subCoin($mid, $mnum, $account_id);
}
$active_time = time();
$sub_list = $this->getExplode($e['equip_upgradetime']);
$sub_time = $sub_list[$lv][0];
$sub_time = 0;//$sub_list[$lv][0];
if ($sub_time == 0) {
$active_time = 0;
$flag = 1;
@ -1043,6 +1071,9 @@ 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,9 +1,13 @@
<?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{
@ -197,9 +201,45 @@ class FesActivityController{
foreach ($user_db['info_list'] as &$us) {
if ($us['id'] == $id) {
if ($us['status'] != 1) {
phpcommon\sendError(ERR_USER_BASE + 4, '奖励不可领');
return;
if ($us['type'] == '2') {
//扣除钻石
$userrow = $conn->execQueryOne(
'SELECT diamond_num FROM user WHERE accountid=:accountid;',
array(
':accountid' => $account_id
)
);
if (!$userrow) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
if ($userrow['diamond_num'] < $us['condition']) {
phpcommon\sendError(ERR_USER_BASE + 3, '钻石不足');
return;
}
$ret = $conn->execScript(
'UPDATE user SET diamond_num=:diamond_num, modify_time=:modify_time ' .
' WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
':diamond_num' => $userrow['diamond_num'] - $us['condition'],
':modify_time' => time()
)
);
if (!$ret) {
die();
return;
}
$rechargeactivity = new classes\RechargeActivity();
$rechargeactivity->triggerConsume($account_id, $us['condition']);
GameLog::Log('diamond cost: 4,'.$account_id.','.$us['condition']);
} else {
phpcommon\sendError(ERR_USER_BASE + 4, '奖励不可领');
return;
}
}
$us['status'] = 2;
$status = 2;
$reward = metatable\getRewardInfo($user_db['act_id'], $id, 0);
@ -275,6 +315,10 @@ 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

@ -2,8 +2,10 @@
require 'classes/Quest.php';
require 'classes/AddReward.php';
require 'classes/RechargeActivity.php';
class GameOverController{
class GameOverController
{
protected function getMysql($account_id)
{
@ -74,7 +76,7 @@ class GameOverController{
'equip_upgradetime' => $equip_conf['equip_upgradetime'],
'diamond_cost' => $equip_conf['diamond_cost'],
'drop_id' => $equip_conf['drop_id']
);
);
return $e;
}
@ -164,29 +166,32 @@ class GameOverController{
}
//道具物品
$first_list = array();
if (phpcommon\extractChannel($account_id) == 6001 ||
phpcommon\extractChannel($account_id) == 6007 ||
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) == 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);
// }
$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,
@ -213,16 +218,25 @@ 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'];
@ -240,9 +254,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'],
@ -254,7 +268,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,
@ -274,7 +288,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(
@ -287,7 +301,8 @@ 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, '没有这个奖励');
@ -298,13 +313,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(
@ -318,14 +333,13 @@ 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);
@ -407,9 +421,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'],
@ -421,7 +435,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,
@ -494,7 +508,7 @@ class GameOverController{
$diamond_num = $addreward->getDiamondNum($account_id);
echo json_encode(array(
'errcode' => 0,
'errmsg'=> '',
'errmsg' => '',
'diamond_nums' => $diamond_num,
));
}
@ -513,10 +527,12 @@ 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;
@ -528,10 +544,14 @@ 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,
));
}
@ -566,7 +586,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'],
@ -578,7 +598,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,5 +1,6 @@
<?php
require_once 'metatable/shopGoods.php';
class HangController{
protected function getMysql($account_id)
@ -141,6 +142,7 @@ 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++) {
@ -150,8 +152,9 @@ 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 ' .
$rowpass = $conn->execQueryOne('SELECT active_status, honor_status, season_passport ' .
' FROM passinfo WHERE accountid=:accountid AND passid=:passid;',
array(
':accountid' => $account_id,
@ -159,12 +162,13 @@ class HangController{
));
$rank_status = 0;
if (!$rowpass) {
$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) ' .
$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) ' .
' 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()
));
@ -175,6 +179,22 @@ 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;
@ -431,6 +451,29 @@ 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' => '',
@ -451,6 +494,7 @@ 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

@ -0,0 +1,502 @@
<?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,6 +2,7 @@
require 'classes/Quest.php';
require 'classes/AddReward.php';
require_once 'metatable/shopGoods.php';
class PassController{
@ -80,6 +81,7 @@ 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++) {
@ -89,9 +91,10 @@ 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 ' .
$rowpass = $conn->execQueryOne('SELECT active_status, honor_status, season_passport ' .
' FROM passinfo WHERE accountid=:accountid AND passid=:passid;',
array(
':accountid' => $account_id,
@ -99,12 +102,13 @@ class PassController{
));
$rank_status = 0;
if (!$rowpass) {
$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) ' .
$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) ' .
' 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()
));
@ -115,6 +119,22 @@ 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;
@ -192,6 +212,28 @@ 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,
@ -207,6 +249,7 @@ class PassController{
'week' => $week_reward,
'seareward' => $sea_reward,
'min_rank_score' => $min_rank_score,
'passport_reward' => $passport_reward,
));
}
@ -292,6 +335,103 @@ 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,7 +1,11 @@
<?php
use classes\GameLog;
require 'classes/Quest.php';
require 'classes/AddReward.php';
require 'classes/RechargeActivity.php';
require 'classes/GameLog.php';
class PayController{
@ -599,6 +603,9 @@ 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) {
@ -833,6 +840,9 @@ 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

@ -0,0 +1,574 @@
<?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,6 +2,7 @@
require 'classes/AddReward.php';
require 'classes/Quest.php';
require 'classes/RechargeActivity.php';
class ShareController{
@ -119,6 +120,8 @@ class ShareController{
if (!$ret) {
die();
}
$rechargeactivity = new classes\RechargeActivity();
$rechargeactivity->triggerConsume($account_id, $num);
}
protected function randBoxReward($drop_id, $times)

View File

@ -1,6 +1,10 @@
<?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';
@ -46,7 +50,6 @@ 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'],
);
@ -65,7 +68,6 @@ 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;
@ -325,6 +327,9 @@ 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();
@ -368,11 +373,15 @@ 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,
@ -1301,6 +1310,8 @@ 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($param_id)
function getItemById($item_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)$parameter_id;
$parameter_id = (int)$param_id;
return array_key_exists($parameter_id, $conf) ? $conf[$parameter_id] : null;
}

View File

@ -0,0 +1,36 @@
<?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

@ -0,0 +1,36 @@
<?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_shopG_table = require(getConfigBaseDir() . 'shopGoods@shopGoods.php');
$g_shopGoods_table = require(getConfigBaseDir() . 'shopGoods@shopGoods.php');
}
return $g_shopG_table;
return $g_shopGoods_table;
}