changhongserver/web_group/src/main/java/com/group/controller/GroupController.java

1623 lines
51 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.group.controller;
import java.util.Set;
import com.data.bean.AccountBean;
import com.data.bean.GroupBean;
import com.data.bean.GroupMemberBean;
import com.data.cache.AccountCache;
import com.data.cache.GroupCache;
import com.data.cache.GroupMemberCache;
import com.data.util.ErrorCode;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.group.Protocol;
import com.group.WebInterceptor;
import com.group.service.GroupLogService;
import com.group.service.GroupRoomService;
import com.group.service.GroupService;
import com.group.service.RSAUtils;
import com.taurus.core.entity.ITArray;
import com.taurus.core.entity.ITObject;
import com.taurus.core.entity.TObject;
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;
import redis.clients.jedis.Jedis;
public class GroupController extends Controller {
/**
* 获取圈子列表
*
* @throws Exception
*/
@ActionKey(value = Protocol.GET_GROUPS, validate = WebInterceptor.V_SESSION)
public final void getGroups() throws Exception {
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
logger.info("jefe_test: " + acc.id);
ITArray list = GroupService.getGroups(acc.id);
ITObject resData = TObject.newInstance();
resData.putTArray("groups", list);
sendResponse(0, resData);
}
/**
* 获取玩家列表
*
* @throws Exception
*/
@ActionKey(value = Protocol.GET_HP_TOTAL, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getHpTotal() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int tag = reqData.getInt("tagId");
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
ITObject resData = GroupService.getPersonHpTotal(groupId, acc.id, tag);
sendResponse(0, resData);
}
/**
* 获取玩家列表
*
* @throws Exception
*/
@ActionKey(value = Protocol.GET_GROUP_MEMBERS, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getMembers() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
int limit = reqData.getInt("limit");
int num = reqData.getInt("num");
// boolean minus_only = reqData.getBoolean("minus_only");
// int type = reqData.getInt("type");
ITObject resData = GroupService.getMembers(groupId, acc.id, limit, num);
sendResponse(0, resData);
}
/**
* 获取玩家列表
*
* @throws Exception
*/
@ActionKey(value = Protocol.GET_ALLPLAY, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getAllplays() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int uid = reqData.getInt("uid");
ITObject resData = GroupService.getAllplay(groupId, uid);
sendResponse(0, resData);
}
/**
* 设置屏蔽玩法列表
*
* @throws Exception
*/
@ActionKey(value = Protocol.SET_BANPLAY, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void setBanplays() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int uid = reqData.getInt("uid");
String bans = reqData.getString("bans");
GroupService.setBanplay(groupId, uid, bans);
this.sendResponse(0, null);
}
@ActionKey(value = Protocol.GET_MY_MEMBERS, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getMembers_1() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
int limit = reqData.getInt("limit");
int num = reqData.getInt("num");
int type = reqData.getInt("type"); // 1-我的成员 2-全部成员
int online = reqData.getInt("online");
int tagId = 0;
try {
tagId = reqData.getInt("tagId");
} catch (Exception e) {
}
if (tagId == 0) {
tagId = acc.id;
}
////////////////////////////////////////////////////////
ITObject resData = GroupService.getMembers_1(groupId, acc.id, tagId, 0, type, limit, num);
sendResponse(0, resData);
////////////////////////////////////////////////////////
}
@ActionKey(value = Protocol.GET_CHILD_MEMBERS, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getMembers_child() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
int limit = reqData.getInt("limit");
int num = reqData.getInt("num");
int type = 1; // = reqData.getInt("type"); //1-我的成员 2-全部成员
// int online = reqData.getInt("online");
int tagId = 0;
try {
tagId = reqData.getInt("tagId");// 目标查询id
} catch (Exception e) {
}
////////////////////////////////////////////////////////
ITObject resData = GroupService.getMembers_child(groupId, acc.id, tagId, 0, type, limit, num);
sendResponse(0, resData);
////////////////////////////////////////////////////////
}
@ActionKey(value = Protocol.GET_MEMBERS_COUNT, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getMembersCount() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
logger.info("查看盟主自身数据" + Protocol.GET_MEMBERS_COUNT);
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
////////////////////////////////////////////////////////
ITObject resData = GroupService.getMemberCount(groupId, acc.id);
sendResponse(0, resData);
////////////////////////////////////////////////////////
}
/**
* 查询成员
*
* @throws Exception
*/
@ActionKey(value = Protocol.FIND_MEMBER, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void findMember() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int uid = 0;
int groupId = 0;
int tagId = 0;
int tagtype = 0;
String tagName = StringUtil.Empty;
try {
uid = AccountCache.getAccount(session).id;
groupId = reqData.getInt("id");
tagId = reqData.containsKey("tagId") ? reqData.getInt("tagId") : 0;
tagName = reqData.containsKey("tagName") ? reqData.getUtfString("tagName") : StringUtil.Empty;
tagtype = reqData.containsKey("tagType") ? reqData.getInt("tagType") : 0;
} catch (Exception e) {
sendResponse(0, null);
return;
}
if (tagtype == 1) {
//
Integer parentid = GroupService.getParents(groupId, tagId);
logger.info("jefe parentid: " + parentid);
ITObject resData = GroupService.findMember(groupId, parentid, parentid, parentid.toString());
sendResponse(0, resData);
} else {
Integer parentid = GroupService.getParents(groupId, tagId);
ITObject resData = GroupService.findMember(groupId, uid, tagId, parentid.toString());
sendResponse(0, resData);
}
}
/**
* 查询成员
*
* @throws Exception
*/
/*
* @ActionKey(value = Protocol.FIND_MEMBER1, validate =
* WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.
* V_GROUP_MGR_OR_PARTNER) public final void findMember1() throws Exception{
* ITObject reqData = this.getParams(); int groupId = reqData.getInt("id"); int
* tagId = reqData.getInt("tagId"); ITObject resData =
* GroupService.findMember1(groupId,tagId); sendResponse(0, resData); }
*/
/**
* 获取合伙人
*
* @throws Exception
*/
/*
* @ActionKey(value = Protocol.GET_GROUP_PARTNERS, validate =
* WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.
* V_GROUP_MGR_OR_PARTNER) public final void getPartners() throws Exception {
* ITObject reqData = this.getParams(); int groupId = reqData.getInt("id");
* String session = this.getSession(); AccountBean acc =
* AccountCache.getAccount(session); int limit = reqData.getInt("limit"); int
* num = reqData.getInt("num"); int qid = reqData.getInt("qid"); ITObject
* resData = GroupService.getPartners(groupId,acc.id,limit,num,qid);
* sendResponse(0, resData); }
*/
/**
* 获取成员上级合伙人列表
*
* @throws Exception
*/
/*
* 容易被黑客关注获取到盟主ID
*
* @ActionKey(value = Protocol.GET_MEMBER_PARENTS, validate =
* WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.
* V_GROUP_MGR_OR_PARTNER) public final void getMemberParents() throws Exception
* { ITObject reqData = this.getParams(); int groupId = reqData.getInt("id");
* int tagId = reqData.getInt("tagId"); ITArray list =
* GroupService.getMemberParents(groupId, tagId); ITObject resData =
* TObject.newInstance(); resData.putTArray("parents", list); sendResponse(0,
* resData); }
*/
/**
* 获取邀请玩家列表
*
* @throws Exception
*/
/*
* @ActionKey(value = Protocol.GET_GROUP_JOINS, validate =
* WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR)
* public final void getGroupJoins() throws Exception { ITObject reqData =
* this.getParams(); int groupId = reqData.getInt("id");
*
* ITArray array = GroupService.getGroupJoins(groupId); ITObject resData = new
* TObject(); resData.putTArray("joins", array); sendResponse(ErrorCode._SUCC,
* resData); }
*/
/**
* 删除圈子
*
* @throws Exception
*/
/*
* @ActionKey(value = Protocol.DEL_GROUP, validate =
* WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_OWNER)
* public final void delGroup() throws Exception { String session =
* this.getSession(); ITObject reqData = this.getParams(); int groupId =
* reqData.getInt("id"); AccountBean acc = AccountCache.getAccount(session);
* GroupService.delGroup(groupId,acc.id); this.sendResponse(0, null); }
*/
/**
* 创建圈子
*
* @throws Exception
*/
@ActionKey(value = Protocol.CREATE_GROUP, validate = WebInterceptor.V_SESSION)
public final void createGroup() throws Exception {
String session = this.getSession();
ITObject reqData = this.getParams();
String name = reqData.getString("name").trim();
if (StringUtil.isEmpty(name)) {
throw new WebException(ErrorCode._FAILED);
}
name = StringUtil.filterEmoji(name);
if (StringUtil.isEmpty(name)) {
throw new WebException(ErrorCode._FAILED);
}
AccountBean acc = AccountCache.getAccount(session);
int type = reqData.getInt("type");
int pay_type = reqData.getInt("pay_type");
int num = 0;
if (reqData.containsKey("num")) {
num = reqData.getInt("num");
}
Jedis jedis0 = Redis.use("group1_db0").getJedis();
try {
String mng = jedis0.hget(acc.redis_key, "mng");
if (StringUtil.isEmpty(mng) || !mng.equals("2")) {
throw new WebException(ErrorCode._FAILED);
}
} finally {
jedis0.close();
}
ITObject info = GroupService.createGroup(name, acc.id, type, pay_type, num);
if (info != null) {
ITObject resData = TObject.newInstance();
resData.putTObject("info", info);
this.sendResponse(0, resData);
} else {
throw new WebException(ErrorCode._FAILED);
}
}
/**
* 创建圈子
*
* @throws Exception
*/
/*
* @ActionKey(value = Protocol.STICK_GROUP, validate =
* WebInterceptor.V_SESSION|WebInterceptor.V_GROUP) public final void topGroup()
* throws Exception { String session = this.getSession(); ITObject reqData =
* this.getParams(); int groupId = reqData.getInt("id"); boolean top =
* reqData.getBoolean("top"); AccountBean acc =
* AccountCache.getAccount(session); int top_time
* =GroupService.topGroup(groupId, acc.id, top);
*
* ITObject resData = TObject.newInstance(); resData.putInt("top_time",
* top_time); this.sendResponse(0, resData); }
*/
/**
* 进入圈子
*
* @throws Exception
*/
@ActionKey(value = Protocol.ENTER_GROUP, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP)
public final void enterGroup() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
AccountBean acc = AccountCache.getAccount(session);
ITObject tem = GroupService.enterGroup(groupId, acc.id);
if (tem == null) {
throw new WebException(ErrorCode._FAILED);
}
// ITObject resData = TObject.newInstance();
// resData.putString("host", tem.getString("host"));
// ITArray arr = GroupService.getPlayList(groupId);
// resData.putTArray("playList", arr);
this.sendResponse(0, tem);
}
/**
* 进入圈子
*
* @throws Exception
*/
@ActionKey(value = Protocol.ENTER_GROUP_3, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP)
public final void enterGroup3() throws Exception {
ITObject reqData = this.getParams();
String decryptedText = RSAUtils.decrypt(reqData.getString("data"));
JsonObject object = new Gson().fromJson(decryptedText, JsonObject.class);
String deviceCode = object.get("deviceCode").toString().replaceAll("\"", "");
Integer id = Integer.parseInt(object.get("id").toString().replaceAll("\"", ""));
Jedis jedis1 = Redis.use("group1_db1").getJedis();
try {
Set<String> banDeviceList = jedis1.smembers("bandevice");
// logger.info("banDeviceList:" + banDeviceList);
for (String banDevice : banDeviceList) {
if (banDevice.equalsIgnoreCase(deviceCode)) {
throw new WebException(ErrorCode._FAILED);
}
}
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
// if(acc.id==100095) {
// Set<String> canDeviceList = jedis1.smembers("candevice");
//// logger.info("banDeviceList:" + banDeviceList);
//
// for (String canDevice : canDeviceList) {
// if (!canDevice.equalsIgnoreCase(deviceCode)) {
// throw new WebException(ErrorCode._FAILED);
// }
// }
// }
ITObject tem = GroupService.enterGroup(id, acc.id);
if (tem == null) {
throw new WebException(ErrorCode._FAILED);
}
// ITObject resData = TObject.newInstance();
// resData.putString("host", tem.getString("host"));
// ITArray arr = GroupService.getPlayList(groupId);
// resData.putTArray("playList", arr);
this.sendResponse(0, tem);
} finally {
jedis1.close();
}
}
/**
* 退出圈子
*
* @throws Exception
*/
/*
* @ActionKey(value = Protocol.EXIT_GROUP, validate =
* WebInterceptor.V_SESSION|WebInterceptor.V_GROUP) public final void
* exitGroup() throws Exception{ ITObject reqData = this.getParams(); String
* session = this.getSession(); int groupId = reqData.getInt("id"); AccountBean
* acc = AccountCache.getAccount(session); GroupService.exitGroup(groupId,
* acc.id); this.sendResponse(0, null); }
*/
/**
* 创建圈子玩法
*
* @throws Exception
*/
@ActionKey(value = Protocol.ADD_PLAY, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_OWNER)
public final void addPlay() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int hpOnOff = reqData.getInt("hpOnOff");
int groupType = reqData.getInt("gtype");
if (hpOnOff == 0 && groupType == 2) {
throw new WebException(ErrorCode.GROUP_TYPE2_MUST_HP);
}
int gameId = reqData.getInt("gameId");
ITObject config = reqData.getTObject("config");
String name = reqData.getString("name");
int deskId = reqData.containsKey("deskId") ? reqData.getInt("deskId") : 0;
ITObject hpData = reqData.getTObject("hpData");
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
ITObject obj = GroupService.addPlay(groupId, gameId, name, deskId, config, hpData, hpOnOff, acc.id);
this.sendResponse(0, obj);
}
/**
* 创建圈子玩法
*
* @throws Exception
*/
@ActionKey(value = Protocol.UPDATE_PLAY, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR | WebInterceptor.V_GROUP_PLAY)
public final void updatePlay() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int groupType = reqData.getInt("gtype");
int hpOnOff = reqData.getInt("hpOnOff");
if (hpOnOff == 0 && groupType == 2) {
throw new WebException(ErrorCode.GROUP_TYPE2_MUST_HP);
}
int pid = reqData.getInt("pid");
int gameId = reqData.getInt("gameId");
ITObject config = reqData.getTObject("config");
String name = reqData.getString("name");
ITObject hpData = reqData.getTObject("hpData");
int deskId = reqData.containsKey("deskId") ? reqData.getInt("deskId") : 0;
GroupService.updatePlay(groupId, pid, gameId, name, deskId, config, hpData, hpOnOff);
int maxPlayers = config.getInt("maxPlayers");
int maxRound = config.getInt("maxRound");
ITObject params = TObject.newInstance();
params.putInt("maxPlayers", maxPlayers);
params.putInt("maxRound", maxRound);
this.sendResponse(0, params);
}
/**
* 删除圈子玩法
*
* @throws Exception
*/
@ActionKey(value = Protocol.DEL_PLAY, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_OWNER | WebInterceptor.V_GROUP_PLAY)
public final void delPlay() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int pid = reqData.getInt("pid");
int result = GroupService.delPlay(groupId, pid);
this.sendResponse(result, null);
}
/**
* 加入圈子
*
* @throws Exception
*/
/*
* @ActionKey(value = Protocol.JOIN_GROUP, validate = WebInterceptor.V_SESSION)
* public final void applyGroup() throws Exception { String session =
* this.getSession(); ITObject reqData = this.getParams(); AccountBean acc =
* AccountCache.getAccount(session); int result =
* GroupService.applyGroup(reqData.getInt("id"), acc.id); sendResponse(result,
* null); }
*/
/**
* 审核加入圈子
*
* @throws Exception
*/
/*
* @ActionKey(value = Protocol.VERIFY_JOIN_GROUP, validate =
* WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR)
* public final void verifyJoinGroup() throws Exception { String session =
* this.getSession(); ITObject reqData = this.getParams(); AccountBean acc =
* AccountCache.getAccount(session); int uid = acc.id; int groupId =
* reqData.getInt("id"); int tagId = reqData.getInt("tagId"); if(acc.id ==
* tagId) { throw new WebException(ErrorCode._FAILED); } boolean allow =
* reqData.getBoolean("allow"); int result
* =GroupService.verifyJoinGroup(groupId, uid, tagId, allow); if(result!=0) {
* throw new WebException(result); } this.sendResponse(0, null); }
*/
/**
* 添加成员
*
* @throws Exception
*/
@ActionKey(value = Protocol.GET_PLAYER_INFO, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP)
public final void getPlayerInfo() throws Exception {
ITObject reqData = this.getParams();
int tagId = reqData.getInt("tagId");
AccountBean acc = AccountCache.getAccount(tagId);
if (acc == null) {
sendResponse(ErrorCode._FAILED, null);
return;
}
ITObject obj = TObject.newInstance();
obj.putInt("uid", tagId);
obj.putString("nick", acc.nick);
obj.putString("portrait", acc.portrait);
sendResponse(0, obj);
}
/**
* 添加成员
*
* @throws Exception
*/
@ActionKey(value = Protocol.INVITE_GROUP_MEMBER, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void addMember() throws Exception {
String session = this.getSession();
ITObject reqData = this.getParams();
AccountBean acc = AccountCache.getAccount(session);
int groupId = reqData.getInt("id");
int tagId = reqData.getInt("tagId");
if (acc.id == tagId) {
throw new WebException(ErrorCode._FAILED);
}
int result = GroupService.addMember(groupId, acc.id, tagId);
if (result != 0) {
throw new WebException(result);
}
this.sendResponse(0, null);
}
/**
* 删除成员
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_KICK, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void delMember() throws Exception {
String session = this.getSession();
ITObject reqData = this.getParams();
AccountBean acc = AccountCache.getAccount(session);
int groupId = reqData.getInt("id");
int tagId = reqData.getInt("tagId");
if (acc.id == tagId) {
throw new WebException(ErrorCode._FAILED);
}
GroupService.delMember(groupId, acc.id, tagId);
this.sendResponse(0, null);
}
@ActionKey(value = Protocol.GET_KICK_LOG, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getKickLog() throws Exception {
String session = this.getSession();
ITObject reqData = this.getParams();
AccountBean acc = AccountCache.getAccount(session);
int groupId = reqData.getInt("id");
int limit = reqData.getInt("limit");
int num = reqData.getInt("num");
ITArray arr = GroupService.getKickLog(groupId, acc.id, limit, num);
ITObject rspData = new TObject();
rspData.putTArray("data", arr);
this.sendResponse(0, rspData);
logger.info("getKickLog: " + rspData);
}
/**
* 禁止娱乐
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_BAN_MEMBER, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void banMember() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int tagId = reqData.getInt("tagId");
int ban = reqData.getInt("ban");
int optType = reqData.getInt("opType");
AccountBean acc = AccountCache.getAccount(session);
GroupService.banMember(groupId, acc.id, tagId, optType, ban);
this.sendResponse(0, null);
}
/**
* 禁止娱乐
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_BLACK_MEMBER, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP)
public final void blackMember() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int tagId = reqData.getInt("tagId");
int ban = reqData.getInt("ban");
int ban_rate = reqData.getInt("ban_rate");
int ban_value = reqData.getInt("ban_max_value");
int optType = reqData.getInt("opType");
AccountBean acc = AccountCache.getAccount(session);
if (acc.id == tagId) {
throw new WebException(ErrorCode.GROUP_NOT_PERMISSION);
}
GroupService.blackMember(groupId, acc.id, tagId, optType, ban, ban_rate, ban_value);
// GroupService.blackPartner(groupId,acc.id, tagId, optType, ban, ban_rate,
// ban_value);
ITObject resData = TObject.newInstance();
resData.putInt("ban", ban);
resData.putInt("playerid", acc.id);
resData.putInt("groupid", groupId);
resData.putInt("ban_rate", ban_rate);
resData.putInt("ban_max_value", ban_value);
resData.putInt("ban_value", 0);
this.sendResponse(0, resData);
}
/**
* 禁止娱乐
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_GET_BLACK_MEMBER, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getBlackMember() throws Exception {
ITObject reqData = this.getParams();
logger.info("set begin:" + reqData);
String session = this.getSession();
int groupId = reqData.getInt("id");
int tagId = reqData.getInt("tagId");
String gm_key = GroupMemberCache.genKey(groupId, tagId);
ITObject resData = TObject.newInstance();
Jedis jedis10 = Redis.use("group1_db10").getJedis();
try {
String black_key = jedis10.hget(gm_key, "group_black_key");
if (StringUtil.isEmpty(black_key)) {
black_key = gm_key;
}
String black = jedis10.hget(black_key, "black");
String group_black = jedis10.hget(black_key, "group_black");
String black_rate = jedis10.hget(black_key, "group_black_rate");
if (StringUtil.isEmpty(black_rate)) {
black_rate = "0";
}
String black_max_value = jedis10.hget(black_key, "group_black_max_value");
if (StringUtil.isEmpty(black_max_value)) {
black_max_value = "0";
}
String black_value = jedis10.hget(black_key, "group_black_now_value");
if (StringUtil.isEmpty(black_value)) {
black_value = "0";
}
resData.putInt("ban_rate", Integer.parseInt(black_rate));
resData.putInt("ban_max_value", Integer.parseInt(black_max_value));
resData.putInt("ban_value", Integer.parseInt(black_value));
if (StringUtil.isNotEmpty(black) && black.equals("0")) {
resData.putInt("black", 0);
} else if (StringUtil.isNotEmpty(black) && black.equals("1")) {
resData.putInt("black", 1);
} else if (StringUtil.isNotEmpty(black) && black.equals("2")) {
resData.putInt("black", 2);
} else {
resData.putInt("black", 0);
}
if (StringUtil.isNotEmpty(group_black) && group_black.equals("0")) {
resData.putInt("group_black", 0);
} else if (StringUtil.isNotEmpty(group_black) && group_black.equals("1")) {
resData.putInt("group_black", 1);
} else if (StringUtil.isNotEmpty(group_black) && group_black.equals("2")) {
resData.putInt("group_black", 2);
} else {
resData.putInt("group_black", 0);
}
} finally {
jedis10.close();
}
logger.info("set end:" + reqData);
resData.putInt("playerid", tagId);
resData.putInt("groupid", groupId);
this.sendResponse(0, resData);
}
/**
* 玩法禁止娱乐
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_BAN_PLAY, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_OWNER | WebInterceptor.V_GROUP_PLAY)
public final void banPlay() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int pid = reqData.getInt("pid");
int ban = reqData.getInt("ban");
GroupService.banPlay(groupId, pid, ban);
this.sendResponse(0, null);
}
/**
* 标识玩法
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_MARK_PLAY, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_OWNER | WebInterceptor.V_GROUP_PLAY)
public final void markPlay() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int pid = reqData.getInt("pid");
boolean mark = reqData.getBoolean("mark");
int iMark = mark ? 1 : 0;
int count = GroupService.getMarkedPlayCount(groupId);
if (iMark == 1) {
if (count >= 5) {
this.sendResponse(1, null);
return;
}
}
logger.info("GROUP_MARK_PLAY count = " + count);
GroupService.markPlay(groupId, pid, iMark);
logger.info("GROUP_MARK_PLAY count ================> OK");
this.sendResponse(0, null);
}
/**
* 更改圈子信息
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_UPDATE_INFO, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_OWNER)
public final void updateGroupInfo() throws Exception {
ITObject reqData = this.getParams();
String name = reqData.getString("name").trim();
if (StringUtil.isEmpty(name)) {
throw new WebException(ErrorCode._FAILED);
}
name = StringUtil.filterEmoji(name);
if (StringUtil.isEmpty(name)) {
throw new WebException(ErrorCode._FAILED);
}
int groupId = reqData.getInt("id");
// boolean ban = reqData.getBoolean("ban");
// String notice = reqData.getString("notice");
//// boolean ban_ip = reqData.getBoolean("ban_ip");
//// boolean ban_gps = reqData.getBoolean("ban_gps");
// int dissolve_opt = reqData.getInt("dissolve_opt");
// int kick_opt = reqData.getInt("kick_opt");
// int ban_apply = reqData.getInt("ban_apply");
GroupService.updateGroupInfo(groupId, name, reqData);
this.sendResponse(0, null);
}
/**
* 更改圈子信息
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_SET_MEMBER_MGR, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_OWNER)
public final void updateMgrLev() throws Exception {
String session = this.getSession();
ITObject reqData = this.getParams();
int tagId = reqData.getInt("tagId");
AccountBean acc = AccountCache.getAccount(session);
if (acc.id == tagId) {
throw new WebException(ErrorCode._FAILED);
}
int groupId = reqData.getInt("id");
// 1 设置管理员 2 取消管理员
int opt = reqData.getInt("opt");
ITObject resData = GroupService.updateMemberMgr(groupId, tagId, opt);
this.sendResponse(0, resData);
}
/**
* 更改圈子信息
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_SET_PARTNER, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void setParent() throws Exception {
String session = this.getSession();
ITObject reqData = this.getParams();
int tagId = reqData.getInt("tagId");
AccountBean acc = AccountCache.getAccount(session);
if (acc.id == tagId) {
throw new WebException(ErrorCode._FAILED);
}
int groupId = reqData.getInt("id");
// 1 设置管理员 2 取消管理员
int opt = reqData.getInt("opt");
ITObject resData = TObject.newInstance();
if (opt == 2) {
resData = GroupService.cancelParent(groupId, acc.id, tagId);
} else {
resData = GroupService.setParent(groupId, acc.id, tagId);
}
this.sendResponse(0, resData);
}
/**
* 设置玩法奖励
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_SET_REWARD, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void setReward() throws Exception {
String session = this.getSession();
ITObject reqData = this.getParams();
int tagId = reqData.getInt("tagId");
AccountBean acc = AccountCache.getAccount(session);
if (acc.id == tagId) {
throw new WebException(ErrorCode._FAILED);
}
int groupId = reqData.getInt("id");
int value = reqData.getInt("value");
int pid = reqData.getInt("pid");
int partnerLev = reqData.getInt("partnerLev");
boolean all = reqData.getBoolean("all");
int isSingle = 0;
try {
isSingle = reqData.getInt("single"); // 0:all 1:单局
} catch (Exception e) {
}
int result = GroupService.setReward(groupId, acc.id, tagId, partnerLev, pid, value, all, isSingle);
this.sendResponse(result, null);
}
/**
* 设置洗牌玩法奖励
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_SET_XIPAI_REWARD, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void setXiPaiReward() throws Exception {
String session = this.getSession();
ITObject reqData = this.getParams();
int tagId = reqData.getInt("tagId");
AccountBean acc = AccountCache.getAccount(session);
if (acc.id == tagId) {
throw new WebException(ErrorCode._FAILED);
}
int groupId = reqData.getInt("id");
int value = reqData.getInt("value");
int pid = reqData.getInt("pid");
int partnerLev = reqData.getInt("partnerLev");
boolean all = reqData.getBoolean("all");
int isSingle = 0;
try {
isSingle = reqData.getInt("single"); // 0:all 1:单局
} catch (Exception e) {
}
int result = GroupService.setXiPaiReward(groupId, acc.id, tagId, partnerLev, pid, value, all, isSingle);
this.sendResponse(result, null);
}
/**
* 获取玩法奖励列表
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_GET_REWARDS, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getRewards() throws Exception {
String session = this.getSession();
ITObject reqData = this.getParams();
int tagId = reqData.getInt("tagId");
AccountBean acc = AccountCache.getAccount(session);
// if(acc.id == tagId) {
// throw new WebException(ErrorCode._FAILED);
// }
int groupId = reqData.getInt("id");
int partnerLev = reqData.getInt("partnerLev");
ITObject resData = TObject.newInstance();
GroupService.getRewards(groupId, acc.id, tagId, partnerLev, resData);
this.sendResponse(0, resData);
;
}
/**
* 更新我成员体力值
*
* @throws Exception
*/
@ActionKey(value = Protocol.UPDATE_MEMBER_HP, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER | WebInterceptor.V_GROUP_CHECK_ROOM)
public final void updateMemberHp() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int hp = 0;
try {
hp = reqData.getInt("hp");
} catch (Exception e) {
logger.info("jefe_test: " + e);
throw new WebException(ErrorCode._FAILED);
}
if (hp == 0) {
throw new WebException(ErrorCode._FAILED);
}
Jedis jedis10 = Redis.use("group1_db10").getJedis();
int tag = reqData.getInt("tag");
AccountBean acc = AccountCache.getAccount(session);
try {
// 正在游戏不允许下分操作
if (hp < 0) {
if (GroupRoomService.checkRoom(groupId, acc.id)) {
throw new WebException(ErrorCode.GROUP_DONOT_SUB_HP);
}
if (GroupRoomService.checkRoom(groupId, tag)) {
throw new WebException(ErrorCode.GROUP_DONOT_SUB_HP);
}
}
String uidKey = GroupMemberCache.genKey(groupId, acc.id);
long uid_hp = Long.parseLong(jedis10.hget(uidKey, "hp"));
if (uid_hp > Integer.MAX_VALUE) {
throw new WebException(ErrorCode.GROUP_PARTNER_HP_THAN_LIMIET);
}
String tagKey = GroupMemberCache.genKey(groupId, tag);
long tag_hp = Long.parseLong(jedis10.hget(tagKey, "hp"));
if (tag_hp > Integer.MAX_VALUE) {
throw new WebException(ErrorCode.GROUP_PARTNER_OTHER_HP_THAN_LIMIET);
}
if (acc.id != tag) {
if (hp < 0) {
if ((long) uid_hp + (long) Math.abs(hp) > Integer.MAX_VALUE) {
throw new WebException(ErrorCode.GROUP_PARTNER_HP_THAN_LIMIET);
}
if ((long) tag_hp < Math.abs(hp)) {
throw new WebException(ErrorCode.GROUP_LIMIT_NO_HP);
}
} else if (hp > 0) {
if ((long) uid_hp < hp) {
throw new WebException(ErrorCode.GROUP_LIMIT_NO_HP);
}
if ((long) tag_hp + (long) Math.abs(hp) > Integer.MAX_VALUE) {
throw new WebException(ErrorCode.GROUP_PARTNER_OTHER_HP_THAN_LIMIET);
}
}
GroupMemberBean mng_bean = GroupCache.getMember(groupId, acc.id);
if (mng_bean != null && mng_bean.lev == 1) {
GroupService.updateMemberHp(groupId, acc.id, acc.id, -hp, true, tag);
}
} else {
if (hp < 0) {
if ((long) uid_hp < Math.abs(hp)) {
throw new WebException(ErrorCode.GROUP_LIMIT_NO_HP);
}
} else if (hp > 0) {
if ((long) uid_hp + (long) Math.abs(hp) > Integer.MAX_VALUE) {
throw new WebException(ErrorCode.GROUP_PARTNER_HP_THAN_LIMIET);
}
}
}
} catch (Exception e) {
throw e;
} finally {
jedis10.close();
}
ITObject resData = GroupService.updateMemberHp(groupId, acc.id, tag, hp, false, 0);
this.sendResponse(0, resData);
}
/**
* 更新我成员体力值
*
* @throws Exception
*/
@ActionKey(value = Protocol.UPDATE_MEMBER_SCORE, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER | WebInterceptor.V_GROUP_CHECK_ROOM)
public final void updateMemberScore() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int score = reqData.getInt("score");
int tag = reqData.getInt("tag");
AccountBean acc = AccountCache.getAccount(session);
GroupService.updateMemberScore(groupId, acc.id, tag, score);
this.sendResponse(0, null);
}
/**
* 更新我成员体力值
*
* @throws Exception
*/
@ActionKey(value = Protocol.UPDATE_MEMBER_QUEUEID, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER | WebInterceptor.V_GROUP_CHECK_ROOM)
public final void updateMemberQueueid() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int queueid = reqData.getInt("queueid");
int tag = reqData.getInt("tag");
AccountBean acc = AccountCache.getAccount(session);
GroupService.updateMemberQueue(groupId, acc.id, tag, queueid);
this.sendResponse(0, null);
}
// /**
// * 调控幸运值
// *
// * @throws Exception
// */
// @ActionKey(value = Protocol.UPDATE_MEMBER_DIAOKONG, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
// | WebInterceptor.V_GROUP_MGR_OR_PARTNER | WebInterceptor.V_GROUP_CHECK_ROOM)
// public final void updateMemberDiaokong() throws Exception {
// ITObject reqData = this.getParams();
// String session = this.getSession();
// int groupId = reqData.getInt("id");
// int queueid = reqData.getInt("queueid");
//
// int tag = reqData.getInt("tag");
// AccountBean acc = AccountCache.getAccount(session);
// GroupService.updateMemberDiaokong(groupId, acc.id, tag, queueid);
// this.sendResponse(0, null);
// }
/**
* 更新我成员查看值
*
* @throws Exception
*/
@ActionKey(value = Protocol.UPDATE_MEMBER_SEEID, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER | WebInterceptor.V_GROUP_CHECK_ROOM)
public final void updateMemberSeeid() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int seeid = reqData.getInt("seeid");
int tag = reqData.getInt("tag");
AccountBean acc = AccountCache.getAccount(session);
GroupService.updateMemberSee(groupId, acc.id, tag, seeid);
this.sendResponse(0, null);
}
/**
* 获取能量包信息
*
* @throws Exception
*/
@ActionKey(value = Protocol.TRADE_TAKE_INFO, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_OWNER_OR_MGR_OR_PARTNER)
public final void getTakeInfo() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int tagId = 0;
try {
tagId = reqData.getInt("tagId");
} catch (Exception e) {
}
AccountBean acc = AccountCache.getAccount(session);
if (tagId == 0) {
tagId = acc.id;
}
ITObject resData = GroupService.getTakeInfo(groupId, acc.id, tagId);
this.sendResponse(0, resData);
}
/**
* 提取体力值
*
* @throws Exception
*/
@ActionKey(value = Protocol.TAKE_HP, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_CHECK_ROOM | WebInterceptor.V_GROUP_OWNER_OR_MGR_OR_PARTNER)
public final void takeHp() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int hp = reqData.getInt("hp");
AccountBean acc = AccountCache.getAccount(session);
int tagId = 0;
try {
tagId = reqData.getInt("tagId");
} catch (Exception e) {
}
if (tagId == 0) {
tagId = acc.id;
}
ITObject resData = GroupService.takeHp(groupId, acc.id, tagId, hp);
this.sendResponse(0, resData);
}
/**
* 盟主强行提取体力值
*
* @throws Exception
*/
@ActionKey(value = Protocol.GROUP_TAKE_HP, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_OWNER)
public final void groupTakeHp() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int tagId = reqData.getInt("tagId");
AccountBean acc = AccountCache.getAccount(session);
GroupService.groupTakeHp(groupId, acc.id, tagId);
this.sendResponse(0, null);
}
@ActionKey(value = Protocol.GET_BANK_HP, validate = WebInterceptor.V_SESSION
| WebInterceptor.V_GROUP/* |WebInterceptor.V_GROUP_PARTNER */)
public final void getBankHp() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
AccountBean acc = AccountCache.getAccount(session);
int tagId = 0;
try {
tagId = reqData.getInt("tagId");
} catch (Exception e) {
}
if (tagId == 0) {
tagId = acc.id;
}
ITObject resData = GroupService.getBankInfo(groupId, acc.id, tagId);
this.sendResponse(0, resData);
}
@ActionKey(value = Protocol.TAKE_BANK_HP, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_CHECK_ROOM/* |WebInterceptor.V_GROUP_PARTNER */)
public final void takeBankHp() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int hp = reqData.getInt("hp");
AccountBean acc = AccountCache.getAccount(session);
int tagId = 0;
try {
tagId = reqData.getInt("tagId");
} catch (Exception e) {
}
if (tagId == 0) {
tagId = acc.id;
}
ITObject resData = GroupService.takeBankHp(groupId, acc.id, tagId, hp);
this.sendResponse(0, resData);
}
@ActionKey(value = Protocol.SAVE_BANK_HP, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_CHECK_ROOM/* |WebInterceptor.V_GROUP_PARTNER */)
public final void saveBankHp() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int hp = reqData.getInt("hp");
AccountBean acc = AccountCache.getAccount(session);
int tagId = 0;
try {
tagId = reqData.getInt("tagId");
} catch (Exception e) {
}
if (tagId == 0) {
tagId = acc.id;
}
ITObject resData = GroupService.saveBankHp(groupId, acc.id, tagId, hp);
this.sendResponse(0, resData);
}
/**
* 分配成员
*
* @throws Exception
*/
/*
* @ActionKey(value = Protocol.DISTRIBUTE_MEMBER, validate =
* WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.V_GROUP_MGR)
* public final void distributeMember() throws Exception { ITObject reqData =
* this.getParams(); int groupId = reqData.getInt("id"); int parId =
* reqData.getInt("parId"); int tagId = reqData.getInt("tagId");
* GroupService.distributeMember(groupId, parId, tagId); this.sendResponse(0,
* null); }
*/
/**
* 获取合伙人管理列表
*
* @throws Exception
*/
@ActionKey(value = Protocol.GET_PARTNER_INFOS, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void getPartnerInfos() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int limit = 0;
int num = 0;
int simpleAll = reqData.getInt("simple_all");
if (simpleAll == 0) {
limit = reqData.getInt("limit");
num = reqData.getInt("num");
}
boolean diff = false;
int tagId = 0;
try {
tagId = reqData.getInt("tagId");
if (tagId > 0) {
diff = true;
}
} catch (Exception e) {
}
AccountBean acc = AccountCache.getAccount(session);
if (tagId == 0) {
tagId = acc.id;
}
ITObject resData = GroupService.getPartnerInfos(groupId, acc.id, tagId, limit, num, simpleAll, diff);
sendResponse(0, resData);
}
/**
* 获取合伙人管理列表
*
* @throws Exception
*/
@ActionKey(value = Protocol.QUERY_PARTNER_INFOS, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void queryPartnerInfos() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int qid = 0;
String tagName = StringUtil.Empty;
try {
qid = reqData.getInt("qid");
tagName = reqData.getUtfString("tagName");
} catch (Exception e) {
sendResponse(0, null);
return;
}
AccountBean acc = AccountCache.getAccount(session);
ITObject resData = GroupService.queryPartnerInfos(groupId, acc.id, qid, tagName);
sendResponse(0, resData);
}
/**
* 获取合伙人管理列表
*
* @throws Exception
*/
/*
* @ActionKey(value = Protocol.GET_PARTNER_MEMBERS, validate =
* WebInterceptor.V_SESSION|WebInterceptor.V_GROUP|WebInterceptor.
* V_GROUP_MGR_OR_PARTNER) public final void getPartnerMemebers() throws
* Exception { ITObject reqData = this.getParams(); int groupId =
* reqData.getInt("id"); int tagId = reqData.getInt("tagId"); int limit =
* reqData.getInt("limit"); int num = reqData.getInt("num"); int qid =
* reqData.getInt("qid"); ITObject resData
* =GroupService.getPartnerMemebers(groupId, tagId, limit, num,qid);
* sendResponse(0, resData); }
*/
/**
* 设置合伙人上下分开关
*
* @throws Exception
*/
@ActionKey(value = Protocol.SET_MGR_PERMISSION, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_OWNER)
public final void setMgrPermission() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int tagId = reqData.getInt("tagId");
int permission = reqData.getInt("permission");
GroupService.setMgrPermission(groupId, tagId, permission);
sendResponse(0, null);
}
/**
* 获取禁止同桌列表
*
* @throws Exception
*/
@ActionKey(value = Protocol.GET_BAN_DESK_LIST, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR)
public final void getBanDeskList() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
int tagId = reqData.getInt("tagId");
if (acc.id == tagId) {
throw new WebException(ErrorCode._FAILED);
}
int groupId = reqData.getInt("id");
ITArray arr = GroupService.getBanDeskList(groupId, acc.id, tagId);
ITObject resData = TObject.newInstance();
resData.putTArray("ban_list", arr);
sendResponse(0, resData);
}
/**
* 设置禁止同桌
*
* @throws Exception
*/
@ActionKey(value = Protocol.SET_BAN_DESK, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR)
public final void setBanDesk() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
int tagId = reqData.getInt("tagId");
if (acc.id == tagId) {
throw new WebException(ErrorCode._FAILED);
}
int groupId = reqData.getInt("id");
ITArray ban_list = reqData.getTArray("ban_list");
ITArray del_list = reqData.getTArray("del_list");
GroupService.setBanDesk(groupId, acc.id, tagId, ban_list, del_list);
sendResponse(0, null);
}
/**
* 转移合伙人
*
* @throws Exception
*/
@ActionKey(value = Protocol.MOVE_PARTNER, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_OWNER)
public final void movePartner() throws Exception {
ITObject reqData = this.getParams();
int tagId = reqData.getInt("tagId");
int parId = reqData.getInt("parId");
int groupId = reqData.getInt("id");
ITObject resData = GroupService.movePartner(groupId, parId, tagId);
sendResponse(0, resData);
}
/**
* 获取邮件列表
*
* @throws Exception
*/
@ActionKey(value = Protocol.GET_MAIL_LIST, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP)
public final void getMailList() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int uid = reqData.getInt("uid");
AccountBean acc = AccountCache.getAccount(session);
if (acc.id != uid) {
throw new WebException(ErrorCode._FAILED);
}
int limit = reqData.getInt("limit");
int num = reqData.getInt("num");
ITArray arr = GroupService.getMailList(groupId, uid, limit, num);
ITObject resData = TObject.newInstance();
resData.putTArray("mail_list", arr);
sendResponse(0, resData);
}
/**
* 删除所有邮件
*
* @throws Exception
*/
@ActionKey(value = Protocol.DEL_MAIL_ALL, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP)
public final void delMailAll() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int uid = reqData.getInt("uid");
AccountBean acc = AccountCache.getAccount(session);
if (acc.id != uid) {
throw new WebException(ErrorCode._FAILED);
}
GroupService.delMailAll(groupId, uid);
sendResponse(0, null);
}
/**
* 设置阀值
*/
@ActionKey(value = Protocol.SET_AUTO_SCORE, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_MGR_OR_PARTNER)
public final void setPartenerAutoScore() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int groupId = reqData.getInt("id");
int tagId = reqData.getInt("uid");
int score = reqData.getInt("score");
AccountBean acc = AccountCache.getAccount(session);
int result = GroupService.setPartenerAutoScore(groupId, acc.id, tagId, score);
if (result == 0) {
this.sendResponse(-1, null);
} else {
this.sendResponse(0, null);
}
}
@ActionKey(value = Protocol.GET_XINGYUNHAO_INFO, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP
| WebInterceptor.V_GROUP_OWNER)
public final void getXingyunhaoInfo() throws Exception {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
int limit = reqData.getInt("limit");
int num = reqData.getInt("num");
int tt = reqData.getInt("tt");
int beginTime = 0;
int endTime = 0;
if (tt == 0) {
beginTime = reqData.getInt("bt");
endTime = reqData.getInt("et");
}
ITObject resData = GroupLogService.getXingYunHaoMember(groupId, limit, num, tt, beginTime, endTime);
sendResponse(0, resData);
}
// /**
// * 重置用户密码
// */
// @ActionKey(value = Protocol.GROUP_RESET_PASSWORD, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP)
// public final void resetPassword() throws Exception {
// ITObject reqData = this.getParams();
// String session = this.getSession();
// int tagId = reqData.getInt("tagId");
// String password = reqData.getString("password");
//
//// AccountBean acc = AccountCache.getAccount(session);
// String sql = "UPDATE account SET password='" + Utils.getMD5Hash(password) + "' where id=" + tagId;
// DataBase.use().executeUpdate(sql);
// this.sendResponse(0, null);
// }
/**
* 重置设备锁定状态
*/
@ActionKey(value = Protocol.GROUP_RESET_LOCK, validate = WebInterceptor.V_SESSION | WebInterceptor.V_GROUP)
public final void resetLock() throws Exception {
ITObject reqData = this.getParams();
String session = this.getSession();
int tagId = reqData.getInt("tagId");
int lockType = reqData.getInt("lockType");
// AccountBean acc = AccountCache.getAccount(session);
String sql = "UPDATE account SET is_lock=? where id=?";
String[] params1 = new String[2];
params1[0] = lockType + "";
params1[1] = tagId + "";
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 {
ITObject reqData = this.getParams();
int groupId = reqData.getInt("id");
GroupBean gb = GroupCache.getGroup(groupId);
logger.info("查看伞下合伙人数据" + Protocol.GROUP_GET_PARTNER);
String session = this.getSession();
AccountBean acc = AccountCache.getAccount(session);
if(gb.owner==acc.id) {
//获取所有合伙人
ITObject resData = GroupService.getAllPartner(groupId,acc.id);
sendResponse(0, resData);
}else {
//获取所有合伙人
ITObject resData = GroupService.getAllPartner(groupId,acc.id);
sendResponse(0, resData);
}
////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
}
}