1
This commit is contained in:
parent
c240c939fd
commit
3d917552f8
283
sql/gamedb.sql
283
sql/gamedb.sql
@ -30,24 +30,24 @@ CREATE TABLE `user` (
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
||||
`user_name` tinyblob COMMENT '用户名字',
|
||||
`avatar_url` varchar(256) NOT NULL DEFAULT '' COMMENT '用户头像',
|
||||
`game_times` int(11) NOT NULL COMMENT '游戏场次',
|
||||
`win_times` int(11) NOT NULL COMMENT '胜场',
|
||||
`kills` int(11) NOT NULL COMMENT '所有击杀',
|
||||
`harm` int(11) NOT NULL COMMENT '所有伤害',
|
||||
`add_HP` int(11) NOT NULL COMMENT '所有治疗量',
|
||||
`alive_time` int(11) NOT NULL COMMENT '所有生存时间',
|
||||
`game_times` int(11) NOT NULL DEFAULT '0' COMMENT '游戏场次',
|
||||
`win_times` int(11) NOT NULL DEFAULT '0' COMMENT '胜场',
|
||||
`kills` int(11) NOT NULL DEFAULT '0' COMMENT '所有击杀',
|
||||
`harm` int(11) NOT NULL DEFAULT '0' COMMENT '所有伤害',
|
||||
`add_HP` int(11) NOT NULL DEFAULT '0' COMMENT '所有治疗量',
|
||||
`alive_time` int(11) NOT NULL DEFAULT '0' COMMENT '所有生存时间',
|
||||
`coin_num` bigint NOT NULL COMMENT '角色金币',
|
||||
`integral` bigint NOT NULL COMMENT '角色积分',
|
||||
`kill_his` int(11) NOT NULL COMMENT '最高击杀',
|
||||
`alive_time_his` int(11) NOT NULL COMMENT '最长生存时间',
|
||||
`harm_his` int(11) NOT NULL COMMENT '最高伤害',
|
||||
`add_HP_his` int(11) NOT NULL COMMENT '最多治疗量',
|
||||
`act_share_status` int(11) NOT NULL COMMENT '分享好礼活动状态',
|
||||
`act_share_time` int(11) NOT NULL COMMENT '分享好礼活动时间',
|
||||
`create_time` int(11) NOT NULL COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL COMMENT '修改时间',
|
||||
`first_fight` int(11) NOT NULL COMMENT '是否是第一次战斗',
|
||||
`collect_status` int(11) NOT NULL COMMENT '收藏状态',
|
||||
`kill_his` int(11) NOT NULL DEFAULT '0' COMMENT '最高击杀',
|
||||
`alive_time_his` int(11) NOT NULL DEFAULT '0' COMMENT '最长生存时间',
|
||||
`harm_his` int(11) NOT NULL DEFAULT '0' COMMENT '最高伤害',
|
||||
`add_HP_his` int(11) NOT NULL DEFAULT '0' COMMENT '最多治疗量',
|
||||
`act_share_status` int(11) NOT NULL DEFAULT '0' COMMENT '分享好礼活动状态',
|
||||
`act_share_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 '修改时间',
|
||||
`first_fight` int(11) NOT NULL DEFAULT '0' COMMENT '是否是第一次战斗',
|
||||
`collect_status` int(11) NOT NULL DEFAULT '0' COMMENT '收藏状态',
|
||||
`keys_num` int(11) NOT NULL DEFAULT '0' COMMENT '钥匙数量',
|
||||
`battle_re_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日战斗奖励次数',
|
||||
`shop_flush_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日商店刷新次数',
|
||||
@ -58,7 +58,7 @@ CREATE TABLE `user` (
|
||||
`diamond_shop_flush_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日钻石商店刷新次数',
|
||||
`sum_coin` double NOT NULL DEFAULT '0' COMMENT '累计充值金额',
|
||||
`recharge_times_total` int(11) NOT NULL DEFAULT '0' COMMENT '累计充值次数',
|
||||
`pass_status` int(11) NOT NULL DEFAULT '0' COMMENT '通行证购买状态',
|
||||
`pass_status` int(11) NOT NULL DEFAULT '0' COMMENT '周奖励状态',
|
||||
`score` int(11) NOT NULL DEFAULT '0' COMMENT '通行证积分',
|
||||
`season_status` int(11) NOT NULL DEFAULT '0' COMMENT '赛季奖励状态',
|
||||
`first_gift` int(11) NOT NULL DEFAULT '0' COMMENT '首充礼包领取状态',
|
||||
@ -79,54 +79,25 @@ CREATE TABLE `user` (
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
--
|
||||
-- Table structure for table `skin`
|
||||
-- Table structure for table `bag`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `skin`;
|
||||
DROP TABLE IF EXISTS `bag`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `skin` (
|
||||
CREATE TABLE `bag` (
|
||||
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
||||
`skin_id` int(11) NOT NULL COMMENT '皮肤id',
|
||||
`skin_status` int(11) NOT NULL COMMENT '皮肤状态(0:上阵中,1:已获得)',
|
||||
`fragment_id` int(11) NOT NULL COMMENT '碎片id',
|
||||
`fragment_num` int(11) NOT NULL COMMENT '碎片数量',
|
||||
`active_time` varchar(50) NOT NULL DEFAULT '有效时间(体验时间)',
|
||||
`fragment_status` int(11) NOT NULL COMMENT '碎片收集状态(活动相关)',
|
||||
`skin_type` int(11) NOT NULL COMMENT '皮肤类型',
|
||||
`skin_level` int(11) NOT NULL COMMENT '皮肤等级',
|
||||
`skin_experience_level` int(11) NOT NULL COMMENT '皮肤体验等级',
|
||||
`skin_experience_type` int(11) NOT NULL COMMENT '皮肤试用类型(0:没试用,1:皮肤体验,2:满级体验)',
|
||||
`create_time` int(11) NOT NULL COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL COMMENT '修改时间',
|
||||
`id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
|
||||
`color_id` int(11) NOT NULL DEFAULT '0' COMMENT '颜色id',
|
||||
`status` int(11) NOT NULL DEFAULT '0' COMMENT '状态(0:上阵中,1:已获得,2:未获得)',
|
||||
`active_time` varchar(50) 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 `skin_uuid` (`accountid`, `skin_id`)
|
||||
UNIQUE KEY `item_uuid` (`accountid`, `id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `equip`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `equip`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `equip` (
|
||||
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`equip_id` int(11) NOT NULL COMMENT '装备id',
|
||||
`equip_level` int(11) NOT NULL COMMENT '装备等级',
|
||||
`equip_experience_level` int(11) NOT NULL COMMENT '装备体验等级',
|
||||
`active_time` varchar(50) NOT NULL DEFAULT '有效时间',
|
||||
`create_time` int(11) NOT NULL COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `equip_uuid` (`accountid`, `equip_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `sign`
|
||||
--
|
||||
@ -147,24 +118,6 @@ CREATE TABLE `sign` (
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `hang`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `hang`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client*/;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `hang` (
|
||||
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`hang_time` varchar(50) NOT NULL DEFAULT '领取时间',
|
||||
`create_time` int(11) NOT NULL COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
--
|
||||
-- Table structrure for table `quest`
|
||||
--
|
||||
@ -175,65 +128,16 @@ DROP TABLE IF EXISTS `quest`;
|
||||
CREATE TABLE `quest` (
|
||||
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`quest_id` int(11) NOT NULL COMMENT '任务id',
|
||||
`quest_num` int(11) NOT NULL COMMENT '任务进度',
|
||||
`quest_type` int(11) NOT NULL COMMENT '任务类型',
|
||||
`quest_state` int(11) NOT NULL COMMENT '任务状态',
|
||||
`create_time` int(11) NOT NULL COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL COMMENT '修改时间',
|
||||
`quest_id` int(11) NOT NULL DEFAULT '0' COMMENT '任务id',
|
||||
`quest_num` int(11) NOT NULL DEFAULT '0' COMMENT '任务进度',
|
||||
`quest_type` int(11) NOT NULL DEFAULT '0' COMMENT '任务类型',
|
||||
`quest_state` 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 `quest_uuid` (`accountid`, `quest_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
--
|
||||
-- Table structrure for table `active`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `active`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client*/;
|
||||
/*!40101 SET character_set_client = utf8*/;
|
||||
CREATE TABLE `active` (
|
||||
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`active_num` int(11) NOT NULL COMMENT '日活跃度',
|
||||
`num_time` varchar(50) NOT NULL DEFAULT '日活跃度时间',
|
||||
`active_sum` int(11) NOT NULL COMMENT '周活跃度',
|
||||
`sum_time` varchar(50) NOT NULL DEFAULT '周活跃度时间',
|
||||
`create_time` int(11) NOT NULL COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
--
|
||||
-- Table structrure for table `history_record`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `history_record`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `history_record`(
|
||||
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`room_uuid` varchar(60) NOT NULL DEFAULT '' COMMENT '战斗id',
|
||||
`map_id` int(11) NOT NULL COMMENT '地图id',
|
||||
`map_tpl_name` varchar(50) NOT NULL DEFAULT '' COMMENT '地图模板名字',
|
||||
`map_name` varchar(50) DEFAULT '' COMMENT '地图名字',
|
||||
`game_time` int(11) NOT NULL COMMENT '游戏完成时间',
|
||||
`rank` int(11) NOT NULL COMMENT '游戏排名',
|
||||
`kills` int(11) NOT NULL COMMENT '游戏击杀',
|
||||
`harms` int(11) NOT NULL COMMENT '游戏伤害',
|
||||
`hurts` int(11) NOT NULL COMMENT '承受伤害',
|
||||
`alive_time` int(11) NOT NULL COMMENT '游戏生存时间',
|
||||
`coin` bigint NOT NULL COMMENT '战斗结算金币',
|
||||
`status` int(11) NOT NULL COMMENT '结算金币领取状态',
|
||||
`create_time` int(11) NOT NULL COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `history_record_uuid` (`accountid`, `room_uuid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
--
|
||||
-- Table structure for table `share_achievement`
|
||||
--
|
||||
@ -244,10 +148,10 @@ DROP TABLE IF EXISTS `share_achievement`;
|
||||
CREATE TABLE `share_achievement` (
|
||||
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`ach_id` int(11) NOT NULL COMMENT '分享邀请成就id',
|
||||
`status` int(11) NOT NULL COMMENT '状态(0:未领取,1:已领取)',
|
||||
`create_time` int(11) NOT NULL COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL COMMENT '修改时间',
|
||||
`ach_id` int(11) NOT NULL DEFAULT '0' COMMENT '分享邀请成就id',
|
||||
`status` int(11) NOT NULL DEFAULT '0' COMMENT '状态(0:未领取,1:已领取)',
|
||||
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid_ach_id` (`accountid`, `ach_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
@ -269,61 +173,6 @@ CREATE TABLE `activity` (
|
||||
UNIQUE KEY `accountid` (`accountid`)
|
||||
) 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` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`itemid` int(11) NOT NULL DEFAULT '0' COMMENT 'itemid',
|
||||
`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`),
|
||||
KEY `accountid` (`accountid`),
|
||||
UNIQUE KEY `accountid_itemid` (`accountid`, `itemid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
DROP TABLE IF EXISTS `orderinfo`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client*/;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `orderinfo` (
|
||||
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`orderid` varchar(60) DEFAULT '' COMMENT '订单id',
|
||||
`itemid` int(11) NOT NULL DEFAULT '0' COMMENT 'itemid',
|
||||
`coin` double NOT NULL DEFAULT '0' COMMENT '充值金额',
|
||||
`status` int(11) NOT NULL DEFAULT '0' COMMENT '0: 新添加订单 1:已经完成订单',
|
||||
`item_list` mediumblob COMMENT 'item_list',
|
||||
`confirmtime` int(11) NOT NULL DEFAULT '0' COMMENT 'GameServer订单确认时间',
|
||||
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `orderid` (`orderid`),
|
||||
KEY `accountid` (`accountid`),
|
||||
KEY `accountid_itemid` (`accountid`, `itemid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
DROP TABLE IF EXISTS `vipinfo`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client*/;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `vipinfo` (
|
||||
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`vipid` int(11) NOT NULL DEFAULT '0' COMMENT 'vipid',
|
||||
`reward_id` int(11) NOT NULL DEFAULT '0' COMMENT '奖励id',
|
||||
`reward_status` int(11) NOT NULL DEFAULT '0' COMMENT '奖励状态',
|
||||
`today_reward_id` int(11) NOT NULL DEFAULT '0' COMMENT '今日奖励id',
|
||||
`today_reward_status` 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`),
|
||||
KEY `accountid` (`accountid`),
|
||||
UNIQUE KEY `accountid_vipid` (`accountid`, `vipid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `passinfo`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client*/;
|
||||
@ -333,7 +182,7 @@ CREATE TABLE `passinfo` (
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`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 '荣耀奖励状态',
|
||||
`honor_status` 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`),
|
||||
@ -342,60 +191,4 @@ CREATE TABLE `passinfo` (
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `emoji`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client*/;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `emoji` (
|
||||
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`emojiid` int(11) NOT NULL DEFAULT '0' COMMENT 'emojiid',
|
||||
`status` 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`),
|
||||
KEY `accountid` (`accountid`),
|
||||
UNIQUE KEY `accountid_emojiid` (`accountid`, `emojiid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `redpack`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client*/;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `redpack` (
|
||||
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`red_type` int(11) NOT NULL DEFAULT '0' COMMENT '红包类型(1:红包雨红包,2:邀请好友红包)',
|
||||
`red_sum` double NOT NULL DEFAULT '0' COMMENT '红包金额(已发放的)',
|
||||
`red_date` int(11) NOT NULL DEFAULT '0' COMMENT '日期(某天时间的00:00:00)',
|
||||
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `red_type_red_date` (`red_type`, `red_date`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `redpack_log`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `redpack_log` (
|
||||
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
||||
`order_id` varchar(60) DEFAULT '' COMMENT '订单id',
|
||||
`get_time` int(11) NOT NULL DEFAULT '0' COMMENT '领取时间',
|
||||
`coin_num` int(11) NOT NULL DEFAULT '0' COMMENT '金钱数量',
|
||||
`custom_data` mediumblob COMMENT '其他字段',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `account_order_id_get_time` (`accountid`, `order_id` , `get_time`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
DROP TABLE IF EXISTS `orderidx`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `orderidx` (
|
||||
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
PRIMARY KEY (`idx`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
-- Dump completed on 2015-08-19 18:51:22
|
||||
|
3
third_party/f7/f7/app.py
vendored
3
third_party/f7/f7/app.py
vendored
@ -115,7 +115,10 @@ class _App:
|
||||
assert self._listened
|
||||
def thread_func(args):
|
||||
try:
|
||||
if len(args) > 0:
|
||||
func(args)
|
||||
else:
|
||||
func()
|
||||
except Exception as e:
|
||||
f7.udplog.error('_dispatchIMMsg ' + str(e))
|
||||
if done_callback:
|
||||
|
@ -1 +1 @@
|
||||
../../third_party/f7
|
||||
../../third_party/f7/f7
|
@ -1 +1 @@
|
||||
../../third_party/q7
|
||||
../../third_party/q7/q7
|
@ -194,5 +194,17 @@ function getEmojiConfig($Emoji_table, $Emoji_id)
|
||||
$Emoji_id = (int)$Emoji_id;
|
||||
return array_key_exists($Emoji_id, $Emoji_table) ? $Emoji_table[$Emoji_id] : null;
|
||||
}
|
||||
|
||||
function getBoxConfig($Box_table, $Box_id)
|
||||
{
|
||||
$Box_id = (int)$Box_id;
|
||||
return array_key_exists($Box_id, $Box_table) ? $Box_table[$Box_id] : null;
|
||||
}
|
||||
|
||||
function getBagConfig($Bag_table, $Bag_id)
|
||||
{
|
||||
$Bag_id = (int)$Bag_id;
|
||||
return array_key_exists($Bag_id, $Bag_table) ? $Bag_table[$Bag_id] : null;
|
||||
}
|
||||
checkMysqlConfig();
|
||||
checkRedisConfig();
|
||||
|
@ -24,28 +24,13 @@ class AddReward {
|
||||
$item_conf = getItemConfig($g_conf_item_cluster, $item_id);
|
||||
$it = array(
|
||||
'id' => $item_conf['id'],
|
||||
'price' => $item_conf['price'],
|
||||
'dprice' => $item_conf['dprice'],
|
||||
'diamond' => $item_conf['diamond'],
|
||||
'type' => $item_conf['fuction'],
|
||||
'index' => $item_conf['fuctionindex']
|
||||
'diamond_hour' => $item_conf['diamond_hour']
|
||||
);
|
||||
return $it;
|
||||
}
|
||||
|
||||
protected function getDrop($drop_id)
|
||||
{
|
||||
$g_conf_drop_cluster = require('../res/drop@drop.php');
|
||||
$drop_conf = getDropConfig($g_conf_drop_cluster, $drop_id);
|
||||
$d = array(
|
||||
'drop_id' => $drop_conf['drop_id'],
|
||||
'item_id' => $drop_conf['item_id'],
|
||||
'num' => $drop_conf['num'],
|
||||
'weight' => $drop_conf['weight'],
|
||||
'type' => $drop_conf['type']
|
||||
);
|
||||
return $d;
|
||||
}
|
||||
|
||||
protected function getExplode($string)
|
||||
{
|
||||
$delim = "|";
|
||||
@ -59,7 +44,7 @@ class AddReward {
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public function addReward($item_id, $item_num, $account_id)
|
||||
public function addReward($item_id, $item_num, $account_id, $time)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
@ -75,39 +60,22 @@ class AddReward {
|
||||
array_push($item_list, array(
|
||||
'itemid' => $item_id,
|
||||
'itemnum' => $item_num,
|
||||
'time' => $time
|
||||
));
|
||||
if ($it['type'] == 5) {
|
||||
$item_list = $this->addGift($it['index'], $account_id);
|
||||
} else if ($it['type'] == 7) {
|
||||
$this->addPass($it['id'], $item_num, $account_id);
|
||||
}
|
||||
|
||||
|
||||
foreach ($item_list as $item) {
|
||||
$i = $this->getItem($item['itemid']);
|
||||
switch ($i['type'])
|
||||
{
|
||||
case 1:
|
||||
//添加金币
|
||||
if ($i['type'] == 1){
|
||||
$this->addCoin($item['itemid'], $item['itemnum'], $account_id);
|
||||
break;
|
||||
case 2:
|
||||
//添加钻石
|
||||
} else if ($i['type'] == 2) {
|
||||
$this->addDiamond($item['itemid'], $item['itemnum'], $account_id);
|
||||
break;
|
||||
case 3:
|
||||
//添加角色碎片
|
||||
$this->addSkinFragment($item['itemid'], $item['itemnum'], $account_id);
|
||||
break;
|
||||
case 4:
|
||||
//添加角色
|
||||
$this->addSkin($item['itemid'], $item['itemnum'], $account_id);
|
||||
break;
|
||||
case 6:
|
||||
//添加表情
|
||||
$this->addEmoji($item['itemid'], $account_id, $it['dprice']);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} else {
|
||||
$price = $i['diamond'];
|
||||
if ($time != 0) {
|
||||
$price = $i['diamond_hour'] * $time;
|
||||
}
|
||||
$item_list = $this->addItem($item['itemid'], $item['time'], $account_id, $price);
|
||||
}
|
||||
}
|
||||
return $item_list;
|
||||
@ -141,82 +109,6 @@ class AddReward {
|
||||
return $row['diamond_num'];
|
||||
}
|
||||
|
||||
//添加礼包
|
||||
protected function addGift($dropid, $accountid)
|
||||
{
|
||||
$conn = $this->getMysql($accountid);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$d = $this->getDrop($dropid);
|
||||
if (!$d) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个道具');
|
||||
die();
|
||||
}
|
||||
$item_list = array();
|
||||
$item_id_array = $this->getExplode($d['item_id']);
|
||||
$weight_sum = 0;
|
||||
$keys = 0;
|
||||
$item_num_array = $this->getExplode($d['num']);
|
||||
$weight_array = $this->getExplode($d['weight']);
|
||||
for ($i = 0; $i < count($weight_array); $i++) {
|
||||
$random = Rand(0, 10000);
|
||||
if ($weight_array[$i][0] > $random) {
|
||||
$item_id = $item_id_array[$i][0];
|
||||
$item_num = $item_num_array[$i][0];
|
||||
array_push($item_list, array(
|
||||
'itemid' => $item_id,
|
||||
'itemnum' => $item_num,
|
||||
));
|
||||
}
|
||||
}
|
||||
return $item_list;
|
||||
}
|
||||
//添加表情
|
||||
protected function addEmoji($itemid, $accountid, $dprice)
|
||||
{
|
||||
$item_list = array();
|
||||
$item_id = 0;
|
||||
$item_num = 0;
|
||||
$conn = $this->getMysql($accountid);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT status FROM emoji WHERE accountid=:accountid AND emojiid=:emojiid;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':emojiid' => $itemid,
|
||||
));
|
||||
if (!$row) {
|
||||
$ret = $conn->execScript('INSERT INTO emoji(accountid, emojiid, status, create_time, modify_time) ' .
|
||||
' VALUES(:account_id, :emojiid, 1, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, emojiid=:emojiid, status=1, modify_time=:modify_time;',
|
||||
array(
|
||||
':account_id' => $accountid,
|
||||
':emojiid' => $itemid,
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
));
|
||||
if(!$ret){
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$item_id = $itemid;
|
||||
$item_num = 1;
|
||||
} else {
|
||||
$item_id = 10003;
|
||||
$item_num = $dprice;
|
||||
$this->addDiamond($item_id, $item_num, $accountid);
|
||||
}
|
||||
|
||||
array_push($item_list, array(
|
||||
'itemid' => $item_id,
|
||||
'itemnum' => $item_num,
|
||||
));
|
||||
return $item_list;
|
||||
}
|
||||
//添加钻石
|
||||
protected function addDiamond($item_id, $item_num, $accountid)
|
||||
{
|
||||
@ -263,112 +155,84 @@ class AddReward {
|
||||
die();
|
||||
}
|
||||
}
|
||||
//添加角色碎片
|
||||
protected function addSkinFragment($item_id, $item_num, $accountid)
|
||||
{
|
||||
$conn = $this->getMysql($accountid);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$rowSkin = $conn->execQueryOne('SELECT fragment_num FROM skin WHERE accountid=:accountid AND fragment_id=:fragment_id;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':fragment_id' => $item_id
|
||||
));
|
||||
if (!$rowSkin) {
|
||||
$ret = $conn->execScript('INSERT INTO skin(accountid, skin_id, skin_status, fragment_id, fragment_num, active_time, fragment_status, skin_type, skin_level, skin_experience_level, skin_experience_type, create_time, modify_time) ' .
|
||||
' VALUES(:account_id, :skin_id, :skin_status, :fragment_id, :fragment_num, 0, 0, :skin_type, 1, 0, 0, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, skin_id=:skin_id, skin_status=:skin_status, fragment_id=:fragment_id, fragment_num=:fragment_num, active_time=0, fragment_status=0, skin_type=:skin_type, skin_level=1, skin_experience_level=0, skin_experience_type=0, modify_time=:modify_time;',
|
||||
array(
|
||||
':account_id' => $accountid,
|
||||
':skin_id' => $item_id + 1000,
|
||||
':skin_status' => 2,
|
||||
':fragment_id' => $item_id,
|
||||
':fragment_num' => $item_num,
|
||||
':skin_type' => 1,
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
));
|
||||
if(!$ret){
|
||||
die();
|
||||
}
|
||||
} else {
|
||||
$ret = $conn->execScript('UPDATE skin SET fragment_num=:fragment_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid AND fragment_id=:fragment_id;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':fragment_id' => $item_id,
|
||||
':fragment_num' => $item_num + $rowSkin['fragment_num'],
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
//添加角色
|
||||
protected function addSkin($item_id, $item_num, $accountid)
|
||||
|
||||
//添加道具
|
||||
protected function addItem($item_id, $time, $accountid, $price)
|
||||
{
|
||||
$item_list = array();
|
||||
$item_id = 0;
|
||||
$item_num = 0;
|
||||
$item_num = 1;
|
||||
$item_id = $item_id;
|
||||
$time = $time;
|
||||
$conn = $this->getMysql($accountid);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$rowSkin = $conn->execQueryOne('SELECT fragment_num FROM skin WHERE accountid=:accountid AND fragment_id=:fragment_id;',
|
||||
$status = 2;
|
||||
$active_time = $time * 3600 + time();
|
||||
if ($time == 0) {
|
||||
$active_time = 0;
|
||||
$status = 1;
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT * FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':fragment_id' => $item_id
|
||||
'id' => $item_id
|
||||
));
|
||||
if (!$rowSkin) {
|
||||
$ret = $conn->execScript('INSERT INTO skin(accountid, skin_id, skin_status, fragment_id, fragment_num, active_time, fragment_status, skin_type, skin_level, skin_experience_level, skin_experience_type, create_time, modify_time) ' .
|
||||
' VALUES(:account_id, :skin_id, :skin_status, :fragment_id, 0, 0, 0, :skin_type, 1, 0, 0, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, skin_id=:skin_id, skin_status=:skin_status, fragment_id=:fragment_id, fragment_num=0, active_time=0, fragment_status=0, skin_type=:skin_type, skin_level=1, skin_experience_level=0, skin_experience_type=0, modify_time=:modify_time;',
|
||||
error_log(22222222);
|
||||
if (!$row) {
|
||||
error_log(111111111);
|
||||
error_log($item_id);
|
||||
$ret = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, active_time, create_time, modify_time) ' .
|
||||
' VALUES(:account_id, :id, 0, :status, :active_time, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=:status, active_time=:active_time, modify_time=:modify_time;',
|
||||
array(
|
||||
':account_id' => $accountid,
|
||||
':skin_id' => $item_id,
|
||||
':skin_status' => 1,
|
||||
':fragment_id' => $item_id - 1000,
|
||||
':skin_type' => 1,
|
||||
':id' => $item_id,
|
||||
':active_time' => $active_time,
|
||||
':status' => $status,
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
));
|
||||
if(!$ret){
|
||||
die();
|
||||
}
|
||||
$item_id = $itemid;
|
||||
$item_num = 1;
|
||||
} else {
|
||||
$item_id = 10003;
|
||||
$item_num = $dprice;
|
||||
$this->addDiamond($item_id, $item_num, $accountid);
|
||||
}
|
||||
|
||||
} else {
|
||||
if ($row['status'] != 2 && $row['active_time'] == 0) {
|
||||
$item_id = 10003;
|
||||
$item_num = $price;
|
||||
$time = 0;
|
||||
$this->addDiamond($item_id, $item_num, $accountid);
|
||||
} else {
|
||||
$nowTime = $row['active_time'];
|
||||
if ($row['active_time'] < time() + $time * 3600) {
|
||||
$nowTime = time() + $time * 3600;
|
||||
} else {
|
||||
if ($time == 0) {
|
||||
$nowTime = 0;
|
||||
}
|
||||
}
|
||||
$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();
|
||||
}
|
||||
}
|
||||
}
|
||||
array_push($item_list, array(
|
||||
'itemid' => $item_id,
|
||||
'itemnum' => $item_num,
|
||||
'time' => $time,
|
||||
));
|
||||
}
|
||||
//添加通行证
|
||||
protected function addPass($item_id, $item_num, $accountid)
|
||||
{
|
||||
$conn = $this->getMysql($accountid);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$user_ret = $conn->execScript('UPDATE user SET pass_status=1, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$user_ret) {
|
||||
die();
|
||||
}
|
||||
return $item_list;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -28,7 +28,6 @@ class Quest{
|
||||
'type' => $quest_conf['type'],
|
||||
'condition' => $quest_conf['condition'],
|
||||
'value' => $quest_conf['value'],
|
||||
'active_value' => $quest_conf['active_value'],
|
||||
);
|
||||
return $q;
|
||||
}
|
||||
|
@ -81,6 +81,7 @@ class ActivityController{
|
||||
'weight' => $lot_conf['weight'],
|
||||
'quailty' => $lot_conf['quailty'],
|
||||
'jilv' => $lot_conf['jilv'],
|
||||
'time' => $lot_conf['time'],
|
||||
);
|
||||
return $l;
|
||||
}
|
||||
@ -185,6 +186,7 @@ class ActivityController{
|
||||
'item_id' => $draw['item_id'],
|
||||
'item_num' => $draw['item_num'],
|
||||
'quailty' => $draw['quailty'],
|
||||
'time' => $draw['time'],
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -260,6 +262,7 @@ class ActivityController{
|
||||
if ($draw['key'] == $key - 1) {
|
||||
$item_id = $draw['item_id'];
|
||||
$item_num = $draw['item_num'];
|
||||
$time = $draw['time'];
|
||||
$flag = 1;
|
||||
break;
|
||||
}
|
||||
@ -311,7 +314,7 @@ class ActivityController{
|
||||
}
|
||||
//增加奖励
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($item_id, $item_num, $account_id);
|
||||
$addreward->addReward($item_id, $item_num, $account_id, $time);
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
$item_list = array();
|
||||
@ -392,14 +395,17 @@ class ActivityController{
|
||||
$item_id_array = $this->getExplode($l['item_id']);
|
||||
$num_array = $this->getExplode($l['num']);
|
||||
$quailty_array = $this->getExplode($l['quailty']);
|
||||
$time_array = $this->getExplode($l['time']);
|
||||
$item_id = $item_id_array[$key][0];
|
||||
$item_num = $num_array[$key][0];
|
||||
$quailty = $quailty_array[$key][0];
|
||||
$time = $time_array[$key][0];
|
||||
array_push($draw_list, array(
|
||||
'key' => $i - 1,
|
||||
'item_id' => $item_id,
|
||||
'item_num' => $item_num,
|
||||
'quailty' => $quailty,
|
||||
'time' => $time,
|
||||
));
|
||||
}
|
||||
return $draw_list;
|
||||
@ -536,442 +542,5 @@ class ActivityController{
|
||||
}
|
||||
return $randreward_list;
|
||||
}
|
||||
|
||||
public function airDropBoxReward()
|
||||
{
|
||||
$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 + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT box_num FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
if ($row['box_num'] <= 0) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '今日开箱子次数已用完');
|
||||
return;
|
||||
}
|
||||
$airReward_uuid = 'game2004api_airReward_uuid:' . md5($_REQUEST['account_id']);
|
||||
$airReward_list = array();
|
||||
$r = $this->getRedis($airReward_uuid);
|
||||
if (!$r) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$user_db_str = $r->get($airReward_uuid);
|
||||
$airReward_num = 0;
|
||||
$last_time = 0;
|
||||
if (empty($user_db_str)) {
|
||||
$airReward_list = $this->getRandomAirReward(24106);
|
||||
$airReward_db = array(
|
||||
'airReward_uuid' => $airReward_uuid,
|
||||
'airReward_list' => $airReward_list,
|
||||
);
|
||||
$r -> set($airReward_uuid, json_encode($airReward_db));
|
||||
$r -> pexpire($airReward_uuid, 1000 * 7200);
|
||||
} else {
|
||||
$user_db = json_decode($user_db_str, true);
|
||||
unset($user_db['airReward_list']);
|
||||
$airReward_list = $this->getRandomAirReward(24106);
|
||||
$airReward_db = array(
|
||||
'airReward_uuid' => $airReward_uuid,
|
||||
'airReward_list' => $airReward_list,
|
||||
);
|
||||
$r -> set($airReward_uuid, json_encode($airReward_db));
|
||||
$r -> pexpire($airReward_uuid, 1000 * 7200);
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE user SET box_num=:box_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':box_num' => $row['box_num'] - 1,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
foreach ($airReward_list as $airReward) {
|
||||
//增加奖励
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($airReward['item_id'], $airReward['item_num'], $account_id);
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'item_list' => $airReward_list
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
public function airDoubleReward()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$airReward_uuid = 'game2004api_airReward_uuid:' . md5($_REQUEST['account_id']);
|
||||
$airReward_list = array();
|
||||
$r = $this->getRedis($airReward_uuid);
|
||||
if (!$r) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$user_db_str = $r->get($airReward_uuid);
|
||||
if (empty($user_db_str)) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2,'session失效');
|
||||
return;
|
||||
}
|
||||
$user_db = json_decode($user_db_str, true);
|
||||
if (empty($user_db)) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3,'session失效');
|
||||
return;
|
||||
}
|
||||
$p = $this->getParameter(REWARD_TIMES);
|
||||
$times = $p['value'] - 1;
|
||||
foreach ($user_db['airReward_list'] as $airReward) {
|
||||
//增加奖励
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($airReward['item_id'], $airReward['item_num'] * $times, $account_id);
|
||||
}
|
||||
$r->del($airReward_uuid, json_encode($user_db));
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
protected function getRandomAirReward($drop_id)
|
||||
{
|
||||
$airReward_list = array();
|
||||
//随机奖励
|
||||
$d = $this->getDrop($drop_id);
|
||||
if (!$d) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励');
|
||||
die();
|
||||
}
|
||||
$item_id_array = $this->getExplode($d['item_id']);
|
||||
$item_num_array = $this->getExplode($d['num']);
|
||||
$weight_array = $this->getExplode($d['weight']);
|
||||
if ($d['type'] == 2) {
|
||||
$weight_sum = 0;
|
||||
$keys = 0;
|
||||
for ($i = 0; $i < count($weight_array); $i++) {
|
||||
$weight_sum += $weight_array[$i][0];
|
||||
}
|
||||
$random = Rand(0, $weight_sum);
|
||||
$weight = 0;
|
||||
for ($i = 0; $i < count($weight_array); $i++) {
|
||||
$weight += $weight_array[$i][0];
|
||||
if ($weight > $random) {
|
||||
$keys = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$item_id = $item_id_array[$keys][0];
|
||||
$item_num = $item_num_array[$keys][0];
|
||||
array_push($airReward_list, array(
|
||||
'item_id' => $item_id,
|
||||
'item_num' => $item_num,
|
||||
));
|
||||
}
|
||||
if ($d['type'] == 1) {
|
||||
for ($i = 0; $i < count($weight_array); $i++) {
|
||||
$random = Rand(0, 10000);
|
||||
if ($weight_array[$i][0] < $random) {
|
||||
continue;
|
||||
}
|
||||
array_push($airReward_list, array(
|
||||
'item_id' => $item_id_array[$keys][0],
|
||||
'item_num' => $item_num_array[$keys][0],
|
||||
));
|
||||
}
|
||||
}
|
||||
return $airReward_list;
|
||||
}
|
||||
|
||||
public function tempRedPack()
|
||||
{
|
||||
//$this->getRedPack($_REQUEST['amount'], $_REQUEST['account_id']);
|
||||
//error_log('success');
|
||||
}
|
||||
|
||||
public function getRedBag()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$p = array();
|
||||
$type = $_REQUEST['type'];
|
||||
$item_list = array();
|
||||
//随机奖励
|
||||
if ($type == 1) {
|
||||
$item_list = $this->getRandomAirReward(24006);
|
||||
$p = $this->getParameter(REDLIMIT);
|
||||
}
|
||||
if ($type == 2) {
|
||||
$item_list = $this->getRandomAirReward(24007);
|
||||
$p = $this->getParameter(73);
|
||||
}
|
||||
$limit = $p['value'];
|
||||
foreach ($item_list as $item) {
|
||||
if ($item['item_id'] != 10004 ) {
|
||||
//增加奖励
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($item['item_id'], $item['item_num'], $account_id);
|
||||
} else {
|
||||
//判断今日红包是否领完
|
||||
$red_conn = $this->getRedMysql();
|
||||
$row = $red_conn->execQueryOne('SELECT red_sum FROM redpack ' .
|
||||
' WHERE red_type=:red_type AND red_date=:red_date;',
|
||||
array(
|
||||
':red_type' => $type,
|
||||
':red_date' => phpcommon\getdayseconds(time())
|
||||
));
|
||||
if ($row['red_sum'] + $item['item_num'] > $limit) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '今日红包已领完');
|
||||
return;
|
||||
}
|
||||
//红包领取现金
|
||||
$this->getRedPack($item['item_num'] * 100, $account_id);
|
||||
//更新红包数据
|
||||
$this->updateRedPack($item['item_num'], $type);
|
||||
}
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'item_list' => $item_list
|
||||
));
|
||||
}
|
||||
|
||||
protected function getRedMysql()
|
||||
{
|
||||
$mysql_conf = getMysqlConfig(crc32(''));
|
||||
$conn = new phpcommon\Mysql(array(
|
||||
'host' => $mysql_conf['host'],
|
||||
'port' => $mysql_conf['port'],
|
||||
'user' => $mysql_conf['user'],
|
||||
'passwd' => $mysql_conf['passwd'],
|
||||
'dbname' => 'gamedb2004_' . 1
|
||||
));
|
||||
return $conn;
|
||||
}
|
||||
|
||||
//redpack201908191405_xxxxx
|
||||
protected function getOrderId($accountid)
|
||||
{
|
||||
$mysql_conf = getMysqlConfig(crc32($accountid));
|
||||
$conn = $this->getMysql($accountid);
|
||||
$orderid_pre = 'rp' . strftime('%y%m%d%H%M%S');
|
||||
$ret = $conn->execScript("INSERT INTO orderidx(createtime) VALUES(:createtime);",
|
||||
array(
|
||||
'createtime' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT LAST_INSERT_ID();', array());
|
||||
if (empty($row)) {
|
||||
die();
|
||||
}
|
||||
$orderid = $orderid_pre . 'db' . $mysql_conf['instance_id'] . 'idx' . $row[0];
|
||||
return $orderid;
|
||||
}
|
||||
|
||||
//红包提现
|
||||
protected function getRedPack($amount, $account_id)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT user_name FROM user ' .
|
||||
' WHERE accountid=:accountid ;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$mch_appid = '';
|
||||
$appid_url = '';
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
$appid_url = 'https://login.kingsome.cn/webapp/index.php?c=SdkService&a=getAppId&';
|
||||
} else {
|
||||
$appid_url = 'https://login-test.kingsome.cn/webapp/index.php?c=SdkService&a=getAppId&';
|
||||
}
|
||||
$params['account_id'] = $account_id;
|
||||
$app_response = '';
|
||||
if (!phpcommon\HttpClient::get($appid_url, $params, $app_response)) {
|
||||
phpcommon\sendError(ERR_RETRY, '系统繁忙');
|
||||
die();
|
||||
}
|
||||
$app_data = json_decode($app_response, true);
|
||||
$mch_appid = $app_data['appid'];
|
||||
$openid = phpcommon\extractOpenId($account_id);
|
||||
$re_user_name = $row['user_name'];
|
||||
$url = '';
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
$url = 'https://cloud.kingsome.cn/webapp/index.php?c=Config&a=read&';
|
||||
} else {
|
||||
$url = 'https://cloud-test.kingsome.cn/webapp/index.php?c=Config&a=read&';
|
||||
}
|
||||
|
||||
$params['gameid'] = phpcommon\extractGameId($account_id);
|
||||
$params['channel'] = phpcommon\extractChannel($account_id);
|
||||
$response = '';
|
||||
if (!phpcommon\HttpClient::get($url, $params, $response)) {
|
||||
phpcommon\sendError(ERR_RETRY, '系统繁忙');
|
||||
die();
|
||||
}
|
||||
$desc = '';
|
||||
$data = json_decode($response, true);
|
||||
$data_list = json_decode($data['KVList'], true);
|
||||
foreach ($data_list as $d) {
|
||||
if ($d['key'] == 'red_env_tip') {
|
||||
$desc = $d['value'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$partner_trade_no = $this->getOrderId($account_id);
|
||||
$url = '';
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
$url = 'https://service.kingsome.cn/webapp/index.php?c=RedPack&a=sendRedPack&';
|
||||
} else {
|
||||
$url = 'https://service-test.kingsome.cn/webapp/index.php?c=RedPack&a=sendRedPack&';
|
||||
}
|
||||
|
||||
$param['mch_appid'] = $mch_appid;
|
||||
$param['partner_trade_no'] = $partner_trade_no;
|
||||
$param['openid'] = $openid;
|
||||
$param['re_user_name'] = $re_user_name;
|
||||
$param['amount'] = $amount;
|
||||
$param['desc'] = $desc;
|
||||
$param['account_id'] = $account_id;
|
||||
$res = '';
|
||||
if (!phpcommon\HttpClient::get($url, $param, $res)) {
|
||||
phpcommon\sendError(ERR_RETRY, '系统繁忙');
|
||||
die();
|
||||
}
|
||||
$data = json_decode($res, true);
|
||||
if ($data['errcode'] != 0) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '领取失败');
|
||||
die();
|
||||
}
|
||||
//插入日志信息
|
||||
$ret = $conn->execScript('INSERT INTO redpack_log(accountid, order_id, get_time, custom_data, createtime, modifytime, coin_num) ' .
|
||||
' VALUES(:accountid, :order_id, :get_time, :custom_data, :createtime, :modifytime, :coin_num);',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':order_id' => $partner_trade_no,
|
||||
':get_time' => time(),
|
||||
':custom_data' => $res,
|
||||
':coin_num' => $amount,
|
||||
':createtime' => time(),
|
||||
':modifytime' => time()
|
||||
));
|
||||
}
|
||||
|
||||
//更新今日红包数据
|
||||
protected function updateRedPack($item_num, $type)
|
||||
{
|
||||
$sum = 0;
|
||||
$red_conn = $this->getRedMysql();
|
||||
$row = $red_conn->execQueryOne('SELECT red_sum FROM redpack ' .
|
||||
' WHERE red_type=:red_type AND red_date=:red_date;',
|
||||
array(
|
||||
':red_type' => $type,
|
||||
':red_date' => phpcommon\getdayseconds(time())
|
||||
));
|
||||
|
||||
if (!$row) {
|
||||
$ret = $red_conn->execScript('INSERT INTO redpack(red_type, red_sum, red_date, create_time, modify_time) ' .
|
||||
' VALUES(:red_type, :red_sum, :red_date, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE red_type=1, red_sum=:red_sum, red_date=:red_date, modify_time=:modify_time;',
|
||||
array(
|
||||
':red_sum' => $item_num,
|
||||
':create_time' => time(),
|
||||
':red_type' => $type,
|
||||
':red_date' => phpcommon\getdayseconds(time()),
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
} else {
|
||||
$sum = $row['red_sum'] + $item_num;
|
||||
$ret = $red_conn->execScript('UPDATE redpack set red_sum=:red_sum, modify_time=:modify_time ' .
|
||||
' WHERE red_type=:red_type AND red_date=:red_date;',
|
||||
array(
|
||||
':red_sum' => $sum,
|
||||
':red_type' => $type,
|
||||
':red_date' => phpcommon\getdayseconds(time()),
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function airDropBoxInfo()
|
||||
{
|
||||
$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 + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$d = $this->getDrop(24106);
|
||||
if (!$d) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励');
|
||||
die();
|
||||
}
|
||||
$item_list = array();
|
||||
$item_id_array = $this->getExplode($d['item_id']);
|
||||
$item_num_array = $this->getExplode($d['num']);
|
||||
for($i = 0; $i < count($item_id_array); $i++) {
|
||||
$item_id = $item_id_array[$i][0];
|
||||
$item_num = $item_num_array[$i][0];
|
||||
array_push($item_list, array(
|
||||
'item_id' => $item_id,
|
||||
'item_num' => $item_num,
|
||||
));
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'item_list' => $item_list
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -15,88 +15,6 @@ class HangController{
|
||||
return $conn;
|
||||
}
|
||||
|
||||
protected function getParameter($para_id)
|
||||
{
|
||||
$g_conf_para_cluster = require('../res/parameter@parameter.php');
|
||||
$para_conf = getParameterConfig($g_conf_para_cluster, $para_id);
|
||||
$p = array(
|
||||
'id' => $para_conf['id'],
|
||||
'param_name' => $para_conf['param_name'],
|
||||
'param_value' => $para_conf['param_value'],
|
||||
);
|
||||
return $p;
|
||||
}
|
||||
|
||||
public function getHangReward()
|
||||
{
|
||||
$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);
|
||||
$item_id = 0;
|
||||
$num = 0;
|
||||
$weight = $_REQUEST['weight'];
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT * FROM hang WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
if ($row) {
|
||||
$ret = $conn->execScript('UPDATE hang SET hang_time=:hang_time, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':hang_time' => time(),
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$item_id = 10001;
|
||||
$p_num = $this->getParameter(GOLD);
|
||||
$p_time_limit = $this->getParameter(TIME_LIMIT);
|
||||
$num = floor((time() - $row['hang_time']) / 5 * $p_num['param_value']);
|
||||
if ((time() - $row['hang_time']) >= $p_time_limit['param_value']) {
|
||||
$num = floor($p_time_limit['param_value'] / 5 * $p_num['param_value']);
|
||||
}
|
||||
if ($weight != 0) {
|
||||
$p = $this->getParameter(REWARD_TIMES);
|
||||
$times = $p['param_value'] - 1;
|
||||
$num = $num * $times;
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
$ret = $conn->execScript('UPDATE user SET coin_num=:coin_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':coin_num' => $num + $row['coin_num'],
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'item_id' => $item_id,
|
||||
'num' => $num,
|
||||
'time' => time()
|
||||
));
|
||||
}
|
||||
|
||||
public function getTime()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
@ -111,39 +29,11 @@ class HangController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$num = 0;
|
||||
$row = $conn->execQueryOne('SELECT * FROM hang WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
if (!$row) {
|
||||
$ret = $conn->execScript('INSERT INTO hang(accountid, hang_time, create_time, modify_time) ' .
|
||||
' VALUES(:accountid, :hang_time, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:accountid, hang_time=:hang_time, modify_time=:modify_time;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':hang_time' => time(),
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$p_num = $this->getParameter(GOLD);
|
||||
$p_time_limit = $this->getParameter(TIME_LIMIT);
|
||||
$num = floor((time() - $row['hang_time']) / 5 * $p_num['param_value']);
|
||||
if ((time() - $row['hang_time']) >= $p_time_limit['param_value']) {
|
||||
$num = floor($p_time_limit['param_value'] / 5 * $p_num['param_value']);
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'time' => time(),
|
||||
'num' => $num
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -43,20 +43,6 @@ class PassController{
|
||||
return $season;
|
||||
}
|
||||
|
||||
protected function getSeasonReward($seaReward_id)
|
||||
{
|
||||
$seaReward_meta_table = require('../res/seasonReward@seasonReward.php');
|
||||
$seaReward_meta = getSeasonRewardConfig($seaReward_meta_table, $seaReward_id);
|
||||
$seaReward = array(
|
||||
'id' => $seaReward_meta['id'],
|
||||
'point' => $seaReward_meta['point'],
|
||||
'active' => $seaReward_meta['reward1'],
|
||||
'honor' => $seaReward_meta['reward2'],
|
||||
'level' => $seaReward_meta['level']
|
||||
);
|
||||
return $seaReward;
|
||||
}
|
||||
|
||||
protected function getSeasonPoint($seaPoint_id)
|
||||
{
|
||||
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
|
||||
@ -67,6 +53,7 @@ class PassController{
|
||||
'max' => $seaPoint_meta['max_point'],
|
||||
'des' => $seaPoint_meta['des'],
|
||||
'reward' => $seaPoint_meta['season_reward'],
|
||||
'weekreward' => $seaPoint_meta['week_reward'],
|
||||
);
|
||||
return $seaPoint;
|
||||
}
|
||||
@ -119,6 +106,7 @@ class PassController{
|
||||
$rank_score = 0;
|
||||
$max_rank_score = 0;
|
||||
$reward = array();
|
||||
$week_reward = array();
|
||||
$row = $conn->execQueryOne('SELECT integral, pass_status, score FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
@ -127,18 +115,22 @@ class PassController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$rank_status = 0;
|
||||
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
|
||||
for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) {
|
||||
$seaPoint = $this->getSeasonPoint($ii);
|
||||
if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|
||||
|| $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1)
|
||||
{
|
||||
$delim = ':';
|
||||
$drop_multiply = explode($delim, $seaPoint['reward']);
|
||||
array_push($reward, array(
|
||||
'item_id' => $drop_multiply[0],
|
||||
'item_num' => $drop_multiply[1],
|
||||
$drop_multiply = $this->getExplode($seaPoint['weekreward']);
|
||||
for($s = 0; $s < count($drop_multiply); $s++) {
|
||||
array_push($week_reward, array(
|
||||
'item_id' => $drop_multiply[$s][0],
|
||||
'item_num' => $drop_multiply[$s][1],
|
||||
'time' => $drop_multiply[$s][2],
|
||||
'status' => $row['pass_status']
|
||||
));
|
||||
}
|
||||
$rank = $ii;
|
||||
$max_rank_score = $seaPoint['max'] + 1 - $seaPoint['min'];
|
||||
$rank_score = $row['integral'] - $seaPoint['min'];
|
||||
@ -148,97 +140,46 @@ class PassController{
|
||||
$max_rank_score = $seaPoint['max'] + 1;
|
||||
}
|
||||
}
|
||||
$rowpass = $conn->execQueryOne('SELECT active_status, honor_status ' .
|
||||
' FROM passinfo WHERE accountid=:accountid AND passid=:passid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $ii,
|
||||
));
|
||||
$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) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:accountid, passid=:passid, active_status=0, honor_status=0, modify_time=:modify_time;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $ii,
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$rank_status = 0;
|
||||
} else {
|
||||
$rank_status = $rowpass['active_status'];
|
||||
}
|
||||
$delim = ':';
|
||||
$item_multiply = explode($delim, $seaPoint['reward']);
|
||||
array_push($reward, array(
|
||||
'item_id' => $item_multiply[0],
|
||||
'item_num' => $item_multiply[1],
|
||||
'time' => $item_multiply[2],
|
||||
'status' => $rank_status
|
||||
));
|
||||
}
|
||||
if ($rank == 0) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '未达到段位要求');
|
||||
return;
|
||||
}
|
||||
//奖励信息
|
||||
$level = 0;
|
||||
$sum_score = 0;
|
||||
$pass_score = 0;
|
||||
$max_pass_score = 0;
|
||||
$sum_point = 0;
|
||||
$item_list = array();
|
||||
$seaReward_meta_table = require('../res/seasonReward@seasonReward.php');
|
||||
for ($j = 1; $j <= count($seaReward_meta_table); $j++) {
|
||||
$id = $j + 100;
|
||||
$drop_multiply = array();
|
||||
$status = 0;
|
||||
$seaReward = $this->getSeasonReward($id - 1);
|
||||
$sum_point = $sum_point + $seaReward['point'];
|
||||
if ($row['score'] <= $sum_point) {
|
||||
$level = $seaReward['level'];
|
||||
$pass_score = $row['score'] - $sum_point + $seaReward['point'];
|
||||
$max_pass_score = $seaReward['point'];
|
||||
if ($row['score'] == $sum_point) {
|
||||
$level = $level + 1;
|
||||
$s = $this->getSeasonReward($id);
|
||||
$max_pass_score = $s['point'];
|
||||
} else {
|
||||
if ($id - 1 == 100) {
|
||||
$pass_score = $row['score'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($seaReward['point'] == -1) {
|
||||
$level = $seaReward['level'];
|
||||
$pass_score = $row['score'];
|
||||
$max_pass_score = $seaReward['point'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach ($seaReward_meta_table as $seaR) {
|
||||
//如果是最大等级,则返回上一级的最大值
|
||||
$status = 0;
|
||||
if ($seaR['point'] == -1) {
|
||||
$sea = $this->getSeasonReward($seaR['id'] - 1);
|
||||
$sum_score = $sea['point'];
|
||||
} else {
|
||||
$sum_score = $seaR['point'];
|
||||
}
|
||||
$rowPass = $conn->execQueryOne('SELECT active_status, honor_status ' .
|
||||
' FROM passinfo WHERE accountid=:accountid AND passid=:passid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $seaR['id']
|
||||
));
|
||||
$itemid = 0;
|
||||
$itemnum = 0;
|
||||
for ($t = 1; $t <= 2; $t++) {
|
||||
$delim = ":";
|
||||
if ($t == 1) {
|
||||
if ($seaR['reward1'] != '') {
|
||||
$drop_multiply = explode($delim, $seaR['reward1']);
|
||||
$itemid = $drop_multiply[0];
|
||||
$itemnum = $drop_multiply[1];
|
||||
}
|
||||
if ($rowPass) {
|
||||
$status = $rowPass['active_status'];
|
||||
}
|
||||
}
|
||||
if ($t == 2) {
|
||||
if ($seaR['reward2'] != '') {
|
||||
$drop_multiply = explode($delim, $seaR['reward2']);
|
||||
$itemid = $drop_multiply[0];
|
||||
$itemnum = $drop_multiply[1];
|
||||
}
|
||||
if ($rowPass) {
|
||||
$status = $rowPass['honor_status'];
|
||||
}
|
||||
}
|
||||
array_push($item_list, array(
|
||||
'id' => $seaR['id'],
|
||||
'type' => $t,
|
||||
'point' => $seaR['point'],
|
||||
'item_id' => $itemid,
|
||||
'item_num' => $itemnum,
|
||||
'status' => $status,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
@ -249,12 +190,8 @@ class PassController{
|
||||
'rank' => $rank,
|
||||
'rank_score' => $rank_score,
|
||||
'max_rank_score' => $max_rank_score,
|
||||
'level' => $level,
|
||||
'sum_score' => $sum_score,
|
||||
'pass_score' => $pass_score,
|
||||
'max_pass_score' => $max_pass_score,
|
||||
'reward' => $reward,
|
||||
'item_list' => $item_list
|
||||
'week' => $week_reward,
|
||||
));
|
||||
}
|
||||
|
||||
@ -274,32 +211,23 @@ class PassController{
|
||||
return;
|
||||
}
|
||||
$passid = $_REQUEST['id'];
|
||||
$type = $_REQUEST['type'];
|
||||
//$type = $_REQUEST['type'];
|
||||
$status = 0;
|
||||
$seaReward = $this->getSeasonReward($passid);
|
||||
if (!$seaReward) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励');
|
||||
return;
|
||||
}
|
||||
$rowPass = $conn->execQueryOne('SELECT active_status, honor_status ' .
|
||||
$rowPass = $conn->execQueryOne('SELECT active_status ' .
|
||||
' FROM passinfo WHERE accountid=:accountid AND passid=:passid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $passid
|
||||
));
|
||||
if ($rowPass) {
|
||||
if ($type == 1) {
|
||||
|
||||
$status = $rowPass['active_status'];
|
||||
}
|
||||
if ($type == 2) {
|
||||
$status = $rowPass['honor_status'];
|
||||
}
|
||||
if ($status == 1) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '该奖励已领取');
|
||||
return;
|
||||
}
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT score, pass_status FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT integral FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
));
|
||||
@ -307,47 +235,25 @@ class PassController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$seaR = $this->getSeasonReward($passid - 1);
|
||||
if ($seaR['point'] > $row['score']) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 4, '没有达到通行证要求');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($type == 2 && $row['pass_status'] == 0) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 4, '没有达到通行证要求');
|
||||
return;
|
||||
}
|
||||
|
||||
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) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:accountid, passid=:passid, active_status=0, honor_status=0, modify_time=:modify_time;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $passid,
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
}
|
||||
$this->updateStatus($account_id, $passid, $type);
|
||||
|
||||
|
||||
$this->updateStatus($account_id, $passid);
|
||||
//增加奖励
|
||||
$drop_multiply = array();
|
||||
if ($type == 1) {
|
||||
$seaPoint = $this->getSeasonPoint($passid);
|
||||
$delim = ':';
|
||||
$drop_multiply = explode($delim, $seaReward['active']);
|
||||
}
|
||||
if ($type == 2) {
|
||||
$delim = ':';
|
||||
$drop_multiply = explode($delim, $seaReward['honor']);
|
||||
}
|
||||
$drop_multiply = explode($delim, $seaPoint['reward']);
|
||||
array_push($reward, array(
|
||||
'item_id' => $drop_multiply[0],
|
||||
'item_num' => $drop_multiply[1],
|
||||
'time' => $drop_multiply[2],
|
||||
));
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($drop_multiply[0], $drop_multiply[1], $account_id);
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
foreach ($reward as $r) {
|
||||
$addreward->addReward($r['item_id'], $r['item_num'], $account_id, $r['time']);
|
||||
}
|
||||
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
@ -357,14 +263,14 @@ class PassController{
|
||||
));
|
||||
}
|
||||
|
||||
protected function updateStatus($accountid, $passid, $type)
|
||||
protected function updateStatus($accountid, $passid)
|
||||
{
|
||||
$conn = $this->getMysql($accountid);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
if ($type == 1) {
|
||||
|
||||
$ret = $conn->execScript('UPDATE passinfo SET active_status=1, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid AND passid=:passid;',
|
||||
array(
|
||||
@ -376,20 +282,74 @@ class PassController{
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if ($type == 2) {
|
||||
$ret = $conn->execScript('UPDATE passinfo SET honor_status=1, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid AND passid=:passid;',
|
||||
|
||||
public function getWeekReward()
|
||||
{
|
||||
$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;
|
||||
}
|
||||
|
||||
$row = $conn->execQueryOne('SELECT pass_status, integral FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':passid' => $passid,
|
||||
':accountid' => $account_id,
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$reward = array();
|
||||
$level = 0;
|
||||
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
|
||||
for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) {
|
||||
$seaPoint = $this->getSeasonPoint($ii);
|
||||
if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|
||||
|| $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1)
|
||||
{
|
||||
$delim = ':';
|
||||
$drop_multiply = explode($delim, $seaPoint['reward']);
|
||||
array_push($reward, array(
|
||||
'item_id' => $drop_multiply[0],
|
||||
'item_num' => $drop_multiply[1],
|
||||
'time' => $drop_multiply[2]
|
||||
));
|
||||
$level = $ii;
|
||||
}
|
||||
}
|
||||
$addreward = new classes\AddReward();
|
||||
foreach ($reward as $r) {
|
||||
$addreward->addReward($r['item_id'], $r['item_num'], $account_id, $r['time']);
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE user SET pass_status=1, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
}
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'item_list' => $reward,
|
||||
'level' => $level,
|
||||
'diamond_nums' => $diamond_num
|
||||
));
|
||||
}
|
||||
|
||||
public function getSeaReward()
|
||||
@ -411,7 +371,7 @@ class PassController{
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
));
|
||||
if (!$row) {
|
||||
/* if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
@ -419,7 +379,7 @@ class PassController{
|
||||
if ($row['season_status'] == 1) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '赛季未结束');
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
$reward = array();
|
||||
$level = 0;
|
||||
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
|
||||
@ -433,15 +393,16 @@ class PassController{
|
||||
array_push($reward, array(
|
||||
'item_id' => $drop_multiply[0],
|
||||
'item_num' => $drop_multiply[1],
|
||||
'time' => $drop_multiply[2]
|
||||
));
|
||||
$level = $ii;
|
||||
}
|
||||
}
|
||||
$addreward = new classes\AddReward();
|
||||
foreach ($reward as $r) {
|
||||
$addreward->addReward($r['item_id'], $r['item_num'], $account_id);
|
||||
$addreward->addReward($r['item_id'], $r['item_num'], $account_id, $r['time']);
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE user SET season_end_score=0, season_status=1, modify_time=:modify_time ' .
|
||||
$ret = $conn->execScript('UPDATE user SET pass_status=1, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
|
@ -27,7 +27,7 @@ class QuestController{
|
||||
'type' => $quest_conf['type'],
|
||||
'condition' => $quest_conf['condition'],
|
||||
'value' => $quest_conf['value'],
|
||||
'active_value' => $quest_conf['active_value'],
|
||||
// 'active_value' => $quest_conf['active_value'],
|
||||
'reward' => $quest_conf['reward'],
|
||||
);
|
||||
return $q;
|
||||
@ -45,18 +45,6 @@ class QuestController{
|
||||
return $p;
|
||||
}
|
||||
|
||||
protected function getTaskReward($taskReward_id)
|
||||
{
|
||||
$g_conf_taskReward_cluster = require('../res/taskReward@taskReward.php');
|
||||
$taskReward_conf = getTaskRewardConfig($g_conf_taskReward_cluster, $taskReward_id);
|
||||
$t = array(
|
||||
'id' => $taskReward_conf['id'],
|
||||
'type' => $taskReward_conf['type'],
|
||||
'value' => $taskReward_conf['value'],
|
||||
'reward' => $taskReward_conf['reward']
|
||||
);
|
||||
return $t;
|
||||
}
|
||||
|
||||
protected function getExplode($string)
|
||||
{
|
||||
@ -85,120 +73,6 @@ class QuestController{
|
||||
return $d;
|
||||
}
|
||||
|
||||
protected function insertActive($account_id, $active_id, $task_num)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
for ($i = $active_id; $i < $active_id + $task_num; $i++) {
|
||||
$ret = $conn->execScript('INSERT INTO quest(accountid, quest_id, quest_type, quest_state, create_time, modify_time) ' .
|
||||
' VALUES(:accountid, :quest_id, :quest_type, :quest_state, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:accountid, quest_id=:quest_id, quest_type=:quest_type, quest_state=:quest_state, modify_time=:modify_time;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':quest_id' => $i,
|
||||
':quest_type' => 0,
|
||||
':quest_state'=> 0,
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function updateActive($account_id, $active_num, $active_sum)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
for ($i = 73001; $i < 73006; $i++) {
|
||||
$quest_id = $i;
|
||||
$row = $conn->execQueryOne('SELECT * FROM quest WHERE accountid=:accountid AND quest_id=:quest_id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':quest_id' => $quest_id
|
||||
));
|
||||
$t = $this->getTaskReward($quest_id);
|
||||
if ($row['quest_state'] != 0 || $active_num < $t['value']) {
|
||||
continue;
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE quest SET quest_state=:quest_state, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid AND quest_id =:quest_id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':quest_id' => $quest_id,
|
||||
':quest_state' => 1,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
for ($j = 74001; $j < 74004; $j++) {
|
||||
$quest_id = $j;
|
||||
$row = $conn->execQueryOne('SELECT * FROM quest WHERE accountid=:accountid AND quest_id=:quest_id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':quest_id' => $quest_id
|
||||
));
|
||||
$t = $this->getTaskReward($j);
|
||||
if ($row['quest_state'] != 0 || $active_sum < $t['value']) {
|
||||
continue;
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE quest SET quest_state=:quest_state, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid AND quest_id =:quest_id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':quest_id' => $quest_id,
|
||||
':quest_state' => 1,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function updateActiveTime($account_id, $quest_id, $flag)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
if ($flag == 2) {
|
||||
$ret = $conn->execScript('UPDATE active SET sum_time=:sum_time, active_sum=:active_sum, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':sum_time' => time(),
|
||||
':active_sum' => 0,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
} else if ($flag == 1) {
|
||||
$ret = $conn->execScript('UPDATE active SET num_time=:num_time, active_num=:active_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':num_time' => time(),
|
||||
':active_num' => 0,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE quest SET quest_state=:quest_state, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid AND quest_type=:quest_type AND quest_id<:quest_id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':quest_type' => 0,
|
||||
':quest_id' => $quest_id,
|
||||
':quest_state' => 0,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
public function questInfo()
|
||||
{
|
||||
@ -219,30 +93,7 @@ class QuestController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT active_sum, sum_time FROM active WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
));
|
||||
if ($row) {
|
||||
//每周更新活跃度
|
||||
if (phpcommon\getMondayseconds(time()) - phpcommon\getMondayseconds($row['sum_time']) > 0) {
|
||||
$this->updateActiveTime($account_id, 75000, 2);
|
||||
} else {
|
||||
$active_sum = $row['active_sum'];
|
||||
}
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT active_num, num_time FROM active WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
));
|
||||
if ($row) {
|
||||
//每日更新活跃度
|
||||
if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($row['num_time']) > 0) {
|
||||
$this->updateActiveTime($account_id, 74000, 1);
|
||||
} else {
|
||||
$active_num = $row['active_num'];
|
||||
}
|
||||
}
|
||||
|
||||
$rowCount = $conn->execQueryRowCount('SELECT * FROM quest WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
@ -263,44 +114,11 @@ class QuestController{
|
||||
));
|
||||
}
|
||||
}
|
||||
$rows = $conn->execQuery('SELECT * FROM quest WHERE accountid=:accountid AND quest_type=:quest_type;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':quest_type' => 2
|
||||
));
|
||||
if ($rows) {
|
||||
foreach ($rows as $row) {
|
||||
array_push($achievement_list, array(
|
||||
'type' => $row['quest_type'],
|
||||
'achievement_id' => $row['quest_id'],
|
||||
'achievement_num' => $row['quest_num'],
|
||||
'achievement_state' => $row['quest_state']
|
||||
));
|
||||
}
|
||||
}
|
||||
$rows = $conn->execQuery('SELECT * FROM quest WHERE accountid=:accountid AND quest_type=:quest_type;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':quest_type' => 0
|
||||
));
|
||||
if ($rows) {
|
||||
foreach ($rows as $row) {
|
||||
array_push($active_list, array(
|
||||
'type' => $row['quest_type'],
|
||||
'active_id' => $row['quest_id'],
|
||||
'active_state' => $row['quest_state']
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'active_num' => $active_num,
|
||||
'active_sum' => $active_sum,
|
||||
'active_list' => $active_list,
|
||||
'quest_list' => $quest_list,
|
||||
'achievement_list' => $achievement_list
|
||||
));
|
||||
}
|
||||
|
||||
@ -400,6 +218,7 @@ class QuestController{
|
||||
return;
|
||||
}
|
||||
$item_list = array();
|
||||
$addreward = new classes\AddReward();
|
||||
if ($row['quest_state'] == 1) {
|
||||
$ret = $conn->execScript('UPDATE quest SET quest_state=:quest_state, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid AND quest_id =:quest_id AND quest_type=:quest_type;',
|
||||
@ -416,43 +235,6 @@ class QuestController{
|
||||
}
|
||||
|
||||
//发奖励
|
||||
if ($quest_type == 0) {
|
||||
$t = $this->getTaskReward($quest_id);
|
||||
if (!$t) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个任务');
|
||||
return;
|
||||
}
|
||||
$d = $this->getDrop($t['reward']);
|
||||
if (!$d) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励');
|
||||
return;
|
||||
}
|
||||
$weight_sum = 0;
|
||||
$weight_array = $this->getExplode($d['weight']);
|
||||
for ($i = 0; $i < count($weight_array); $i++) {
|
||||
$weight_sum += $weight_array[$i][0];
|
||||
}
|
||||
|
||||
$random = Rand(0, $weight_sum);
|
||||
$weight = 0;
|
||||
for ($i = 0; $i < count($weight_array); $i++) {
|
||||
$weight += $weight_array[$i][0];
|
||||
if ($weight > $random) {
|
||||
$key = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$item_id_array = $this->getExplode($d['item_id']);
|
||||
$num_array = $this->getExplode($d['num']);
|
||||
$item_id = $item_id_array[$key][0];
|
||||
$item_num = $num_array[$key][0];
|
||||
array_push($item_list, array(
|
||||
'item_id' => $item_id,
|
||||
'item_num' => $item_num,
|
||||
));
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($item_id, $item_num, $account_id);
|
||||
} else {
|
||||
$q = $this->getQuest($quest_id);
|
||||
if (!$q) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个任务');
|
||||
@ -461,58 +243,12 @@ class QuestController{
|
||||
$array = $this->getExplode($q['reward']);
|
||||
$reward_id = $array[0][0];
|
||||
$reward_num = $array[0][1];
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($reward_id, $reward_num, $account_id);
|
||||
$addreward->addReward($reward_id, $reward_num, $account_id, 0);
|
||||
array_push($item_list, array(
|
||||
'item_id' => $reward_id,
|
||||
'item_num' => $reward_num,
|
||||
));
|
||||
}
|
||||
if ($row['quest_type'] == 1) {
|
||||
$active = $conn->execQueryOne('SELECT active_num, active_sum FROM active WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
//增加活跃度
|
||||
if (!$active) {
|
||||
$this->insertActive($account_id, 73001, 5);
|
||||
$this->insertActive($account_id, 74001, 3);
|
||||
$ret = $conn->execScript('INSERT INTO active(accountid, active_num, num_time, active_sum, sum_time, create_time, modify_time) ' .
|
||||
' VALUES(:accountid, :active_num, :num_time, :active_sum, :sum_time, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:accountid, active_num=:active_num, num_time=:num_time, active_sum=:active_sum, sum_time=:sum_time, modify_time=:modify_time;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':active_num' => $q['active_value'],
|
||||
':num_time' => time(),
|
||||
':active_sum' => $q['active_value'],
|
||||
':sum_time' => time(),
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$this->updateActive($account_id, $q['active_value'], $q['active_value']);
|
||||
} else {
|
||||
$active['active_num'] = $q['active_value'] + $active['active_num'];
|
||||
$active['active_sum'] = $q['active_value'] + $active['active_sum'];
|
||||
$ret = $conn->execScript('UPDATE active SET active_num=:active_num, active_sum=:active_sum, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':active_num' => $active['active_num'],
|
||||
':active_sum' => $active['active_sum'],
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$this->updateActive($account_id, $active['active_num'], $active['active_sum']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
|
@ -434,27 +434,11 @@ class RoleController{
|
||||
$quest->triggerQuest(QUEST_DAY_HARM, 1, $harm, $account_id);
|
||||
$quest->triggerQuest(QUEST_DAY_KILL, 1, $kills, $account_id);
|
||||
$quest->triggerQuest(QUEST_DAY_HELP, 1, $rescue_member, $account_id);
|
||||
$quest->triggerQuest(QUEST_SUM_FIGHT, 2, 1, $account_id);
|
||||
$quest->triggerQuest(QUEST_SUM_ALIVE, 2, (int)($alive_time / 1000 / 60), $account_id);
|
||||
$quest->triggerQuest(QUEST_SUM_HARM, 2, $harm, $account_id);
|
||||
$quest->triggerQuest(QUEST_SUM_KILL, 2, $kills, $account_id);
|
||||
$quest->triggerQuest(QUEST_SUM_HELP, 2, $rescue_member, $account_id);
|
||||
$quest->triggerQuest(QUEST_SUM_SNIPEKILL, 2, $snipe_kill, $account_id);
|
||||
$quest->triggerQuest(QUEST_SUM_RIFLEKILL, 2, $rifle_kill, $account_id);
|
||||
$quest->triggerQuest(QUEST_SUM_PISTOLKILL, 2, $pistol_kill, $account_id);
|
||||
$quest->triggerQuest(QUEST_SUM_SUBMACKILL, 2, $submachine_kill, $account_id);
|
||||
if ($team_status == 1 && $rank <= 5) {
|
||||
$quest->triggerQuest(QUEST_DAY_RANK, 1, 1, $account_id);
|
||||
}
|
||||
if ($team_status == 0 && $rank == 1) {
|
||||
$quest->triggerQuest(QUEST_SUM_WIM, 2, 1, $account_id);
|
||||
}
|
||||
if ($team_status == 1) {
|
||||
$quest->triggerQuest(QUEST_DAY_TEAM, 1, 1, $account_id);
|
||||
$quest->triggerQuest(QUEST_SUM_TEAM, 2, 1, $account_id);
|
||||
if ($rank == 1) {
|
||||
$quest->triggerQuest(QUEST_SUM_TEAMWIN, 2, 1, $account_id);
|
||||
}
|
||||
}
|
||||
//额外奖励
|
||||
$p = $this->getParameter(REWARD_TIMES);
|
||||
@ -563,7 +547,6 @@ class RoleController{
|
||||
}
|
||||
$quest = new classes\Quest();
|
||||
$quest->triggerQuest(QUEST_DAY_SHARE, 1, 1, $account_id);
|
||||
$quest->triggerQuest(QUEST_SUM_SHARE, 2, 1, $account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
|
@ -44,6 +44,21 @@ class ShareController{
|
||||
return $d;
|
||||
}
|
||||
|
||||
protected function getBox($box_id)
|
||||
{
|
||||
$box_meta_table = require('../res/box@box.php');
|
||||
$box_meta = getBoxConfig($box_meta_table, $box_id);
|
||||
$b = array(
|
||||
'box_id' => $box_meta['box_type'],
|
||||
'item_id' => $box_meta['item_id'],
|
||||
'num' => $box_meta['num'],
|
||||
'weight' => $box_meta['weight'],
|
||||
'type' => $box_meta['type'],
|
||||
'time' => $box_meta['time'],
|
||||
);
|
||||
return $b;
|
||||
}
|
||||
|
||||
protected function getShare($share_id)
|
||||
{
|
||||
$share_meta_table = require('../res/share@share.php');
|
||||
@ -109,17 +124,24 @@ class ShareController{
|
||||
{
|
||||
//随机奖励
|
||||
$item_list = array();
|
||||
if ($times == 0) {
|
||||
$b = $this->getbox($drop_id);
|
||||
$item_id_array = $this->getExplode($b['item_id']);
|
||||
$times = count($item_id_array);
|
||||
error_log($times);
|
||||
}
|
||||
for ($j = 0; $j < $times; $j++) {
|
||||
$d = $this->getDrop($drop_id);
|
||||
if (!$d) {
|
||||
$b = $this->getbox($drop_id);
|
||||
if (!$b) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励');
|
||||
die();
|
||||
}
|
||||
$item_id_array = $this->getExplode($d['item_id']);
|
||||
$item_id_array = $this->getExplode($b['item_id']);
|
||||
$weight_sum = 0;
|
||||
$keys = 0;
|
||||
$item_num_array = $this->getExplode($d['num']);
|
||||
$weight_array = $this->getExplode($d['weight']);
|
||||
$item_num_array = $this->getExplode($b['num']);
|
||||
$weight_array = $this->getExplode($b['weight']);
|
||||
$time_array = $this->getExplode($b['time']);
|
||||
for ($i = 0; $i < count($weight_array); $i++) {
|
||||
$weight_sum += $weight_array[$i][0];
|
||||
}
|
||||
@ -134,9 +156,11 @@ class ShareController{
|
||||
}
|
||||
$item_id = $item_id_array[$keys][0];
|
||||
$item_num = $item_num_array[$keys][0];
|
||||
$time = $time_array[$keys][0];
|
||||
array_push($item_list, array(
|
||||
'item_id' => $item_id,
|
||||
'item_num' => $item_num,
|
||||
'time' => $time
|
||||
));
|
||||
}
|
||||
return $item_list;
|
||||
@ -163,10 +187,10 @@ class ShareController{
|
||||
if ($free != 0) {
|
||||
$p = $this->getParameter(DIAMONDBOX10);
|
||||
$diamond_num = $p['param_value'];
|
||||
$item_list = $this->randBoxReward(24001, 10);
|
||||
$item_list = $this->randBoxReward(2, 0);
|
||||
} else {
|
||||
$diamond_num = 0;
|
||||
$item_list = $this->randBoxReward(24001, 1);
|
||||
$item_list = $this->randBoxReward(1, 1);
|
||||
$row = $conn->execQueryOne('SELECT free_box FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
@ -222,10 +246,9 @@ class ShareController{
|
||||
}
|
||||
$quest = new classes\Quest();
|
||||
$quest->triggerQuest(71004, 1, 1, $account_id);
|
||||
$quest->triggerQuest(72004, 2, 1, $account_id);
|
||||
foreach ($item_list as $item) {
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($item['item_id'], $item['item_num'], $account_id);
|
||||
$addreward->addReward($item['item_id'], $item['item_num'], $account_id, $item['time']);
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
|
@ -53,7 +53,9 @@ class ShopController{
|
||||
'discount' => $shop_conf['discount'],
|
||||
'discount_weight' => $shop_conf['discount_weight'],
|
||||
'tip' => $shop_conf['tip'],
|
||||
'type' => $shop_conf['shop_type']
|
||||
//'type' => $shop_conf['shop_type'],
|
||||
'time' => $shop_conf['time'],
|
||||
'price' => $shop_conf['price'],
|
||||
);
|
||||
return $s;
|
||||
}
|
||||
@ -83,7 +85,7 @@ class ShopController{
|
||||
return $arr;
|
||||
}
|
||||
|
||||
protected function getShopInfo($shop_uuid, $type)
|
||||
protected function getShopInfo($shop_uuid)
|
||||
{
|
||||
$r = $this->getRedis($shop_uuid);
|
||||
if (!$r) {
|
||||
@ -93,7 +95,7 @@ class ShopController{
|
||||
$shop_list = array();
|
||||
$user_db_str = $r->get($shop_uuid);
|
||||
if (empty($user_db_str)) {
|
||||
$shop_list = $this->randomShop($type);
|
||||
$shop_list = $this->randomShop(1);
|
||||
$shop_db = array(
|
||||
'shop_uuid' => $shop_uuid,
|
||||
'shop_list' => $shop_list,
|
||||
@ -115,6 +117,7 @@ class ShopController{
|
||||
'price' => $shop['price'],
|
||||
'tip' => $shop['tip'],
|
||||
'status' => $shop['status'],
|
||||
'time' => $shop['time']
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -132,15 +135,15 @@ class ShopController{
|
||||
$shop_uuid = 'game2004api_shop_uuid: ' . md5($_REQUEST['account_id']);
|
||||
$diamond_shop_uuid = 'game2004api_diamond_shop_uuid:' . md5($_REQUEST['account_id']);
|
||||
//钻石商店信息
|
||||
$diamond_shop_list = $this->getShopInfo($diamond_shop_uuid, 2);
|
||||
//$diamond_shop_list = $this->getShopInfo($diamond_shop_uuid, 2);
|
||||
//商店信息
|
||||
$shop_list = $this->getShopInfo($shop_uuid, 1);
|
||||
$shop_list = $this->getShopInfo($shop_uuid);
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT shop_flush_times, diamond_shop_flush_times FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT shop_flush_times FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
@ -154,9 +157,9 @@ class ShopController{
|
||||
'shop_uuid' => $shop_uuid,
|
||||
'shop_list' => $shop_list,
|
||||
'shop_flush_times' => $row['shop_flush_times'],
|
||||
'diamond_shop_uuid' => $diamond_shop_uuid,
|
||||
/*'diamond_shop_uuid' => $diamond_shop_uuid,
|
||||
'diamond_shop_list' => $diamond_shop_list,
|
||||
'diamond_shop_flush_times' => $row['diamond_shop_flush_times'],
|
||||
'diamond_shop_flush_times' => $row['diamond_shop_flush_times'],*/
|
||||
));
|
||||
}
|
||||
|
||||
@ -413,13 +416,8 @@ class ShopController{
|
||||
for ($i = 1; $i <= count($g_conf_shop_cluster); $i++)
|
||||
{
|
||||
$s = $this->getShop($i);
|
||||
if ($s['type'] == 1) {
|
||||
$coin_len++;
|
||||
}
|
||||
if ($s['type'] == 2) {
|
||||
$diamond_len++;
|
||||
}
|
||||
}
|
||||
if ($type == 1) {
|
||||
$id = 1;
|
||||
$len = $coin_len;
|
||||
@ -456,8 +454,9 @@ class ShopController{
|
||||
$item_id = $item_id_array[$key][0];
|
||||
$item_num = $num_array[$key][0];
|
||||
//确定折扣和价格
|
||||
$it = $this->getItem($item_id);
|
||||
if ($s['tip'] == 1) {
|
||||
//$it = $this->getItem($item_id);
|
||||
$keys = 0;
|
||||
if ($s['tip'] == 1 || $s['tip'] == 2) {
|
||||
$discount = 0;
|
||||
$price = 0;
|
||||
} else {
|
||||
@ -478,11 +477,15 @@ class ShopController{
|
||||
}
|
||||
$discount_array = $this->getExplode($s['discount']);
|
||||
$discount = $discount_array[$keys][0];
|
||||
$price = round($it['price'] * $item_num * ($discount * 1.0 / 10));
|
||||
if ($s['tip'] == 4) {
|
||||
|
||||
$price_array = $this->getExplode($s['price']);
|
||||
$price = round($price_array[$key][0] * $item_num * ($discount * 1.0 / 10));
|
||||
/*if ($s['tip'] == 4) {
|
||||
$price = round($it['dprice'] * $item_num * ($discount * 1.0 / 10));
|
||||
}*/
|
||||
}
|
||||
}
|
||||
$time_array = $this->getExplode($s['time']);
|
||||
$time = $time_array[$key][0];
|
||||
array_push($shop_list, array(
|
||||
'shop_id' => $s['shop_id'],
|
||||
'item_id' => $item_id,
|
||||
@ -491,6 +494,7 @@ class ShopController{
|
||||
'price' => $price,
|
||||
'tip' => $s['tip'],
|
||||
'status' => 0,
|
||||
'time' => $time
|
||||
));
|
||||
}
|
||||
return $shop_list;
|
||||
|
@ -27,6 +27,7 @@ class SignController{
|
||||
'condition' => $sign_conf['condition'],
|
||||
'item_id' => $sign_conf['item_id'],
|
||||
'num' => $sign_conf['num'],
|
||||
'time' => $sign_conf['time'],
|
||||
);
|
||||
return $s;
|
||||
}
|
||||
@ -120,7 +121,6 @@ class SignController{
|
||||
//完成签到任务
|
||||
$quest = new classes\Quest();
|
||||
$quest->triggerQuest(QUEST_DAY_LOGIN, 1, 1, $account_id);
|
||||
$quest->triggerQuest(QUEST_SUM_LOGIN, 2, 1, $account_id);
|
||||
} else {
|
||||
$last_sign_time = 0;
|
||||
foreach ($rows as $row) {
|
||||
@ -133,12 +133,15 @@ class SignController{
|
||||
//每日刷新
|
||||
$this->updateDaily($account_id);
|
||||
$this->updateSeasonStatus($account_id);
|
||||
if (phpcommon\getMondayseconds(time()) - phpcommon\getMondayseconds($last_sign_time) > 0) {
|
||||
$this->updateWeekReward($account_id);
|
||||
}
|
||||
$passed_days = floor(($nowTime - phpcommon\getdayseconds($last_sign_time)) / (3600 * 24));
|
||||
if ($passed_days > 7 - $last_sign_id) {
|
||||
//跨周时删除老数据
|
||||
$num = 0;
|
||||
$sum = 0;
|
||||
$ret = $conn->execScript('DELETE from sign WHERE accountid=:accountid;',
|
||||
/*$ret = $conn->execScript('DELETE from sign WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
));
|
||||
@ -155,8 +158,8 @@ class SignController{
|
||||
$sum = 7;
|
||||
} else {
|
||||
$sum = $num;
|
||||
}
|
||||
for ($i = 1; $i < $sum + 1; $i++) {
|
||||
}*/
|
||||
for ($i = $last_sign_id + 1; $i < 7; $i++) {
|
||||
//插入补签列表
|
||||
$this->insertSign($account_id, $i);
|
||||
}
|
||||
@ -171,7 +174,7 @@ class SignController{
|
||||
//完成签到任务
|
||||
$quest = new classes\Quest();
|
||||
$quest->triggerQuest(QUEST_DAY_LOGIN, 1, 1, $account_id);
|
||||
$quest->triggerQuest(QUEST_SUM_LOGIN, 2, 1, $account_id);
|
||||
//$quest->triggerQuest(QUEST_SUM_LOGIN, 2, 1, $account_id);
|
||||
}
|
||||
}
|
||||
$sign_list = array();
|
||||
@ -191,19 +194,20 @@ class SignController{
|
||||
));
|
||||
//判断当前第几周
|
||||
$item_list = array();
|
||||
$week = ceil($rowUser['sign_sum'] / 7);
|
||||
/*$week = ceil($rowUser['sign_sum'] / 7);
|
||||
$dayid = ($week - 1) * 7;
|
||||
//如果大于配置表最后一周,按最后一周奖励
|
||||
$g_conf_sign_cluster = require('../res/signDaily@signDaily.php');
|
||||
if ($dayid > count($g_conf_sign_cluster)) {
|
||||
$dayid = count($g_conf_sign_cluster) - 7;
|
||||
}
|
||||
for ($day = $dayid + 1; $day <= $dayid + 7; $day++)
|
||||
}*/
|
||||
for ($day = 1; $day <= 7; $day++)
|
||||
{
|
||||
$s = $this->getSign($day + 90000);
|
||||
array_push($item_list, array(
|
||||
'item_id' => $s['item_id'],
|
||||
'item_num' => $s['num'],
|
||||
'time' => $s['time'],
|
||||
));
|
||||
}
|
||||
echo json_encode(array(
|
||||
@ -257,22 +261,34 @@ class SignController{
|
||||
//获得奖励
|
||||
//判断当前第几周
|
||||
$item_list = array();
|
||||
$week = ceil($rowUser['sign_sum'] / 7);
|
||||
/*$week = ceil($rowUser['sign_sum'] / 7);
|
||||
$dayid = ($week - 1) * 7 + $_REQUEST['sign_id'];
|
||||
//如果大于配置表最后一周,按最后一周奖励
|
||||
$g_conf_sign_cluster = require('../res/signDaily@signDaily.php');
|
||||
if ($dayid > count($g_conf_sign_cluster)) {
|
||||
$dayid = count($g_conf_sign_cluster) - 7;
|
||||
}
|
||||
}*/
|
||||
$dayid = $_REQUEST['sign_id'];
|
||||
$s = $this->getSign($dayid + 90000);
|
||||
$item_id = $s['item_id'];
|
||||
$num = $s['num'];
|
||||
array_push($item_list, array(
|
||||
'item_id' => $s['item_id'],
|
||||
'item_num' => $s['num'],
|
||||
));
|
||||
$item_id_array = $this->getExplode($s['item_id']);
|
||||
$num_array = $this->getExplode($s['num']);
|
||||
$time_array = $this->getExplode($s['time']);
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($item_id, $num, $account_id);
|
||||
for ($i = 0; $i < count($item_id_array); $i++) {
|
||||
$item_id = $item_id_array[$i][0];
|
||||
error_log(json_encode($item_id_array));
|
||||
error_log($item_id);
|
||||
$num = $num_array[$i][0];
|
||||
$time = $time_array[$i][0];
|
||||
array_push($item_list, array(
|
||||
'item_id' => $item_id,
|
||||
'item_num' => $num,
|
||||
'time' => $time,
|
||||
));
|
||||
$addreward->addReward($item_id, $num, $account_id, $time);
|
||||
}
|
||||
//$addreward = new classes\AddReward();
|
||||
//$addreward->addReward($item_id, $num, $account_id);
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
echo json_encode(array(
|
||||
@ -306,24 +322,25 @@ class SignController{
|
||||
//获得奖励
|
||||
//判断当前第几周
|
||||
$item_list = array();
|
||||
$week = ceil($rowUser['sign_sum'] / 7);
|
||||
$dayid = ($week - 1) * 7 + $_REQUEST['sign_id'];
|
||||
//如果大于配置表最后一周,按最后一周奖励
|
||||
$g_conf_sign_cluster = require('../res/signDaily@signDaily.php');
|
||||
if ($dayid > count($g_conf_sign_cluster)) {
|
||||
$dayid = count($g_conf_sign_cluster) - 7;
|
||||
}
|
||||
$dayid = $_REQUEST['sign_id'];
|
||||
$s = $this->getSign($dayid + 90000);
|
||||
$item_id = $s['item_id'];
|
||||
$num = $s['num'];
|
||||
$p = $this->getParameter(REWARD_TIMES);
|
||||
$times = $p['param_value'] - 1;
|
||||
$num = $num * $times;
|
||||
$item_id_array = $this->getExplode($s['item_id']);
|
||||
$num_array = $this->getExplode($s['num']);
|
||||
$time_array = $this->getExplode($s['time']);
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($item_id, $num, $account_id);
|
||||
for ($i = 0; i < count($item_id_array); $i++) {
|
||||
$item_id = $item_id_array[$i][0];
|
||||
$num = $num_array[$i][0];
|
||||
$time = $time_array[$i][0];
|
||||
$addreward->addReward($item_id, $num, $account_id, $time);
|
||||
}
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'coin_nums' => $coin_num,
|
||||
'diamond_nums' => $diamond_num
|
||||
));
|
||||
}
|
||||
|
||||
@ -409,16 +426,6 @@ class SignController{
|
||||
if (!$share_ret) {
|
||||
die();
|
||||
}
|
||||
//刷新vip每日奖励
|
||||
$share_ret = $conn->execScript('UPDATE vipinfo SET today_reward_status=0, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$share_ret) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
protected function updateSeasonStatus($account_id)
|
||||
{
|
||||
@ -455,5 +462,23 @@ class SignController{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function updateWeekReward($account_id)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$user_ret = $conn->execScript('UPDATE user SET pass_status=0, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$user_ret) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user