消耗道具原因

back_recharge
wangyuan 2019-06-13 19:29:17 +08:00
parent 0a0aee11d3
commit 2038e4704f
21 changed files with 89 additions and 46 deletions

View File

@ -55,12 +55,29 @@ public interface BIReason {
int ADVENTURE_UPLEVEL_CONSUME = 1000; //秘境升级
int SECRETBOX_CONSUME = 1001; //秘盒抽卡
int DECOMPOSE_ITEM_CONSUME = 1002;
int UPHEROSTAR_CONSUME = 1003;
int UP_HEROSTAR_CONSUME = 1003;
int WORKSHOP_REBUILD_EQUIP_CONSUME = 1004;
int WORKSHOP_CREATEMATERIAL_CONSUME = 1005;
int ACTIVEBLUECONSUME = 1006;
int STOREHANDREFRESH = 1005;//手动刷新商店
int TEST = 1005;//手动刷新商店
int WORKSHOP_EQUIP_CONSUME = 1005;
int ACTIVE_BLUE_CONSUME = 1006;
int STORE_HAND_REFRESH = 1007;//手动刷新商店
int RANDOM_HERO_CONSUME = 1008;//聚灵
int UP_HERO_LEVEL_CONSUME = 1009;
int START_DIFFICULT = 1010;
int END_DIFFICULT = 1011;
int COMPOS_HERO_CONSUME = 1012;
int POKEMON_LOAD_CONSUME = 1013;
int POKEMON_ADVANCE_CONSUME = 1014;
int POKEMON_UPLEVEL_CONSUME = 1015;
int BUY_GOODS_CONSUME = 1006;
int SWEEP_FIGHT_CONSUME = 1006;
int MAP_ENTER_CONSUME = 1006;
int MAP_EVENT_CONSUME = 1006;
int ARENA_CHALLENGE_CONSUME = 1006;
}

View File

