back_recharge
parent
291d8acbae
commit
0a45445c20
|
|
@ -88,7 +88,7 @@ public class LjsdMongoTemplate {
|
||||||
BasicDBObject update= new BasicDBObject().append("$inc",new BasicDBObject().append(key, 1));
|
BasicDBObject update= new BasicDBObject().append("$inc",new BasicDBObject().append(key, 1));
|
||||||
DBObject query = cursor.next();
|
DBObject query = cursor.next();
|
||||||
DBObject result = collection.findAndModify(query, update);
|
DBObject result = collection.findAndModify(query, update);
|
||||||
return Integer.valueOf(result.get(key).toString())+1;
|
return Integer.parseInt(result.get(key).toString())+1;
|
||||||
} else {
|
} else {
|
||||||
searchQuery.put(key, 1);
|
searchQuery.put(key, 1);
|
||||||
collection.insert(searchQuery);
|
collection.insert(searchQuery);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ public abstract class MongoRoot {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int _getIntId() {
|
public int _getIntId() {
|
||||||
return Integer.valueOf(id);
|
return Integer.parseInt(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class MongoUpdateCache {
|
public class MongoUpdateCache {
|
||||||
class UpdateRequest {
|
static class UpdateRequest {
|
||||||
MongoBase mongoBase;
|
MongoBase mongoBase;
|
||||||
String fullKey;
|
String fullKey;
|
||||||
Object value;
|
Object value;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class SCHero implements BaseConfig{
|
||||||
|
|
||||||
private Map<Integer, Map<Integer,SCHero.ConsumeMaterialInfo>> consumeMaterialInfoOfPositionByStar;
|
private Map<Integer, Map<Integer,SCHero.ConsumeMaterialInfo>> consumeMaterialInfoOfPositionByStar;
|
||||||
|
|
||||||
public class ConsumeMaterialInfo{
|
public static class ConsumeMaterialInfo{
|
||||||
private int groupID;
|
private int groupID;
|
||||||
private int nums;
|
private int nums;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -716,6 +716,37 @@ public class RedisUtil {
|
||||||
}
|
}
|
||||||
return -1;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
Mail mail = new Mail(uid,"GM","GM",prarm1+"#"+prarm2,nowTime,30*24*60*60,"GM", Global.MAIL_TYPE_GM);
|
||||||
cUser.getMailManager().addMail(mail);
|
cUser.getMailManager().addMail(mail);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GM_RESPONSE_VALUE, null, true);
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GM_RESPONSE_VALUE, null, true);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ljsd.jieling.logic.chat;
|
package com.ljsd.jieling.logic.chat;
|
||||||
|
|
||||||
import com.ljsd.jieling.config.SGameSetting;
|
import com.ljsd.jieling.config.SGameSetting;
|
||||||
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.ChatProto;
|
import com.ljsd.jieling.protocols.ChatProto;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
|
@ -28,6 +29,7 @@ public class ChatLogic {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//移除自己所在的频道。
|
//移除自己所在的频道。
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendChatInfo(ISession iSession, ChatProto.SendChatInfoRequest sendChatInfoRequest) {
|
public void sendChatInfo(ISession iSession, ChatProto.SendChatInfoRequest sendChatInfoRequest) {
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,11 @@ public class WorkShopController extends MongoBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(int type,int openId) throws Exception {
|
public void add(int type,int openId) throws Exception {
|
||||||
if(openBlueStateMap.containsKey(type)){
|
if(!openBlueStateMap.containsKey(type)){
|
||||||
openBlueStateMap.put(type,new ArrayList<>());
|
openBlueStateMap.put(type,new ArrayList<>());
|
||||||
}
|
}
|
||||||
openBlueStateMap.get(type).add(openId);
|
openBlueStateMap.get(type).add(openId);
|
||||||
updateString("openBlueStateMap." + type,1);
|
updateString("openBlueStateMap." + type, openBlueStateMap.get(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addWorkShopExp(int addExp) throws Exception {
|
public void addWorkShopExp(int addExp) throws Exception {
|
||||||
|
|
|
||||||
|
|
@ -193,8 +193,9 @@ public class HeroLogic {
|
||||||
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = teamPosManager.getTeamPosForHero();
|
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = teamPosManager.getTeamPosForHero();
|
||||||
Map<Integer, String> teamNames = teamPosManager.getTeamNames();
|
Map<Integer, String> teamNames = teamPosManager.getTeamNames();
|
||||||
Map<Integer, List<TeamPosForPokenInfo>> teamPosForPoken = teamPosManager.getTeamPosForPoken();
|
Map<Integer, List<TeamPosForPokenInfo>> teamPosForPoken = teamPosManager.getTeamPosForPoken();
|
||||||
for(Integer teamId:teamPosForHero.keySet()){
|
for(Map.Entry<Integer, List<TeamPosHeroInfo>> item :teamPosForHero.entrySet()){
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfoList = teamPosForHero.get(teamId);
|
int teamId = item.getKey();
|
||||||
|
List<TeamPosHeroInfo> teamPosHeroInfoList = item.getValue();
|
||||||
List<TeamPosForPokenInfo> teamPosForPokenInfos = teamPosForPoken.get(teamId);
|
List<TeamPosForPokenInfo> teamPosForPokenInfos = teamPosForPoken.get(teamId);
|
||||||
if(null == teamPosForPokenInfos){
|
if(null == teamPosForPokenInfos){
|
||||||
teamPosForPokenInfos = new ArrayList<>(1);
|
teamPosForPokenInfos = new ArrayList<>(1);
|
||||||
|
|
@ -566,6 +567,8 @@ public class HeroLogic {
|
||||||
case GlobalsDef.SPEED_TYPE:
|
case GlobalsDef.SPEED_TYPE:
|
||||||
result = scHero.getSpeed();
|
result = scHero.getSpeed();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,10 @@ public class RedisRecordSendThread extends Thread{
|
||||||
}
|
}
|
||||||
map.get(topic).add(new DefaultTypedTuple<String>(itemInfo,(double)increment));
|
map.get(topic).add(new DefaultTypedTuple<String>(itemInfo,(double)increment));
|
||||||
}
|
}
|
||||||
for(String topic : map.keySet()){
|
for(Map.Entry<String,Set<ZSetOperations.TypedTuple<String>>> item : map.entrySet()){
|
||||||
RedisUtil.getInstence().zsetAddAall(topic,map.get(topic));
|
String topic = item.getKey();
|
||||||
|
Set<ZSetOperations.TypedTuple<String>> value = item.getValue();
|
||||||
|
RedisUtil.getInstence().zsetAddAall(topic,value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
|
|
||||||
|
|
@ -94,8 +94,10 @@ public class CBean2Proto {
|
||||||
|
|
||||||
private static List<CommonProto.SpecialEffects> parseFromMap(Map<Integer,Integer> propertyValueByIdMap){
|
private static List<CommonProto.SpecialEffects> parseFromMap(Map<Integer,Integer> propertyValueByIdMap){
|
||||||
List<CommonProto.SpecialEffects> result = new ArrayList<>();
|
List<CommonProto.SpecialEffects> result = new ArrayList<>();
|
||||||
for(Integer propertyId:propertyValueByIdMap.keySet()){
|
for(Map.Entry<Integer,Integer> item:propertyValueByIdMap.entrySet()){
|
||||||
result.add(CommonProto.SpecialEffects.newBuilder().setPropertyId(propertyId).setPropertyValue(propertyValueByIdMap.get(propertyId)).build());
|
Integer propertyId = item.getKey();
|
||||||
|
Integer propertyValue = item.getValue();
|
||||||
|
result.add(CommonProto.SpecialEffects.newBuilder().setPropertyId(propertyId).setPropertyValue(propertyValue).build());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -104,8 +106,10 @@ public class CBean2Proto {
|
||||||
public static CommonProto.PokemonInfo getPokemon(Pokemon pokemon) {
|
public static CommonProto.PokemonInfo getPokemon(Pokemon pokemon) {
|
||||||
Map<Integer, Integer> comonpentsLevelMap = pokemon.getComonpentsLevelMap();
|
Map<Integer, Integer> comonpentsLevelMap = pokemon.getComonpentsLevelMap();
|
||||||
List<CommonProto.Pokemoncomonpent> pokemoncomonpentList = new ArrayList<>();
|
List<CommonProto.Pokemoncomonpent> pokemoncomonpentList = new ArrayList<>();
|
||||||
for(Integer comonpentId : comonpentsLevelMap.keySet()){
|
for( Map.Entry <Integer, Integer> item: comonpentsLevelMap.entrySet()){
|
||||||
pokemoncomonpentList.add(CommonProto.Pokemoncomonpent.newBuilder().setId(comonpentId).setLevel(comonpentsLevelMap.get(comonpentId)).build());
|
Integer comonpentId = item.getKey();
|
||||||
|
Integer value = item.getValue();
|
||||||
|
pokemoncomonpentList.add(CommonProto.Pokemoncomonpent.newBuilder().setId(comonpentId).setLevel(value).build());
|
||||||
}
|
}
|
||||||
return CommonProto.PokemonInfo.newBuilder()
|
return CommonProto.PokemonInfo.newBuilder()
|
||||||
.setId(pokemon.getId())
|
.setId(pokemon.getId())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue