master
parent
f5c0a76f4a
commit
e1b9392271
|
|
@ -72,7 +72,7 @@ public class HandlerGroupMemberRound implements IHandler {
|
|||
// DataBase.use().prepareCallNonResult("sp_add_member_log", param1);
|
||||
addMemberLog(groupId, pid, uid, score > 0 ? score - pumpReal - xipai_total : score - xipai_total, win, time,
|
||||
perfectRound, valid_count);
|
||||
EventServer.log.info("pumpReal end:" + pumpReal);
|
||||
// EventServer.log.info("pumpReal end:" + pumpReal);
|
||||
|
||||
String sql = String.format(
|
||||
"INSERT INTO group_hp_log(gid,uid,reason,hp,cur_hp,pid,roomid,time) "
|
||||
|
|
@ -82,7 +82,7 @@ public class HandlerGroupMemberRound implements IHandler {
|
|||
(int) (cur_time));
|
||||
|
||||
if (score == 0) {
|
||||
EventServer.log.info("洗牌保底:" +( score - xipai_total - param.getInt("pumpBase")));
|
||||
// EventServer.log.info("洗牌保底:" +( score - xipai_total - param.getInt("pumpBase")));
|
||||
|
||||
sql = String.format(
|
||||
"INSERT INTO group_hp_log(gid,uid,reason,hp,cur_hp,pid,roomid,time) "
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ public class HandlerGroupRound implements IHandler {
|
|||
|
||||
@Override
|
||||
public int processGroup(int groupId, ITObject param) throws Exception {
|
||||
log.info("统计场次:");
|
||||
|
||||
int pid = param.getInt("pid");
|
||||
int valid = param.getInt("valid");
|
||||
|
|
@ -44,10 +43,8 @@ public class HandlerGroupRound implements IHandler {
|
|||
String round_key = String.format("g%s:round", groupId);
|
||||
|
||||
Jedis jedis13 = Redis.use("group1_db13").getJedis();
|
||||
log.info("统计场次1:");
|
||||
|
||||
try {
|
||||
log.info("统计场次3:");
|
||||
|
||||
Pipeline pipeline13 = jedis13.pipelined();
|
||||
|
||||
|
|
@ -60,12 +57,11 @@ public class HandlerGroupRound implements IHandler {
|
|||
CountUtil.countLog(valid_key, valid_count==0?2:1, pipeline13);
|
||||
Utils.countValidAndTotal(pipeline13, playerList, groupId, pid, valid_count, valid_diamo, all_count,
|
||||
win_player);
|
||||
log.info("统计场次4:");
|
||||
|
||||
pipeline13.sync();
|
||||
|
||||
}catch (Exception e) {
|
||||
log.error("统计场次5异常",e);
|
||||
log.error("统计场次异常",e);
|
||||
|
||||
} finally {
|
||||
jedis13.close();
|
||||
|
|
|
|||
|
|
@ -1,20 +1,27 @@
|
|||
package com.evt.mgr.handler;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElementDecl.GLOBAL;
|
||||
|
||||
import com.data.bean.GameBean;
|
||||
import com.data.bean.GroupBean;
|
||||
import com.data.bean.GroupPlayBean;
|
||||
import com.data.cache.AccountCache;
|
||||
import com.data.cache.GameCache;
|
||||
import com.data.cache.GroupCache;
|
||||
import com.data.cache.GroupMemberCache;
|
||||
import com.data.util.ConsumeCode;
|
||||
import com.data.util.CountUtil;
|
||||
import com.data.util.EventType;
|
||||
import com.data.util.Utility;
|
||||
import com.evt.mgr.EventServer;
|
||||
import com.evt.mgr.IHandler;
|
||||
import com.taurus.core.entity.ITArray;
|
||||
import com.taurus.core.entity.ITObject;
|
||||
import com.taurus.core.entity.TArray;
|
||||
import com.taurus.core.entity.TObject;
|
||||
import com.taurus.core.plugin.database.DataBase;
|
||||
import com.taurus.core.plugin.redis.Redis;
|
||||
import com.taurus.core.util.DateUtils;
|
||||
|
|
@ -28,12 +35,11 @@ public class HandlerHpConsume implements IHandler {
|
|||
static Logger log = Logger.getLogger(HandlerHpConsume.class);
|
||||
final static String DB = "group1_db10";
|
||||
|
||||
|
||||
private static boolean hpConsume(int gid, int uid, int pid, int hp, int cur_hp, int reason, String roomid, int time,
|
||||
private static boolean hpConsume(int gid, int uid, int pid, int hp, int cur_hp, int reason, String roomid, int time,
|
||||
String desc) throws SQLException {
|
||||
log.info("uid:" + uid);
|
||||
log.info("当前HP:" + hp);
|
||||
log.info("当前cur_hp:" + cur_hp);
|
||||
// log.info("uid:" + uid);
|
||||
// log.info("当前HP:" + hp);
|
||||
// log.info("当前cur_hp:" + cur_hp);
|
||||
|
||||
String sql = String.format("{call sp_update_hp(%s,%s,%s,%s,%s,%s,'%s',%s,'%s')}", gid, uid, hp, cur_hp, reason,
|
||||
pid, roomid, time, desc);
|
||||
|
|
@ -48,8 +54,8 @@ public class HandlerHpConsume implements IHandler {
|
|||
|
||||
private void to_reward(Pipeline pipeline, int uid, String prs, int rewardType, int valueType, int real_pump,
|
||||
int pump, int groupId, int pid, String roomid, int time, int max_player) throws Exception {
|
||||
EventServer.log.info("to_reward begin:" + uid);
|
||||
EventServer.log.info("prs:" + prs);
|
||||
// EventServer.log.info("to_reward begin:" + uid);
|
||||
// EventServer.log.info("prs:" + prs);
|
||||
|
||||
int useValue = 0;
|
||||
if (StringUtil.isNotEmpty(prs)) {
|
||||
|
|
@ -78,9 +84,9 @@ public class HandlerHpConsume implements IHandler {
|
|||
rv = rewardPercent;
|
||||
}
|
||||
int reward_value = rv;
|
||||
EventServer.log.info("rewardType:" + rewardType);
|
||||
EventServer.log.info("valueType:" + valueType);
|
||||
EventServer.log.info("reward_value:" + reward_value);
|
||||
// EventServer.log.info("rewardType:" + rewardType);
|
||||
// EventServer.log.info("valueType:" + valueType);
|
||||
// EventServer.log.info("reward_value:" + reward_value);
|
||||
|
||||
if (valueType == 1) {
|
||||
// EventServer.log.info("reward_value:" + reward_value);
|
||||
|
|
@ -90,7 +96,7 @@ public class HandlerHpConsume implements IHandler {
|
|||
reward_value = reward_value / max_player;
|
||||
}
|
||||
}
|
||||
EventServer.log.info("reward_value:" + reward_value);
|
||||
// EventServer.log.info("reward_value:" + reward_value);
|
||||
if (reward_value > 1000) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -113,7 +119,7 @@ public class HandlerHpConsume implements IHandler {
|
|||
String desc = "" + uid;
|
||||
long cur_hp = CountUtil.countLogByDay3(String.format("g%s:hp_reward:m%s", groupId, parentId),
|
||||
reward_value, jedis9);
|
||||
EventServer.log.info("ConsumeCode.HP_PARTNER_REWARD:" + reward_value);
|
||||
// EventServer.log.info("ConsumeCode.HP_PARTNER_REWARD:" + reward_value);
|
||||
|
||||
String sql = String.format(
|
||||
"INSERT INTO group_hp_log(gid,uid,reason,hp,cur_hp,pid,roomid,time,round, info) "
|
||||
|
|
@ -172,8 +178,8 @@ public class HandlerHpConsume implements IHandler {
|
|||
if (leftValue < 0) {
|
||||
return;
|
||||
}
|
||||
EventServer.log.info("群主抽水开始:" + leftValue);
|
||||
EventServer.log.info("群主抽水开始:" + real_pump + "-" + useValue);
|
||||
// EventServer.log.info("群主抽水开始:" + leftValue);
|
||||
// EventServer.log.info("群主抽水开始:" + real_pump + "-" + useValue);
|
||||
|
||||
String key = String.format("g{%s}:m%s:reward_hp", groupId, gb.owner);
|
||||
Redis.use(DB).incrBy(key, leftValue);
|
||||
|
|
@ -201,7 +207,7 @@ public class HandlerHpConsume implements IHandler {
|
|||
CountUtil.countLogByDay30(key, leftValue, pipeline);
|
||||
}
|
||||
Jedis jedis9 = Redis.use("group1_db13").getJedis();
|
||||
EventServer.log.info("leftValue:" + leftValue);
|
||||
// EventServer.log.info("leftValue:" + leftValue);
|
||||
|
||||
try {
|
||||
String desc = "" + uid;
|
||||
|
|
@ -216,21 +222,21 @@ public class HandlerHpConsume implements IHandler {
|
|||
DataBase.use().executeUpdate(sql);
|
||||
EventServer.log.info("群主抽水结束:" + leftValue);
|
||||
EventServer.log.info("群主抽水结束:" + real_pump + "-" + useValue);
|
||||
log.info("盟主分层后积分:" + Redis.use(DB).get(key));
|
||||
// log.info("盟主分层后积分:" + Redis.use(DB).get(key));
|
||||
|
||||
} finally {
|
||||
jedis9.close();
|
||||
}
|
||||
}
|
||||
EventServer.log.info("to_reward end:" + uid);
|
||||
// EventServer.log.info("to_reward end:" + uid);
|
||||
|
||||
}
|
||||
|
||||
private void to_reward_base(Pipeline pipeline, int uid, String prs, int pump, int groupId, boolean isPumpBaseWin)
|
||||
throws Exception {
|
||||
EventServer.log.info("to_reward_base begin:" + uid);
|
||||
EventServer.log.info("prs:" + prs);
|
||||
EventServer.log.info("pump:" + pump);
|
||||
// EventServer.log.info("to_reward_base begin:" + uid);
|
||||
// EventServer.log.info("prs:" + prs);
|
||||
// EventServer.log.info("pump:" + pump);
|
||||
|
||||
if (StringUtil.isNotEmpty(prs)) {
|
||||
|
||||
|
|
@ -304,7 +310,7 @@ public class HandlerHpConsume implements IHandler {
|
|||
CountUtil.countLogByDay30(key, -real_pump, pipeline);
|
||||
}
|
||||
}
|
||||
log.info("洗牌分给到盟主");
|
||||
// log.info("洗牌分给到盟主");
|
||||
GroupBean gb = GroupCache.getGroup(groupId);
|
||||
if (gb != null) {
|
||||
int round = 100 / 2;
|
||||
|
|
@ -320,7 +326,7 @@ public class HandlerHpConsume implements IHandler {
|
|||
// String rewardsql = String.format("update group_member set reward_hp = %s where uid = %s AND groupId = %s",
|
||||
// Redis.use(DB).get(key), gb.owner, groupId);
|
||||
// Utility.evtdb(groupId, 1, rewardsql);
|
||||
log.info("盟主洗牌后积分:" + Redis.use(DB).get(key));
|
||||
// log.info("盟主洗牌后积分:" + Redis.use(DB).get(key));
|
||||
|
||||
// String all_key = String.format("g{%s}:m%s:all_reward_hp", groupId,gb.owner);
|
||||
// Redis.use(DB).incrBy(all_key, leftValue);
|
||||
|
|
@ -414,7 +420,8 @@ public class HandlerHpConsume implements IHandler {
|
|||
String hpSql = String.format("SELECT hp FROM `group_member` WHERE uid=%s and groupId=%s", uid, groupId);
|
||||
|
||||
ITArray arr = DataBase.use().executeQueryByTArray(hpSql);
|
||||
int cur_hp = arr.getTObject(0).getInt("hp").intValue();
|
||||
Long mengzhu_hp = arr.getTObject(0).getLong("hp");
|
||||
int cur_hp = mengzhu_hp.intValue();
|
||||
boolean is_pump = param.containsKey("pump");
|
||||
int pump = 0;// 分成抽水
|
||||
int pumpReal = 0;// 真实抽水
|
||||
|
|
@ -495,44 +502,45 @@ public class HandlerHpConsume implements IHandler {
|
|||
// 保底抽水
|
||||
if (pumpBaseWin > 0) {
|
||||
if (hp > 0 && !is_xipai && pumpReal > 0) {
|
||||
log.info("保底赢家抽水到这里cur_hp:" + cur_hp);
|
||||
log.info("保底抽水到这里pumpReal:" + pumpReal);
|
||||
log.info("保底只抽大赢家pumpBaseWin:" + pumpBaseWin);
|
||||
log.info("保底只抽大赢家hp:" + hp);
|
||||
// log.info("保底赢家抽水到这里cur_hp:" + cur_hp);
|
||||
// log.info("保底抽水到这里pumpReal:" + pumpReal);
|
||||
// log.info("保底只抽大赢家pumpBaseWin:" + pumpBaseWin);
|
||||
// log.info("保底只抽大赢家hp:" + hp);
|
||||
|
||||
if (pumpBaseWin == 0) {
|
||||
hpConsume(groupId, uid, pid, hp, cur_hp+hp, ConsumeCode.HP_CLEARING, roomid, time, desc);
|
||||
hpConsume(groupId, uid, pid, -pumpReal, cur_hp+hp-pumpReal, ConsumeCode.HP_PUMP, roomid, time, desc);
|
||||
hpConsume(groupId, uid, pid, hp, cur_hp + hp, ConsumeCode.HP_CLEARING, roomid, time, desc);
|
||||
hpConsume(groupId, uid, pid, -pumpReal, cur_hp + hp - pumpReal, ConsumeCode.HP_PUMP, roomid,
|
||||
time, desc);
|
||||
|
||||
} else {
|
||||
hpConsume(groupId, uid, pid, hp, cur_hp+hp, ConsumeCode.HP_CLEARING, roomid, time, desc);
|
||||
hpConsume(groupId, uid, pid, hp, cur_hp + hp, ConsumeCode.HP_CLEARING, roomid, time, desc);
|
||||
}
|
||||
}
|
||||
else if(hp < 0){
|
||||
log.info("保底输家cur_hp:" + cur_hp);
|
||||
log.info("保底输家:" + hp);
|
||||
} else if (hp < 0) {
|
||||
// log.info("保底输家cur_hp:" + cur_hp);
|
||||
// log.info("保底输家:" + hp);
|
||||
hpConsume(groupId, uid, pid, hp, cur_hp, ConsumeCode.HP_CLEARING, roomid, time, desc);
|
||||
}
|
||||
}
|
||||
// 正常抽水
|
||||
else if (hp != 0 && !is_xipai && pumpReal > 0) {
|
||||
log.info("正常抽水结算到这里:" + cur_hp);
|
||||
// log.info("正常抽水结算到这里:" + cur_hp);
|
||||
cur_hp = cur_hp + hp;
|
||||
if (hp < 0) {
|
||||
hpConsume(groupId, uid, pid, hp, cur_hp+hp, ConsumeCode.HP_CLEARING, roomid, time, desc);
|
||||
hpConsume(groupId, uid, pid, hp, cur_hp + hp, ConsumeCode.HP_CLEARING, roomid, time, desc);
|
||||
} else {
|
||||
cur_hp = cur_hp - pumpReal;
|
||||
hpConsume(groupId, uid, pid, hp, cur_hp - pumpReal, ConsumeCode.HP_CLEARING, roomid, time, desc);
|
||||
hpConsume(groupId, uid, pid, -pumpReal, cur_hp-pumpReal, ConsumeCode.HP_PUMP, roomid, time, desc);
|
||||
hpConsume(groupId, uid, pid, -pumpReal, cur_hp - pumpReal, ConsumeCode.HP_PUMP, roomid, time, desc);
|
||||
|
||||
}
|
||||
//不抽水
|
||||
// 不抽水
|
||||
}
|
||||
// else if(hp != 0 && pumpReal==0){
|
||||
// hpConsume(groupId, uid, pid, hp, cur_hp, ConsumeCode.HP_CLEARING, roomid, time, desc);
|
||||
// }
|
||||
|
||||
Jedis jedis9 = Redis.use("group1_db13").getJedis();
|
||||
Jedis jedis0 = Redis.use("group1_db0").getJedis();
|
||||
try {
|
||||
|
||||
String key = String.format("g%s:m%s:consume_hp", groupId, uid);
|
||||
|
|
@ -568,16 +576,16 @@ public class HandlerHpConsume implements IHandler {
|
|||
// room=328670, prs=[{"p":241662,"r":242},{"p":139302,"r":245}], uid=241662, cur_hp=256892,
|
||||
// xipai_rewardValueType=1, max_player=2, xipai_rewardType=3, time=1762344428, pump=0,
|
||||
// desc=放炮罚 328670, rewardValueType=2, pumpBase=100
|
||||
log.info("reward_value:" + reward_value);
|
||||
log.info("rewardValueType:" + rewardValueType);
|
||||
log.info("is_pump:" + is_pump);
|
||||
log.info("pumpBase:" + pumpBase);
|
||||
log.info("pumpBaseWin:" + pumpBaseWin);
|
||||
log.info("pumpReal:" + pumpReal);
|
||||
// log.info("reward_value:" + reward_value);
|
||||
// log.info("rewardValueType:" + rewardValueType);
|
||||
// log.info("is_pump:" + is_pump);
|
||||
// log.info("pumpBase:" + pumpBase);
|
||||
// log.info("pumpBaseWin:" + pumpBaseWin);
|
||||
// log.info("pumpReal:" + pumpReal);
|
||||
|
||||
if (hp != 0 && (reward_value > 0 || (rewardValueType == 2 && is_pump)) && pumpReal != 0
|
||||
&& pumpBaseWin == 0) {
|
||||
log.info("分层抽水");
|
||||
// log.info("分层抽水");
|
||||
|
||||
time += 1;
|
||||
to_reward(pipeline, uid, prs, rewardType, rewardValueType, pump, reward_value, groupId, pid, roomid,
|
||||
|
|
@ -585,18 +593,25 @@ public class HandlerHpConsume implements IHandler {
|
|||
} else {
|
||||
// 平局则把保底分给到群主
|
||||
if (hp > 0 && pumpBase > 0 && is_pump && pumpBaseWin != 0) {
|
||||
log.info("平局抽赢家保底分");
|
||||
hpConsume(groupId, uid, pid, -pumpBaseWin, cur_hp - -pumpBaseWin, ConsumeCode.HP_PUMP, roomid, time,
|
||||
desc);
|
||||
// log.info("平局抽赢家保底分");
|
||||
hpConsume(groupId, uid, pid, -pumpBaseWin, cur_hp - -pumpBaseWin, ConsumeCode.HP_PUMP, roomid,
|
||||
time, desc);
|
||||
|
||||
GroupBean gb = GroupCache.getGroup(groupId);
|
||||
|
||||
// 给到群主时要刷新mysql的hp值
|
||||
String rewardsql = String.format(
|
||||
"update group_member set bank_hp=bank_hp+ %s where uid = %s AND groupId = %s",
|
||||
"update group_member set reward_hp=reward_hp+ %s where uid = %s AND groupId = %s",
|
||||
pumpBaseWin, gb.owner, groupId);
|
||||
|
||||
// String mng_key = GroupMemberCache.genKey(groupId, gb.owner);
|
||||
// Redis.use("group1_db10").hincrBy(mng_key, "bank_hp", pumpBaseWin);
|
||||
String rhp_key = String.format("g{%s}:m%s:reward_hp", groupId, gb.owner);
|
||||
String r_hp = Redis.use("group1_db10").get(rhp_key);
|
||||
int rewardHp = Integer.parseInt(r_hp) + pumpBaseWin;
|
||||
// log.info("rewardHp:"+rewardHp);
|
||||
Redis.use("group1_db10").set(rhp_key, rewardHp + "");
|
||||
Utility.evtdb(groupId, 1, rewardsql);
|
||||
|
||||
long qunzhu_cur_hp = CountUtil.countLogByDay3(
|
||||
String.format("g%s:hp_reward:m%s", groupId, gb.owner), pumpBaseWin, jedis9);
|
||||
|
||||
|
|
@ -609,7 +624,7 @@ public class HandlerHpConsume implements IHandler {
|
|||
to_reward_base(pipeline, uid, param.getString("prs"), -pumpBaseWin, groupId, true);
|
||||
|
||||
} else if (pumpBase > 0 && !is_xipai && is_pump && pumpBaseWin == 0) {
|
||||
log.info("平局抽双方保底分");
|
||||
// log.info("平局抽双方保底分");
|
||||
hpConsume(groupId, uid, pid, -pumpBase, cur_hp - pumpBase, ConsumeCode.HP_PUMP, roomid, time,
|
||||
desc);
|
||||
|
||||
|
|
@ -617,12 +632,20 @@ public class HandlerHpConsume implements IHandler {
|
|||
long qunzhu_cur_hp = CountUtil.countLogByDay3(
|
||||
String.format("g%s:hp_reward:m%s", groupId, gb.owner), pumpBase, jedis9);
|
||||
|
||||
|
||||
// 给到群主时要刷新mysql的hp值
|
||||
String rewardsql = String.format(
|
||||
"update group_member set bank_hp=bank_hp+ %s where uid = %s AND groupId = %s", pumpBase,
|
||||
gb.owner, groupId);
|
||||
|
||||
"update group_member set reward_hp=reward_hp+ %s where uid = %s AND groupId = %s",
|
||||
pumpBase, gb.owner, groupId);
|
||||
// String mng_key = GroupMemberCache.genKey(groupId, gb.owner);
|
||||
// Redis.use("group1_db10").hincrBy(mng_key, "bank_hp", pumpBaseWin);
|
||||
String rhp_key = String.format("g{%s}:m%s:reward_hp", groupId, gb.owner);
|
||||
String r_hp = Redis.use("group1_db10").get(rhp_key);
|
||||
int rewardHp = Integer.parseInt(r_hp) + pumpBase;
|
||||
// log.info("rewardHp:"+rewardHp);
|
||||
Redis.use("group1_db10").set(rhp_key, rewardHp + "");
|
||||
Utility.evtdb(groupId, 1, rewardsql);
|
||||
|
||||
String sqllog = String.format(
|
||||
"INSERT INTO group_hp_log(gid,uid,reason,hp,cur_hp,pid,roomid,time,round,info) "
|
||||
+ "VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,'" + "保底抽水" + "')",
|
||||
|
|
@ -662,10 +685,26 @@ public class HandlerHpConsume implements IHandler {
|
|||
* to_mengzhu_reward(pipeline,uid,prs,xipai_rewardType,xipai_rewardValueType,
|
||||
* xipai, xipai_reward_value ,groupId,pid,roomid,time,max_player); } }
|
||||
*/
|
||||
// GroupBean gb = GroupCache.getGroup(groupId);
|
||||
|
||||
//这里结算房卡
|
||||
// GroupBean groupb = GroupCache.getGroup(groupId);
|
||||
|
||||
// GameBean gb = GameCache.getGame(pid);
|
||||
// GroupPlayBean gpb = GroupCache.getPlay(groupId, pid);
|
||||
// ITObject configData = TObject.newFromJsonData(gpb.config);
|
||||
// int maxPlayers = gpb.maxPlayers;
|
||||
// int opt = configData.getInt("opt");
|
||||
//
|
||||
// Integer pay = gb.pay.get("pay" + opt + "_" + gpb.maxPlayers);
|
||||
// String owner_session = AccountCache.genKey(groupb.owner);
|
||||
//
|
||||
// Utility.payDiamo(jedis0, owner_session, pay);
|
||||
pipeline.sync();
|
||||
|
||||
} finally {
|
||||
jedis9.close();
|
||||
jedis0.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
EventServer.log.error("群主保底分sql异常:", e);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.data.cache.AccountCache;
|
|||
import com.data.util.ConsumeCode;
|
||||
import com.data.util.Utility;
|
||||
import com.evt.mgr.EventController;
|
||||
import com.evt.mgr.EventServer;
|
||||
import com.evt.mgr.IHandler;
|
||||
import com.taurus.core.entity.ITObject;
|
||||
import com.taurus.core.plugin.redis.Redis;
|
||||
|
|
@ -47,9 +48,10 @@ public class HandlerPay implements IHandler{
|
|||
if(reason == ConsumeCode.DIAMO_ADD) {
|
||||
pay = -pay;
|
||||
}
|
||||
|
||||
|
||||
if(isPay) {
|
||||
int cur_diamo = param.getInt("diamo");
|
||||
|
||||
EventController.payDiamo(uid, pay, cur_diamo, reason, gameId, groupId, pid);
|
||||
result = 0;
|
||||
}else {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@ import java.util.Map;
|
|||
|
||||
import com.data.bean.AccountBean;
|
||||
import com.data.cache.AccountCache;
|
||||
import com.data.cache.BaseCache;
|
||||
import com.data.cache.GroupMemberCache;
|
||||
import com.data.util.ErrorCode;
|
||||
import com.data.util.EventType;
|
||||
import com.data.util.Utility;
|
||||
import com.game.data.JoinRoomData;
|
||||
import com.game.data.Player;
|
||||
import com.game.data.Room;
|
||||
|
|
@ -238,6 +241,8 @@ public class GameController implements IController {
|
|||
int playerid = acc.id;
|
||||
|
||||
boolean full = owner.playerMapBySeat.size() >= owner.maxPlayers;
|
||||
Global.logger.info("owner.status:" + owner.status);
|
||||
|
||||
boolean reload = owner.status == Constant.ROOM_STATUS_PLAYING;
|
||||
|
||||
String ip = acc.ip;
|
||||
|
|
@ -342,12 +347,14 @@ public class GameController implements IController {
|
|||
if (new_player && player.seat != 0) {
|
||||
owner.broadCastToClient(player.playerid, Router.GAME_EVT_PLAYER_JOIN, player.getInfo());
|
||||
}
|
||||
Global.logger.info("reload:" + reload);
|
||||
player.stateMachine.curState.reload(player);
|
||||
|
||||
if (reload) {
|
||||
owner.join_player = player;
|
||||
owner.dismissRunable.reload(player);
|
||||
owner.stateMachine.curState.reload(owner);
|
||||
player.stateMachine.curState.reload(player);
|
||||
|
||||
owner.join_player = null;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -619,12 +626,28 @@ public class GameController implements IController {
|
|||
owner.room.stateMachine.changeState(Global.getState(RoomDestoryGameState.class));
|
||||
} else {
|
||||
// 在座位上
|
||||
if (owner.room.playerMapBySeat.containsKey(owner.seat)) {
|
||||
if (owner.room.playerMapBySeat.containsKey(owner.seat) && owner.room.playerMapBySeat.size() == 1) {
|
||||
ITObject data = new TObject();
|
||||
data.putInt("aid", owner.playerid);
|
||||
owner.room.broadCastToClient(owner.playerid, Router.GAME_EVT_PLAYER_EXIT, data);
|
||||
int groupId = owner.room.groupId;
|
||||
String roomid = owner.room.roomid;
|
||||
try {
|
||||
delRoom(groupId, roomid);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
owner.destroy(true);
|
||||
|
||||
GroupPublisherService.delRoomEvt(groupId, roomid);
|
||||
Redis.use("group1_db0").getJedis().del("room:"+roomid);
|
||||
} else if (owner.room.playerMapBySeat.containsKey(owner.seat)) {
|
||||
ITObject data = new TObject();
|
||||
data.putInt("aid", owner.playerid);
|
||||
owner.room.broadCastToClient(owner.playerid, Router.GAME_EVT_PLAYER_EXIT, data);
|
||||
owner.destroy(true);
|
||||
|
||||
}
|
||||
owner.destroy(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -666,4 +689,83 @@ public class GameController implements IController {
|
|||
param.putBoolean("entrust", owner.entrust);
|
||||
owner.room.broadCastToClient(0, Router.GAME_EVT_UPDATE_PLAYERINFO, param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除房间
|
||||
*
|
||||
* @param groupId
|
||||
* @param roomId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static final ITObject delRoom(int groupId, String roomId) throws Exception {
|
||||
String tag_key = "room:" + roomId;
|
||||
Jedis jedis0 = Redis.use("group1_db0").getJedis();
|
||||
// String svr = StringUtil.Empty;
|
||||
|
||||
RedisLock lock = new RedisLock(tag_key, jedis0);
|
||||
try {
|
||||
lock.lock();
|
||||
List<String> list = jedis0.hmget(tag_key, "AA", "payer", "pay", "group", "game", "status", "gpid", "fake",
|
||||
"players");
|
||||
String status = list.get(5);
|
||||
int _status = Integer.parseInt(status);
|
||||
|
||||
String group = list.get(3);
|
||||
int _gid = 0;
|
||||
if (StringUtil.isNotEmpty(group)) {
|
||||
_gid = Integer.parseInt(group);
|
||||
}
|
||||
|
||||
String strGpid = list.get(6);
|
||||
int _gpid = 0;
|
||||
if (StringUtil.isNotEmpty(strGpid)) {
|
||||
_gpid = Integer.parseInt(strGpid);
|
||||
}
|
||||
|
||||
String strFake = list.get(7);
|
||||
if (_status == 0) {
|
||||
if (strFake == null) {
|
||||
int gameId = Integer.parseInt(list.get(4));
|
||||
boolean pay_AA = Integer.parseInt(list.get(0)) == 1;
|
||||
if (!pay_AA) {
|
||||
int payer = Integer.parseInt(list.get(1));
|
||||
int pay = Integer.parseInt(list.get(2));
|
||||
Utility.payDiamo(EventType.REDIS_EVENT_BACK_PAY, payer, gameId, pay, groupId, _gpid);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strFake != null) {
|
||||
try {
|
||||
ITArray players = TArray.newFromJsonData(list.get(8));
|
||||
for (int i = 0; i < players.size(); i++) {
|
||||
int player_id = players.getInt(i);
|
||||
Redis.use("group1_db1").srem("used_robot", Integer.toString(player_id));
|
||||
// Redis.use("group1_db1").sadd("free_robot", Integer.toString(player_id));
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
jedis0.hset(tag_key, "status", "2");
|
||||
BaseCache.updateCacheVer(jedis0, tag_key);
|
||||
GroupPublisherService.delRoomEvt(groupId, roomId);
|
||||
// svr = jedis0.hget(tag_key, "svr");
|
||||
//
|
||||
// List<String> server_ip = Redis.use("group1_db0").hmget(svr, "ip", "port");
|
||||
// String ip = server_ip.get(0);
|
||||
// if(StringUtil.isEmpty(ip)) {
|
||||
// throw new WebException(ErrorCode.NO_SERVICE);
|
||||
// }
|
||||
// String port =server_ip.get(1);
|
||||
ITObject obj = TObject.newInstance();
|
||||
// obj.putString("ip", ip);
|
||||
// obj.putInt("port", Integer.parseInt(port));
|
||||
return obj;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -554,8 +554,11 @@ public class Room implements Runnable {
|
|||
player.initSeat();
|
||||
this.playerMapByPlaying.put(player.playerid, player);
|
||||
}
|
||||
Global.logger.info("游戏开始:"+this.status);
|
||||
if (this.round == 0 && this.status == Constant.ROOM_STATUS_NOBEGIN) {
|
||||
this.status = Constant.ROOM_STATUS_PLAYING;
|
||||
Global.logger.info("this.status:"+this.status);
|
||||
|
||||
this.redis_room_map.put("status", this.status + "");
|
||||
Redis.use().hset(this.room_key, "status", this.status + "");
|
||||
this.redis_room_map.put("open", "0");
|
||||
|
|
@ -595,12 +598,12 @@ public class Room implements Runnable {
|
|||
boolean total = totalType();
|
||||
// if (!total)
|
||||
// total = entrustTotal();
|
||||
Global.logger.info("total: " + total);
|
||||
// Global.logger.info("total: " + total);
|
||||
CountXiPai();
|
||||
CheckModifyHp();
|
||||
boolean settlement = redisUpdateHp();// 结算分数
|
||||
// total = total || settlement;
|
||||
Global.logger.info("total: " + total);
|
||||
// Global.logger.info("total: " + total);
|
||||
this.saveRecRound();
|
||||
|
||||
if (total) {
|
||||
|
|
@ -608,7 +611,7 @@ public class Room implements Runnable {
|
|||
} else {
|
||||
roomResult();
|
||||
}
|
||||
Global.logger.info("total: " + total);
|
||||
// Global.logger.info("total: " + total);
|
||||
for (Entry<Integer, Player> entry : this.playerMapById.entrySet()) {
|
||||
|
||||
Player player = entry.getValue();
|
||||
|
|
@ -621,10 +624,10 @@ public class Room implements Runnable {
|
|||
Global.gameCtr.updatePlayerEntrust(player);
|
||||
}
|
||||
}
|
||||
Global.logger.info("player.score.total_score: " + player.score.total_score);
|
||||
// Global.logger.info("player.score.total_score: " + player.score.total_score);
|
||||
|
||||
}
|
||||
Global.logger.info("total: " + total);
|
||||
// Global.logger.info("total: " + total);
|
||||
if (total) {
|
||||
this.stateMachine.changeState(Global.getState(RoomDestoryGameState.class));
|
||||
} else {
|
||||
|
|
@ -852,8 +855,8 @@ public class Room implements Runnable {
|
|||
ITArray info_list = TArray.newInstance();
|
||||
for (Entry<Integer, Player> entry : this.playerMapBySeat.entrySet()) {
|
||||
Player self = (Player) entry.getValue();
|
||||
Global.logger.info("self.playerid:" + self.playerid);
|
||||
Global.logger.info("player.playerid:" + player.playerid);
|
||||
// Global.logger.info("self.playerid:" + self.playerid);
|
||||
// Global.logger.info("player.playerid:" + player.playerid);
|
||||
if (self.playerid == player.playerid) {
|
||||
info_list.addTObject(entry.getValue().getReloadInfo(true));
|
||||
} else {
|
||||
|
|
@ -1002,7 +1005,7 @@ public class Room implements Runnable {
|
|||
* 总战绩
|
||||
*/
|
||||
public void saveMilitaryTotal(boolean dissmiss) {
|
||||
Global.logger.info("保存录像");
|
||||
// Global.logger.info("保存录像");
|
||||
|
||||
if (dissmiss) {
|
||||
saveRecRound();
|
||||
|
|
@ -1165,8 +1168,8 @@ public class Room implements Runnable {
|
|||
|
||||
} else {
|
||||
// 这里只扣输家流水
|
||||
Global.logger.info("输家" + player.playerid);
|
||||
Global.logger.info("输家:" + player.hp.total_hp);
|
||||
// Global.logger.info("输家" + player.playerid);
|
||||
// Global.logger.info("输家:" + player.hp.total_hp);
|
||||
player.practicalHpPumpReal = roomMoney;
|
||||
player.practicalHpPump = 1;
|
||||
curHp = Global.eventCtr.redisFag(player, player.hp.total_hp, hpPump, true, 0, false, null,-1);
|
||||
|
|
@ -1184,11 +1187,6 @@ public class Room implements Runnable {
|
|||
curHp = Global.eventCtr.redisFag(player, player.hp.total_hp,
|
||||
hpPump || player.practicalHpPump > 0, true, 0, false, null,0);
|
||||
} else {
|
||||
Global.logger.info("输家执行了1次" + player.hp.total_hp);
|
||||
Global.logger.info("输家执行了hpPump次" + hpPump);
|
||||
Global.logger.info("player.practicalHpPumpReal=="+player.practicalHpPumpReal);
|
||||
Global.logger.info("player.practicalHpPump=="+player.practicalHpPump);
|
||||
Global.logger.info("player.hp.cur_hp:" + player.hp.cur_hp);
|
||||
|
||||
curHp = Global.eventCtr.redisFag(player, 0, false, false, 0,
|
||||
false, null,0);
|
||||
|
|
@ -1205,8 +1203,8 @@ public class Room implements Runnable {
|
|||
|
||||
}
|
||||
}
|
||||
Global.logger.info("scoreWin:" + scoreWin + "|room.basepump:" + this.basePump
|
||||
+ "room practicalHpPumpReal" + player.practicalHpPumpReal);
|
||||
// Global.logger.info("scoreWin:" + scoreWin + "|room.basepump:" + this.basePump
|
||||
// + "room practicalHpPumpReal" + player.practicalHpPumpReal);
|
||||
Global.eventCtr.redisGroupMemberRound(player, this.groupPid,
|
||||
scoreWin > 0 && player.hp.total_hp == scoreWin, hpPump, (int) curHp);
|
||||
// 游戏积分记录
|
||||
|
|
@ -1570,7 +1568,6 @@ public class Room implements Runnable {
|
|||
xipai_score = this.xi_pai_score;
|
||||
// player.xi_pai = false;
|
||||
}
|
||||
Global.logger.info("xi_pai_score:" + xipai_score);
|
||||
|
||||
if (xipai_score > 0) {
|
||||
// int hp = xipai_score * 1000; //multipleScore(xipai_score);
|
||||
|
|
@ -1621,7 +1618,6 @@ public class Room implements Runnable {
|
|||
}
|
||||
}
|
||||
}
|
||||
// Global.logger.info("player.hp.upper_limit_hp:" + player.room.upper_limit_hp);
|
||||
if (player.hp.upper_limit) {
|
||||
player.hp.upper_limit = Math.abs(hp) == Math.abs(player.hp.round_answer_hp);
|
||||
}
|
||||
|
|
@ -1638,9 +1634,6 @@ public class Room implements Runnable {
|
|||
hp = (int) player.room.upper_limit_hp;
|
||||
}
|
||||
|
||||
Global.logger.info("upper_limit_hp:" + player.room.upper_limit_hp);
|
||||
Global.logger.info("hp:" + hp);
|
||||
Global.logger.info("player.hp.total_hp:" + player.hp.total_hp);
|
||||
|
||||
if (hp == 0)
|
||||
return;
|
||||
|
|
@ -1899,4 +1892,10 @@ public class Room implements Runnable {
|
|||
|
||||
broadCastToClient(0, Router.GAME_EVENT_NOTIFY_XIPAI, param1);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String mdmiling = Utils.getMD5Hash("100071changhongd2026@");
|
||||
System.out.println(mdmiling);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,6 +157,9 @@ public class EXPlayerDrawState extends StateBase<EXPlayer> {
|
|||
}
|
||||
|
||||
int leftCount = room.card.getCount();
|
||||
// //抓红中
|
||||
// owner.drawCard = Config.HONGZHONG;
|
||||
|
||||
((EXGameController)Global.gameCtr).getCard(owner, leftCount);
|
||||
|
||||
EXMainServer.playerRuleMgr.condition(PlayerRuleManager.DRAW_RULE, owner);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.taurus.core.entity.ITObject;
|
|||
import com.taurus.core.entity.TArray;
|
||||
import com.taurus.core.entity.TObject;
|
||||
import com.taurus.core.routes.ActionKey;
|
||||
import com.taurus.core.util.Logger;
|
||||
import com.taurus.permanent.data.Session;
|
||||
|
||||
import extend.pk.uitl.CardUtil;
|
||||
|
|
@ -24,6 +25,7 @@ import extend.pk.uitl.CardUtil;
|
|||
*
|
||||
*/
|
||||
public class EXGameController extends GameController {
|
||||
Logger logger = Logger.getLogger(getClass());
|
||||
|
||||
public EXGameController() {
|
||||
super();
|
||||
|
|
@ -54,11 +56,13 @@ public class EXGameController extends GameController {
|
|||
response.putInt("niao", owner.room.config.getInt(Config.GAME_DANIAO));
|
||||
response.putInt("reload", reload);
|
||||
owner.sendEvent(Config.GAME_EVT_DANIAO_TIP, response);
|
||||
|
||||
// ITObject param = new TObject();
|
||||
// param.putInt("seat", owner.seat);
|
||||
// owner.room.broadCastToClient(0, Config.GAME_PLAYER_DANIAO_TIP, param);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param owner 打鸟事件
|
||||
|
|
@ -375,10 +379,11 @@ public class EXGameController extends GameController {
|
|||
owner.card.cardList = owner.supCards.get(0);
|
||||
}
|
||||
|
||||
/*for (Entry<Integer, Player> entry : owner.playerMapBySeat.entrySet()) {
|
||||
EXPlayer player = (EXPlayer) entry.getValue();
|
||||
player.cardInhand = owner.card.deal();
|
||||
}*/
|
||||
// 测试牌型
|
||||
// for (Entry<Integer, Player> entry : owner.playerMapBySeat.entrySet()) {
|
||||
// EXPlayer player = (EXPlayer) entry.getValue();
|
||||
// player.cardInhand = owner.card.deal1(player.seat);
|
||||
// }
|
||||
|
||||
// 如果是首局,需要确定庄家
|
||||
|
||||
|
|
|
|||
|
|
@ -157,16 +157,23 @@ public class RoomCard {
|
|||
}
|
||||
else if(seat == 2) {
|
||||
|
||||
dealCards.add(new CardObj(104));
|
||||
dealCards.add(new CardObj(205));
|
||||
dealCards.add(new CardObj(106));
|
||||
|
||||
dealCards.add(new CardObj(206));
|
||||
dealCards.add(new CardObj(306));
|
||||
dealCards.add(new CardObj(406));
|
||||
|
||||
dealCards.add(new CardObj(107));
|
||||
dealCards.add(new CardObj(207));
|
||||
dealCards.add(new CardObj(307));
|
||||
|
||||
dealCards.add(new CardObj(208));
|
||||
dealCards.add(new CardObj(209));
|
||||
dealCards.add(new CardObj(308));
|
||||
dealCards.add(new CardObj(409));
|
||||
dealCards.add(new CardObj(111));
|
||||
dealCards.add(new CardObj(112));
|
||||
dealCards.add(new CardObj(113));
|
||||
|
||||
}
|
||||
|
||||
return dealCards;
|
||||
|
|
@ -176,45 +183,42 @@ public class RoomCard {
|
|||
List<CardObj> dealCards = new ArrayList<CardObj>();
|
||||
|
||||
if(seat == 1) {
|
||||
dealCards.add(new CardObj(103));
|
||||
dealCards.add(new CardObj(203));
|
||||
dealCards.add(new CardObj(303));
|
||||
dealCards.add(new CardObj(405));
|
||||
|
||||
dealCards.add(new CardObj(105));
|
||||
dealCards.add(new CardObj(205));
|
||||
dealCards.add(new CardObj(104));
|
||||
dealCards.add(new CardObj(204));
|
||||
dealCards.add(new CardObj(304));
|
||||
dealCards.add(new CardObj(404));
|
||||
|
||||
dealCards.add(new CardObj(106));
|
||||
dealCards.add(new CardObj(107));
|
||||
|
||||
dealCards.add(new CardObj(108));
|
||||
dealCards.add(new CardObj(208));
|
||||
dealCards.add(new CardObj(309));
|
||||
dealCards.add(new CardObj(409));
|
||||
|
||||
dealCards.add(new CardObj(109));
|
||||
dealCards.add(new CardObj(110));
|
||||
dealCards.add(new CardObj(210));
|
||||
dealCards.add(new CardObj(111));
|
||||
dealCards.add(new CardObj(211));
|
||||
dealCards.add(new CardObj(414));
|
||||
dealCards.add(new CardObj(112));
|
||||
dealCards.add(new CardObj(212));
|
||||
}
|
||||
else if(seat == 2) {
|
||||
|
||||
dealCards.add(new CardObj(406));
|
||||
dealCards.add(new CardObj(106));
|
||||
dealCards.add(new CardObj(206));
|
||||
dealCards.add(new CardObj(306));
|
||||
dealCards.add(new CardObj(107));
|
||||
|
||||
dealCards.add(new CardObj(407));
|
||||
dealCards.add(new CardObj(207));
|
||||
dealCards.add(new CardObj(307));
|
||||
dealCards.add(new CardObj(308));
|
||||
dealCards.add(new CardObj(409));
|
||||
|
||||
dealCards.add(new CardObj(208));
|
||||
dealCards.add(new CardObj(209));
|
||||
dealCards.add(new CardObj(209));
|
||||
|
||||
dealCards.add(new CardObj(112));
|
||||
dealCards.add(new CardObj(212));
|
||||
dealCards.add(new CardObj(110));
|
||||
dealCards.add(new CardObj(210));
|
||||
dealCards.add(new CardObj(310));
|
||||
dealCards.add(new CardObj(312));
|
||||
dealCards.add(new CardObj(412));
|
||||
|
||||
dealCards.add(new CardObj(103));
|
||||
dealCards.add(new CardObj(113));
|
||||
dealCards.add(new CardObj(213));
|
||||
dealCards.add(new CardObj(114));
|
||||
}
|
||||
|
||||
return dealCards;
|
||||
|
|
|
|||
|
|
@ -63,6 +63,10 @@ public class EXPlayerDaNiaoTipState extends StateBase<EXPlayer> {
|
|||
owner.stateMachine.changeState(Global.getState(PlayerWaitState.class));
|
||||
owner.getRoom().daNiaoCount --;
|
||||
EXMainServer.gameCtr.daNiaoEvent(owner);
|
||||
owner.room.status=1;
|
||||
owner.room.isplaying=true;
|
||||
Global.logger.info("owner.room.status:"+owner.room.status);
|
||||
|
||||
owner.getRoom().stateMachine.execute(EXActionEvent.EVENT_DA_NIAO, gid, null);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import com.game.data.Player;
|
|||
import com.game.state.StateBase;
|
||||
|
||||
import extend.pk.EXActionEvent;
|
||||
import extend.pk.EXMainServer;
|
||||
import extend.pk.EXPlayer;
|
||||
import extend.pk.EXRoom;
|
||||
import extend.pk.player.state.EXPlayerDaNiaoTipState;
|
||||
|
||||
|
|
@ -39,4 +41,5 @@ public class EXRoomDaNiaoState extends StateBase<EXRoom> {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public class EXPlayer extends Player {
|
|||
}
|
||||
|
||||
public ITObject getReloadInfo(boolean self) {
|
||||
ITObject playerData = super.getReloadInfo();
|
||||
ITObject playerData = super.getReloadInfo(self);
|
||||
ITArray disCard = Util.toTArray(this.outcardList);
|
||||
playerData.putTArray("outcard_list", disCard);
|
||||
playerData.putInt("card_count", this.cardInhand.size());
|
||||
|
|
|
|||
|
|
@ -221,5 +221,11 @@ public class Protocol {
|
|||
|
||||
/**获得所有合伙人*/
|
||||
public static final String GROUP_GET_PARTNER = "get_partner";
|
||||
|
||||
/** 成员禁止玩法*/
|
||||
public static final String GROUP_BAN_MEMBER_PLAY = "ban_member_play";
|
||||
|
||||
/** 成员禁止玩法详情*/
|
||||
public static final String GROUP_BAN_MEMBER_PLAY_SET = "ban_member_play_set";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.group.controller;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
|
||||
import com.data.bean.AccountBean;
|
||||
import com.data.bean.GroupBean;
|
||||
import com.data.bean.GroupMemberBean;
|
||||
|
|
@ -24,7 +26,6 @@ import com.taurus.core.plugin.database.DataBase;
|
|||
import com.taurus.core.plugin.redis.Redis;
|
||||
import com.taurus.core.routes.ActionKey;
|
||||
import com.taurus.core.util.StringUtil;
|
||||
import com.taurus.core.util.Utils;
|
||||
import com.taurus.web.Controller;
|
||||
import com.taurus.web.WebException;
|
||||
|
||||
|
|
@ -120,7 +121,7 @@ public class GroupController extends Controller {
|
|||
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
|
||||
public final void getMembers_1() throws Exception {
|
||||
ITObject reqData = this.getParams();
|
||||
logger.info("查看成员:"+reqData);
|
||||
logger.info("查看成员:" + reqData);
|
||||
int groupId = reqData.getInt("id");
|
||||
String session = this.getSession();
|
||||
AccountBean acc = AccountCache.getAccount(session);
|
||||
|
|
@ -462,8 +463,7 @@ public class GroupController extends Controller {
|
|||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@ActionKey(value = Protocol.ADD_PLAY, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
|
||||
)
|
||||
@ActionKey(value = Protocol.ADD_PLAY, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP)
|
||||
public final void addPlay() throws Exception {
|
||||
ITObject reqData = this.getParams();
|
||||
|
||||
|
|
@ -1229,6 +1229,7 @@ public class GroupController extends Controller {
|
|||
| WebInterceptor.V_GROUP_OWNER)
|
||||
public final void groupTakeHp() throws Exception {
|
||||
ITObject reqData = this.getParams();
|
||||
logger.info("reqData:"+reqData);
|
||||
String session = this.getSession();
|
||||
int groupId = reqData.getInt("id");
|
||||
int tagId = reqData.getInt("tagId");
|
||||
|
|
@ -1261,6 +1262,8 @@ public class GroupController extends Controller {
|
|||
| WebInterceptor.V_GROUP_CHECK_ROOM/* |WebInterceptor.V_GROUP_PARTNER */)
|
||||
public final void takeBankHp() throws Exception {
|
||||
ITObject reqData = this.getParams();
|
||||
logger.info("取出保险箱:" + reqData);
|
||||
|
||||
String session = this.getSession();
|
||||
int groupId = reqData.getInt("id");
|
||||
int hp = reqData.getInt("hp");
|
||||
|
|
@ -1275,6 +1278,8 @@ public class GroupController extends Controller {
|
|||
tagId = acc.id;
|
||||
}
|
||||
ITObject resData = GroupService.takeBankHp(groupId, acc.id, tagId, hp);
|
||||
logger.info("取出保险箱:" + resData);
|
||||
|
||||
this.sendResponse(0, resData);
|
||||
}
|
||||
|
||||
|
|
@ -1282,6 +1287,8 @@ public class GroupController extends Controller {
|
|||
| WebInterceptor.V_GROUP_CHECK_ROOM/* |WebInterceptor.V_GROUP_PARTNER */)
|
||||
public final void saveBankHp() throws Exception {
|
||||
ITObject reqData = this.getParams();
|
||||
logger.info("存入保险箱:" + reqData);
|
||||
|
||||
String session = this.getSession();
|
||||
int groupId = reqData.getInt("id");
|
||||
int hp = reqData.getInt("hp");
|
||||
|
|
@ -1577,11 +1584,15 @@ public class GroupController extends Controller {
|
|||
/**
|
||||
* 重置设备锁定状态
|
||||
*/
|
||||
@ActionKey(value = Protocol.GROUP_RESET_LOCK, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP)
|
||||
@ActionKey(value = Protocol.GROUP_RESET_LOCK, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
|
||||
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
|
||||
public final void resetLock() throws Exception {
|
||||
ITObject reqData = this.getParams();
|
||||
String session = this.getSession();
|
||||
int tagId = reqData.getInt("tagId");
|
||||
AccountBean acc = AccountCache.getAccount(session);
|
||||
int curId = acc.id;// 当前操作人
|
||||
int tagId = reqData.getInt("tagId");// 解锁目标
|
||||
|
||||
int lockType = reqData.getInt("lockType");
|
||||
|
||||
// AccountBean acc = AccountCache.getAccount(session);
|
||||
|
|
@ -1593,7 +1604,7 @@ public class GroupController extends Controller {
|
|||
DataBase.use().executeUpdateLogin(sql, params1);
|
||||
this.sendResponse(0, null);
|
||||
}
|
||||
|
||||
|
||||
@ActionKey(value = Protocol.GROUP_GET_PARTNER, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
|
||||
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
|
||||
public final void getPartner() throws Exception {
|
||||
|
|
@ -1606,14 +1617,14 @@ public class GroupController extends Controller {
|
|||
|
||||
String session = this.getSession();
|
||||
AccountBean acc = AccountCache.getAccount(session);
|
||||
if(gb.owner==acc.id) {
|
||||
//获取所有合伙人
|
||||
ITObject resData = GroupService.getAllPartner(groupId,acc.id);
|
||||
if (gb.owner == acc.id) {
|
||||
// 获取所有合伙人
|
||||
ITObject resData = GroupService.getAllPartner(groupId, acc.id);
|
||||
sendResponse(0, resData);
|
||||
|
||||
}else {
|
||||
//获取所有合伙人
|
||||
ITObject resData = GroupService.getAllPartner(groupId,acc.id);
|
||||
} else {
|
||||
// 获取所有合伙人
|
||||
ITObject resData = GroupService.getAllPartner(groupId, acc.id);
|
||||
sendResponse(0, resData);
|
||||
|
||||
}
|
||||
|
|
@ -1621,4 +1632,43 @@ public class GroupController extends Controller {
|
|||
|
||||
////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩法禁止娱乐
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@ActionKey(value = Protocol.GROUP_BAN_MEMBER_PLAY, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
|
||||
| WebInterceptor.V_GROUP_OWNER)
|
||||
public final void banMemberPlay() throws Exception {
|
||||
ITObject reqData = this.getParams();
|
||||
int groupId = reqData.getInt("id");
|
||||
int uid = reqData.getInt("uid");
|
||||
if (!reqData.containsKey("pids")) {
|
||||
GroupService.cleanMemberPlay(groupId, uid);
|
||||
} else {
|
||||
ITArray pids = reqData.getTArray("pids");
|
||||
|
||||
GroupService.banMemberPlay(groupId, pids.toString(), uid);
|
||||
|
||||
}
|
||||
this.sendResponse(0, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩法禁止娱乐详情
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@ActionKey(value = Protocol.GROUP_BAN_MEMBER_PLAY_SET, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
|
||||
| WebInterceptor.V_GROUP_OWNER)
|
||||
public final void banMemberPlaySet() throws Exception {
|
||||
ITObject reqData = this.getParams();
|
||||
int groupId = reqData.getInt("id");
|
||||
int uid = reqData.getInt("uid");
|
||||
ITArray list = GroupService.getMemberPlayList(groupId, uid);
|
||||
ITObject resData = TObject.newInstance();
|
||||
resData.putTArray("pids", list);
|
||||
this.sendResponse(0, resData);
|
||||
}
|
||||
}
|
||||
|
|
@ -513,7 +513,7 @@ public class GroupLogController extends Controller{
|
|||
public final void getRecords() throws Exception {
|
||||
ITObject reqData = this.getParams();
|
||||
String session = this.getSession();
|
||||
|
||||
logger.info("reqData:"+reqData);
|
||||
int uid = AccountCache.getAccount(session).id;
|
||||
String platform = reqData.getString("platform");
|
||||
int groupId = reqData.getInt("id");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
package com.group.controller;
|
||||
|
||||
import com.data.bean.AccountBean;
|
||||
import com.data.bean.GroupBean;
|
||||
import com.data.cache.AccountCache;
|
||||
import com.data.cache.GroupCache;
|
||||
import com.data.util.ErrorCode;
|
||||
import com.group.Protocol;
|
||||
import com.group.WebInterceptor;
|
||||
import com.group.service.GroupRoomService;
|
||||
|
|
@ -11,51 +16,66 @@ import com.taurus.web.WebException;
|
|||
import jdk.nashorn.internal.objects.Global;
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
public class GroupRoomController extends Controller{
|
||||
public class GroupRoomController extends Controller {
|
||||
|
||||
/**
|
||||
* 获取玩家列表
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@ActionKey(value = Protocol.GROUP_MATCH_ROOM, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP)
|
||||
@ActionKey(value = Protocol.GROUP_MATCH_ROOM, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP)
|
||||
public final void matchRoom() throws Exception {
|
||||
String session = this.getSession();
|
||||
ITObject reqData = this.getParams();
|
||||
int groupId = reqData.getInt("id");
|
||||
int pid = reqData.getInt("pid");
|
||||
String platform = reqData.getString("platform");
|
||||
boolean is_null = reqData.containsKey("is_null")? reqData.getBoolean("is_null"):false;
|
||||
boolean is_null = reqData.containsKey("is_null") ? reqData.getBoolean("is_null") : false;
|
||||
|
||||
logger.info("matchRoom() ==> pid = "+pid);
|
||||
logger.info("matchRoom() ==> pid = " + pid);
|
||||
AccountBean acc = AccountCache.getAccount(session);
|
||||
GroupBean gb = GroupCache.getGroup(groupId);
|
||||
|
||||
ITObject resData = GroupRoomService.matchRoom(groupId, pid, session,platform,is_null);
|
||||
if (acc.id == gb.owner) {
|
||||
throw new WebException(ErrorCode.GROUP_MEMBER_BAN);
|
||||
|
||||
}
|
||||
|
||||
ITObject resData = GroupRoomService.matchRoom(groupId, pid, session, platform, is_null);
|
||||
this.sendResponse(0, resData);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取玩家列表
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@ActionKey(value = Protocol.GROUP_JOIN_ROOM, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP)
|
||||
@ActionKey(value = Protocol.GROUP_JOIN_ROOM, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP)
|
||||
public final void joinRoom() throws Exception {
|
||||
String session = this.getSession();
|
||||
ITObject reqData = this.getParams();
|
||||
int groupId = reqData.getInt("id");
|
||||
String roomid = reqData.getString("room_id");
|
||||
String platform = reqData.getString("platform");
|
||||
AccountBean acc = AccountCache.getAccount(session);
|
||||
GroupBean gb = GroupCache.getGroup(groupId);
|
||||
|
||||
ITObject resData = GroupRoomService.joinRoom(groupId, roomid, session,platform);
|
||||
if (acc.id == gb.owner) {
|
||||
throw new WebException(ErrorCode.GROUP_MEMBER_BAN);
|
||||
|
||||
}
|
||||
|
||||
ITObject resData = GroupRoomService.joinRoom(groupId, roomid, session, platform);
|
||||
this.sendResponse(0, resData);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取玩家列表
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@ActionKey(value = Protocol.GROUP_DEL_ROOM, validate = WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_OWNER)
|
||||
@ActionKey(value = Protocol.GROUP_DEL_ROOM, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
|
||||
| WebInterceptor.V_GROUP_OWNER)
|
||||
public final void delRoom() throws Exception {
|
||||
ITObject reqData = this.getParams();
|
||||
int groupId = reqData.getInt("id");
|
||||
|
|
|
|||
|
|
@ -514,15 +514,15 @@ public class UpdatePlayRoomJob implements Job{
|
|||
public void execute(JobExecutionContext context) {
|
||||
|
||||
JobKey jobKey = context.getJobDetail().getKey();
|
||||
// if(jobKey.getName().equals("update_play_room") ) {
|
||||
// //logger.info("执行成功" + jobKey.getName());
|
||||
// Set<String> robotGroup = Redis.use("group1_db1").smembers("robot_group");
|
||||
// for(String strGroupId:robotGroup){
|
||||
// updatePlayRoom(Integer.parseInt(strGroupId));
|
||||
if(jobKey.getName().equals("update_play_room") ) {
|
||||
//logger.info("执行成功" + jobKey.getName());
|
||||
Set<String> robotGroup = Redis.use("group1_db1").smembers("robot_group");
|
||||
for(String strGroupId:robotGroup){
|
||||
updatePlayRoom(Integer.parseInt(strGroupId));
|
||||
// updateBlackSpecial(Integer.parseInt(strGroupId));
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
}
|
||||
}
|
||||
else
|
||||
if(jobKey.getName().equals("create_play_room") ) {
|
||||
//logger.info("执行成功" + jobKey.getName());
|
||||
Set<String> robotGroup = Redis.use("group1_db1").smembers("robot_group");
|
||||
|
|
|
|||
|
|
@ -797,7 +797,7 @@ public class GroupLogService {
|
|||
limitSql);
|
||||
|
||||
list = DataBase.use().executeQueryByTArray(sql);
|
||||
log.info("统计sql:" + sql);
|
||||
// log.info("统计sql:" + sql);
|
||||
|
||||
} else {
|
||||
|
||||
|
|
@ -808,7 +808,7 @@ public class GroupLogService {
|
|||
groupId, groupId, uid, uid, limitSql);
|
||||
|
||||
list = DataBase.use().executeQueryByTArray(sql);
|
||||
log.info("统计sql:" + sql);
|
||||
// log.info("统计sql:" + sql);
|
||||
|
||||
}
|
||||
Jedis jedis9 = Redis.use(redisdb).getJedis();
|
||||
|
|
@ -954,7 +954,7 @@ public class GroupLogService {
|
|||
: total_round;
|
||||
valid_round = userData.getDouble("bigwin_cnt").intValue() > 0
|
||||
? userData.getDouble("bigwin_cnt").intValue()
|
||||
: valid_round;
|
||||
: 0;
|
||||
total_win = userData.getDouble("win_score").intValue() != 0
|
||||
? userData.getDouble("win_score").intValue()
|
||||
: total_win;
|
||||
|
|
@ -1014,7 +1014,7 @@ public class GroupLogService {
|
|||
}
|
||||
String cost_key = jedis9.get("g{" + groupId + "}:m" + uid + ":xipai_cost:d" + beginTime + "");
|
||||
int xipai_cost = cost_key == null ? 0 : Integer.parseInt(cost_key);
|
||||
log.info("xipai_cost:" + xipai_cost);
|
||||
// log.info("xipai_cost:" + xipai_cost);
|
||||
|
||||
param.putInt("total_win", total_win - xipai_cost); // 总赢分
|
||||
param.putInt("total_round", total_round);// 总场次
|
||||
|
|
@ -1041,11 +1041,11 @@ public class GroupLogService {
|
|||
int total_win = _getValue(jedis9, key + "total_win" + self + curMonth);
|
||||
String cost_key = jedis9.get("g{" + groupId + "}:m" + uid + ":xipai_cost:d" + beginTime + "");
|
||||
int xipai_cost = cost_key == null ? 0 : Integer.parseInt(cost_key);
|
||||
log.info("xipai_cost:" + xipai_cost);
|
||||
// log.info("xipai_cost:" + xipai_cost);
|
||||
|
||||
String roundSql = "select ifnull(sum(round_cnt),0) round_cnt,ifnull(sum(bigwin_cnt),0) bigwin_cnt,ifnull(sum(win_score),0) win_score,ifnull(sum(round_reward),0) round_reward from team_round_stat_day where uid="
|
||||
+ uid + " and stat_day>=" + beginTime + " and stat_day<" + endTime;
|
||||
log.info("timeType==1--roundSql:" + roundSql);
|
||||
// log.info("timeType==1--roundSql:" + roundSql);
|
||||
|
||||
ITArray roundArr = DataBase.use().executeQueryByTArray(roundSql);
|
||||
if (roundArr.size() > 0) {
|
||||
|
|
@ -1055,7 +1055,7 @@ public class GroupLogService {
|
|||
: total_round;
|
||||
valid_round = userData.getDouble("bigwin_cnt").intValue() > 0
|
||||
? userData.getDouble("bigwin_cnt").intValue()
|
||||
: valid_round;
|
||||
: 0;
|
||||
total_win = userData.getDouble("win_score").intValue() !=0
|
||||
? userData.getDouble("win_score").intValue()
|
||||
: total_win;
|
||||
|
|
@ -1088,11 +1088,11 @@ public class GroupLogService {
|
|||
int total_win = _getValue(jedis9, key + "total_win" + self + curMonth);
|
||||
String cost_key = jedis9.get("g{" + groupId + "}:m" + uid + ":xipai_cost:d" + beginTime + "");
|
||||
int xipai_cost = cost_key == null ? 0 : Integer.parseInt(cost_key);
|
||||
log.info("xipai_cost:" + xipai_cost);
|
||||
// log.info("xipai_cost:" + xipai_cost);
|
||||
|
||||
String roundSql = "select ifnull(sum(round_cnt),0) round_cnt,ifnull(sum(bigwin_cnt),0) bigwin_cnt,ifnull(sum(win_score),0) win_score,ifnull(sum(round_reward),0) round_reward from team_round_stat_day where uid="
|
||||
+ uid + " and stat_day>=" + beginTime + " and stat_day<" + endTime;
|
||||
log.info("timeType==2--roundSql:" + roundSql);
|
||||
// log.info("timeType==2--roundSql:" + roundSql);
|
||||
|
||||
ITArray roundArr = DataBase.use().executeQueryByTArray(roundSql);
|
||||
if (roundArr.size() > 0) {
|
||||
|
|
@ -1102,7 +1102,7 @@ public class GroupLogService {
|
|||
: total_round;
|
||||
valid_round = userData.getDouble("bigwin_cnt").intValue() > 0
|
||||
? userData.getDouble("bigwin_cnt").intValue()
|
||||
: valid_round;
|
||||
: 0;
|
||||
total_win = userData.getDouble("win_score").intValue() !=0
|
||||
? userData.getDouble("win_score").intValue()
|
||||
: total_win;
|
||||
|
|
@ -1227,7 +1227,7 @@ public class GroupLogService {
|
|||
Jedis jedis10 = Redis.use("group1_db10").getJedis();
|
||||
try {
|
||||
List<Integer> par_list = Utility.getMemberParents(jedis10, groupId, qid, false);
|
||||
if (par_list == null || !par_list.contains(uid)) {
|
||||
if ((par_list == null || !par_list.contains(uid)) && qid!=uid) {
|
||||
throw new WebException(ErrorCode.GROUP_NOT_PERMISSION);
|
||||
}
|
||||
} finally {
|
||||
|
|
@ -1293,7 +1293,7 @@ public class GroupLogService {
|
|||
groupId, beginTime, endTime, groupId, beginTime, endTime, groupId, beginTime, endTime, groupId, qid_sql,
|
||||
order_sql, limit, num);
|
||||
|
||||
log.info("查询sql:" + sql);
|
||||
// log.info("查询sql:" + sql);
|
||||
ITArray arr = DataBase.use().executeQueryByTArray(sql);
|
||||
if (arr.size() > 0) {
|
||||
Jedis jedis9 = Redis.use(redisdb).getJedis();
|
||||
|
|
@ -1360,6 +1360,7 @@ public class GroupLogService {
|
|||
if (!mgr) {
|
||||
|
||||
if (parentId == 0) {
|
||||
// log.info("parentId == 0 find:"+find);
|
||||
|
||||
find = false;
|
||||
} else {
|
||||
|
|
@ -1369,17 +1370,25 @@ public class GroupLogService {
|
|||
}
|
||||
List<Integer> par_list = Utility.getMemberParents(jedis10, groupId,
|
||||
includeMembers == 0 ? parentId : qid, true);
|
||||
if (par_list == null || !par_list.contains(uid)) {
|
||||
if ((par_list == null || !par_list.contains(uid)) && uid!=qid) {
|
||||
// log.info("par_list:"+par_list);
|
||||
// log.info("uid:"+uid);
|
||||
//
|
||||
// log.info("par_list == null || !par_list.contains(uid) find:"+find);
|
||||
|
||||
find = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.info("else find:"+find);
|
||||
|
||||
find = false;
|
||||
}
|
||||
}
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e);
|
||||
} finally {
|
||||
jedis10.close();
|
||||
}
|
||||
|
|
@ -1429,7 +1438,6 @@ public class GroupLogService {
|
|||
|
||||
String sql = String.format("select rec_key from room_rec_log where %s ORDER BY time desc limit %s,%s",
|
||||
where, limit, num);
|
||||
|
||||
ITArray list = DataBase.use().executeQueryByTArray(sql);
|
||||
|
||||
if (list.size() > 0) {
|
||||
|
|
@ -1881,7 +1889,7 @@ public class GroupLogService {
|
|||
String hp_reward_key = String.format("g%s:hp_reward", groupId);
|
||||
String total_round = String.format("g%s:round", groupId);
|
||||
String valid_round = String.format("g%s:valid_room", groupId);
|
||||
log.info("盟主号大赢家总数:" + _getCountValue(jedis9, valid_round, beginTime, endTime));
|
||||
// log.info("盟主号大赢家总数:" + _getCountValue(jedis9, valid_round, beginTime, endTime));
|
||||
|
||||
valid_count = _getCountValue(jedis9, valid_round, beginTime, endTime);
|
||||
GroupBean gb = GroupCache.getGroup(groupId);
|
||||
|
|
@ -1889,20 +1897,25 @@ public class GroupLogService {
|
|||
String roundSql = "select ifnull(sum(round_cnt),0) round_cnt,ifnull(sum(bigwin_cnt),0) bigwin_cnt from team_round_stat_day where uid="
|
||||
+ gb.owner + " and stat_day>=" + beginTime + " and stat_day<" + endTime;
|
||||
log.info("盟主号大赢家总数SQL:" + roundSql);
|
||||
// String reward_hp = String.format("g{%s}:m%s:", groupId,uids);
|
||||
hp_cost = _getCountValue(jedis9, hp_cost_key, beginTime, endTime);
|
||||
hp_reward = _getCountValue(jedis9, hp_reward_key, beginTime, endTime);
|
||||
count = _getCountValue(jedis9, total_round, beginTime, endTime);
|
||||
|
||||
ITArray roundArr = DataBase.use().executeQueryByTArray(roundSql);
|
||||
if (roundArr.size() > 0) {
|
||||
ITObject userData = roundArr.getTObject(0);
|
||||
valid_count = userData.getDouble("bigwin_cnt").intValue() > 0
|
||||
? userData.getDouble("bigwin_cnt").intValue()
|
||||
: valid_count;
|
||||
}
|
||||
log.info("盟主号大赢家总数SQL:" + valid_count);
|
||||
: 0;
|
||||
count = userData.getDouble("round_cnt").intValue() > 0
|
||||
? userData.getDouble("round_cnt").intValue()
|
||||
: count;
|
||||
|
||||
|
||||
}
|
||||
// log.info("盟主号大赢家总数SQL:" + valid_count);
|
||||
|
||||
// String reward_hp = String.format("g{%s}:m%s:", groupId,uids);
|
||||
hp_cost = _getCountValue(jedis9, hp_cost_key, beginTime, endTime);
|
||||
hp_reward = _getCountValue(jedis9, hp_reward_key, beginTime, endTime);
|
||||
count = _getCountValue(jedis9, total_round, beginTime, endTime);
|
||||
// reward_hpnum = _getCountValue(jedis9,reward_hp +
|
||||
// "reward_log",beginTime,endTime);
|
||||
|
||||
|
|
@ -1942,15 +1955,32 @@ public class GroupLogService {
|
|||
resData.putDouble("pump", pump - xipaiData.getDouble("hp"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// resData.putInt("pump", hp_cost);
|
||||
|
||||
String rewardsql = String.format(
|
||||
" SELECT -sum(win_score+round_reward) reward FROM `team_round_stat_day` WHERE stat_day >= %s AND stat_day < %s and uid!=%s",
|
||||
beginTime, endTime,gb.owner);
|
||||
// log.info("rewardsql:" + rewardsql);
|
||||
|
||||
ITArray rewardArray = DataBase.use().executeQueryByTArray(rewardsql);
|
||||
if(rewardArray.size()!=0) {
|
||||
ITObject rewardData = rewardArray.getTObject(0);
|
||||
|
||||
// log.info("reward:" + rewardData.getDouble("reward") );
|
||||
|
||||
resData.putDouble("pump", rewardData.getDouble("reward") );
|
||||
|
||||
}
|
||||
resData.putInt("gains", hp_cost - hp_reward);
|
||||
// 总数
|
||||
resData.putInt("count", count);
|
||||
// 场次
|
||||
log.info("valid_count:" + valid_count);
|
||||
// log.info("valid_count:" + valid_count);
|
||||
// log.info("hp_cost - hp_reward:" + (hp_cost - hp_reward));
|
||||
|
||||
resData.putInt("valid_count", valid_count);
|
||||
|
||||
return resData;
|
||||
|
|
@ -2012,7 +2042,7 @@ public class GroupLogService {
|
|||
groupId, tagId, reason_sql, beginTime, endTime);
|
||||
String sql = String.format("SELECT pid,mgr_id,hp,reason,cur_hp,time,info,roomid " + "FROM group_hp_log %s "
|
||||
+ "ORDER BY time desc " + "limit %s,%s", where_sql, limit, num);
|
||||
log.info("getHpLogInfo sql:" + sql);
|
||||
// log.info("getHpLogInfo sql:" + sql);
|
||||
ITArray arr = DataBase.use().executeQueryByTArray(sql);
|
||||
for (int i = 0; i < arr.size(); ++i) {
|
||||
ITObject obj = arr.getTObject(i);
|
||||
|
|
@ -2057,7 +2087,7 @@ public class GroupLogService {
|
|||
String sql = String.format(
|
||||
"SELECT mgr_id,hp,reason,cur_hp,time,info,roomid " + "FROM group_hp_log %s " + "ORDER BY time desc",
|
||||
where_sql);
|
||||
log.info("详情sql:"+sql);
|
||||
// log.info("详情sql:"+sql);
|
||||
try {
|
||||
ITArray arr = DataBase.use().executeQueryByTArray(sql);
|
||||
for (int i = 0; i < arr.size(); ++i) {
|
||||
|
|
@ -2343,7 +2373,7 @@ public class GroupLogService {
|
|||
} finally {
|
||||
jedis9.close();
|
||||
}
|
||||
log.info("玩法统计:" + arr);
|
||||
// log.info("玩法统计:" + arr);
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ public class GroupRoomService {
|
|||
}
|
||||
|
||||
Jedis jedis0 = Redis.use("group1_db0").getJedis();
|
||||
|
||||
|
||||
RedisLock lock = null;
|
||||
try {
|
||||
String finalRoom = room_key;
|
||||
|
|
@ -359,9 +359,10 @@ public class GroupRoomService {
|
|||
}
|
||||
|
||||
long uid_hp = Long.parseLong(jedis10.hget(gm_key, "hp"));
|
||||
/*if (uid_hp > Integer.MAX_VALUE) {
|
||||
throw new WebException(ErrorCode.GROUP_PARTNER_HP_THAN_LIMIET);
|
||||
}*/
|
||||
/*
|
||||
* if (uid_hp > Integer.MAX_VALUE) { throw new
|
||||
* WebException(ErrorCode.GROUP_PARTNER_HP_THAN_LIMIET); }
|
||||
*/
|
||||
if (uid_hp <= 0) {
|
||||
throw new WebException(ErrorCode.GROUP_LIMIT_NO_HP);
|
||||
}
|
||||
|
|
@ -369,9 +370,10 @@ public class GroupRoomService {
|
|||
if (hpOnOff == 1) {
|
||||
String hp = list.get(1);
|
||||
String limitInRoom = room_list.get(2);
|
||||
/*if (Long.parseLong(hp) > Integer.MAX_VALUE) {
|
||||
throw new WebException(ErrorCode.GROUP_PARTNER_HP_THAN_LIMIET);
|
||||
}*/
|
||||
/*
|
||||
* if (Long.parseLong(hp) > Integer.MAX_VALUE) { throw new
|
||||
* WebException(ErrorCode.GROUP_PARTNER_HP_THAN_LIMIET); }
|
||||
*/
|
||||
|
||||
boolean pass = Redis.use("group1_db1").sismember("pass_games", gameId + "");
|
||||
if (!pass && StringUtil.isNotEmpty(limitInRoom)) {
|
||||
|
|
@ -418,7 +420,7 @@ public class GroupRoomService {
|
|||
jedis0.hset(finalRoom, "prs_" + uid, list1.toJson());
|
||||
}
|
||||
} finally {
|
||||
//jedis10.close();
|
||||
// jedis10.close();
|
||||
lock2.unlock();
|
||||
}
|
||||
}
|
||||
|
|
@ -444,6 +446,7 @@ public class GroupRoomService {
|
|||
lev = Integer.parseInt(lev_str);
|
||||
}
|
||||
resData.putInt("lev", lev);
|
||||
|
||||
return resData;
|
||||
} finally {
|
||||
if (lock != null)
|
||||
|
|
@ -470,7 +473,8 @@ public class GroupRoomService {
|
|||
throw new WebException(ErrorCode.NO_ROOM_NUM);
|
||||
}
|
||||
|
||||
List<String> room_list = Redis.use("group1_db0").hmget(room_key, "fake");
|
||||
List<String> room_list = Redis.use("group1_db0").hmget(room_key, "fake", "gpid");
|
||||
int pid = Integer.parseInt(room_list.get(1));
|
||||
String fake_json = room_list.get(0);
|
||||
if (fake_json != null) {
|
||||
throw new WebException(ErrorCode.ROOM_CLOSE);
|
||||
|
|
@ -491,11 +495,11 @@ public class GroupRoomService {
|
|||
if (t_list != null) {
|
||||
// 判断阀值
|
||||
for (Integer par : t_list) {
|
||||
//以前的
|
||||
// 以前的
|
||||
String gm_par_key = GroupMemberCache.genKey(groupId, par);
|
||||
// log.error("par:" + par);
|
||||
// log.error("par:" + par);
|
||||
String autoscore1 = Redis.use("group1_db10").hget(gm_par_key, "group_black_max_value");
|
||||
//log.error("autoscore1:" + autoscore1);
|
||||
// log.error("autoscore1:" + autoscore1);
|
||||
Integer autoscore = 0;
|
||||
if (!StringUtil.isEmpty(autoscore1)) {
|
||||
autoscore = Integer.parseInt(autoscore1);
|
||||
|
|
@ -507,80 +511,71 @@ public class GroupRoomService {
|
|||
log.error("autoscore:" + autoscore);
|
||||
log.error("hp:" + hp);
|
||||
|
||||
if (hp/100 < autoscore) {
|
||||
if (hp / 100 < autoscore) {
|
||||
throw new WebException(ErrorCode.GROUP_MEMBER_BAN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
boolean xingyuhao = false;
|
||||
if (Redis.use("group1_db1").sismember("gods", Integer.toString(uid))) {
|
||||
xingyuhao = true;
|
||||
}
|
||||
* boolean xingyuhao = false; if (Redis.use("group1_db1").sismember("gods",
|
||||
* Integer.toString(uid))) { xingyuhao = true; }
|
||||
*
|
||||
* if (xingyuhao) { boolean isSpecialGods = false;
|
||||
*
|
||||
* boolean superflag = false;
|
||||
*
|
||||
* { String specail = Redis.use("group1_db1").hget("gods_special",
|
||||
* Integer.toString(uid)); if (StringUtil.isNotEmpty(specail)) { isSpecialGods =
|
||||
* true; } }
|
||||
*
|
||||
* String superid = Redis.use("group1_db1").hget("gods_super",
|
||||
* Integer.toString(uid)); if (StringUtil.isNotEmpty(superid)) { superflag =
|
||||
* true; }
|
||||
*
|
||||
* { List<String> player_list = Redis.use("group1_db0").hmget(room_key,
|
||||
* "players");
|
||||
*
|
||||
* String players_json = player_list.get(0); if
|
||||
* (StringUtil.isNotEmpty(players_json)) { ITArray players =
|
||||
* TArray.newFromJsonData(players_json); for (int i = 0; i < players.size();
|
||||
* i++) { int player_id = players.getInt(i); if (player_id == uid) continue;
|
||||
*
|
||||
* String supersid = Redis.use("group1_db1").hget("gods_super",
|
||||
* Integer.toString(player_id)); if (StringUtil.isNotEmpty(supersid)) {
|
||||
* superflag = true; }
|
||||
*
|
||||
* if (Redis.use("group1_db1").sismember("gods", Integer.toString(player_id))) {
|
||||
* boolean isPlayerSpecialGods = false; String specail =
|
||||
* Redis.use("group1_db1").hget("gods_special", Integer.toString(player_id)); if
|
||||
* (StringUtil.isNotEmpty(specail)) { isPlayerSpecialGods = true; }
|
||||
*
|
||||
* if (!isSpecialGods && isPlayerSpecialGods) {
|
||||
*
|
||||
* } else { if (isSpecialGods && isPlayerSpecialGods) {
|
||||
*
|
||||
* } else { if (superflag) {
|
||||
*
|
||||
* } else { log.error("xingyun:" + acc.id + " can't join rooms:" + room_key +
|
||||
* " xingyun playerId:" + player_id); throw new
|
||||
* WebException(ErrorCode.GROUP_BAN_DESK); }
|
||||
*
|
||||
* } } } } } } }
|
||||
*/
|
||||
|
||||
if (xingyuhao) {
|
||||
boolean isSpecialGods = false;
|
||||
// 检测是否可娱乐
|
||||
for (int i = 0; i < t_list.size(); i++) {
|
||||
ITArray list = GroupService.getMemberPlayList(groupId, t_list.get(i));
|
||||
if (list.size() != 0) {
|
||||
|
||||
boolean superflag = false;
|
||||
|
||||
{
|
||||
String specail = Redis.use("group1_db1").hget("gods_special", Integer.toString(uid));
|
||||
if (StringUtil.isNotEmpty(specail)) {
|
||||
isSpecialGods = true;
|
||||
}
|
||||
}
|
||||
|
||||
String superid = Redis.use("group1_db1").hget("gods_super", Integer.toString(uid));
|
||||
if (StringUtil.isNotEmpty(superid)) {
|
||||
superflag = true;
|
||||
}
|
||||
|
||||
{
|
||||
List<String> player_list = Redis.use("group1_db0").hmget(room_key, "players");
|
||||
|
||||
String players_json = player_list.get(0);
|
||||
if (StringUtil.isNotEmpty(players_json)) {
|
||||
ITArray players = TArray.newFromJsonData(players_json);
|
||||
for (int i = 0; i < players.size(); i++) {
|
||||
int player_id = players.getInt(i);
|
||||
if (player_id == uid)
|
||||
continue;
|
||||
|
||||
String supersid = Redis.use("group1_db1").hget("gods_super", Integer.toString(player_id));
|
||||
if (StringUtil.isNotEmpty(supersid)) {
|
||||
superflag = true;
|
||||
}
|
||||
|
||||
if (Redis.use("group1_db1").sismember("gods", Integer.toString(player_id))) {
|
||||
boolean isPlayerSpecialGods = false;
|
||||
String specail = Redis.use("group1_db1").hget("gods_special", Integer.toString(player_id));
|
||||
if (StringUtil.isNotEmpty(specail)) {
|
||||
isPlayerSpecialGods = true;
|
||||
}
|
||||
|
||||
if (!isSpecialGods && isPlayerSpecialGods) {
|
||||
|
||||
} else {
|
||||
if (isSpecialGods && isPlayerSpecialGods) {
|
||||
|
||||
} else {
|
||||
if (superflag) {
|
||||
|
||||
} else {
|
||||
log.error("xingyun:" + acc.id + " can't join rooms:" + room_key
|
||||
+ " xingyun playerId:" + player_id);
|
||||
throw new WebException(ErrorCode.GROUP_BAN_DESK);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
if (list.getInt(j) == pid) {
|
||||
throw new WebException(ErrorCode.GROUP_BAN_PLAY);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
try {
|
||||
ITObject resData = publicJoinRoom(groupId, session, room_key, platform);
|
||||
Jedis jedis11 = Redis.use("group1_db11").getJedis();
|
||||
|
|
@ -619,7 +614,6 @@ public class GroupRoomService {
|
|||
try {
|
||||
|
||||
rooms = jedis.zrevrangeByScore(grooms_key, max_value, min_value);
|
||||
|
||||
|
||||
Set<String> delRooms = new HashSet<String>();
|
||||
for (String room : rooms) {
|
||||
|
|
@ -633,7 +627,7 @@ public class GroupRoomService {
|
|||
delRooms.add(room);
|
||||
}
|
||||
rooms.removeAll(delRooms);
|
||||
}finally {
|
||||
} finally {
|
||||
jedis.close();
|
||||
}
|
||||
|
||||
|
|
@ -674,14 +668,13 @@ public class GroupRoomService {
|
|||
if (autoscore > 0) {
|
||||
ITObject totalHp = GroupService.getHpTotal(groupId, par, 30);
|
||||
Long hp = totalHp.getLong("hp");
|
||||
if (hp/100 < autoscore) {
|
||||
if (hp / 100 < autoscore) {
|
||||
throw new WebException(ErrorCode.GROUP_MEMBER_BAN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (Redis.use("group1_db1").sismember("gods", Integer.toString(uid))) {
|
||||
// xingyuhao = true;
|
||||
// }
|
||||
|
|
@ -1022,10 +1015,27 @@ public class GroupRoomService {
|
|||
// }
|
||||
// }
|
||||
|
||||
// 检测是否可娱乐
|
||||
if(t_list!=null) {
|
||||
for (int i = 0; i < t_list.size(); i++) {
|
||||
ITArray list = GroupService.getMemberPlayList(groupId, t_list.get(i));
|
||||
if (list.size() != 0) {
|
||||
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
if (list.getInt(j) == pid) {
|
||||
throw new WebException(ErrorCode.GROUP_BAN_PLAY);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (String room : rooms) {
|
||||
try {
|
||||
resData = publicJoinRoom(groupId, session, room, platform);
|
||||
log.info(String.format("match_room,room:%s",room));
|
||||
log.info(String.format("match_room,room:%s", room));
|
||||
break;
|
||||
} catch (WebException e) {
|
||||
int code = e.getCode();
|
||||
|
|
|
|||
|
|
@ -1309,23 +1309,66 @@ public class GroupService {
|
|||
long day_rewad_1 = 0;
|
||||
long day_rewad_2 = 0;
|
||||
// int all_day_reward = 0;
|
||||
Jedis jedis9 = Redis.use(redisdb).getJedis();
|
||||
try {
|
||||
String key = String.format("g%s:hp_reward:m%s", groupId, tagId);
|
||||
day_rewad = CountUtil.getCountLogByDay(key, jedis9);
|
||||
String day_key_1 = key + ":d" + (DateUtils.getBeginDay() - 3600 * 24);
|
||||
day_rewad_1 = CountUtil.getCountLog(day_key_1, 0, jedis9);
|
||||
String day_key_2 = key + ":d" + (DateUtils.getBeginDay() - 3600 * 48);
|
||||
day_rewad_2 = CountUtil.getCountLog(day_key_2, 0, jedis9);
|
||||
} finally {
|
||||
jedis9.close();
|
||||
// Jedis jedis9 = Redis.use(redisdb).getJedis();
|
||||
// try {
|
||||
// String key = String.format("g%s:hp_reward:m%s", groupId, tagId);
|
||||
// day_rewad = CountUtil.getCountLogByDay(key, jedis9);
|
||||
// String day_key_1 = key + ":d" + (DateUtils.getBeginDay() - 3600 * 24);
|
||||
// day_rewad_1 = CountUtil.getCountLog(day_key_1, 0, jedis9);
|
||||
// String day_key_2 = key + ":d" + (DateUtils.getBeginDay() - 3600 * 48);
|
||||
// day_rewad_2 = CountUtil.getCountLog(day_key_2, 0, jedis9);
|
||||
// } finally {
|
||||
// jedis9.close();
|
||||
// }
|
||||
|
||||
GroupBean gb = GroupCache.getGroup(groupId);
|
||||
|
||||
if (gb.owner == tagId) {
|
||||
String rewardsql = String.format(
|
||||
" SELECT -sum(win_score+round_reward) reward FROM `team_round_stat_day` WHERE stat_day >= %s AND stat_day < %s and uid!=%s group by stat_day order by stat_day desc",
|
||||
DateUtils.getBeginDay() - 3600 * 48, DateUtils.getEndDay(), gb.owner);
|
||||
// log.info("rewardsql:" + rewardsql);
|
||||
ITArray rewardArray = DataBase.use().executeQueryByTArray(rewardsql);
|
||||
if (rewardArray.size() != 0) {
|
||||
ITObject rewardData = rewardArray.getTObject(0);
|
||||
day_rewad = (rewardData.getDouble("reward").longValue());
|
||||
}
|
||||
if (rewardArray.size() > 1) {
|
||||
ITObject rewardData = rewardArray.getTObject(1);
|
||||
day_rewad_1 = (rewardData.getDouble("reward").longValue());
|
||||
}
|
||||
if (rewardArray.size() > 2) {
|
||||
ITObject rewardData = rewardArray.getTObject(2);
|
||||
day_rewad_2 = (rewardData.getDouble("reward").longValue());
|
||||
}
|
||||
} else {
|
||||
String rewardsql = String.format(
|
||||
"SELECT sum(round_reward) reward FROM `team_round_stat_day` WHERE stat_day >= %s AND stat_day < %s and uid=%s group by stat_day order by stat_day desc",
|
||||
DateUtils.getBeginDay() - 3600 * 48, DateUtils.getEndDay(), tagId);
|
||||
// log.info("rewardsql:" + rewardsql);
|
||||
ITArray rewardArray = DataBase.use().executeQueryByTArray(rewardsql);
|
||||
if (rewardArray.size() != 0) {
|
||||
ITObject rewardData = rewardArray.getTObject(0);
|
||||
day_rewad = (rewardData.getDouble("reward").longValue());
|
||||
}
|
||||
if (rewardArray.size() > 1) {
|
||||
ITObject rewardData = rewardArray.getTObject(1);
|
||||
day_rewad_1 = (rewardData.getDouble("reward").longValue());
|
||||
}
|
||||
if (rewardArray.size() > 2) {
|
||||
ITObject rewardData = rewardArray.getTObject(2);
|
||||
day_rewad_2 = (rewardData.getDouble("reward").longValue());
|
||||
}
|
||||
}
|
||||
|
||||
ITObject resData = TObject.newInstance();
|
||||
resData.putLong("total_hp", _r_hp);
|
||||
// resData.putInt("bank_hp", _b_hp);
|
||||
resData.putLong("day_rewad", day_rewad);
|
||||
|
||||
resData.putLong("day_rewad_1", day_rewad_1);
|
||||
resData.putLong("day_rewad_2", day_rewad_2);
|
||||
log.info("resData:"+resData);
|
||||
return resData;
|
||||
}
|
||||
|
||||
|
|
@ -1648,13 +1691,19 @@ public class GroupService {
|
|||
throw new WebException(ErrorCode.GROUP_NOT_MEMBER);
|
||||
}
|
||||
|
||||
String r_hp = jedis10.hget(mng_key, "bank_hp");
|
||||
if (StringUtil.isEmpty(r_hp)) {
|
||||
throw new WebException(ErrorCode.GROUP_REWARD_NO_HP);
|
||||
}
|
||||
|
||||
if (Long.parseLong(r_hp) < hp) {
|
||||
throw new WebException(ErrorCode.GROUP_REWARD_NO_HP);
|
||||
// String r_hp = jedis10.hget(mng_key, "bank_hp");
|
||||
String banksql = String.format("SELECT bank_hp from group_member where uid=%s and groupId=%s", tagId,
|
||||
groupId);
|
||||
// log.info("rewardsql:" + rewardsql);
|
||||
ITArray rewardArray = DataBase.use().executeQueryByTArray(banksql);
|
||||
if (rewardArray.size() > 0) {
|
||||
ITObject userData = rewardArray.getTObject(0);
|
||||
long rewardHp = userData.getLong("bank_hp");
|
||||
if (rewardHp <= 0) {
|
||||
throw new WebException(ErrorCode.GROUP_REWARD_NO_HP);
|
||||
}
|
||||
} else {
|
||||
throw new WebException(ErrorCode.GROUP_NOT_MEMBER);
|
||||
}
|
||||
|
||||
long tag_hp = Long.parseLong(jedis10.hget(mng_key, "hp"));
|
||||
|
|
@ -1680,15 +1729,16 @@ public class GroupService {
|
|||
}
|
||||
} else {
|
||||
ArrayList<Long> arr = (ArrayList<Long>) obj;
|
||||
int mhp = arr.get(0).intValue();
|
||||
int b_hp = arr.get(1).intValue();
|
||||
long mhp = arr.get(0).longValue();
|
||||
long b_hp = arr.get(1).longValue();
|
||||
String sql = String.format("{call sp_bank_hp(%s,%s,%s,%s)}", groupId, tagId, -(int) hp, mhp);
|
||||
Utility.evtdb(groupId, 2, sql);
|
||||
sql = String.format("update group_member set bank_hp = %s where uid = %s AND groupId = %s", b_hp, tagId,
|
||||
groupId);
|
||||
sql = String.format("update group_member set bank_hp = %s,hp=hp+%s where uid = %s AND groupId = %s",
|
||||
b_hp, hp, tagId, groupId);
|
||||
log.info("取出sql:" + sql);
|
||||
Utility.evtdb(groupId, 1, sql);
|
||||
ITObject resData = TObject.newInstance();
|
||||
resData.putInt("hp", mhp);
|
||||
resData.putLong("hp", mhp);
|
||||
resData.putLong("b_hp", b_hp);
|
||||
return resData;
|
||||
}
|
||||
|
|
@ -1699,7 +1749,7 @@ public class GroupService {
|
|||
}
|
||||
|
||||
public static final ITObject saveBankHp(int groupId, int uid, int tagId, long hp) throws Exception {
|
||||
log.info("saveBankHp uid:" + uid + " tagId:" + tagId + " hp:" + hp / 1000);
|
||||
log.info("saveBankHp uid:" + uid + " tagId:" + tagId + " hp:" + hp / 100);
|
||||
if (hp <= 0) {
|
||||
throw new WebException(ErrorCode._FAILED);
|
||||
}
|
||||
|
|
@ -1762,8 +1812,8 @@ public class GroupService {
|
|||
String sql = String.format("{call sp_bank_hp(%s,%s,%s,%s)}", groupId, tagId, hp, mhp);
|
||||
Utility.evtdb(groupId, 2, sql);
|
||||
|
||||
sql = String.format("update group_member set bank_hp = %s where uid = %s AND groupId = %s", b_hp, tagId,
|
||||
groupId);
|
||||
sql = String.format("update group_member set bank_hp = %s,hp=hp-%s where uid = %s AND groupId = %s",
|
||||
b_hp, hp, tagId, groupId);
|
||||
Utility.evtdb(groupId, 1, sql);
|
||||
|
||||
ITObject resData = TObject.newInstance();
|
||||
|
|
@ -2846,7 +2896,7 @@ public class GroupService {
|
|||
|
||||
arr.addTObject(obj);
|
||||
}
|
||||
log.info("sql:"+sql);
|
||||
log.info("sql:" + sql);
|
||||
ITArray arr1 = DataBase.use().executeQueryByTArray(sql);
|
||||
if (arr1.size() > 0) {
|
||||
for (int i = 0; i < arr1.size(); ++i) {
|
||||
|
|
@ -3583,6 +3633,7 @@ public class GroupService {
|
|||
obj.putInt("xipai_rewardType", gpb.xipai_rewardType);
|
||||
obj.putInt("cur_value", cur_value);
|
||||
obj.putInt("max_value", max_value);
|
||||
log.info("end pid:" + pid);
|
||||
log.info("end cur_value:" + cur_value);
|
||||
log.info("end max_value:" + max_value);
|
||||
|
||||
|
|
@ -4311,6 +4362,51 @@ public class GroupService {
|
|||
Redis.use("group1_db11").hincrBy(p_key, "cache_ver", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩法禁止娱乐
|
||||
*
|
||||
* @param groupId
|
||||
* @throws Exception
|
||||
*/
|
||||
public static final void banMemberPlay(int groupId, String pids, int uid) throws Exception {
|
||||
log.info("banPlay pid:" + pids + " member:" + uid);
|
||||
Redis.use("group1_db2").hset("genusersplay", uid + "",
|
||||
pids.replace("[", "").replace("]", "").replaceAll(" ", ""));
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩法禁止娱乐
|
||||
*
|
||||
* @param groupId
|
||||
* @throws Exception
|
||||
*/
|
||||
public static final void cleanMemberPlay(int groupId, int uid) throws Exception {
|
||||
log.info("cleanPlay member:" + uid);
|
||||
Redis.use("group1_db2").hdel("genusersplay", uid + "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩法禁止娱乐
|
||||
*
|
||||
* @param groupId
|
||||
* @throws Exception
|
||||
*/
|
||||
public static final ITArray getMemberPlayList(int groupId, int uid) throws Exception {
|
||||
log.info("cleanPlay member:" + uid);
|
||||
String list = Redis.use("group1_db2").hget("genusersplay", uid + "");
|
||||
ITArray arr = TArray.newInstance();
|
||||
if (list != null && list.length() != 0) {
|
||||
String[] pids = list.split(",");
|
||||
if (pids.length > 0) {
|
||||
for (int i = 0; i < pids.length; i++) {
|
||||
arr.addInt(Integer.parseInt(pids[i]));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 标识玩法
|
||||
*
|
||||
|
|
@ -5649,18 +5745,21 @@ public class GroupService {
|
|||
|
||||
public static void sp_add_member(int groupId, int mgn_uid, int tagId) {
|
||||
try {
|
||||
String sql = String.format("select count(1) from group_member where uid = %s AND groupId = %s for update",tagId,groupId);
|
||||
String sql = String.format("select count(1) from group_member where uid = %s AND groupId = %s for update",
|
||||
tagId, groupId);
|
||||
ITArray arr = DataBase.use().executeQueryByTArray(sql);
|
||||
if (arr.size() > 0) {
|
||||
throw new WebException(ErrorCode.GROUP_MEMBER_EXIST);
|
||||
}else {
|
||||
log.info("录入group_member: tagId-"+tagId+",parentId-"+mgn_uid);
|
||||
String addSql = String.format("INSERT INTO group_member(uid,groupId,join_time,parentId) VALUES(%s,%s,%s,%s)",tagId,groupId,System.currentTimeMillis(),mgn_uid);
|
||||
} else {
|
||||
log.info("录入group_member: tagId-" + tagId + ",parentId-" + mgn_uid);
|
||||
String addSql = String.format(
|
||||
"INSERT INTO group_member(uid,groupId,join_time,parentId) VALUES(%s,%s,%s,%s)", tagId, groupId,
|
||||
System.currentTimeMillis(), mgn_uid);
|
||||
DataBase.use().executeUpdate(addSql);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
log.error("加入成员失败", e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ public class Protocol {
|
|||
public static final String REGIST_LOGIN = "regist_login";
|
||||
|
||||
public static final String REGIST_LOGIN_2 = "regist_login_2";
|
||||
|
||||
|
||||
public static final String REGIST_LOGIN_3 = "regist_login_3";
|
||||
|
||||
|
||||
public static final String CHECK_UUID = "check_uuid";
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import java.util.UUID;
|
|||
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyuncs.utils.StringUtils;
|
||||
import com.data.bean.AccountBean;
|
||||
import com.data.bean.GameBean;
|
||||
|
|
@ -37,6 +38,7 @@ import com.mjlogin.MainServer;
|
|||
import com.mjlogin.Protocol;
|
||||
import com.mjlogin.WebInterceptor;
|
||||
import com.mjlogin.util.sms.RedisKey;
|
||||
import com.mjlogin.util.sms.WeChatOpenIdValidator;
|
||||
import com.taurus.core.entity.ITArray;
|
||||
import com.taurus.core.entity.ITObject;
|
||||
import com.taurus.core.entity.TArray;
|
||||
|
|
@ -255,6 +257,35 @@ public class AccountService extends Controller {
|
|||
StringBuffer sbf = new StringBuffer();
|
||||
httpUrl = httpUrl + "?" + httpArg;
|
||||
|
||||
try {
|
||||
// System.out.println("httpUrl:"+httpUrl);
|
||||
URL url = new URL(httpUrl);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.connect();
|
||||
InputStream is = connection.getInputStream();
|
||||
reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||
String strRead = reader.readLine();
|
||||
if (strRead != null) {
|
||||
sbf.append(strRead);
|
||||
while ((strRead = reader.readLine()) != null) {
|
||||
sbf.append("\n");
|
||||
sbf.append(strRead);
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
result = sbf.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String request(String httpUrl) {
|
||||
BufferedReader reader = null;
|
||||
String result = null;
|
||||
StringBuffer sbf = new StringBuffer();
|
||||
|
||||
try {
|
||||
URL url = new URL(httpUrl);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
|
|
@ -732,33 +763,6 @@ public class AccountService extends Controller {
|
|||
if (resultArray.size() == 0) {
|
||||
reqData.putInt("sex", Integer.parseInt(object.get("sex").toString().replaceAll("\"", "")));
|
||||
accountid = register(reqData);
|
||||
|
||||
// if (deviceCode == null) {
|
||||
// accountid = register(reqData);
|
||||
// } else {
|
||||
// reqData.putInt("sex", Integer.parseInt(object.get("sex").toString().replaceAll("\"", "")));
|
||||
// reqData.putString("portrait", object.get("portrait").toString().replaceAll("\"", ""));
|
||||
// reqData.putString("nick", object.get("nick").toString().replaceAll("\"", ""));
|
||||
// reqData.putUtfString("acc", acc);
|
||||
// reqData.putUtfString("deviceCode", deviceCode);
|
||||
// // 判断是否有相同的设备id
|
||||
//
|
||||
// String sqld = "SELECT * FROM account WHERE device_code =?";
|
||||
// String[] paramsd = new String[1];
|
||||
// paramsd[0] = deviceCode;
|
||||
// ITArray resultArrayd = DataBase.use().executeQueryByTArrayLogin(sqld, paramsd);
|
||||
// if (resultArrayd.size() == 1) {
|
||||
// // 自动同步id
|
||||
// ITObject objd = resultArrayd.getTObject(0);
|
||||
// accountid = objd.getInt("id");
|
||||
// String updateDeviceCodeSql = "update account set acc ='" + acc + "',is_bangding =1 where id="
|
||||
// + accountid;
|
||||
// DataBase.use().executeUpdate(updateDeviceCodeSql);
|
||||
// isBangding = 1;
|
||||
// } else {
|
||||
// accountid = register(reqData);
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
ITObject obj = resultArray.getTObject(0);
|
||||
accountid = obj.getInt("id");
|
||||
|
|
@ -808,18 +812,6 @@ public class AccountService extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
// String passwordsql = String.format("SELECT password FROM account WHERE id ='%d'", acc_bean.id);
|
||||
// ITArray passwordArray = DataBase.use().executeQueryByTArray(passwordsql);
|
||||
// if (passwordArray.size() > 0) {
|
||||
// ITObject userData = passwordArray.getTObject(0);
|
||||
// String password = userData.getString("password");
|
||||
// if (password == null || password.length() == 0) {
|
||||
// havePassword = false;
|
||||
// } else {
|
||||
// havePassword = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
String idPwdBan = Redis.use("group1_db0").get(acc_bean.id + "_login_ban");
|
||||
if (StringUtil.isNotEmpty(idPwdBan)) {
|
||||
logger.error("id:" + acc_bean.id + " ban login");
|
||||
|
|
@ -858,7 +850,7 @@ public class AccountService extends Controller {
|
|||
// String[] params3 = new String[2];
|
||||
// params3[0] = 1 + "";
|
||||
// params3[1] = accountid + "";
|
||||
//
|
||||
//
|
||||
// DataBase.use().executeUpdateLogin(lockSql, params3);
|
||||
|
||||
this.sendResponse(ErrorCode._SUCC, resData);
|
||||
|
|
@ -1540,7 +1532,7 @@ public class AccountService extends Controller {
|
|||
System.currentTimeMillis() / 1000);
|
||||
|
||||
DataBase.use().executeUpdate(loginSql);
|
||||
|
||||
|
||||
// // 默认锁住账户
|
||||
// String lockSql = "update account set is_lock=? WHERE id=?";
|
||||
// String[] params3 = new String[2];
|
||||
|
|
@ -1549,7 +1541,6 @@ public class AccountService extends Controller {
|
|||
//
|
||||
// DataBase.use().executeUpdateLogin(lockSql, params3);
|
||||
|
||||
|
||||
this.sendResponse(ErrorCode._SUCC, resData);
|
||||
// }finally {
|
||||
// lock.unlock();
|
||||
|
|
@ -2722,6 +2713,151 @@ public class AccountService extends Controller {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密登录2
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@ActionKey(value = Protocol.REGIST_LOGIN_3)
|
||||
public final void login3() throws Exception {
|
||||
ITObject reqData = this.getParams();
|
||||
|
||||
String decryptedText = RSAUtils.decrypt(reqData.getString("data"));
|
||||
JsonObject object = new Gson().fromJson(decryptedText, JsonObject.class);
|
||||
logger.info("解密后:" + object);
|
||||
|
||||
String deviceCode = object.get("deviceCode").toString().replaceAll("\"", "");
|
||||
String code = object.get("code").toString().replaceAll("\"", "");
|
||||
String line = object.get("line").toString().replaceAll("\"", "");
|
||||
String deviceType = object.get("deviceType").toString().replaceAll("\"", "");
|
||||
String appLineKey = "appLine:line" + line;
|
||||
logger.info("appLineKey:" + appLineKey);
|
||||
String appid = Redis.use("group1_db1").hget(appLineKey, "appid_" + deviceType.toLowerCase());
|
||||
String appSecret = Redis.use("group1_db1").hget(appLineKey, "appSecret_" + deviceType.toLowerCase());
|
||||
JSONObject wechatObject = WeChatOpenIdValidator.getOpenIdByCode(code, appid, appSecret);
|
||||
String access_token = wechatObject.getString("access_token");
|
||||
|
||||
String acc = wechatObject.getString("unionid");
|
||||
logger.info("wechatObject请求成功:" + wechatObject);
|
||||
JSONObject userinfoObject = WeChatOpenIdValidator.getUserInfoByOpenId(access_token, acc);
|
||||
logger.info("userinfoObject请求成功:" + userinfoObject);
|
||||
|
||||
reqData.putUtfString("acc", acc);
|
||||
reqData.putUtfString("code", code);
|
||||
Jedis jedis0 = Redis.use("group1_db0").getJedis();
|
||||
RedisLock lock = new RedisLock("wx_" + code, jedis0);
|
||||
try {
|
||||
String sql = "SELECT * FROM account WHERE acc =?";
|
||||
String[] params = new String[1];
|
||||
params[0] = reqData.getUtfString("acc") + "";
|
||||
ITArray resultArray = DataBase.use().executeQueryByTArrayLogin(sql, params);
|
||||
|
||||
String strNick = userinfoObject.get("nickname").toString().replaceAll("\"", "");
|
||||
String portrait = userinfoObject.get("headimgurl").toString().replaceAll("\"", "");
|
||||
|
||||
strNick = StringUtil.filterEmoji(strNick);
|
||||
reqData.putUtfString("nick", strNick);
|
||||
reqData.putUtfString("portrait", portrait);
|
||||
|
||||
int accountid = 0;
|
||||
if (resultArray.size() == 0) {
|
||||
reqData.putInt("sex", Integer.parseInt(userinfoObject.get("sex").toString().replaceAll("\"", "")));
|
||||
accountid = register(reqData);
|
||||
} else {
|
||||
ITObject obj = resultArray.getTObject(0);
|
||||
accountid = obj.getInt("id");
|
||||
String updateDeviceCodeSql = "update account set device_code ='" + deviceCode + "' where id="
|
||||
+ accountid;
|
||||
DataBase.use().executeUpdate(updateDeviceCodeSql);
|
||||
|
||||
}
|
||||
|
||||
if (acc.equals(accountid + "")) {
|
||||
logger.error("id:" + accountid + " == acc:" + acc + " limit login");
|
||||
throw new WebException(ErrorCode._FAILED);
|
||||
}
|
||||
|
||||
AccountBean acc_bean = AccountCache.getAccount(accountid);
|
||||
if (acc_bean == null) {
|
||||
sql = String.format("SELECT * FROM account WHERE id =?");
|
||||
String[] params1 = new String[1];
|
||||
params1[0] = accountid + "";
|
||||
|
||||
ITArray resultArray2 = DataBase.use().executeQueryByTArrayLogin(sql, params1);
|
||||
if (resultArray2.size() == 0) {
|
||||
throw new WebException(ErrorCode._FAILED);
|
||||
}
|
||||
|
||||
ITObject userData = resultArray2.getTObject(0);
|
||||
UpdateUserData(userData, accountid);
|
||||
|
||||
acc_bean = AccountCache.getAccount(accountid);
|
||||
}
|
||||
String session = acc_bean.redis_key;
|
||||
this.setSession(session);
|
||||
|
||||
if (resultArray.size() > 0) {
|
||||
this.setSession(session);
|
||||
String old_nick = acc_bean.nick;
|
||||
String old_portrait = acc_bean.portrait;
|
||||
String new_nick = reqData.getUtfString("nick");
|
||||
String new_portrait = reqData.getUtfString("portrait");
|
||||
if (!old_nick.equals(new_nick) || !old_portrait.equals(new_portrait)) {
|
||||
ITObject userData = TObject.newInstance();
|
||||
userData.putUtfString("nick", userinfoObject.get("nickname").toString().replaceAll("\"", ""));
|
||||
userData.putUtfString("portrait", userinfoObject.get("headimgurl").toString().replaceAll("\"", ""));
|
||||
userData.putInt("sex", Integer.parseInt(userinfoObject.get("sex").toString().replaceAll("\"", "")));
|
||||
updateSession(reqData, accountid);
|
||||
}
|
||||
}
|
||||
|
||||
String idPwdBan = Redis.use("group1_db0").get(acc_bean.id + "_login_ban");
|
||||
if (StringUtil.isNotEmpty(idPwdBan)) {
|
||||
logger.error("id:" + acc_bean.id + " ban login");
|
||||
throw new WebException(ErrorCode.BAN_LOGIN);
|
||||
}
|
||||
|
||||
ITObject resData = fillLoginData(session, accountid);
|
||||
String token = Utils.getMD5Hash(acc + "_" + accountid + "_" + System.currentTimeMillis()
|
||||
+ "e4!Fesu]]{QyUuEA" + Math.random() * 1000000);
|
||||
|
||||
Redis.use("group1_db0").sadd(session + "_token", token);
|
||||
|
||||
Redis.use("group1_db0").hset(token, "user", session);
|
||||
Redis.use("group1_db0").hset(token, "create_time", "" + System.currentTimeMillis() / 1000);
|
||||
Redis.use("group1_db0").expire(token, 172800);
|
||||
|
||||
Set<String> allToken = Redis.use("group1_db0").smembers(session + "_token");
|
||||
for (String temp : allToken) {
|
||||
if (!Redis.use("group1_db0").exists(temp)) {
|
||||
Redis.use("group1_db0").srem(session + "_token", temp);
|
||||
logger.info("delte timeout token:" + temp);
|
||||
}
|
||||
}
|
||||
|
||||
long tokenNum = Redis.use("group1_db0").scard(session + "_token");
|
||||
if (tokenNum >= 10) {
|
||||
logger.warn("id:" + accountid + " repeat login, token count:" + tokenNum);
|
||||
}
|
||||
resData.putString("token", token);
|
||||
resData.putBoolean("havePassword", true);
|
||||
resData.putBoolean("havegroup", true);
|
||||
resData.putString("isBangding", "1");
|
||||
|
||||
// // 默认锁住账户
|
||||
// String lockSql = "update account set is_lock=? WHERE id=?";
|
||||
// String[] params3 = new String[2];
|
||||
// params3[0] = 1 + "";
|
||||
// params3[1] = accountid + "";
|
||||
//
|
||||
// DataBase.use().executeUpdateLogin(lockSql, params3);
|
||||
|
||||
this.sendResponse(ErrorCode._SUCC, resData);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String[] params1 = new String[2];
|
||||
params1[0] = "123" + "";
|
||||
|
|
|
|||
Loading…
Reference in New Issue