chatGPT答: |
8v6.cn |
new StartTimeThread(true).start();
}
// 解锁英雄可以使用令牌解锁
if (payType == BattlePay.PAY_TYPE_UNLOCK_HERO && channel == BattlePay.PAY_CHANNEL_TOKEN) {
int unlockHeroId = unlockHeroVO.getHeroId();
buildHero = heroAO.queryHero(userId, unlockHeroId);
if (buildHero == null) {
UserHeroBO userHero = new UserHeroBO();
userHero.setUserId(userId);
userHero.setHeroId(unlockHeroId);
userHero.setLevel(1);
String userHeroId = BaseDrawAction.createUserHeroId(SystemConfig.gameFlag);
userHero.setUserHeroId(userHeroId);
buildHero = heroInfoAO.buildHero(userHero, SystemConfig.getServerId(), user.getVipLevel());
userHeroAO.addUserHero(userHero);
}
}
// 把物品添加到用户背包
if (inBattlePay != null) {
// private String payGoodsName; // 产品名
// private String payGoodsDesc; // 产品描述
int exp = 0;
int goldNum = 0;
int money = 0;
int fist = 0;
int dayActive = 0;
String drawType = null;
for (String goodsNo : inBattlePay.getGoodsNoList()) {
if (goodsNo.equals("EXP")) {
// exp
exp = Integer.valueOf(inBattlePay.getGoodsNumList().get(goodsNo));
buildExp += exp;
} else if (goodsNo.equals("GOLD")) {
goldNum = Integer.valueOf(inBattlePay.getGoodsNumList().get(goodsNo));
buildGold += goldNum;
} else if (goodsNo.equals("MONEY")) {
money = Integer.valueOf(inBattlePay.getGoodsNumList().get(goodsNo));
buildMoney += money;
} else if (goodsNo.equals("FIST")) {
fist = Integer.valueOf(inBattlePay.getGoodsNumList().get(goodsNo));
buildFist += fist;
} else if (goodsNo.equals("DAYACTIVE")) {
dayActive = Integer.valueOf(inBattlePay.getGoodsNumList().get(goodsNo));
buildDayActive += dayActive;
}
drawType = inBattlePay.getGoodsTypeList().get(goodsNo);
if(drawType != null) {
break;
}
}
if (exp > 0 || goldNum > 0 || money > 0) {
User user = this.userService.getByUserId(userId);
int userLv = user.getLv();
if (exp > 0) {
int canGetExp = userService.getCanGetExp(userLv, exp);
userService.updateUserExp(userId, canGetExp, UserService.EXP_TYPE_BUY, userLv, 0);
}
if (goldNum > 0) {
userService.addGold(userId, goldNum, 0);
}
if (money > 0) {
userService.addMoney(userId, money, 0);
}
if (fist > 0) {
userService.addFist(userId, fist, 0);
//TODO 活动打怪统计
// boolean isFirstWork = false;
// DailyMission dailyMission = dailyMissionAO.queryUserDailyMission(userId);
// if(dailyMission == null) {
// dailyMission = new DailyMission();
// dailyMission.setFist (0);
// isFirstWork = true;
// }
// int totoalFist = fist + dailyMission.getFist();
// dailyMission.setFist(totoalFist);
// dailyMissionAO.saveOrUpdate(userId, dailyMission, isFirstWork);
}
if (dayActive > 0) {
dailyTaskAO.setTotalActive(userId, dayActive);
}
heroService.computeUserHeroAttributes(userId);
}
if (drawType != null) {
// 添加物品
this.heroService.draw(userId, drawType, inBattlePay.getGoodsIdList(), false);
}
}
int userLv = 0;
if (buildExp > 0 || buildHero != null) {
User user = this.userService.getByUserId(userId);
userLv = user.getLv();
// 奖励金币
int gold = UserXMLInfoMap.getUserXMLInfo(userLv).getPayReward();
// 处理同步服务器数据
// userService.addGold(userId, gold, 0);
userService.addGold(userId, gold, UserService.CHANNEL_PAY, 0);
// 更新用户等级战力等属性
heroService.computeUserHeroAttributes(userId);
// 判断用户当前等级是否是VIP可享受等级,如果是,增加大礼包入口
vipAO.checkUserVipGift(userId);
// 更新登录天数
userService.reLogin(userId);
// 累工资
arenaService.accumulateSalary(userId);
// 奖励活跃度
dailyTaskAO.addTotalActive(userId, DayActiveXMLInfoMap.getDayActiveXMLInfo(DayActiveXMLInfo.PAY_CODE).getActiveValue());
// 完成充值300任务
dailyTaskAO.finishDailyTask(userId, TaskConditionType.CHARGE_300, 1);
}
StringBuffer payGoods = new StringBuffer();
int goodsValue = 0;
if (buildExp > 0) {
int canGetExp = userService.getCanGetExp(userLv, buildExp);
payGoods.append("EXP=");
payGoods.append(canGetExp);
payGoods.append("|");
goodsValue += canGetExp;
}
if (buildGold > 0) {
payGoods.append("GOLD
|