@ -140,7 +140,7 @@ public class MapLogic {
if(type == 1){
if(crossInfoMap.containsKey(mapId)){
if(crossInfoMap.get(mapId).getStars().contains(STAR_1)){
boolean enough = ItemUtil.itemCost(user, new int[][]{{Global.GENERALSTORY_TICKET, 1}},BIReason.TEST);
boolean enough = ItemUtil.itemCost(user, new int[][]{{Global.GENERALSTORY_TICKET, 1}},BIReason.MAP_ENTER_CONSUME,mapId);
if(!enough){
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "no ticket");
return;
@ -148,7 +148,7 @@ public class MapLogic {
}
}
}else if(type == 2){
boolean enough = ItemUtil.itemCost(user, new int[][]{{Global.HEROSTORY_TICKET, 1}},BIReason.TEST);
boolean enough = ItemUtil.itemCost(user, new int[][]{{Global.HEROSTORY_TICKET, 1}},BIReason.MAP_ENTER_CONSUME,mapId);
if(!enough){
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "no ticket");
return;
@ -1471,7 +1471,7 @@ public class MapLogic {
* @param messageType
*/
public void buyFightCount(ISession session, int buyCount, MessageTypeProto.MessageType messageType) throws Exception {
if (buyCount <= 0 || buyCount>= 100) {
/* if (buyCount <= 0 || buyCount>= 100) {
buyCount = 1;
}
int uid = session.getUid();
@ -1503,7 +1503,7 @@ public class MapLogic {
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return;
}
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);*/
}
/**
@ -1657,7 +1657,7 @@ public class MapLogic {
String key = RedisKey.getKey(RedisKey.LEVE_DIFFICULTY_INFO, String.valueOf(uid), false);
RedisUtil.getInstence().set(key, fightInfo, sLevelDifficultyConfig.getRankTime()+100);
//扣除预先道具
ItemUtil.itemCost(user,sLevelDifficultyConfig.getPreLevelCost(),BIReason.TEST);
ItemUtil.itemCost(user,sLevelDifficultyConfig.getPreLevelCost(),BIReason.START_DIFFICULT,fightId);
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
BehaviorUtil.getLevelDifficultyifficuFightInfo(user,sLevelDifficultyConfig.getMonsterGroup(),teamId,sLevelDifficultyConfig.getRankTime(),fightStartResponse);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);
@ -1758,7 +1758,7 @@ public class MapLogic {
return;
}
PlayerManager playerInfoManager = user.getPlayerInfoManager();
ItemUtil.itemCost(user, sLevelDifficultyConfig.getCost(),BIReason.TEST);
ItemUtil.itemCost(user, sLevelDifficultyConfig.getCost(),BIReason.END_DIFFICULT,fightId);
//玩家升级
userLevelUp(user,sLevelDifficultyConfig.getExp());
LevelDifficulty levelDifficulty = levelDifficultyManager.getLevelDifficultyInfosMap().get(fightId);

View File

@ -80,7 +80,7 @@ public class SweepLogic {
return;
}
//扣除道具
ItemUtil.itemCost(user, cost,BIReason.TEST);
ItemUtil.itemCost(user, cost,BIReason.SWEEP_FIGHT_CONSUME,fightId);
List<CommonProto.Drop> dropList = new CopyOnWriteArrayList<>();
for (int i = 0 ; i < sweepTimes ;i++){
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sLevelDifficultyConfig.getRandomReward(), 1, 0, BIReason.LEVELDIFFICULTY_SWEEP_REWARD);

View File

@ -16,7 +16,7 @@ public class ScoutBehavior extends BaseBehavior {
@Override
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
boolean isEnough = ItemUtil.itemCost(user, behaviorTypeValues, BIReason.TEST);
boolean isEnough = ItemUtil.itemCost(user, behaviorTypeValues,BIReason.MAP_EVENT_CONSUME,getBehaviorType());
if (!isEnough) {
return isEnough;
}

View File

@ -19,7 +19,7 @@ public class ThirtySexBehavior extends BaseBehavior{
@Override
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
int[][] ints = Arrays.copyOfRange(behaviorTypeValues, 1, behaviorTypeValues.length);
boolean isEnough = ItemUtil.itemCost(user, ints, BIReason.TEST);
boolean isEnough = ItemUtil.itemCost(user, ints, BIReason.MAP_EVENT_CONSUME,getBehaviorType());
if (!isEnough) {
return isEnough;
}

View File

@ -16,7 +16,7 @@ public class TwentyNineBehavior extends BaseBehavior{
@Override
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
boolean isEnough = ItemUtil.itemCost(user, behaviorTypeValues, BIReason.TEST);
boolean isEnough = ItemUtil.itemCost(user, behaviorTypeValues, BIReason.MAP_EVENT_CONSUME,getBehaviorType());
if (!isEnough) {
return isEnough;
}

View File

@ -16,7 +16,7 @@ public class UseItemAndDestroyBehavior extends BaseBehavior {
@Override
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
boolean isEnough = ItemUtil.itemCost(user, behaviorTypeValues, BIReason.TEST);
boolean isEnough = ItemUtil.itemCost(user, behaviorTypeValues, BIReason.MAP_EVENT_CONSUME,getBehaviorType());
if (!isEnough) {
return isEnough;
}

View File

@ -16,7 +16,7 @@ public class UseItemBehavior extends BaseBehavior {
@Override
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
boolean isEnough = ItemUtil.itemCost(user, behaviorTypeValues, BIReason.TEST);
boolean isEnough = ItemUtil.itemCost(user, behaviorTypeValues, BIReason.MAP_EVENT_CONSUME,getBehaviorType());
if (!isEnough) {
return isEnough;
}

View File

@ -21,7 +21,7 @@ public class UseItemMissionBehavior extends BaseBehavior {
for (int i = 0; i < behaviorTypeValues[1].length; i++) {
userItem[0][i] = behaviorTypeValues[1][i];
}
boolean checkCost = ItemUtil.itemCost(user, userItem,BIReason.TEST);
boolean checkCost = ItemUtil.itemCost(user, userItem,BIReason.MAP_EVENT_CONSUME,getBehaviorType());
if (!checkCost) {
return false;
}

View File

@ -373,7 +373,7 @@ public class ActivityLogic {
}
if(!allowedFree){
int[][] mainCost = sDifferDemonsBoxSetting.getMainCost();
boolean enough = ItemUtil.itemCost(user, mainCost,BIReason.SECRETBOX_CONSUME);
boolean enough = ItemUtil.itemCost(user, mainCost,BIReason.SECRETBOX_CONSUME,id);
if(!enough){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.SECRETBOX_RANDOM_RESPONSE_VALUE,"道具不足");
return;

View File

@ -283,7 +283,7 @@ public class ArenaLogic {
int battleFree = sArenaSetting.getBattleFree();
if(useFreeTimes>=battleFree){
//校验消耗
boolean enough = ItemUtil.itemCost(user, new int[][]{sArenaSetting.getCost()}, BIReason.TEST);
boolean enough = ItemUtil.itemCost(user, new int[][]{sArenaSetting.getCost()}, BIReason.ARENA_CHALLENGE_CONSUME,enemyInfo.getEnemyId());
if(!enough){
return "道具不足";
}

View File

@ -6,6 +6,7 @@ import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.util.KeyGenUtils;
import com.ljsd.jieling.util.MathUtils;
import com.ljsd.jieling.util.TimeUtils;
import com.ljsd.jieling.util.UUIDEnum;
import org.slf4j.LoggerFactory;
@ -32,6 +33,8 @@ public class Equip extends MongoBase implements Cloneable{
private Map<Integer, Integer> secondValueByIdMap; //副属性
private int createTime;
public Equip() {
this.setRootCollection(User._COLLECTION_NAME);
@ -61,6 +64,7 @@ public class Equip extends MongoBase implements Cloneable{
int secondNumMax = sEquipConfig.getSecondNumMax();
int secondValue = MathUtils.random(secondNumMin, secondNumMax);
this.secondValueByIdMap = getSecondValue(sEquipConfig.getPool(), secondValue,promoteMap);
this.createTime = (int)(TimeUtils.now()/1000);
}
//锻造
@ -86,6 +90,7 @@ public class Equip extends MongoBase implements Cloneable{
int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100);
this.propertyValueByIdMap.put(properTyId,finalProperValue);
setForRunnes(runneIds,promoteMap);
this.createTime = (int)(TimeUtils.now()/1000);
}
@ -309,4 +314,8 @@ public class Equip extends MongoBase implements Cloneable{
public Object clone() throws CloneNotSupportedException {
return (Equip) super.clone();
}
public int getCreateTime() {
return createTime;
}
}

View File

@ -303,7 +303,7 @@ public class CombatLogic {
return;
}
int[] upgradeConsume = sAdventureConfig.getUpgradeConsume()[level-1];
boolean enough = ItemUtil.itemCost(user, new int[][]{upgradeConsume},BIReason.ADVENTURE_UPLEVEL_CONSUME);
boolean enough = ItemUtil.itemCost(user, new int[][]{upgradeConsume},BIReason.ADVENTURE_UPLEVEL_CONSUME,arenaId);
if(!enough){
MessageUtil.sendErrorResponse(iSession,0, MessageTypeProto.MessageType.ADVENTURE_UPLEVEL_RESPONSE_VALUE,"item not");
return;

View File

@ -164,7 +164,7 @@ public class HeroLogic {
}
if(!allowFree){
int [][] costItems = new int[][]{sLotterySetting.getCostItem()};
boolean enoughCost = ItemUtil.itemCost(user, costItems,BIReason.TEST);
boolean enoughCost = ItemUtil.itemCost(user, costItems,BIReason.RANDOM_HERO_CONSUME,type);
if(!enoughCost){
MessageUtil.sendErrorResponse(session, 0, MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE,"道具不足");
return;
@ -431,7 +431,7 @@ public class HeroLogic {
//校验消耗
boolean result = ItemUtil.itemCost(user, consume,BIReason.TEST);
boolean result = ItemUtil.itemCost(user, consume,BIReason.UP_HERO_LEVEL_CONSUME,hero.getTemplateId());
if(!result){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.UP_HERO_LEVEL_RESPONSE_VALUE,"道具不足");
return;
@ -547,7 +547,7 @@ public class HeroLogic {
}
int[][] consumeMaterial = scHeroRankUpConfig.getConsumeMaterial();
boolean enoughCost = ItemUtil.itemCost(user, consumeMaterial,BIReason.UPHEROSTAR_CONSUME);
boolean enoughCost = ItemUtil.itemCost(user, consumeMaterial,BIReason.UP_HEROSTAR_CONSUME,targetHero.getTemplateId());
if(!enoughCost){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,"");
return;
@ -1128,7 +1128,7 @@ public class HeroLogic {
MessageUtil.sendErrorResponse(iSession,0,msgId,"英雄已达上限");
return;
}
boolean result = ItemUtil.checkCost(user, sItem, itemNum,BIReason.TEST);
boolean result = ItemUtil.checkCost(user, sItem, itemNum,BIReason.COMPOS_HERO_CONSUME,0);
if (!result){
MessageUtil.sendErrorResponse(iSession,0,msgId,"");
return;
@ -1177,7 +1177,7 @@ public class HeroLogic {
Integer oldLevel = pokemon.getComonpentsLevelMap().get(comonpentId);
if( null == oldLevel){
//消耗组件
boolean enough = ItemUtil.itemCost(user, new int[][]{{comonpentId, 1}},BIReason.TEST);
boolean enough = ItemUtil.itemCost(user, new int[][]{{comonpentId, 1}},BIReason.POKEMON_LOAD_CONSUME,pokemonId);
if(!enough){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.POKEMON_COMONPENT_LEVELUP_RESPONSE_VALUE,"");
return;
@ -1232,7 +1232,7 @@ public class HeroLogic {
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.POKEMON_ADVANCED_RESPONSE_VALUE,"not match");
return;
}
isEnough = ItemUtil.itemCost(user,cost,BIReason.TEST);
isEnough = ItemUtil.itemCost(user,cost,BIReason.POKEMON_ADVANCE_CONSUME,pokemonId);
if(!isEnough){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.POKEMON_ADVANCED_RESPONSE_VALUE,"道具不足");
return;
@ -1270,7 +1270,7 @@ public class HeroLogic {
}
SDifferDemonsComonpentsConfig sDifferDemonsComonpentsConfig = sDifferDemonsComonpentsConfigMap.get(oldLevel);
int[][] cost = sDifferDemonsComonpentsConfig.getCost();
boolean enoughCost = ItemUtil.itemCost(user, cost,BIReason.TEST);
boolean enoughCost = ItemUtil.itemCost(user, cost,BIReason.POKEMON_UPLEVEL_CONSUME,pokemonId);
if(!enoughCost){
return true;
}
@ -1400,7 +1400,7 @@ public class HeroLogic {
PokemonManager pokemonManager = user.getPokemonManager();
Pokemon pokemon = pokemonManager.getRingFireMap().get(pokemonId);
if(pokemon == null){
pokemon = new Pokemon();
pokemon = new Pokemon(pokemonId);
}
SRingTypeConfig sRingTypeConfig = SRingTypeConfig.config.get(pokemonId);
if(sRingTypeConfig == null){

View File

@ -61,7 +61,7 @@ public class ItemLogic {
}
}
int[][] costItemArr = StringUtil.parseFiledInt2(cost.toString());
boolean result = ItemUtil.itemCost(user, costItemArr,BIReason.DECOMPOSE_ITEM_CONSUME);
boolean result = ItemUtil.itemCost(user, costItemArr,BIReason.DECOMPOSE_ITEM_CONSUME,0);
if (!result){
MessageUtil.sendErrorResponse(iSession,0,msgId,"");
return;

View File

@ -186,7 +186,7 @@ public class WorkShopLogic {
if(openType!=GlobalsDef.BLUE_LOCK){
return false;
}
boolean enough = ItemUtil.itemCost(user, new int[][]{{openParm, 1}},BIReason.ACTIVEBLUECONSUME);
boolean enough = ItemUtil.itemCost(user, new int[][]{{openParm, 1}},BIReason.ACTIVE_BLUE_CONSUME,0);
if(!enough){
return false;
}
@ -234,7 +234,7 @@ public class WorkShopLogic {
}
int[][] cost = sWorkShopFoundationConfig.getCost();
int[][] reallyCost = times2Array(cost, nums);
if( !ItemUtil.itemCost(user, reallyCost,BIReason.WORKSHOP_CREATEMATERIAL_CONSUME)){
if( !ItemUtil.itemCost(user, reallyCost,BIReason.WORKSHOP_CREATEMATERIAL_CONSUME,materialId)){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"道具不足");
return;
}
@ -293,7 +293,7 @@ public class WorkShopLogic {
costs[--costLength] = new int[]{specialRunneId[0],specialRunneId[1]};
}
boolean enoughCost = ItemUtil.itemCost(user,costs,nums);
boolean enoughCost = ItemUtil.itemCost(user,costs,nums,BIReason.WORKSHOP_EQUIP_CONSUME,equipTid);
if(!enoughCost){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_RESPONSE_VALUE,"道具不足");
return;
@ -400,7 +400,7 @@ public class WorkShopLogic {
if(!costResult){
return "祭品错误";
}
costResult = ItemUtil.itemCost(user,secondaryCost,BIReason.WORKSHOP_REBUILD_EQUIP_CONSUME);
costResult = ItemUtil.itemCost(user,secondaryCost,BIReason.WORKSHOP_REBUILD_EQUIP_CONSUME,sEquipConfig.getId());
if(!costResult){
return "道具不足";
}

View File

@ -25,7 +25,6 @@ import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.BiFunction;
public class StoreLogic {
@ -226,7 +225,7 @@ public class StoreLogic {
}
}
int[][] cost = getCost(buyTimes ,itemNum, sStoreConfig.getCost(), sStoreConfig.getPremiumType());
boolean result = ItemUtil.itemCost(user, cost,BIReason.TEST);
boolean result = ItemUtil.itemCost(user, cost,BIReason.BUY_GOODS_CONSUME,storeId);
if (!result){
return "道具不足";
}
@ -290,7 +289,7 @@ public class StoreLogic {
MessageUtil.sendErrorResponse(iSession,0,msgId,"over limmit");
return;
}
boolean result = ItemUtil.itemCost(user, cost, BIReason.STOREHANDREFRESH);
boolean result = ItemUtil.itemCost(user, cost, BIReason.STORE_HAND_REFRESH,storeId);
if (!result){
MessageUtil.sendErrorResponse(iSession,0,msgId,"道具不足");
return;

View File

@ -147,7 +147,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
//在线列表加入session
OnlineUserManager.userOnline(session.getUid(),session);
}
if(packetNetData.getMsgId() == MessageTypeProto.MessageType.ACK_INDICATION_COMMAND_VALUE){
if(packetNetData.getMsgId() == MessageTypeProto.MessageType.ACK_INDICATION_REQUEST_VALUE){
ackIndication(session,packetNetData.getIndex());
return;
}
@ -246,6 +246,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
private void ackIndication(ISession iSession, int ackId) {
LOGGER.info("the uid={},the ackId={}",iSession.getUid(),ackId);
iSession.clearIndication(ackId);
MessageUtil.sendAck(iSession,ackId);
}
private void dealHeartBeat(ISession session) {

View File

@ -105,6 +105,7 @@ public class CBean2Proto {
.setMainAttribute(parseFromMap(propertyValueByIdMap).get(0))
.addAllSecondAttribute(parseFromMap(secondValueByIdMap))
.setRebuildLevel(equip.getRebuildLevel())
.setCreateTime(equip.getCreateTime())
.build();
return equipProto;
}

View File

@ -512,7 +512,7 @@ public class ItemUtil {
}
private static void useItem(User user,Map<Integer,Integer> useItemMap,int reason) throws Exception{
private static void useItem(User user,Map<Integer,Integer> useItemMap,int reason,int subReason) throws Exception{
if(useItemMap.isEmpty()){
return;
}
@ -704,25 +704,25 @@ public class ItemUtil {
* @return
* @throws Exception
*/
public static boolean itemCost(User user,int[][] costItems,int reason) throws Exception {
public static boolean itemCost(User user,int[][] costItems,int reason,int subReson) throws Exception {
Map<Integer, Integer> itemMap = new HashMap<>();
selectCost(costItems,itemMap);
boolean result = checkCost(user, itemMap);
if (!result) {
return false;
}
useItem(user, itemMap,reason);
useItem(user, itemMap,reason,subReson);
return true;
}
public static boolean itemCost(User user,int[][] costItems,int times,int reason) throws Exception {
public static boolean itemCost(User user,int[][] costItems,int times,int reason,int subReason) throws Exception {
Map<Integer, Integer> itemMap = new HashMap<>();
selectCost(costItems,itemMap,times);
boolean result = checkCost(user, itemMap);
if (!result) {
return false;
}
useItem(user, itemMap,reason);
useItem(user, itemMap,reason,subReason);
return true;
}
@ -832,7 +832,7 @@ public class ItemUtil {
* @return
* @throws Exception
*/
public static boolean checkCost(User user ,SItem sItem , int itemNum,int reason) throws Exception {
public static boolean checkCost(User user ,SItem sItem , int itemNum,int reason,int subReason) throws Exception {
if (sItem == null){
return false;
}
@ -841,7 +841,7 @@ public class ItemUtil {
}
String costItem = sItem.getId() +"#"+ itemNum;
int[][] ints = StringUtil.parseFiledInt2(costItem);
return ItemUtil.itemCost(user, ints,reason);
return ItemUtil.itemCost(user, ints,reason,subReason);
}
public static void initDropReward() {

View File

@ -65,8 +65,6 @@ public class MessageUtil {
session.write(byteBuf);
}
session.putBackMassageToMap(byteBuf);
/* PlayerInfoProto.RedPointInfo redPointInfo = PlayerInfoProto.RedPointInfo.newBuilder().setType(1).build();
MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.SEND_RED_POINT_INDICATION_VALUE,redPointInfo,true);*/
}
@ -101,6 +99,24 @@ public class MessageUtil {
session.writeAndFlush(byteBuf);
}
public static void sendAck(ISession session,int ackId) {
int length = PackageConstant.UID_FIELD_LEN + PackageConstant.TOKEN_LEN
+ PackageConstant.MSG_ID_FIELD_LEN + PackageConstant.INDEX_FIELD_LEN+4;
byte[] bytes = new byte[length];
int pos = 0;
Tea.intToByte(bytes, pos, session.getUid());
pos += PackageConstant.UID_FIELD_LEN;
Tea.intToByte(bytes, pos, session.getToken());
pos += PackageConstant.TOKEN_LEN;
Tea.intToByte(bytes, pos, MessageTypeProto.MessageType.ACK_INDICATION_RESPONSE_VALUE);
pos += PackageConstant.MSG_ID_FIELD_LEN;
Tea.intToByte(bytes, pos, ackId);
pos += PackageConstant.INDEX_FIELD_LEN;
Tea.intToByte(bytes, pos, 1);
byte[] byteBuf = Tea.encrypt2(bytes, Tea.KEY);
session.writeAndFlush(byteBuf);
}
//服务器推送错误码,一般情况是系统错误
public static void sendErrorCode(ISession session,int errorCode, String errMsg) {
if( null == errMsg){