back_recharge
wangyuan 2019-02-27 21:31:04 +08:00
parent 291d8acbae
commit 0a45445c20
11 changed files with 58 additions and 14 deletions

View File

@ -88,7 +88,7 @@ public class LjsdMongoTemplate {
BasicDBObject update= new BasicDBObject().append("$inc",new BasicDBObject().append(key, 1));
DBObject query = cursor.next();
DBObject result = collection.findAndModify(query, update);
return Integer.valueOf(result.get(key).toString())+1;
return Integer.parseInt(result.get(key).toString())+1;
} else {
searchQuery.put(key, 1);
collection.insert(searchQuery);

View File

@ -23,7 +23,7 @@ public abstract class MongoRoot {
}
public int _getIntId() {
return Integer.valueOf(id);
return Integer.parseInt(id);
}
public void setId(String id) {

View File

@ -9,7 +9,7 @@ import java.util.List;
import java.util.Map;
public class MongoUpdateCache {
class UpdateRequest {
static class UpdateRequest {
MongoBase mongoBase;
String fullKey;
Object value;

View File

@ -47,7 +47,7 @@ public class SCHero implements BaseConfig{
private Map<Integer, Map<Integer,SCHero.ConsumeMaterialInfo>> consumeMaterialInfoOfPositionByStar;
public class ConsumeMaterialInfo{
public static class ConsumeMaterialInfo{
private int groupID;
private int nums;

View File

@ -716,6 +716,37 @@ public class RedisUtil {
}
return -1;
}
// ===============================set=================================
public boolean sadd(String key,String member){
try {
redisTemplate.opsForSet().add(key,member);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean sremove(String key,String member){
try {
redisTemplate.opsForSet().remove(key,member);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public int getSetLength(String key){
try {
return redisTemplate.opsForSet().size(key).intValue();
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}

View File

@ -62,6 +62,8 @@ public class GMRequestHandler extends BaseHandler{
Mail mail = new Mail(uid,"GM","GM",prarm1+"#"+prarm2,nowTime,30*24*60*60,"GM", Global.MAIL_TYPE_GM);
cUser.getMailManager().addMail(mail);
break;
default:
break;
}
try {
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GM_RESPONSE_VALUE, null, true);

View File

@ -1,6 +1,7 @@
package com.ljsd.jieling.logic.chat;
import com.ljsd.jieling.config.SGameSetting;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.ChatProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
@ -28,6 +29,7 @@ public class ChatLogic {
return;
}
//移除自己所在的频道。
}
public void sendChatInfo(ISession iSession, ChatProto.SendChatInfoRequest sendChatInfoRequest) {

View File

@ -24,11 +24,11 @@ public class WorkShopController extends MongoBase {
}
public void add(int type,int openId) throws Exception {
if(openBlueStateMap.containsKey(type)){
if(!openBlueStateMap.containsKey(type)){
openBlueStateMap.put(type,new ArrayList<>());
}
openBlueStateMap.get(type).add(openId);
updateString("openBlueStateMap." + type,1);
updateString("openBlueStateMap." + type, openBlueStateMap.get(type));
}
public void addWorkShopExp(int addExp) throws Exception {

View File

@ -193,8 +193,9 @@ public class HeroLogic {
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = teamPosManager.getTeamPosForHero();
Map<Integer, String> teamNames = teamPosManager.getTeamNames();
Map<Integer, List<TeamPosForPokenInfo>> teamPosForPoken = teamPosManager.getTeamPosForPoken();
for(Integer teamId:teamPosForHero.keySet()){
List<TeamPosHeroInfo> teamPosHeroInfoList = teamPosForHero.get(teamId);
for(Map.Entry<Integer, List<TeamPosHeroInfo>> item :teamPosForHero.entrySet()){
int teamId = item.getKey();
List<TeamPosHeroInfo> teamPosHeroInfoList = item.getValue();
List<TeamPosForPokenInfo> teamPosForPokenInfos = teamPosForPoken.get(teamId);
if(null == teamPosForPokenInfos){
teamPosForPokenInfos = new ArrayList<>(1);
@ -566,6 +567,8 @@ public class HeroLogic {
case GlobalsDef.SPEED_TYPE:
result = scHero.getSpeed();
break;
default:
break;
}
return result;

View File

@ -56,8 +56,10 @@ public class RedisRecordSendThread extends Thread{
}
map.get(topic).add(new DefaultTypedTuple<String>(itemInfo,(double)increment));
}
for(String topic : map.keySet()){
RedisUtil.getInstence().zsetAddAall(topic,map.get(topic));
for(Map.Entry<String,Set<ZSetOperations.TypedTuple<String>>> item : map.entrySet()){
String topic = item.getKey();
Set<ZSetOperations.TypedTuple<String>> value = item.getValue();
RedisUtil.getInstence().zsetAddAall(topic,value);
}
}catch (Exception e){

View File

@ -94,8 +94,10 @@ public class CBean2Proto {
private static List<CommonProto.SpecialEffects> parseFromMap(Map<Integer,Integer> propertyValueByIdMap){
List<CommonProto.SpecialEffects> result = new ArrayList<>();
for(Integer propertyId:propertyValueByIdMap.keySet()){
result.add(CommonProto.SpecialEffects.newBuilder().setPropertyId(propertyId).setPropertyValue(propertyValueByIdMap.get(propertyId)).build());
for(Map.Entry<Integer,Integer> item:propertyValueByIdMap.entrySet()){
Integer propertyId = item.getKey();
Integer propertyValue = item.getValue();
result.add(CommonProto.SpecialEffects.newBuilder().setPropertyId(propertyId).setPropertyValue(propertyValue).build());
}
return result;
}
@ -104,8 +106,10 @@ public class CBean2Proto {
public static CommonProto.PokemonInfo getPokemon(Pokemon pokemon) {
Map<Integer, Integer> comonpentsLevelMap = pokemon.getComonpentsLevelMap();
List<CommonProto.Pokemoncomonpent> pokemoncomonpentList = new ArrayList<>();
for(Integer comonpentId : comonpentsLevelMap.keySet()){
pokemoncomonpentList.add(CommonProto.Pokemoncomonpent.newBuilder().setId(comonpentId).setLevel(comonpentsLevelMap.get(comonpentId)).build());
for( Map.Entry <Integer, Integer> item: comonpentsLevelMap.entrySet()){
Integer comonpentId = item.getKey();
Integer value = item.getValue();
pokemoncomonpentList.add(CommonProto.Pokemoncomonpent.newBuilder().setId(comonpentId).setLevel(value).build());
}
return CommonProto.PokemonInfo.newBuilder()
.setId(pokemon.getId())