优化代码
parent
d37d1176ed
commit
8e31ca0acf
|
|
@ -107,7 +107,7 @@ public class TimeUtils {
|
|||
/**
|
||||
* 年月日 时分秒, 格式如: 20110111011059
|
||||
*/
|
||||
private static final DateFormat ymdhmsFormat_new = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
private static final String ymdhmsFormat_new = "yyyyMMddHHmmss";
|
||||
/**
|
||||
* 年月日 时分, 格式如: 2011-01-11 01:10
|
||||
*/
|
||||
|
|
@ -120,7 +120,7 @@ public class TimeUtils {
|
|||
/**
|
||||
* 年月日,格式如19700710
|
||||
*/
|
||||
private static final DateFormat ymdFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
private static final String ymdFormat = "yyyyMMdd";
|
||||
/**
|
||||
* 年月日,格式如1970年07月10日
|
||||
*/
|
||||
|
|
@ -280,16 +280,14 @@ public class TimeUtils {
|
|||
* 获取时间戳字符串yyyyMMDDHHmmss
|
||||
*/
|
||||
public static String getTimeStamp(Long time) {
|
||||
Date data = new Date(time);
|
||||
return ymdhmsFormat_new.format(data);
|
||||
return new SimpleDateFormat(ymdhmsFormat_new).format(new Date(time));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取时间戳字符串yyyyMMdd
|
||||
*/
|
||||
public static String getTimeStampYMD(Long time) {
|
||||
Date data = new Date(time);
|
||||
return ymdFormat.format(data);
|
||||
return new SimpleDateFormat(ymdFormat).format(new Date(time));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import java.util.Random;
|
|||
* 加密解密轮数应为8的倍数,推荐加密轮数为64轮
|
||||
*/
|
||||
public class Tea {
|
||||
public static int[] KEY = new int[]{//加密解密所用的KEY
|
||||
public static final int[] KEY = new int[]{//加密解密所用的KEY
|
||||
0x789f5645, 0xf68bd5a4,
|
||||
0x81963ffa, 0x458fac58
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
public class UserBloodySnpInfo {
|
||||
private int serverId;
|
||||
|
||||
private int uid;
|
||||
|
||||
|
|
@ -37,7 +36,6 @@ public class UserBloodySnpInfo {
|
|||
public UserBloodySnpInfo(int uid, String name) {
|
||||
this.uid = uid;
|
||||
this.name = name;
|
||||
this.serverId = GameApplication.serverId;
|
||||
}
|
||||
|
||||
public void updateHeroSkill(String heroId, String skills){
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package com.ljsd.jieling.config.json;
|
||||
|
||||
public class GlobalPlatConfigure {
|
||||
public static PlatConfigure platConfigure = new PlatConfigure();
|
||||
protected static PlatConfigure platConfigure = new PlatConfigure();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
package com.ljsd.jieling.config.json;
|
||||
|
||||
public class KTSDKConstans {
|
||||
public static String appidTest = "jl_test";
|
||||
public static String appidOnlie = "lj_jl_7qdsc";
|
||||
public static String appidTestOnline = "lj_jl_8qdcs";
|
||||
public static final String appidTest = "jl_test";
|
||||
public static final String appidOnlie = "lj_jl_7qdsc";
|
||||
public static final String appidTestOnline = "lj_jl_8qdcs";
|
||||
public static String appid = appidTest;
|
||||
public static String appkey = "c0fb59eb68559b6c9c1463e4d5d0c806";
|
||||
public static String md5Key = "0A008C48E74E8A399F1F80DBED71161C";
|
||||
public static String appsecret = "d53b3e8ef74bf72d8aafce3a1c8671a0";
|
||||
public static final String appkey = "c0fb59eb68559b6c9c1463e4d5d0c806";
|
||||
public static final String md5Key = "0A008C48E74E8A399F1F80DBED71161C";
|
||||
public static final String appsecret = "d53b3e8ef74bf72d8aafce3a1c8671a0";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package com.ljsd.jieling.config.json;
|
||||
|
||||
public class SDK37Constans {
|
||||
public static String gid = "1006856";
|
||||
public static String pid = "1";
|
||||
public static String appkey = "$5wl2BKfodm4nqxVIC0XeHPb9ZRLQFz?";
|
||||
public static String payKey = "cxSeo5IBl6;kdPOJRgjEYHp9LsQMf+1V";
|
||||
public static String chatKey = "37opkldcs341";
|
||||
public static final String gid = "1006856";
|
||||
public static final String pid = "1";
|
||||
public static final String appkey = "$5wl2BKfodm4nqxVIC0XeHPb9ZRLQFz?";
|
||||
public static final String payKey = "cxSeo5IBl6;kdPOJRgjEYHp9LsQMf+1V";
|
||||
public static final String chatKey = "37opkldcs341";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.ljsd.jieling.util.http.HttpPool;
|
|||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.luaj.vm2.ast.Str;
|
||||
import util.StringUtil;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
|
@ -143,15 +144,15 @@ public class DataMessageUtils {
|
|||
return null;
|
||||
}
|
||||
final String reserved_char = ";/?:@=&";
|
||||
String ret = "";
|
||||
StringBuilder ret = new StringBuilder();
|
||||
for(int i=0; i < url.length(); i++) {
|
||||
String cs = String.valueOf( url.charAt(i) );
|
||||
if(reserved_char.contains(cs)){
|
||||
ret += cs;
|
||||
ret.append(cs);
|
||||
}else{
|
||||
ret += URLEncoder.encode(cs, "utf-8");
|
||||
ret.append(URLEncoder.encode(cs, "utf-8"));
|
||||
}
|
||||
}
|
||||
return ret.replace("+", "%20");
|
||||
return ret.toString().replace("+", "%20");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import org.springframework.data.domain.Sort;
|
|||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -54,7 +55,7 @@ public class EndlessFunction implements FunctionManager {
|
|||
Query query = new Query();
|
||||
query.with(new Sort(Sort.Direction.DESC,"playerManager.level"));
|
||||
query.fields().include("playerManager.level");
|
||||
List<User> users = null;
|
||||
List<User> users = new ArrayList<>();
|
||||
try {
|
||||
users = MongoUtil.getLjsdMongoTemplate().findAllByCondition(query, User.class);
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -76,6 +76,8 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
|||
if(!b){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
||||
}
|
||||
} else {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
||||
}
|
||||
|
||||
int hurt = 0;
|
||||
|
|
|
|||
|
|
@ -3239,7 +3239,7 @@ public class MapLogic {
|
|||
}
|
||||
}
|
||||
}
|
||||
response.setBoxDrop(drop);
|
||||
response.setBoxDrop(drop == null ? CommonProto.Drop.newBuilder() : drop);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class CardRandomManager {
|
||||
|
||||
private Set<Integer> heroIids;
|
||||
|
||||
private Map<Integer,Integer> totalConuntByType;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -241,7 +241,7 @@ public class Equip extends PropertyItem implements Cloneable{
|
|||
return result;
|
||||
}
|
||||
private int getRandomSkill(int[] skills){
|
||||
if(skills.length<0){
|
||||
if(skills.length<=0){
|
||||
return 0;
|
||||
}
|
||||
int poolId = MathUtils.randomFromArray(skills);
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
public class GoodsInfo {
|
||||
private int goodsId;
|
||||
private int type;
|
||||
private int startTime;
|
||||
private int endTime;
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
|
|
|||
|
|
@ -335,20 +335,21 @@ public class PlayerManager extends MongoBase {
|
|||
}
|
||||
|
||||
public void vipFlush( Set<Integer> removePrivileges) {
|
||||
if (vipInfo.isEmpty()){
|
||||
if (vipInfo.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for(Integer id : vipInfo.keySet()){
|
||||
for (Map.Entry<Integer, VipInfo> entry : vipInfo.entrySet()) {
|
||||
Integer id = entry.getKey();
|
||||
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(id);
|
||||
if(null == sPrivilegeTypeConfig){
|
||||
if (null == sPrivilegeTypeConfig) {
|
||||
continue;
|
||||
}
|
||||
int refreshType = sPrivilegeTypeConfig.getRefreshType()[0];
|
||||
if(refreshType == 1&&vipInfo.get(id).getCount()>0){
|
||||
vipInfo.put(id,new VipInfo());
|
||||
if (refreshType == 1 && entry.getValue().getCount() > 0) {
|
||||
vipInfo.put(id, new VipInfo());
|
||||
}
|
||||
}
|
||||
for(Integer remove : removePrivileges){
|
||||
for (Integer remove : removePrivileges) {
|
||||
vipInfo.remove(remove);
|
||||
}
|
||||
updateString("vipInfo", vipInfo);
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
|
||||
public class QuestionOption {
|
||||
private String content = "";
|
||||
private int type;
|
||||
private String[] options ;
|
||||
|
||||
public QuestionOption(String content, int type, String[] options) {
|
||||
this.content = content;
|
||||
this.type = type;
|
||||
this.options = options;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
public class RingFire {
|
||||
private int level;
|
||||
}
|
||||
|
|
@ -277,8 +277,8 @@ public class UserMissionManager extends MongoBase {
|
|||
for(int quality:qualityArray){
|
||||
qualityNum.put(quality,qualityNum.getOrDefault(quality,0)+1);
|
||||
}
|
||||
for(int quality:qualityNum.keySet()){
|
||||
List<SMazeTreasure> sMazeTreasures = SMazeTreasure.mazeMapByTaskType.get(quality);
|
||||
for(Map.Entry<Integer,Integer> entry:qualityNum.entrySet()){
|
||||
List<SMazeTreasure> sMazeTreasures = SMazeTreasure.mazeMapByTaskType.get(entry.getKey());
|
||||
int[][] treasures = new int[sMazeTreasures.size()][];
|
||||
for(int i = 0 ; i<sMazeTreasures.size();i++){
|
||||
|
||||
|
|
@ -286,7 +286,7 @@ public class UserMissionManager extends MongoBase {
|
|||
treasures[i][0] = sMazeTreasures.get(i).getId();
|
||||
treasures[i][1] = 1;
|
||||
}
|
||||
int[] ids = MathUtils.randomFromWeightWithTaking(treasures, qualityNum.get(quality));
|
||||
int[] ids = MathUtils.randomFromWeightWithTaking(treasures, entry.getValue());
|
||||
// int missionId = sMazeTreasures.get(MathUtils.randomInt(sMazeTreasures.size())).getId();
|
||||
for(int id:ids){
|
||||
missingRoomMissionType.addDoingMission(missingRoomMissionType.getMissionIndex()*10000+id);
|
||||
|
|
|
|||
|
|
@ -332,8 +332,7 @@ public class DeathPathLogic {
|
|||
|
||||
|
||||
|
||||
class DeathPathExecutor extends Thread{
|
||||
|
||||
public static class DeathPathExecutor extends Thread{
|
||||
|
||||
public DeathPathExecutor(BlockingQueue<DeathPathTask> blockingQueue) {
|
||||
this.blockingQueue = blockingQueue;
|
||||
|
|
|
|||
|
|
@ -266,19 +266,20 @@ public class GuildFightLogic {
|
|||
public static void familyFightMatching() throws Exception {
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
// Thread.sleep(10000);
|
||||
Set<Integer> guildIds = GuilidManager.guildInfoMap.keySet();
|
||||
if (guildIds.size() < 1) {
|
||||
int guildIds = GuilidManager.guildInfoMap.size();
|
||||
if (guildIds < 1) {
|
||||
return;
|
||||
}
|
||||
String key = RedisKey.getKey(RedisKey.FAMILY_FIGHT_RANK, "", false);
|
||||
SGuildSetting guildSetting = sGuildSetting;
|
||||
for (Integer gid : guildIds) {
|
||||
for (Map.Entry<Integer,GuildInfo> guildInfoMapEntry : GuilidManager.guildInfoMap.entrySet()) {
|
||||
Integer gid = guildInfoMapEntry.getKey();
|
||||
if(redisUtil.getZSetScore("guild-release","",String.valueOf(gid))>0){
|
||||
continue;
|
||||
}
|
||||
Map<Integer, SGuildLevelConfig> configMap = STableManager.getConfig(SGuildLevelConfig.class);
|
||||
//todo 人数限制
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(gid);
|
||||
GuildInfo guildInfo = guildInfoMapEntry.getValue();
|
||||
if(guildInfo.getDefendInfo().size()<configMap.get(guildInfo.getLevel()).getDefendNum()){
|
||||
continue;
|
||||
}
|
||||
|
|
@ -376,13 +377,13 @@ public class GuildFightLogic {
|
|||
|
||||
private static void sendMatchingInfo(){
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
Set<Integer> guildIds = GuilidManager.guildInfoMap.keySet();
|
||||
for (Integer gid : guildIds) {
|
||||
for (Map.Entry<Integer,GuildInfo> entry : GuilidManager.guildInfoMap.entrySet()) {
|
||||
Integer gid = entry.getKey();
|
||||
int enemyFamily = getEnemyFamily(gid);
|
||||
if (enemyFamily == -1) {
|
||||
continue;
|
||||
}
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(gid);
|
||||
GuildInfo guildInfo = entry.getValue();
|
||||
GuildCache enemyInfo = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(enemyFamily), GuildCache.class);
|
||||
// GuildInfo enemyInfo = GuilidManager.guildInfoMap.get(enemyFamily);
|
||||
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder().setId(enemyFamily)
|
||||
|
|
|
|||
|
|
@ -634,11 +634,12 @@ public class CombatLogic {
|
|||
}
|
||||
int nowTime = (int)(TimeUtils.now()/1000);
|
||||
User findUser = UserManager.getUser(findUserId);
|
||||
String findRewardMail = ItemUtil.getMailReward(findUser,findRewardgroup, 1.0f);
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("adventuren_boss_find_reward_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("adventuren_boss_find_reward__txt");
|
||||
MailLogic.getInstance().sendMail(findUserId,title,content,findRewardMail,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
|
||||
if (findRewardgroup != null) {
|
||||
String findRewardMail = ItemUtil.getMailReward(findUser,findRewardgroup, 1.0f);
|
||||
MailLogic.getInstance().sendMail(findUserId,title,content,findRewardMail,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
User killUser = UserManager.getUser(killUid);
|
||||
String killRewardMail = ItemUtil.getMailReward(killUser,killReward, 1.0f);
|
||||
title = SErrorCodeEerverConfig.getI18NMessage("adventuren_boss_kill_reward_title");
|
||||
|
|
@ -1046,10 +1047,11 @@ public class CombatLogic {
|
|||
int count = 0;
|
||||
do {
|
||||
isOver = true;
|
||||
Iterator<Integer> it = tempMap.keySet().iterator();
|
||||
Iterator<Map.Entry<Integer, Integer>> it = tempMap.entrySet().iterator();
|
||||
while(it.hasNext()){
|
||||
int key = it.next();
|
||||
int value = tempMap.get(key);
|
||||
Map.Entry<Integer, Integer> entry = it.next();
|
||||
int key = entry.getKey();
|
||||
int value = entry.getValue();
|
||||
SEquipConfig sEquipConfig = config.get(key);
|
||||
if(sEquipConfig==null)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -7,13 +7,11 @@ import com.ljsd.jieling.logic.dao.root.User;
|
|||
*/
|
||||
public class AyyncWorker implements AyncWorkerRunnable {
|
||||
private User user;
|
||||
private boolean isTask;
|
||||
private AyncWorkerRunnable ayncWorkerRunnable;
|
||||
|
||||
|
||||
public AyyncWorker(User user, boolean isTask, AyncWorkerRunnable ayncWorkerRunnable) {
|
||||
this.user = user;
|
||||
this.isTask = isTask;
|
||||
this.ayncWorkerRunnable = ayncWorkerRunnable;
|
||||
}
|
||||
|
||||
|
|
@ -28,10 +26,6 @@ public class AyyncWorker implements AyncWorkerRunnable {
|
|||
this.user = user;
|
||||
}
|
||||
|
||||
public void setTask(boolean task) {
|
||||
isTask = task;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ public class SGameSetting implements BaseConfig {
|
|||
}
|
||||
|
||||
public void setShowRank(int showRank) {
|
||||
showRank = showRank;
|
||||
this.showRank = showRank;
|
||||
}
|
||||
|
||||
public int getMaxNameLength() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue