Commit 9855819a by 周君强

1.留言功能调整;

2.代码结构调整,弃用动态代理
parent 453f64c4
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId> <groupId>org.example</groupId>
<artifactId>SecretGradeGame</artifactId> <artifactId>SecretGardenGame</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>secretGradeGame</name> <name>secretGardenGame</name>
<build> <build>
<finalName>secretGardenGame</finalName> <finalName>secretGardenGame</finalName>
<plugins> <plugins>
......
...@@ -6,6 +6,7 @@ import org.springframework.boot.SpringApplication; ...@@ -6,6 +6,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication @SpringBootApplication
...@@ -14,9 +15,6 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -14,9 +15,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling @EnableScheduling
public class SecretGardenApplication { public class SecretGardenApplication {
public static void main(String[] args) { public static void main(String[] args) {
TimingAcquisition timingAcquisition = new TimingAcquisition();
// timingAcquisition.loadingTest();
TimingAcquisition.loading();
SpringApplication.run(SecretGardenApplication.class, args); SpringApplication.run(SecretGardenApplication.class, args);
ExpireThread expireThread = new ExpireThread(); ExpireThread expireThread = new ExpireThread();
Thread thread = new Thread(expireThread); Thread thread = new Thread(expireThread);
......
...@@ -13,6 +13,7 @@ import org.slf4j.Logger; ...@@ -13,6 +13,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -27,6 +28,13 @@ import java.util.stream.Collectors; ...@@ -27,6 +28,13 @@ import java.util.stream.Collectors;
public class InitSysServlet implements InitializingBean { public class InitSysServlet implements InitializingBean {
Logger log = LoggerFactory.getLogger(InitSysServlet.class); Logger log = LoggerFactory.getLogger(InitSysServlet.class);
@Value("${userFilePath}")
private String userFilePath;
@Value("${configFilePath}")
private String configFilePath;
@Value("${speechFilePath}")
private String speechFilePath;
private NurseryMapper nurseryMapper; private NurseryMapper nurseryMapper;
private PlantPeriodMapper plantPeriodMapper; private PlantPeriodMapper plantPeriodMapper;
private PlantMapper plantMapper; private PlantMapper plantMapper;
...@@ -178,6 +186,12 @@ public class InitSysServlet implements InitializingBean { ...@@ -178,6 +186,12 @@ public class InitSysServlet implements InitializingBean {
*/ */
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
//--------------------------加载玩家数据----------------------
TimingAcquisition.loading(userFilePath);
//--------------------加载话术-----------------
TimingAcquisition.speechLoading(speechFilePath);
//--------------------------缓存花圃配置信息---------------------- //--------------------------缓存花圃配置信息----------------------
log.info("开始缓存花圃配置信息到缓存"); log.info("开始缓存花圃配置信息到缓存");
Map<Integer, NurseryPojo> nurseryPojoMap = new ConcurrentHashMap<>(); Map<Integer, NurseryPojo> nurseryPojoMap = new ConcurrentHashMap<>();
...@@ -514,7 +528,7 @@ public class InitSysServlet implements InitializingBean { ...@@ -514,7 +528,7 @@ public class InitSysServlet implements InitializingBean {
TimingAcquisition.friendshipRankingList.addAll(friendshipRankingList); TimingAcquisition.friendshipRankingList.addAll(friendshipRankingList);
//获取所有地区 //获取所有地区
String fileName = "region.json"; String fileName = "region.json";
String s = PersistenceUtil.getConfigFromFile(fileName); String s = PersistenceUtil.getConfigFromFile(configFilePath, fileName);
Map<String, List<RegionIPDto>> IPRegionsMap = JSON.parseObject(s, new TypeReference<Map<String, List<RegionIPDto>>>(){}); Map<String, List<RegionIPDto>> IPRegionsMap = JSON.parseObject(s, new TypeReference<Map<String, List<RegionIPDto>>>(){});
for (Map.Entry<String, List<RegionIPDto>> entry : IPRegionsMap.entrySet()) { for (Map.Entry<String, List<RegionIPDto>> entry : IPRegionsMap.entrySet()) {
List<RegionIPDto> regionIPList = entry.getValue(); List<RegionIPDto> regionIPList = entry.getValue();
......
...@@ -2,6 +2,7 @@ package com.qiwuai.garden.common; ...@@ -2,6 +2,7 @@ package com.qiwuai.garden.common;
import com.qiwuai.garden.common.cache.CacheUtil; import com.qiwuai.garden.common.cache.CacheUtil;
import com.qiwuai.garden.common.utils.DateUtil; import com.qiwuai.garden.common.utils.DateUtil;
import com.qiwuai.garden.common.utils.HttpUtil;
import com.qiwuai.garden.common.utils.SpeechUtil; import com.qiwuai.garden.common.utils.SpeechUtil;
import com.qiwuai.garden.common.utils.YamlUtil; import com.qiwuai.garden.common.utils.YamlUtil;
import com.qiwuai.garden.dto.FriendDto; import com.qiwuai.garden.dto.FriendDto;
...@@ -12,6 +13,7 @@ import com.qiwuai.garden.dto.base.ResultVarsResponse; ...@@ -12,6 +13,7 @@ import com.qiwuai.garden.dto.base.ResultVarsResponse;
import com.qiwuai.garden.dto.request.OperationRequest; import com.qiwuai.garden.dto.request.OperationRequest;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
...@@ -23,7 +25,8 @@ import java.util.Map; ...@@ -23,7 +25,8 @@ import java.util.Map;
public class ProxyFactory { public class ProxyFactory {
Logger log = LoggerFactory.getLogger(ProxyFactory.class); Logger log = LoggerFactory.getLogger(ProxyFactory.class);
//从yml配置文件中取出对话过期时间 //从yml配置文件中取出对话过期时间
String offlineTime = YamlUtil.getValueByKey("offlineTime"); @Value("${offlineTime}")
private String offlineTime;
private Object target; private Object target;
public ProxyFactory(Object target) { public ProxyFactory(Object target) {
......
...@@ -21,7 +21,6 @@ import org.springframework.util.StringUtils; ...@@ -21,7 +21,6 @@ import org.springframework.util.StringUtils;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.io.File; import java.io.File;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -83,7 +82,14 @@ public class TimingAcquisition { ...@@ -83,7 +82,14 @@ public class TimingAcquisition {
* 地区友情榜 * 地区友情榜
*/ */
public volatile static Map<String, List<PlayerTimesDto>> regionFriendShipRankingListMap = new ConcurrentHashMap<>(); public volatile static Map<String, List<PlayerTimesDto>> regionFriendShipRankingListMap = new ConcurrentHashMap<>();
/**
* 配置文件信息
*/
public volatile static Map<String, String> applicationMap = new ConcurrentHashMap<>();
/**
* 敏感词
*/
public volatile static List<String> sensitiveWordList = new ArrayList<>();
/** /**
...@@ -241,10 +247,8 @@ public class TimingAcquisition { ...@@ -241,10 +247,8 @@ public class TimingAcquisition {
/** /**
* 通过json文件加载所有用户数据到缓存中 * 通过json文件加载所有用户数据到缓存中
*/ */
public static void loading() { public static void loading(String userFilePath) {
log.info("-----------开始加载玩家数据----------------"); log.info("-----------开始加载玩家数据----------------");
//从yml配置文件中取出存放玩家数据的地址
String userFilePath = YamlUtil.getValueByKey("userFilePath");
File file = new File(userFilePath); File file = new File(userFilePath);
File[] files = file.listFiles(); File[] files = file.listFiles();
if (files == null) { if (files == null) {
...@@ -255,24 +259,17 @@ public class TimingAcquisition { ...@@ -255,24 +259,17 @@ public class TimingAcquisition {
if (f.isFile()) { if (f.isFile()) {
String s = PersistenceUtil.getDataFromFile(String.valueOf(f)); String s = PersistenceUtil.getDataFromFile(String.valueOf(f));
//JSON转map对象 //JSON转map对象
// log.info("取出的数据:" + s);
Map<String, GardenerDto> gardener = JSON.parseObject(s, new TypeReference<Map<String, GardenerDto>>(){}); Map<String, GardenerDto> gardener = JSON.parseObject(s, new TypeReference<Map<String, GardenerDto>>(){});
// log.info("从文件中取出玩家的缓存数据:" + gardener);
gardenerMap.putAll(gardener); gardenerMap.putAll(gardener);
} }
} }
log.info("-----------玩家数据加载完成----------------"); log.info("-----------玩家数据加载完成----------------");
// log.info("内存中所有玩家的缓存数据:" + gardenerMap );
//加载话术
speechLoading();
//加载配置文件region.json
// regionNoLoading("region.json");
} }
/** /**
* 通过yaml文件加载所有话术到缓存中 * 通过yaml文件加载所有话术到缓存中
*/ */
public static void speechLoading() { public static void speechLoading(String speechFilePath) {
log.info("---------开始加载话术到缓存中---------"); log.info("---------开始加载话术到缓存中---------");
Map<String, Map<String, List<String>>> plantSpeech = new HashMap<>(); Map<String, Map<String, List<String>>> plantSpeech = new HashMap<>();
Map<String, Map<String, List<String>>> gardenerSpeech = new HashMap<>(); Map<String, Map<String, List<String>>> gardenerSpeech = new HashMap<>();
...@@ -284,26 +281,19 @@ public class TimingAcquisition { ...@@ -284,26 +281,19 @@ public class TimingAcquisition {
Map<String, Map<String, List<String>>> adviseSpeech = new HashMap<>(); Map<String, Map<String, List<String>>> adviseSpeech = new HashMap<>();
Map<String, Map<String, List<String>>> rankingSpeech = new HashMap<>(); Map<String, Map<String, List<String>>> rankingSpeech = new HashMap<>();
try { try {
plantSpeech = YamlUtil.loadSpeechToMap("plant.yaml"); plantSpeech = YamlUtil.loadSpeechToMap(speechFilePath, "plant.yaml");
gardenerSpeech = YamlUtil.loadSpeechToMap("gardener.yaml"); gardenerSpeech = YamlUtil.loadSpeechToMap(speechFilePath, "gardener.yaml");
petSpeech = YamlUtil.loadSpeechToMap("pet.yaml"); petSpeech = YamlUtil.loadSpeechToMap(speechFilePath, "pet.yaml");
marketSpeech = YamlUtil.loadSpeechToMap("market.yaml"); marketSpeech = YamlUtil.loadSpeechToMap(speechFilePath, "market.yaml");
socialSpeech = YamlUtil.loadSpeechToMap("social.yaml"); socialSpeech = YamlUtil.loadSpeechToMap(speechFilePath, "social.yaml");
taskSpeech = YamlUtil.loadSpeechToMap("task.yaml"); taskSpeech = YamlUtil.loadSpeechToMap(speechFilePath, "task.yaml");
helpSpeech = YamlUtil.loadSpeechToMap("help.yaml"); helpSpeech = YamlUtil.loadSpeechToMap(speechFilePath, "help.yaml");
adviseSpeech = YamlUtil.loadSpeechToMap("advise.yaml"); adviseSpeech = YamlUtil.loadSpeechToMap(speechFilePath, "advise.yaml");
rankingSpeech = YamlUtil.loadSpeechToMap("ranking.yaml"); rankingSpeech = YamlUtil.loadSpeechToMap(speechFilePath, "ranking.yaml");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
//JSON转map对象 //JSON转map对象
// log.info("从yaml文件中取出的种植话术:" + plantSpeech);
// log.info("从yaml文件中取出的园丁话术:" + gardenerSpeech);
// log.info("从yaml文件中取出的宠物话术:" + petSpeech);
// log.info("从yaml文件中取出的市场话术:" + marketSpeech);
// log.info("从yaml文件中取出的社交话术:" + socialSpeech);
// log.info("从yaml文件中取出的任务话术:" + taskSpeech);
// log.info("从yaml文件中取出的帮助话术:" + helpSpeech);
plantSpeechMap.putAll(plantSpeech); plantSpeechMap.putAll(plantSpeech);
gardenerSpeechMap.putAll(gardenerSpeech); gardenerSpeechMap.putAll(gardenerSpeech);
petSpeechMap.putAll(petSpeech); petSpeechMap.putAll(petSpeech);
...@@ -313,13 +303,6 @@ public class TimingAcquisition { ...@@ -313,13 +303,6 @@ public class TimingAcquisition {
helpSpeechMap.putAll(helpSpeech); helpSpeechMap.putAll(helpSpeech);
adviseSpeechMap.putAll(adviseSpeech); adviseSpeechMap.putAll(adviseSpeech);
rankingSpeechMap.putAll(rankingSpeech); rankingSpeechMap.putAll(rankingSpeech);
// log.info("缓存中玩家的种植话术:" + plantSpeechMap);
// log.info("缓存中玩家的园丁话术:" + gardenerSpeechMap);
// log.info("缓存中玩家的宠物话术:" + petSpeechMap);
// log.info("缓存中玩家的市场话术:" + marketSpeechMap);
// log.info("缓存中玩家的社交话术:" + socialSpeechMap);
// log.info("缓存中玩家的任务话术:" + taskSpeechMap);
// log.info("缓存中玩家的帮助话术:" + helpSpeechMap);
log.info("---------加载话术到缓存的操作完成---------"); log.info("---------加载话术到缓存的操作完成---------");
} }
...@@ -327,8 +310,8 @@ public class TimingAcquisition { ...@@ -327,8 +310,8 @@ public class TimingAcquisition {
* @param fileName * @param fileName
* 通过json文件加载配置到缓存中 * 通过json文件加载配置到缓存中
*/ */
public static void regionNoLoading(String fileName) { public static void regionNoLoading(String configFilePath, String fileName) {
String s = PersistenceUtil.getConfigFromFile(fileName); String s = PersistenceUtil.getConfigFromFile(configFilePath, fileName);
//JSON转map对象 //JSON转map对象
log.info(fileName + "配置文件取出的配置数据:" + s); log.info(fileName + "配置文件取出的配置数据:" + s);
Map<String, Integer> config = JSON.parseObject(s, new TypeReference<Map<String, Integer>>(){}); Map<String, Integer> config = JSON.parseObject(s, new TypeReference<Map<String, Integer>>(){});
...@@ -339,10 +322,10 @@ public class TimingAcquisition { ...@@ -339,10 +322,10 @@ public class TimingAcquisition {
/** /**
* 通过json文件加载配置到缓存中 * 通过json文件加载配置到缓存中
*/ */
public static String generateAddress(String IP) { public static String generateAddress(String configFilePath, String IP) {
String result = null; String result = null;
String fileName = "region.json"; String fileName = "region.json";
String s = PersistenceUtil.getConfigFromFile(fileName); String s = PersistenceUtil.getConfigFromFile(configFilePath, fileName);
Map<String, List<RegionIPDto>> IPRegionsMap = JSON.parseObject(s, new TypeReference<Map<String, List<RegionIPDto>>>(){}); Map<String, List<RegionIPDto>> IPRegionsMap = JSON.parseObject(s, new TypeReference<Map<String, List<RegionIPDto>>>(){});
log.info(fileName + "文件中取出服务器和地区的数据:" + IPRegionsMap); log.info(fileName + "文件中取出服务器和地区的数据:" + IPRegionsMap);
//通过服务器IP找到所有的地区 //通过服务器IP找到所有的地区
......
package com.qiwuai.garden.common.cache;
public class UserThread {
}
...@@ -14,6 +14,7 @@ import com.qiwuai.garden.pojo.PetPojo; ...@@ -14,6 +14,7 @@ import com.qiwuai.garden.pojo.PetPojo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
...@@ -32,6 +33,9 @@ import java.util.concurrent.TimeUnit; ...@@ -32,6 +33,9 @@ import java.util.concurrent.TimeUnit;
public class ScheduleTask { public class ScheduleTask {
Logger log = LoggerFactory.getLogger(ScheduleTask.class); Logger log = LoggerFactory.getLogger(ScheduleTask.class);
@Value("${configFilePath}")
public String configFilePath;
//定时喂养宠物,消耗物品 //定时喂养宠物,消耗物品
// @Scheduled(cron = "0 0 1 * * ?") // @Scheduled(cron = "0 0 1 * * ?")
// @Scheduled(cron = "0/60 * * * * ?") // @Scheduled(cron = "0/60 * * * * ?")
...@@ -120,7 +124,7 @@ public class ScheduleTask { ...@@ -120,7 +124,7 @@ public class ScheduleTask {
TimingAcquisition.friendshipRankingList.addAll(friendshipRankingList); TimingAcquisition.friendshipRankingList.addAll(friendshipRankingList);
//获取所有地区 //获取所有地区
String fileName = "region.json"; String fileName = "region.json";
String s = PersistenceUtil.getConfigFromFile(fileName); String s = PersistenceUtil.getConfigFromFile(configFilePath, fileName);
Map<String, List<RegionIPDto>> IPRegionsMap = JSON.parseObject(s, new TypeReference<Map<String, List<RegionIPDto>>>(){}); Map<String, List<RegionIPDto>> IPRegionsMap = JSON.parseObject(s, new TypeReference<Map<String, List<RegionIPDto>>>(){});
for (Map.Entry<String, List<RegionIPDto>> entry : IPRegionsMap.entrySet()) { for (Map.Entry<String, List<RegionIPDto>> entry : IPRegionsMap.entrySet()) {
List<RegionIPDto> regionIPList = entry.getValue(); List<RegionIPDto> regionIPList = entry.getValue();
......
package com.qiwuai.garden.common.utils;
import com.qiwuai.garden.common.Constants;
import com.qiwuai.garden.common.TimingAcquisition;
import com.qiwuai.garden.common.cache.CacheUtil;
import com.qiwuai.garden.dto.FriendDto;
import com.qiwuai.garden.dto.GardenerDto;
import com.qiwuai.garden.dto.base.CommonResponse;
import com.qiwuai.garden.dto.base.ResultVarsResponse;
import com.qiwuai.garden.dto.request.OperationRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
public class DataTrimUtil {
static Logger log = LoggerFactory.getLogger(DataTrimUtil.class);
/**
* 更改玩家状态
*/
public static void AdjustStatus(String uid, String offlineTime) throws ParseException {
//玩家当前为离线状态
GardenerDto gardener = TimingAcquisition.gardenerMap.get(uid);
//操作时间为今天之前,需重置
String nowTime = DateUtil.getCurrentTime();
if (!StringUtils.isEmpty(gardener.getOnlineTime())) {
if (DateUtil.compare(nowTime, gardener.getOnlineTime()) == 1) {
//遍历日常任务
if (!StringUtils.isEmpty(gardener.getDailyTaskCountMap())) {
log.info(uid + "的日常任务重置时间:" + nowTime);
for (Map.Entry<Integer, Integer> entry : gardener.getDailyTaskCountMap().entrySet()) {
entry.setValue(0);
}
for (Map.Entry<Integer, Integer> entry : gardener.getDailyTaskFinishMap().entrySet()) {
entry.setValue(0);
}
//更新日常任务重置时间
gardener.setDailyTaskResetTime(nowTime);
}
//重置好友已帮助的标记
List<FriendDto> friendList = gardener.getFriendList();
if (!StringUtils.isEmpty(friendList)) {
if (friendList.size() != 0) {
for (FriendDto friend : friendList) {
//已经帮助过的好友重置
if (friend.getHelpTag() == Constants.HELP_HAVE_SIGN) {
friend.setHelpTag(Constants.HELP_NO_SIGN);
}
}
}
}
//重置帮助和偷菜次数为0
gardener.setHelpTimes(0);
gardener.setStealTimes(0);
//重置“今日已偷取的陌生人”
gardener.setStrangerMap(null);
//更新玩家在线状态
statusUpdate(uid);
}
} else {
//更新玩家在线状态
statusUpdate(uid);
}
if (gardener.getStatus() == Constants.OFFLINE) {
//更新玩家在线状态
statusUpdate(uid);
}
//该玩家以唯一标识加入全局缓存,用于玩家离线判断
String uniqueUid = uid + "%#%online%#%";
CacheUtil.put(uniqueUid, "", Long.parseLong(offlineTime));
}
/**
* 判断整数尾数是否为1
*/
public static CommonResponse AdjustParams(String uid, CommonResponse result, OperationRequest request) throws ParseException {
ResultVarsResponse data = result.getData();
//检索到有新消息
if (!StringUtils.isEmpty(data)) {
//玩家有新的消息提醒
if (checkNewMessage(uid)) {
data.getVars().set消息提醒("1");
}
//所有“后台附加返回”为null值的都给转成“无效返回”
if (StringUtils.isEmpty(data.getVars().get后台附加返回())) {
data.getVars().set后台附加返回("无效返回");
}
//所有“后台附加返回”为null值的都给转成“无效返回”
if (StringUtils.isEmpty(data.getVars().get后台附加返回2())) {
data.getVars().set后台附加返回2("无效返回");
}
//所有“建议指令”为null值的都给转成“无效返回”
if (StringUtils.isEmpty(data.getVars().get建议指令())) {
data.getVars().set建议指令("无效返回");
}
//替换话术词汇
String text = data.getVars().get反馈文本();
if (!StringUtils.isEmpty(text)) {
//替换话术的【男园丁】或【女园丁】
String gardenerName = request.getGardenerName();
if (!StringUtils.isEmpty(gardenerName)) {
if (text.contains("【男园丁@正常】")) {
text = text.replace("【男园丁@正常】", "【" + gardenerName + "@正常】");
}
if (text.contains("【女园丁@正常】")) {
text = text.replace("【女园丁@正常】", "【" + gardenerName + "@正常】");
}
text = text.replace("园丁", gardenerName);
data.getVars().set反馈文本(text);
}
//替换话术里的{花圃称呼}
if (text.contains("{花圃称呼}")) {
data.getVars().set反馈文本(SpeechUtil.replaceNurseryName(text));
}
}
//玩家货币数量
//获取货币袋
//货币配置信息
Integer moneyId = Integer.parseInt(TimingAcquisition.systemConfigMap.get("money").getValue());
Integer moneyNum = TimingAcquisition.gardenerMap.get(uid).getBackPack().getItemBags()
.get(Constants.ITEM_TYPE_MONEY).getItems(moneyId).getItemNum();
data.getVars().set玩家金币数量(moneyNum);
//------------是否有宠物----------
int petCount = TimingAcquisition.getPetNum(uid);
if (petCount > 0) {
data.getVars().set是否有宠物("是");
}
//------------是否有植物----------
boolean plantExist = TimingAcquisition.havaNurseryPlant(uid);
if (plantExist) {
data.getVars().set是否有植物("是");
}
//------------是否开启日常任务----------
boolean dailyTaskExist = TimingAcquisition.havaDailyTask(uid);
if (dailyTaskExist) {
data.getVars().set是否开启日常任务("是");
}
String feedContent = "后台返回参数 = [" +
"code:" + result.getCode() +
", msg:" + result.getMsg() +
", 反馈ID:" + data.getVars().get反馈ID() +
", 反馈文本:" + data.getVars().get反馈文本() +
", 后台附加返回:" + data.getVars().get后台附加返回() +
", 后台附加返回2:" + data.getVars().get后台附加返回2() +
", 消息推送附加返回:" + data.getVars().get消息推送附加返回() +
", 玩家当前地址:" + data.getVars().get玩家当前位置() +
", 消息提醒:" + data.getVars().get消息提醒() +
", 任务完成:" + data.getVars().get任务完成() +
", 玩家金币数量:" + data.getVars().get玩家金币数量() +
", 是否有宠物:" + data.getVars().get是否有宠物() +
", 是否有植物:" + data.getVars().get是否有植物() +
", 是否开启日常任务:" + data.getVars().get是否开启日常任务() +
"]";
//玩家有新消息提示
log.info(feedContent);
}
return result;
}
/**
* 玩家状态更新为在线
*/
public static void statusUpdate(String uid) {
if (!StringUtils.isEmpty(TimingAcquisition.gardenerMap.get(uid))) {
TimingAcquisition.gardenerMap.get(uid).setStatus(Constants.ONLINE);
//修改上线时间
TimingAcquisition.gardenerMap.get(uid).setOnlineTime(DateUtil.getCurrentTime());
}
}
/**
* 检查玩家是否有新消息
*/
public static boolean checkNewMessage(String uid) {
boolean result = false;
//获取玩家的所有消息提醒
Map<String, Integer> notice = TimingAcquisition.gardenerMap.get(uid).getNotice();
//遍历所有消息提示,统计各类消息提醒次数
for (Map.Entry<String, Integer> entry : notice.entrySet()) {
if (entry.getValue() > 0) {
//好友申请提示个数
if (Constants.ADD_FRIEND_NOTICE.equals(entry.getKey())) {
result = true;
break;
}
//好友申请通过的个数
if (Constants.PASS_ADD_FRIEND_NOTICE.equals(entry.getKey())) {
result = true;
break;
}
//好友留言提示个数
if (Constants.MESSAGE_NOTICE.equals(entry.getKey())) {
result = true;
break;
}
//偷菜简报提示个数
if (Constants.STEAL_REPORT_NOTICE.equals(entry.getKey())) {
result = true;
break;
}
//帮助简报提示个数
if (Constants.HELP_REPORT_NOTICE.equals(entry.getKey())) {
result = true;
break;
}
//任务提示个数
if (Constants.TASK_NOTICE.equals(entry.getKey())) {
result = true;
break;
}
}
}
return result;
}
}
...@@ -7,27 +7,50 @@ import com.qiwuai.garden.dto.response.PhraseResponse; ...@@ -7,27 +7,50 @@ import com.qiwuai.garden.dto.response.PhraseResponse;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.util.List; import java.util.List;
@Component
public class HttpUtil { public class HttpUtil {
static Logger log = LoggerFactory.getLogger(HttpUtil.class); static Logger log = LoggerFactory.getLogger(HttpUtil.class);
//动态词组更新秘钥 //动态词组更新秘钥
public static String appSecret = YamlUtil.getValueByKey("appSecret"); public static String appSecret;
@Value("${appSecret}")
public void setAppSecret(String appSecret) {
HttpUtil.appSecret = appSecret;
}
//动态词组更新秘钥 //动态词组更新秘钥
public static String updatePhraseUrl = YamlUtil.getValueByKey("updatePhraseUrl"); public static String updatePhraseUrl;
@Value("${updatePhraseUrl}")
public void setUpdatePhraseUrl(String updatePhraseUrl) {
HttpUtil.updatePhraseUrl = updatePhraseUrl;
}
//分享关系地址 //分享关系地址
public static String shareRelationUrl = YamlUtil.getValueByKey("shareRelationUrl"); public static String shareRelationUrl;
@Value("${shareRelationUrl}")
public void setShareRelationUrl(String shareRelationUrl) {
HttpUtil.shareRelationUrl = shareRelationUrl;
}
//分享链接通道 //分享链接通道
public static String shareChannelId = YamlUtil.getValueByKey("shareChannelId"); public static String shareChannelId;
@Value("${shareChannelId}")
public void setShareChannelId(String shareChannelId) {
HttpUtil.shareChannelId = shareChannelId;
}
//分享链接秘钥 //分享链接秘钥
public static String shareAppSecret = YamlUtil.getValueByKey("shareAppSecret"); public static String shareAppSecret;
@Value("${shareAppSecret}")
public void setShareAppSecret(String shareAppSecret) {
HttpUtil.shareAppSecret = shareAppSecret;
}
//更新动态词组 //更新动态词组
public static void doPut(String phraseName, String phraseContent) { public static void doPut(String phraseName, String phraseContent) {
......
...@@ -4,27 +4,45 @@ import com.alibaba.fastjson.JSON; ...@@ -4,27 +4,45 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.qiwuai.garden.common.Constants; import com.qiwuai.garden.common.Constants;
import com.qiwuai.garden.common.TimingAcquisition; import com.qiwuai.garden.common.TimingAcquisition;
import com.qiwuai.garden.dto.BackPackDto;
import com.qiwuai.garden.dto.HelpReportDto; import com.qiwuai.garden.dto.HelpReportDto;
import com.qiwuai.garden.dto.MessageTimeDto; import com.qiwuai.garden.dto.MessageTimeDto;
import com.qiwuai.garden.dto.StealReportDto; import com.qiwuai.garden.dto.StealReportDto;
import jxl.Cell; import jxl.Cell;
import jxl.Sheet; import jxl.Sheet;
import jxl.Workbook; import jxl.Workbook;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
@Component
public class PersistenceUtil { public class PersistenceUtil {
//玩家数据的存放路径 //玩家数据的存放路径
public static String userFilePath = YamlUtil.getValueByKey("userFilePath"); public static String userFilePath;
@Value("${userFilePath}")
public void setUserFilePath(String userFilePath) {
PersistenceUtil.userFilePath = userFilePath;
}
//各地区编号的存放路径 //各地区编号的存放路径
public static String configFilePath = YamlUtil.getValueByKey("configFilePath"); public static String configFilePath;
@Value("${configFilePath}")
public void setConfigFilePath(String configFilePath) {
PersistenceUtil.configFilePath = configFilePath;
}
//各玩家的留言信息 //各玩家的留言信息
public static String messageFilePath = YamlUtil.getValueByKey("messageFilePath"); public static String messageFilePath;
@Value("${messageFilePath}")
public void setMessageFilePath(String messageFilePath) {
PersistenceUtil.messageFilePath = messageFilePath;
}
//各玩家的简报信息 //各玩家的简报信息
public static String reportFilePath = YamlUtil.getValueByKey("reportFilePath"); public static String reportFilePath;
@Value("${reportFilePath}")
public void setReportFilePath(String reportFilePath) {
PersistenceUtil.reportFilePath = reportFilePath;
}
/** /**
* 保存玩家数据到json文件 * 保存玩家数据到json文件
* @param fileName * @param fileName
...@@ -122,7 +140,7 @@ public class PersistenceUtil { ...@@ -122,7 +140,7 @@ public class PersistenceUtil {
* @param fileName * @param fileName
* @return String * @return String
*/ */
public static String getConfigFromFile(String fileName) { public static String getConfigFromFile(String configFilePath, String fileName) {
BufferedReader reader = null; BufferedReader reader = null;
String lastStr = ""; String lastStr = "";
try { try {
...@@ -152,6 +170,10 @@ public class PersistenceUtil { ...@@ -152,6 +170,10 @@ public class PersistenceUtil {
* @return String * @return String
*/ */
public static List<String> getContentFromFile(String fileName) { public static List<String> getContentFromFile(String fileName) {
List<String> sensitiveWordList = TimingAcquisition.sensitiveWordList;
if (sensitiveWordList.size() != 0) {
return sensitiveWordList;
} else {
List<String> contentList = new ArrayList<>(); List<String> contentList = new ArrayList<>();
try { try {
File file = new File(configFilePath + fileName); File file = new File(configFilePath + fileName);
...@@ -162,11 +184,13 @@ public class PersistenceUtil { ...@@ -162,11 +184,13 @@ public class PersistenceUtil {
String content = cell.getContents(); String content = cell.getContents();
contentList.add(content); contentList.add(content);
} }
sensitiveWordList.addAll(contentList);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return contentList; return contentList;
} }
}
/** /**
* 保存玩家留言到message目录的json文件中 * 保存玩家留言到message目录的json文件中
......
...@@ -2,21 +2,16 @@ package com.qiwuai.garden.common.utils; ...@@ -2,21 +2,16 @@ package com.qiwuai.garden.common.utils;
import com.qiwuai.garden.common.Constants; import com.qiwuai.garden.common.Constants;
import com.qiwuai.garden.common.TimingAcquisition; import com.qiwuai.garden.common.TimingAcquisition;
import com.qiwuai.garden.dto.GardenerDto;
import com.qiwuai.garden.dto.base.CommonRequest; import com.qiwuai.garden.dto.base.CommonRequest;
import com.qiwuai.garden.dto.request.CallRequest; import com.qiwuai.garden.dto.request.CallRequest;
import com.qiwuai.garden.dto.request.OperationRequest; import com.qiwuai.garden.dto.request.OperationRequest;
import com.qiwuai.garden.pojo.AttributePojo; import com.qiwuai.garden.pojo.AttributePojo;
import com.qiwuai.garden.pojo.ItemPojo; import com.qiwuai.garden.pojo.ItemPojo;
import com.qiwuai.garden.pojo.PetPojo;
import com.qiwuai.garden.pojo.PlantPojo; import com.qiwuai.garden.pojo.PlantPojo;
import com.qiwuai.garden.service.gardenerService.GardenerService;
import com.qiwuai.garden.service.gardenerService.impl.GardenerServiceImpl;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -32,20 +27,6 @@ public class RequestConversionUtil { ...@@ -32,20 +27,6 @@ public class RequestConversionUtil {
OperationRequest operationRequest = new OperationRequest(); OperationRequest operationRequest = new OperationRequest();
CallRequest callRequest = commonRequest.getVars(); CallRequest callRequest = commonRequest.getVars();
operationRequest.setUid(commonRequest.getUid()); operationRequest.setUid(commonRequest.getUid());
//----------------------新的uid则创建用户--------------------------
GardenerDto gardener = TimingAcquisition.gardenerMap.get(commonRequest.getUid());
if (StringUtils.isEmpty(gardener)) {
//给新玩家分配姓名
// List<String> nameList = PersistenceUtil.getContentFromFile("name.xls");
// String name = nameList.get(RandomDropUtil.getRandomNum(0, nameList.size()));
String name = "海棠仙子";
OperationRequest operationReq = new OperationRequest();
operationReq.setUid(commonRequest.getUid());
operationReq.setGender(2);
operationReq.setName(name);
GardenerService gardenerService = new GardenerServiceImpl();
gardenerService.create(operationReq);
}
//---------------------存在GB_园丁姓名----------------------- //---------------------存在GB_园丁姓名-----------------------
String gardenerName = callRequest.getGB_园丁姓名(); String gardenerName = callRequest.getGB_园丁姓名();
if (!StringUtils.isEmpty(gardenerName)) { if (!StringUtils.isEmpty(gardenerName)) {
......
...@@ -3,7 +3,6 @@ package com.qiwuai.garden.common.utils; ...@@ -3,7 +3,6 @@ package com.qiwuai.garden.common.utils;
import com.qiwuai.garden.common.TimingAcquisition; import com.qiwuai.garden.common.TimingAcquisition;
import java.util.List; import java.util.List;
import java.util.Map;
public class SpeechUtil { public class SpeechUtil {
/** /**
...@@ -91,7 +90,7 @@ public class SpeechUtil { ...@@ -91,7 +90,7 @@ public class SpeechUtil {
} }
/** /**
* 从任务模块话术获取话术 * 从帮助模块话术获取话术
* @param someone * @param someone
* @param feedText * @param feedText
* @return String * @return String
......
...@@ -301,21 +301,45 @@ public class TypeConvertUtil { ...@@ -301,21 +301,45 @@ public class TypeConvertUtil {
} }
/** /**
* 提取中文的阿拉伯数字 * 提取文本中的阿拉伯数字
* @param param * @param param
* @return Integer * @return Integer
*/ */
public static Integer extractNum(String param) { public static Integer extractNum(String param) {
int i;
String regEx="[^0-9]"; String regEx="[^0-9]";
Pattern p = Pattern.compile(regEx); Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(param); Matcher m = p.matcher(param);
if (!"".equals(m.replaceAll("").trim())) { if (!"".equals(m.replaceAll("").trim())) {
i = Integer.parseInt(m.replaceAll("").trim()); if (StringUtils.isEmpty(extractChinese(param))) {
if (param.length() > 9) {
return Constants.REQ_NON;
}
}
return Integer.valueOf(m.replaceAll("").trim());
} else {
return Constants.REQ_NON;
}
}
/**
* 提取文本中的阿拉伯数字,以字符串返回
* @param param
* @return Integer
*/
public static String getNumFromContext(String param) {
String regEx="[^0-9]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(param);
if (!"".equals(m.replaceAll("").trim())) {
if (StringUtils.isEmpty(extractChinese(param))) {
if (param.length() > 9) {
return Constants.NON_STR;
}
}
return m.replaceAll("").trim();
} else { } else {
i = Constants.REQ_NON; return Constants.NON_STR;
} }
return i;
} }
/** /**
...@@ -344,6 +368,16 @@ public class TypeConvertUtil { ...@@ -344,6 +368,16 @@ public class TypeConvertUtil {
} }
/** /**
* 删除中文
* @param param
* @return Integer
*/
public static String removeChinese(String param) {
String regEx="[\u4e00-\u9fa5)]";
return param.replaceAll(regEx, "");
}
/**
* {"未读", "已读"}中文转成数字 * {"未读", "已读"}中文转成数字
* @param param * @param param
* @return Integer * @return Integer
...@@ -465,4 +499,70 @@ public class TypeConvertUtil { ...@@ -465,4 +499,70 @@ public class TypeConvertUtil {
pageInfo.setEnd(end); pageInfo.setEnd(end);
return pageInfo; return pageInfo;
} }
/**
* 正则匹配微信号、手机号码和qq号
* @param context
*/
public static int checkContext(String context) {
//微信正则表达式
String weChatPattern = "^[a-zA-Z]{1}[-_a-zA-Z0-9]{5,19}+$";
//qq正则表达式
String qqPattern = "^[1-9][0-9]{4,10}$";
//手机号正则表达式
String phonePattern = "^((13[0-9])|(14[5,6,7,9])|(15[^4])|(16[5,6])|(17[0-9])|(18[0-9])|(19[1,8,9]))\\d{8}$";
//留言内容不符合格式要求
if (!context.contains("微信") && !context.contains("qq")&& !context.contains("QQ") && !context.contains("手机")) {
return 4;
}
//微信格式不正确
if (context.contains("微信")) {
context = removeChinese(context);
//微信格式不正确
if (!context.matches(weChatPattern) && !context.matches(phonePattern)) {
return 1;
}
}
//qq格式不正确
if (context.contains("qq") || context.contains("QQ")) {
context = getNumFromContext(context);
//qq格式不正确
if (!context.matches(qqPattern)) {
return 2;
}
}
//手机号码格式不正确
if (context.contains("手机")) {
context = getNumFromContext(context);
//手机号码格式不正确
if (!context.matches(phonePattern)) {
return 3;
}
}
return 0;
}
/**
* 微信号、手机号码和qq号的文本替换
* @param context
*/
public static String contextChange(String context) {
String result = "";
//微信格式
if (context.contains("微信")) {
context = removeChinese(context);
result = "微信:" + context;
}
//qq格式
if (context.contains("qq") || context.contains("QQ")) {
context = getNumFromContext(context);
result = "QQ:" + context;
}
//手机号码格式
if (context.contains("手机")) {
context = getNumFromContext(context);
result = "手机号码:" + context;
}
return result;
}
} }
package com.qiwuai.garden.common.utils; package com.qiwuai.garden.common.utils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.qiwuai.garden.common.TimingAcquisition;
import com.qiwuai.garden.dto.RegionIPDto; import com.qiwuai.garden.dto.RegionIPDto;
import lombok.Data; import lombok.Data;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.system.ApplicationHome;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.Yaml;
import java.io.FileInputStream; import java.io.*;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
...@@ -18,16 +20,13 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -18,16 +20,13 @@ import java.util.concurrent.ConcurrentHashMap;
@Component @Component
@Data @Data
public class YamlUtil { public class YamlUtil {
//获取话术存放的路径
public static String speechFilePath = YamlUtil.getValueByKey("speechFilePath");
private static LinkedHashMap<String, Map<String, Map<String, String>>> properties = new LinkedHashMap<>(); private static LinkedHashMap<String, Map<String, Map<String, String>>> properties = new LinkedHashMap<>();
/** /**
* 将话术转成map格式 * 将话术转成map格式
* @param * @param
* @return Map<String, Map<String, List<String>>> * @return Map<String, Map<String, List<String>>>
*/ */
public static Map<String, Map<String, List<String>>> loadSpeechToMap(String fileName) { public static Map<String, Map<String, List<String>>> loadSpeechToMap(String speechFilePath, String fileName) {
Map<String, Map<String, List<String>>> speechMap = new HashMap<>(); Map<String, Map<String, List<String>>> speechMap = new HashMap<>();
try { try {
InputStream in = new FileInputStream(speechFilePath + fileName); InputStream in = new FileInputStream(speechFilePath + fileName);
...@@ -46,17 +45,26 @@ public class YamlUtil { ...@@ -46,17 +45,26 @@ public class YamlUtil {
*/ */
public static String getValueByKey(String key) { public static String getValueByKey(String key) {
String value = ""; String value = "";
Map<String, String> applicationMap = TimingAcquisition.applicationMap;
if (applicationMap.size() != 0) {
return String.valueOf(applicationMap.get(key));
} else {
try { try {
Yaml yaml = new Yaml(); Yaml yaml = new Yaml();
ClassPathResource resource = new ClassPathResource("\\application.yml"); ClassPathResource resource = new ClassPathResource("\\application.yml");
properties = yaml.load(resource.getInputStream()); properties = yaml.load(resource.getInputStream());
String val = properties.get("spring").get("profiles").get("active"); String val = properties.get("spring").get("profiles").get("active");
ClassPathResource resourceNext = new ClassPathResource("\\application-" + val + ".yml"); // ClassPathResource resourceNext = new ClassPathResource("\\application-" + val + ".yml");
Map map = yaml.load(resourceNext.getInputStream()); // Map map = yaml.load(resourceNext.getInputStream());
FileInputStream fileInputStream = new FileInputStream("/home/jiaoyou/projects/secretGarden/application-" + val + ".yml");
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8");
Map<String, String> map = yaml.load(inputStreamReader);
applicationMap.putAll(map);
value = String.valueOf(map.get(key)); value = String.valueOf(map.get(key));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
}
return value; return value;
} }
......
package com.qiwuai.garden.controller; package com.qiwuai.garden.controller;
import com.qiwuai.garden.common.ProxyFactory; import com.qiwuai.garden.common.ProxyFactory;
import com.qiwuai.garden.common.TimingAcquisition;
import com.qiwuai.garden.common.utils.DataTrimUtil;
import com.qiwuai.garden.common.utils.RequestConversionUtil; import com.qiwuai.garden.common.utils.RequestConversionUtil;
import com.qiwuai.garden.dto.GardenerDto;
import com.qiwuai.garden.dto.base.CommonRequest; import com.qiwuai.garden.dto.base.CommonRequest;
import com.qiwuai.garden.dto.base.CommonResponse; import com.qiwuai.garden.dto.base.CommonResponse;
import com.qiwuai.garden.dto.base.ResultResponse; import com.qiwuai.garden.dto.base.ResultResponse;
...@@ -31,6 +34,8 @@ import com.qiwuai.garden.service.taskService.TaskService; ...@@ -31,6 +34,8 @@ import com.qiwuai.garden.service.taskService.TaskService;
import com.qiwuai.garden.service.taskService.impl.TaskServiceImpl; import com.qiwuai.garden.service.taskService.impl.TaskServiceImpl;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -43,46 +48,85 @@ import java.text.ParseException; ...@@ -43,46 +48,85 @@ import java.text.ParseException;
@RequestMapping("/secretGarden") @RequestMapping("/secretGarden")
public class CommonController { public class CommonController {
Logger log = LoggerFactory.getLogger(CommonController.class); Logger log = LoggerFactory.getLogger(CommonController.class);
//种植模块动态代理
PlantService plantService = new PlantServiceImpl(); @Value("${offlineTime}")
PlantService plantServiceProxy = (PlantService) new ProxyFactory(plantService).getProxyInstance(); private String offlineTime;
//花圃模块动态代理
NurseryService nurseryService = new NurseryServiceImpl(); //种植模块
NurseryService nurseryServiceProxy = (NurseryService) new ProxyFactory(nurseryService).getProxyInstance(); @Autowired
//园丁模块动态代理 private PlantService plantService;
GardenerService gardenerService = new GardenerServiceImpl(); //花圃模块
GardenerService gardenerServiceProxy = (GardenerService) new ProxyFactory(gardenerService).getProxyInstance(); @Autowired
private NurseryService nurseryService;
//园丁模块
@Autowired
private GardenerService gardenerService;
//背包模块动态代理 //背包模块动态代理
BackPackService backPackService = new BackPackServiceImpl(); @Autowired
BackPackService backPackServiceProxy = (BackPackService) new ProxyFactory(backPackService).getProxyInstance(); private BackPackService backPackService;
//宠物模块动态代理 //宠物模块动态代理
PetService petService = new PetServiceImpl(); @Autowired
PetService petServiceProxy = (PetService) new ProxyFactory(petService).getProxyInstance(); private PetService petService;
//市场模块动态代理 //市场模块动态代理
MarketService marketService = new MarketServiceImpl(); @Autowired
MarketService marketServiceProxy = (MarketService) new ProxyFactory(marketService).getProxyInstance(); private MarketService marketService;
//社交模块动态代理 //社交模块动态代理
SocialService socialService = new SocialServiceImpl(); @Autowired
SocialService socialServiceProxy = (SocialService) new ProxyFactory(socialService).getProxyInstance(); private SocialService socialService;
//任务模块动态代理 //任务模块动态代理
TaskService taskService = new TaskServiceImpl(); @Autowired
TaskService taskServiceProxy = (TaskService) new ProxyFactory(taskService).getProxyInstance(); private TaskService taskService;
//排行榜模块动态代理 //排行榜模块动态代理
RankingService rankingService = new RankingServiceImpl(); @Autowired
RankingService rankingServiceProxy = (RankingService) new ProxyFactory(rankingService).getProxyInstance(); private RankingService rankingService;
//帮助模块动态代理 //帮助模块动态代理
HelpService helpService = new HelpServiceImpl(); @Autowired
HelpService helpServiceProxy = (HelpService) new ProxyFactory(helpService).getProxyInstance(); private HelpService helpService;
//建议模块动态代理 //建议模块动态代理
AdviseService adviseService = new AdviseServiceImpl(); @Autowired
AdviseService adviseServiceProxy = (AdviseService) new ProxyFactory(adviseService).getProxyInstance(); private AdviseService adviseService;
// //种植模块动态代理
// PlantService plantService = new PlantServiceImpl();
// PlantService plantServiceProxy = (PlantService) new ProxyFactory(plantService).getProxyInstance();
// //花圃模块动态代理
// NurseryService nurseryService = new NurseryServiceImpl();
// NurseryService nurseryServiceProxy = (NurseryService) new ProxyFactory(nurseryService).getProxyInstance();
// //园丁模块动态代理
// GardenerService gardenerService = new GardenerServiceImpl();
// GardenerService gardenerServiceProxy = (GardenerService) new ProxyFactory(gardenerService).getProxyInstance();
// //背包模块动态代理
// BackPackService backPackService = new BackPackServiceImpl();
// BackPackService backPackServiceProxy = (BackPackService) new ProxyFactory(backPackService).getProxyInstance();
// //宠物模块动态代理
// PetService petService = new PetServiceImpl();
// PetService petServiceProxy = (PetService) new ProxyFactory(petService).getProxyInstance();
// //市场模块动态代理
// MarketService marketService = new MarketServiceImpl();
// MarketService marketServiceProxy = (MarketService) new ProxyFactory(marketService).getProxyInstance();
// //社交模块动态代理
// SocialService socialService = new SocialServiceImpl();
// SocialService socialServiceProxy = (SocialService) new ProxyFactory(socialService).getProxyInstance();
// //任务模块动态代理
// TaskService taskService = new TaskServiceImpl();
// TaskService taskServiceProxy = (TaskService) new ProxyFactory(taskService).getProxyInstance();
// //排行榜模块动态代理
// RankingService rankingService = new RankingServiceImpl();
// RankingService rankingServiceProxy = (RankingService) new ProxyFactory(rankingService).getProxyInstance();
// //帮助模块动态代理
// HelpService helpService = new HelpServiceImpl();
// HelpService helpServiceProxy = (HelpService) new ProxyFactory(helpService).getProxyInstance();
// //建议模块动态代理
// AdviseService adviseService = new AdviseServiceImpl();
// AdviseService adviseServiceProxy = (AdviseService) new ProxyFactory(adviseService).getProxyInstance();
@PostMapping(value = "/call", produces = "application/json;charset=UTF-8") @PostMapping(value = "/call", produces = "application/json;charset=UTF-8")
public CommonResponse startGame(@RequestBody CommonRequest commonRequest) throws ParseException { public CommonResponse startGame(@RequestBody CommonRequest commonRequest) throws ParseException {
log.info(commonRequest.getUid() + "当前操作的原始请求参数:" + commonRequest.getVars()); String uid = commonRequest.getUid();
log.info(uid + "当前操作的原始请求参数:" + commonRequest.getVars());
CommonResponse result = new CommonResponse(); CommonResponse result = new CommonResponse();
//玩家没有提供uid //玩家没有提供uid
if (StringUtils.isEmpty(commonRequest.getUid())) { if (StringUtils.isEmpty(uid)) {
ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); ResultVarsResponse resultVarsResponse = new ResultVarsResponse();
ResultResponse resultResponse = new ResultResponse(); ResultResponse resultResponse = new ResultResponse();
log.info("未提供uid,无法创建用户"); log.info("未提供uid,无法创建用户");
...@@ -94,12 +138,25 @@ public class CommonController { ...@@ -94,12 +138,25 @@ public class CommonController {
result.setData(resultVarsResponse); result.setData(resultVarsResponse);
return result; return result;
} }
//----------------------新的uid则创建用户--------------------------
GardenerDto gardener = TimingAcquisition.gardenerMap.get(uid);
if (StringUtils.isEmpty(gardener)) {
//给新玩家分配姓名
// List<String> nameList = PersistenceUtil.getContentFromFile("name.xls");
// String name = nameList.get(RandomDropUtil.getRandomNum(0, nameList.size()));
String name = "海棠仙子";
OperationRequest operationReq = new OperationRequest();
operationReq.setUid(commonRequest.getUid());
operationReq.setGender(2);
operationReq.setName(name);
gardenerService.create(operationReq);
}
OperationRequest operationReq = RequestConversionUtil.request2Operation(commonRequest); OperationRequest operationReq = RequestConversionUtil.request2Operation(commonRequest);
String operateName = commonRequest.getVars().get操作名(); String operateName = commonRequest.getVars().get操作名();
log.info(operationReq.getUid() + "开始执行操作:【" + operateName + "】, 请求参数:" + operationReq); log.info(uid + "开始执行操作:【" + operateName + "】, 请求参数:" + operationReq);
//操作名为null //操作名为null
if (StringUtils.isEmpty(operateName)) { if (StringUtils.isEmpty(operateName)) {
log.info(operationReq.getUid() + "未提供操作名,无法操作"); log.info(uid + "未提供操作名,无法操作");
ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); ResultVarsResponse resultVarsResponse = new ResultVarsResponse();
ResultResponse resultResponse = new ResultResponse(); ResultResponse resultResponse = new ResultResponse();
result.setCode(1); result.setCode(1);
...@@ -110,655 +167,658 @@ public class CommonController { ...@@ -110,655 +167,658 @@ public class CommonController {
result.setData(resultVarsResponse); result.setData(resultVarsResponse);
return result; return result;
} }
//登录玩家,修改在线状态
DataTrimUtil.AdjustStatus(commonRequest.getUid(), offlineTime);
switch (operateName) { switch (operateName) {
case "进入游戏": case "进入游戏":
result = gardenerServiceProxy.enterGame(operationReq); result = gardenerService.enterGame(operationReq);
break; break;
case "创建用户": case "创建用户":
result = gardenerServiceProxy.create(operationReq); result = gardenerService.create(operationReq);
break; break;
case "更改园丁性别": case "更改园丁性别":
result = gardenerServiceProxy.changeGender(operationReq); result = gardenerService.changeGender(operationReq);
break; break;
case "更改玩家称呼": case "更改玩家称呼":
result = gardenerServiceProxy.changeCallName(operationReq); result = gardenerService.changeCallName(operationReq);
break; break;
case "用户初始化": case "用户初始化":
result = gardenerServiceProxy.resetPlayer(operationReq); result = gardenerService.resetPlayer(operationReq);
break; break;
case "种植": case "种植":
result = plantServiceProxy.seedCheck(operationReq); result = plantService.seedCheck(operationReq);
break; break;
case "确认种植": case "确认种植":
result = plantServiceProxy.seed(operationReq); result = plantService.seed(operationReq);
break; break;
case "取消种植": case "取消种植":
result = plantServiceProxy.seedCancel(operationReq); result = plantService.seedCancel(operationReq);
break; break;
case "批量种植": case "批量种植":
result = plantServiceProxy.batchSeedCheck(operationReq); result = plantService.batchSeedCheck(operationReq);
break; break;
case "确认批量种植": case "确认批量种植":
result = plantServiceProxy.batchSeed(operationReq); result = plantService.batchSeed(operationReq);
break; break;
case "取消批量种植": case "取消批量种植":
result = plantServiceProxy.batchSeedCancel(operationReq); result = plantService.batchSeedCancel(operationReq);
break; break;
case "收取": case "收取":
result = plantServiceProxy.harvest(operationReq); result = plantService.harvest(operationReq);
break; break;
case "铲除植物": case "铲除植物":
result = plantServiceProxy.clearPlantCheck(operationReq); result = plantService.clearPlantCheck(operationReq);
break; break;
case "收获并铲除植物": case "收获并铲除植物":
result = plantServiceProxy.clearAfterHarvest(operationReq); result = plantService.clearAfterHarvest(operationReq);
break; break;
case "确认铲除植物": case "确认铲除植物":
result = plantServiceProxy.clearPlant(operationReq); result = plantService.clearPlant(operationReq);
break; break;
case "取消铲除植物": case "取消铲除植物":
result = plantServiceProxy.clearPlantCancel(operationReq); result = plantService.clearPlantCancel(operationReq);
break; break;
case "查询植物成熟时间指令": case "查询植物成熟时间指令":
result = plantServiceProxy.checkPlantMatureTime(operationReq); result = plantService.checkPlantMatureTime(operationReq);
break; break;
case "加快植物成熟指令": case "加快植物成熟指令":
result = plantServiceProxy.speedPlantMatureTime(operationReq); result = plantService.speedPlantMatureTime(operationReq);
break; break;
case "查看花圃数量指令": case "查看花圃数量指令":
result = nurseryServiceProxy.checkNurseryAmount(operationReq); result = nurseryService.checkNurseryAmount(operationReq);
break; break;
case "查看花圃指令": case "查看花圃指令":
result = nurseryServiceProxy.checkNurseryByNum(operationReq); result = nurseryService.checkNurseryByNum(operationReq);
break; break;
case "查看花圃状态": case "查看花圃状态":
result = nurseryServiceProxy.checkAllNursery(operationReq); result = nurseryService.checkAllNursery(operationReq);
break; break;
case "查看花圃等级": case "查看花圃等级":
result = nurseryServiceProxy.checkNurseryLevel(operationReq); result = nurseryService.checkNurseryLevel(operationReq);
break; break;
case "查看花圃升级类型": case "查看花圃升级类型":
result = nurseryServiceProxy.searchNurseryToType(operationReq); result = nurseryService.searchNurseryToType(operationReq);
break; break;
case "查看花圃升级条件": case "查看花圃升级条件":
result = nurseryServiceProxy.searchUpgradeCondition(operationReq); result = nurseryService.searchUpgradeCondition(operationReq);
break; break;
case "升级花圃": case "升级花圃":
result = nurseryServiceProxy.nurseryUpgrade(operationReq); result = nurseryService.nurseryUpgrade(operationReq);
break; break;
case "取消升级花圃": case "取消升级花圃":
result = nurseryServiceProxy.nurseryUpgradeCancel(operationReq); result = nurseryService.nurseryUpgradeCancel(operationReq);
break; break;
case "重置花圃": case "重置花圃":
result = nurseryServiceProxy.nurseryResetCheck(operationReq); result = nurseryService.nurseryResetCheck(operationReq);
break; break;
case "确认重置花圃": case "确认重置花圃":
result = nurseryServiceProxy.nurseryReset(operationReq); result = nurseryService.nurseryReset(operationReq);
break; break;
case "取消重置花圃": case "取消重置花圃":
result = nurseryServiceProxy.nurseryResetCancel(operationReq); result = nurseryService.nurseryResetCancel(operationReq);
break; break;
case "开启新花圃": case "开启新花圃":
result = nurseryServiceProxy.nurseryReclaimCheck(operationReq); result = nurseryService.nurseryReclaimCheck(operationReq);
break; break;
case "确认开启新花圃": case "确认开启新花圃":
result = nurseryServiceProxy.nurseryReclaim(operationReq); result = nurseryService.nurseryReclaim(operationReq);
break; break;
case "取消开启新花圃": case "取消开启新花圃":
result = nurseryServiceProxy.nurseryReclaimCancel(operationReq); result = nurseryService.nurseryReclaimCancel(operationReq);
break; break;
case "花圃直接升级指令": case "花圃直接升级指令":
result = nurseryServiceProxy.nurseryUpgradeDirect(operationReq); result = nurseryService.nurseryUpgradeDirect(operationReq);
break; break;
case "查看园丁等级": case "查看园丁等级":
result = gardenerServiceProxy.gardenerLevelCheck(operationReq); result = gardenerService.gardenerLevelCheck(operationReq);
break; break;
case "园丁升级": case "园丁升级":
result = gardenerServiceProxy.gardenerUpgradeCheck(operationReq); result = gardenerService.gardenerUpgradeCheck(operationReq);
break; break;
case "确认园丁升级": case "确认园丁升级":
result = gardenerServiceProxy.gardenerUpgrade(operationReq); result = gardenerService.gardenerUpgrade(operationReq);
break; break;
case "取消园丁升级": case "取消园丁升级":
result = gardenerServiceProxy.gardenerUpgradeCancel(operationReq); result = gardenerService.gardenerUpgradeCancel(operationReq);
break; break;
case "园丁直接升级指令": case "园丁直接升级指令":
result = gardenerServiceProxy.gardenerUpgradeDirect(operationReq); result = gardenerService.gardenerUpgradeDirect(operationReq);
break; break;
case "使用技能": case "使用技能":
result = gardenerServiceProxy.learnSkillCheck(operationReq); result = gardenerService.learnSkillCheck(operationReq);
break; break;
case "确认使用技能": case "确认使用技能":
result = gardenerServiceProxy.learnSkill(operationReq); result = gardenerService.learnSkill(operationReq);
break; break;
case "取消使用技能": case "取消使用技能":
result = gardenerServiceProxy.learnSkillCancel(operationReq); result = gardenerService.learnSkillCancel(operationReq);
break; break;
case "重置园丁": case "重置园丁":
result = gardenerServiceProxy.resetSkillCheck(operationReq); result = gardenerService.resetSkillCheck(operationReq);
break; break;
case "确认重置园丁": case "确认重置园丁":
result = gardenerServiceProxy.resetSkill(operationReq); result = gardenerService.resetSkill(operationReq);
break; break;
case "取消重置园丁": case "取消重置园丁":
result = gardenerServiceProxy.resetSkillCancel(operationReq); result = gardenerService.resetSkillCancel(operationReq);
break; break;
case "查看技能指令": case "查看技能指令":
result = gardenerServiceProxy.skillCheck(operationReq); result = gardenerService.skillCheck(operationReq);
break; break;
case "查看技能详情指令": case "查看技能详情指令":
result = gardenerServiceProxy.skillInfoCheck(operationReq); result = gardenerService.skillInfoCheck(operationReq);
break; break;
// case "查看下一页技能详情指令": // case "查看下一页技能详情指令":
// result = gardenerServiceProxy.skillInfoNextCheck(operationReq); // result = gardenerService.skillInfoNextCheck(operationReq);
// break; // break;
// case "查看上一页技能详情指令": // case "查看上一页技能详情指令":
// result = gardenerServiceProxy.skillInfoLastCheck(operationReq); // result = gardenerService.skillInfoLastCheck(operationReq);
// break; // break;
case "更改园丁姓名": case "更改园丁姓名":
result = gardenerServiceProxy.renameCheck(operationReq); result = gardenerService.renameCheck(operationReq);
break; break;
case "确认更改园丁姓名": case "确认更改园丁姓名":
result = gardenerServiceProxy.rename(operationReq); result = gardenerService.rename(operationReq);
break; break;
case "取消更改园丁姓名": case "取消更改园丁姓名":
result = gardenerServiceProxy.renameCancel(operationReq); result = gardenerService.renameCancel(operationReq);
break; break;
case "打开背包": case "打开背包":
result = backPackServiceProxy.viewBackPack(operationReq); result = backPackService.viewBackPack(operationReq);
break; break;
case "分类检索": case "分类检索":
result = backPackServiceProxy.viewBackPackItem(operationReq); result = backPackService.viewBackPackItem(operationReq);
break; break;
case "货币检索": case "货币检索":
result = backPackServiceProxy.viewMoney(operationReq); result = backPackService.viewMoney(operationReq);
break; break;
case "获取详情": case "获取详情":
result = backPackServiceProxy.searchItemInfo(operationReq); result = backPackService.searchItemInfo(operationReq);
break; break;
case "发放奖励": case "发放奖励":
result = backPackServiceProxy.taskAward(operationReq); result = backPackService.taskAward(operationReq);
break; break;
case "查看宠物指令": case "查看宠物指令":
result = petServiceProxy.petView(operationReq); result = petService.petView(operationReq);
break; break;
case "宠物移至花圃指令": case "宠物移至花圃指令":
result = petServiceProxy.petMoveToNursery(operationReq); result = petService.petMoveToNursery(operationReq);
break; break;
case "花圃宠物移至宠物栏指令": case "花圃宠物移至宠物栏指令":
result = petServiceProxy.petMoveToField(operationReq); result = petService.petMoveToField(operationReq);
break; break;
case "花圃宠物移动指令": case "花圃宠物移动指令":
result = petServiceProxy.nurseryPetMove(operationReq); result = petService.nurseryPetMove(operationReq);
break; break;
case "宠物删除指令": case "宠物删除指令":
result = petServiceProxy.petDeleteCheck(operationReq); result = petService.petDeleteCheck(operationReq);
break; break;
case "确认宠物删除指令": case "确认宠物删除指令":
result = petServiceProxy.petDelete(operationReq); result = petService.petDelete(operationReq);
break; break;
case "取消宠物删除指令": case "取消宠物删除指令":
result = petServiceProxy.petDeleteCancel(operationReq); result = petService.petDeleteCancel(operationReq);
break; break;
case "宠物换位指令": case "宠物换位指令":
result = petServiceProxy.petSetPosition(operationReq); result = petService.petSetPosition(operationReq);
break; break;
case "宠物位置调换指令": case "宠物位置调换指令":
result = petServiceProxy.petSwitch(operationReq); result = petService.petSwitch(operationReq);
break; break;
case "查询宠物栏状态指令": case "查询宠物栏状态指令":
result = petServiceProxy.petCheck(operationReq); result = petService.petCheck(operationReq);
break; break;
case "查询花圃宠物数量指令": case "查询花圃宠物数量指令":
result = petServiceProxy.nurseryPetNumCheck(operationReq); result = petService.nurseryPetNumCheck(operationReq);
break; break;
case "总览查询指令": case "总览查询指令":
result = petServiceProxy.petOverview(operationReq); result = petService.petOverview(operationReq);
break; break;
case "查看花圃宠物指令": case "查看花圃宠物指令":
result = petServiceProxy.nurseryPetCheck(operationReq); result = petService.nurseryPetCheck(operationReq);
break; break;
case "确认查看花圃宠物指令": case "确认查看花圃宠物指令":
result = petServiceProxy.nurseryPetCheckSure(operationReq); result = petService.nurseryPetCheckSure(operationReq);
break; break;
case "取消查看花圃宠物指令": case "取消查看花圃宠物指令":
result = petServiceProxy.nurseryPetCheckCancel(operationReq); result = petService.nurseryPetCheckCancel(operationReq);
break; break;
case "花圃宠物调换指令": case "花圃宠物调换指令":
result = petServiceProxy.nurseryPetSwitch(operationReq); result = petService.nurseryPetSwitch(operationReq);
break; break;
case "发放花圃宠物指令": case "发放花圃宠物指令":
result = petServiceProxy.addNurseryPet(operationReq); result = petService.addNurseryPet(operationReq);
break; break;
case "查看新来宠物": case "查看新来宠物":
result = petServiceProxy.checkNewPets(operationReq); result = petService.checkNewPets(operationReq);
break; break;
case "升级宠物": case "升级宠物":
result = petServiceProxy.updatePet(operationReq); result = petService.updatePet(operationReq);
break; break;
case "购买指令": case "购买指令":
result = marketServiceProxy.buyCheck(operationReq); result = marketService.buyCheck(operationReq);
break; break;
case "确认购买指令": case "确认购买指令":
result = marketServiceProxy.buy(operationReq); result = marketService.buy(operationReq);
break; break;
case "取消购买指令": case "取消购买指令":
result = marketServiceProxy.buyCancel(operationReq); result = marketService.buyCancel(operationReq);
break; break;
case "出售指令": case "出售指令":
result = marketServiceProxy.sellCheck(operationReq); result = marketService.sellCheck(operationReq);
break; break;
case "确认出售指令": case "确认出售指令":
result = marketServiceProxy.sell(operationReq); result = marketService.sell(operationReq);
break; break;
case "取消出售指令": case "取消出售指令":
result = marketServiceProxy.sellCancel(operationReq); result = marketService.sellCancel(operationReq);
break; break;
case "出售宠物指令": case "出售宠物指令":
result = marketServiceProxy.sellPetCheck(operationReq); result = marketService.sellPetCheck(operationReq);
break; break;
case "统一出售指令": case "统一出售指令":
result = marketServiceProxy.sellAllCheck(operationReq); result = marketService.sellAllCheck(operationReq);
break; break;
case "确认统一出售指令": case "确认统一出售指令":
result = marketServiceProxy.sellAll(operationReq); result = marketService.sellAll(operationReq);
break; break;
case "取消统一出售指令": case "取消统一出售指令":
result = marketServiceProxy.sellAllCancel(operationReq); result = marketService.sellAllCancel(operationReq);
break; break;
case "确认取消指令": case "确认取消指令":
result = marketServiceProxy.cancel(operationReq); result = marketService.cancel(operationReq);
break; break;
case "打开商店指令": case "打开商店指令":
result = marketServiceProxy.openShop(operationReq); result = marketService.openShop(operationReq);
break; break;
case "查询商品指令": case "查询商品指令":
result = marketServiceProxy.goodsCheck(operationReq); result = marketService.goodsCheck(operationReq);
break; break;
case "退出商店指令": case "退出商店指令":
result = marketServiceProxy.quitShop(operationReq); result = marketService.quitShop(operationReq);
break; break;
case "拜访陌生人": case "拜访陌生人":
case "拜访好友": case "拜访好友":
result = socialServiceProxy.visitStrangerCheck(operationReq); //拜访好友的方法跟拜访陌生人一样 result = socialService.visitStrangerCheck(operationReq); //拜访好友的方法跟拜访陌生人一样
break; break;
case "确定拜访": case "确定拜访":
result = socialServiceProxy.visitStranger(operationReq); result = socialService.visitStranger(operationReq);
break; break;
case "取消拜访": case "取消拜访":
result = socialServiceProxy.visitStrangerCancel(operationReq); result = socialService.visitStrangerCancel(operationReq);
break; break;
case "随机拜访陌生人": case "随机拜访陌生人":
result = socialServiceProxy.visitStrangerRandom(operationReq); result = socialService.visitStrangerRandom(operationReq);
break; break;
case "上一个玩家": case "上一个玩家":
result = socialServiceProxy.visitLastOne(operationReq); result = socialService.visitLastOne(operationReq);
break; break;
case "下一个玩家": case "下一个玩家":
result = socialServiceProxy.visitNextOne(operationReq); result = socialService.visitNextOne(operationReq);
break; break;
case "添加好友": case "添加好友":
result = socialServiceProxy.addFriendAsk(operationReq); result = socialService.addFriendAsk(operationReq);
break; break;
case "查看好友申请": case "查看好友申请":
result = socialServiceProxy.addFriendCheck(operationReq); result = socialService.addFriendCheck(operationReq);
break; break;
case "查看指定好友申请": case "查看指定好友申请":
result = socialServiceProxy.addFriendCheckByName(operationReq); result = socialService.addFriendCheckByName(operationReq);
break; break;
case "接受好友申请": case "接受好友申请":
result = socialServiceProxy.addFriendRequestAgree(operationReq); result = socialService.addFriendRequestAgree(operationReq);
break; break;
case "拒绝好友申请": case "拒绝好友申请":
result = socialServiceProxy.addFriendRequestReject(operationReq); result = socialService.addFriendRequestReject(operationReq);
break; break;
case "拜访特殊好友": case "拜访特殊好友":
result = socialServiceProxy.visitFriendSpecialCheck(operationReq); result = socialService.visitFriendSpecialCheck(operationReq);
break; break;
case "随机拜访好友": case "随机拜访好友":
result = socialServiceProxy.visitFriendRandomCheck(operationReq); result = socialService.visitFriendRandomCheck(operationReq);
break; break;
case "删除好友": case "删除好友":
result = socialServiceProxy.deleteFriendCheck(operationReq); result = socialService.deleteFriendCheck(operationReq);
break; break;
case "确定删除": case "确定删除":
result = socialServiceProxy.deleteFriend(operationReq); result = socialService.deleteFriend(operationReq);
break; break;
case "取消删除": case "取消删除":
result = socialServiceProxy.deleteFriendCancel(operationReq); result = socialService.deleteFriendCancel(operationReq);
break; break;
case "查看园地": case "查看园地":
result = socialServiceProxy.checkGarden(operationReq); result = socialService.checkGarden(operationReq);
break; break;
case "设置收益比例": case "设置收益比例":
result = socialServiceProxy.setEarnRateCheck(operationReq); result = socialService.setEarnRateCheck(operationReq);
break; break;
case "确定设置收益比例": case "确定设置收益比例":
result = socialServiceProxy.setEarnRate(operationReq); result = socialService.setEarnRate(operationReq);
break; break;
case "取消设置收益比例": case "取消设置收益比例":
result = socialServiceProxy.setEarnRateCancel(operationReq); result = socialService.setEarnRateCancel(operationReq);
break; break;
case "偷菜": case "偷菜":
result = socialServiceProxy.stealOther(operationReq); result = socialService.stealOther(operationReq);
break; break;
case "随机偷菜": case "随机偷菜":
result = socialServiceProxy.stealOtherRandom(operationReq); result = socialService.stealOtherRandom(operationReq);
break; break;
case "帮助好友": case "帮助好友":
result = socialServiceProxy.helpFriend(operationReq); result = socialService.helpFriend(operationReq);
break; break;
case "查询本人地址": case "查询本人地址":
result = socialServiceProxy.checkLocationSelf(operationReq); result = socialService.checkLocationSelf(operationReq);
break; break;
case "随机获取玩家地址": case "随机获取玩家地址":
result = socialServiceProxy.getRandomAddress(operationReq); result = socialService.getRandomAddress(operationReq);
break; break;
case "查看简报": case "查看简报":
result = socialServiceProxy.checkReport(operationReq); result = socialService.checkReport(operationReq);
break; break;
case "查看帮助简报": case "查看帮助简报":
result = socialServiceProxy.checkHelpReport(operationReq); result = socialService.checkHelpReport(operationReq);
break; break;
case "查看偷菜简报": case "查看偷菜简报":
result = socialServiceProxy.checkStealReport(operationReq); result = socialService.checkStealReport(operationReq);
break; break;
case "查看战斗详情": case "查看战斗详情":
result = socialServiceProxy.checkFightDetail(operationReq); result = socialService.checkFightDetail(operationReq);
break; break;
case "获取战斗详情": case "获取战斗详情":
result = socialServiceProxy.getFightDetail(operationReq); result = socialService.getFightDetail(operationReq);
break; break;
case "查看战斗轮次": case "查看战斗轮次":
result = socialServiceProxy.checkFightRound(operationReq); result = socialService.checkFightRound(operationReq);
break; break;
case "获取战斗轮次": case "获取战斗轮次":
result = socialServiceProxy.getFightRound(operationReq); result = socialService.getFightRound(operationReq);
break; break;
case "删除简报": case "删除简报":
result = socialServiceProxy.deleteReportCheck(operationReq); result = socialService.deleteReportCheck(operationReq);
break; break;
case "删除帮助简报": case "删除帮助简报":
result = socialServiceProxy.deleteHelpReportCheck(operationReq); result = socialService.deleteHelpReportCheck(operationReq);
break; break;
case "删除偷菜简报": case "删除偷菜简报":
result = socialServiceProxy.deleteStealReportCheck(operationReq); result = socialService.deleteStealReportCheck(operationReq);
break; break;
case "确认删除简报": case "确认删除简报":
result = socialServiceProxy.deleteReport(operationReq); result = socialService.deleteReport(operationReq);
break; break;
case "取消删除简报": case "取消删除简报":
result = socialServiceProxy.deleteReportCancel(operationReq); result = socialService.deleteReportCancel(operationReq);
break; break;
case "查看提醒消息": case "查看提醒消息":
result = socialServiceProxy.checkNotice(operationReq); result = socialService.checkNotice(operationReq);
break; break;
case "开始留言": case "开始留言":
result = socialServiceProxy.leaveMessageCheck(operationReq); result = socialService.leaveMessageCheck(operationReq);
break; break;
case "确定该留言": case "确定该留言":
result = socialServiceProxy.leaveMessage(operationReq); result = socialService.leaveMessage(operationReq);
break; break;
case "取消该留言": case "取消该留言":
result = socialServiceProxy.leaveMessageCancel(operationReq); result = socialService.leaveMessageCancel(operationReq);
break; break;
case "检查留言": case "检查留言":
result = socialServiceProxy.checkMessage(operationReq); result = socialService.checkMessage(operationReq);
break; break;
case "查看留言": case "查看留言":
result = socialServiceProxy.readMessage(operationReq); result = socialService.readMessage(operationReq);
break; break;
case "重播留言": case "重播留言":
result = socialServiceProxy.repeatMessage(operationReq); result = socialService.repeatMessage(operationReq);
break; break;
case "查看下一条留言": case "查看下一条留言":
result = socialServiceProxy.readNextMessage(operationReq); result = socialService.readNextMessage(operationReq);
break; break;
case "查询好友数量": case "查询好友数量":
result = socialServiceProxy.checkFriendNum(operationReq); result = socialService.checkFriendNum(operationReq);
break; break;
case "查询在线好友数量": case "查询在线好友数量":
result = socialServiceProxy.checkOnlineFriendNum(operationReq); result = socialService.checkOnlineFriendNum(operationReq);
break; break;
case "查询好友": case "查询好友":
result = socialServiceProxy.checkFriendInfo(operationReq); result = socialService.checkFriendInfo(operationReq);
break; break;
case "离线筛选好友": case "离线筛选好友":
result = socialServiceProxy.checkOfflineFriend(operationReq); result = socialService.checkOfflineFriend(operationReq);
break; break;
case "返回自家花园": case "返回自家花园":
result = socialServiceProxy.backHome(operationReq); result = socialService.backHome(operationReq);
break; break;
case "查询他人花圃数量": case "查询他人花圃数量":
result = socialServiceProxy.checkNurseryAmountSide(operationReq); result = socialService.checkNurseryAmountSide(operationReq);
break; break;
case "查询他人指定花圃宠物": case "查询他人指定花圃宠物":
result = socialServiceProxy.nurseryPetSideCheck(operationReq); result = socialService.nurseryPetSideCheck(operationReq);
break; break;
case "查询任务": case "查询任务":
result = taskServiceProxy.checkTask(operationReq); result = taskService.checkTask(operationReq);
break; break;
case "查看排行榜": case "查看排行榜":
result = rankingServiceProxy.checkRankingList(operationReq); result = rankingService.checkRankingList(operationReq);
break; break;
case "查看本人榜单名次": case "查看本人榜单名次":
result = rankingServiceProxy.checkSelfRankingList(operationReq); result = rankingService.checkSelfRankingList(operationReq);
break; break;
case "查看玩家榜单名次": case "查看玩家榜单名次":
result = rankingServiceProxy.checkPlayerRankingList(operationReq); result = rankingService.checkPlayerRankingList(operationReq);
break; break;
case "拜访榜单玩家": case "拜访榜单玩家":
result = rankingServiceProxy.visitRankingPlayer(operationReq); result = rankingService.visitRankingPlayer(operationReq);
break; break;
case "打开帮助菜单": case "打开帮助菜单":
result = helpServiceProxy.openHelpMenu(operationReq); result = helpService.openHelpMenu(operationReq);
break; break;
case "帮助-花圃类型": case "帮助-花圃类型":
result = helpServiceProxy.nurseryTypeCheck(operationReq); result = helpService.nurseryTypeCheck(operationReq);
break; break;
case "帮助-花圃升级路线": case "帮助-花圃升级路线":
result = helpServiceProxy.nurseryTypeGetCheck(operationReq); result = helpService.nurseryTypeGetCheck(operationReq);
break; break;
case "帮助-花圃详情": case "帮助-花圃详情":
result = helpServiceProxy.nurseryTypeInfoCheck(operationReq); result = helpService.nurseryTypeInfoCheck(operationReq);
break; break;
case "帮助-花圃等级上限": case "帮助-花圃等级上限":
result = helpServiceProxy.nurseryLevelMaxCheck(operationReq); result = helpService.nurseryLevelMaxCheck(operationReq);
break; break;
case "帮助-升级花圃": case "帮助-升级花圃":
result = helpServiceProxy.nurseryLevelUpCheck(operationReq); result = helpService.nurseryLevelUpCheck(operationReq);
break; break;
case "帮助-花圃重置": case "帮助-花圃重置":
result = helpServiceProxy.nurseryLevelResetCheck(operationReq); result = helpService.nurseryLevelResetCheck(operationReq);
break; break;
case "帮助-花圃数量": case "帮助-花圃数量":
result = helpServiceProxy.nurseryNumCheck(operationReq); result = helpService.nurseryNumCheck(operationReq);
break; break;
case "帮助-开启花圃": case "帮助-开启花圃":
result = helpServiceProxy.nurseryReclaimRuleCheck(operationReq); result = helpService.nurseryReclaimRuleCheck(operationReq);
break; break;
case "帮助-花圃宠物": case "帮助-花圃宠物":
result = helpServiceProxy.nurseryPetRuleCheck(operationReq); result = helpService.nurseryPetRuleCheck(operationReq);
break; break;
case "帮助-花圃宠物数量": case "帮助-花圃宠物数量":
result = helpServiceProxy.nurseryPetNumRuleCheck(operationReq); result = helpService.nurseryPetNumRuleCheck(operationReq);
break; break;
case "帮助-花圃无法升级": case "帮助-花圃无法升级":
result = helpServiceProxy.nurseryUpgradeFailReasonCheck(operationReq); result = helpService.nurseryUpgradeFailReasonCheck(operationReq);
break; break;
case "帮助-花圃无法开启": case "帮助-花圃无法开启":
result = helpServiceProxy.nurseryReclaimFailReasonCheck(operationReq); result = helpService.nurseryReclaimFailReasonCheck(operationReq);
break; break;
case "帮助-花圃宠物无法放置": case "帮助-花圃宠物无法放置":
result = helpServiceProxy.nurseryPetFailReasonCheck(operationReq); result = helpService.nurseryPetFailReasonCheck(operationReq);
break; break;
case "帮助-如何种植": case "帮助-如何种植":
result = helpServiceProxy.PlantingRuleCheck(operationReq); result = helpService.PlantingRuleCheck(operationReq);
break; break;
case "帮助-生长阶段": case "帮助-生长阶段":
result = helpServiceProxy.PlantPeriodRuleCheck(operationReq); result = helpService.PlantPeriodRuleCheck(operationReq);
break; break;
case "帮助-收取果实": case "帮助-收取果实":
result = helpServiceProxy.PlantHarvestRuleCheck(operationReq); result = helpService.PlantHarvestRuleCheck(operationReq);
break; break;
case "帮助-植物成熟时间": case "帮助-植物成熟时间":
result = helpServiceProxy.PlantMatureTimeRuleCheck(operationReq); result = helpService.PlantMatureTimeRuleCheck(operationReq);
break; break;
case "帮助-铲除植物": case "帮助-铲除植物":
result = helpServiceProxy.PlantClearRuleCheck(operationReq); result = helpService.PlantClearRuleCheck(operationReq);
break; break;
case "帮助-植物详情": case "帮助-植物详情":
result = helpServiceProxy.PlantInfoRuleCheck(operationReq); result = helpService.PlantInfoRuleCheck(operationReq);
break; break;
case "帮助-种植条件": case "帮助-种植条件":
result = helpServiceProxy.PlantConditionCheck(operationReq); result = helpService.PlantConditionCheck(operationReq);
break; break;
case "帮助-植物对应宠物": case "帮助-植物对应宠物":
result = helpServiceProxy.PlantAttractPetCheck(operationReq); result = helpService.PlantAttractPetCheck(operationReq);
break; break;
case "帮助-不能种植原因": case "帮助-不能种植原因":
result = helpServiceProxy.PlantingFailCheck(operationReq); result = helpService.PlantingFailCheck(operationReq);
break; break;
case "帮助-不能成熟原因": case "帮助-不能成熟原因":
result = helpServiceProxy.PlantMatureFailCheck(operationReq); result = helpService.PlantMatureFailCheck(operationReq);
break; break;
case "帮助-伴生植物": case "帮助-伴生植物":
result = helpServiceProxy.nearPlanRuleCheck(operationReq); result = helpService.nearPlanRuleCheck(operationReq);
break; break;
case "帮助-伴生宠物": case "帮助-伴生宠物":
result = helpServiceProxy.nearPetRuleCheck(operationReq); result = helpService.nearPetRuleCheck(operationReq);
break; break;
case "帮助-园丁等级": case "帮助-园丁等级":
result = helpServiceProxy.gardenerLevelExplainCheck(operationReq); result = helpService.gardenerLevelExplainCheck(operationReq);
break; break;
case "帮助-园丁升级": case "帮助-园丁升级":
result = helpServiceProxy.gardenerUpgradeExplainCheck(operationReq); result = helpService.gardenerUpgradeExplainCheck(operationReq);
break; break;
case "帮助-园丁升级任务": case "帮助-园丁升级任务":
result = helpServiceProxy.gardenerUpgradeTaskCheck(operationReq); result = helpService.gardenerUpgradeTaskCheck(operationReq);
break; break;
case "帮助-园丁升级消耗": case "帮助-园丁升级消耗":
result = helpServiceProxy.gardenerUpgradeCostCheck(operationReq); result = helpService.gardenerUpgradeCostCheck(operationReq);
break; break;
case "帮助-园丁功能": case "帮助-园丁功能":
result = helpServiceProxy.gardenerLevelAbilityCheck(operationReq); result = helpService.gardenerLevelAbilityCheck(operationReq);
break; break;
case "查询园丁技能说明": case "查询园丁技能说明":
result = helpServiceProxy.gardenerSkillRuleCheck(operationReq); result = helpService.gardenerSkillRuleCheck(operationReq);
break; break;
case "查询园丁技能重置规则": case "查询园丁技能重置规则":
result = helpServiceProxy.gardenerSkillResetRuleCheck(operationReq); result = helpService.gardenerSkillResetRuleCheck(operationReq);
break; break;
case "查询园丁技能详情": case "查询园丁技能详情":
result = helpServiceProxy.gardenerLevelSkillRuleCheck(operationReq); result = helpService.gardenerLevelSkillRuleCheck(operationReq);
break; break;
case "查询园丁技能获得方式": case "查询园丁技能获得方式":
result = helpServiceProxy.gardenerSkilGetlRuleCheck(operationReq); result = helpService.gardenerSkilGetlRuleCheck(operationReq);
break; break;
case "查询背包查看方式说明": case "查询背包查看方式说明":
result = helpServiceProxy.backPackRuleCheck(operationReq); result = helpService.backPackRuleCheck(operationReq);
break; break;
case "查询园丁改名规则": case "查询园丁改名规则":
result = helpServiceProxy.gardenerRenameRuleCheck(operationReq); result = helpService.gardenerRenameRuleCheck(operationReq);
break; break;
case "查询宠物获取方式": case "查询宠物获取方式":
result = helpServiceProxy.petGetRuleCheck(operationReq); result = helpService.petGetRuleCheck(operationReq);
break; break;
case "查询宠物获取方式说明": case "查询宠物获取方式说明":
result = helpServiceProxy.petGetByNameRuleCheck(operationReq); result = helpService.petGetByNameRuleCheck(operationReq);
break; break;
case "查询宠物说明": case "查询宠物说明":
result = helpServiceProxy.petExplainCheck(operationReq); result = helpService.petExplainCheck(operationReq);
break; break;
case "查询宠物战斗规则": case "查询宠物战斗规则":
result = helpServiceProxy.petFightRuleCheck(operationReq); result = helpService.petFightRuleCheck(operationReq);
break; break;
case "查询宠物属性说明": case "查询宠物属性说明":
result = helpServiceProxy.petAttributeExplainCheck(operationReq); result = helpService.petAttributeExplainCheck(operationReq);
break; break;
case "查询宠物属性克制": case "查询宠物属性克制":
result = helpServiceProxy.petAttributeRestrainCheck(operationReq); result = helpService.petAttributeRestrainCheck(operationReq);
break; break;
case "查询宠物稀有度说明": case "查询宠物稀有度说明":
result = helpServiceProxy.petRarityCheck(operationReq); result = helpService.petRarityCheck(operationReq);
break; break;
case "查询宠物资料": case "查询宠物资料":
result = helpServiceProxy.petInfoCheck(operationReq); result = helpService.petInfoCheck(operationReq);
break; break;
case "查询宠物维护品": case "查询宠物维护品":
result = helpServiceProxy.petCostCheck(operationReq); result = helpService.petCostCheck(operationReq);
break; break;
case "查询拜访陌生人规则": case "查询拜访陌生人规则":
result = helpServiceProxy.visitStrangerRuleCheck(operationReq); result = helpService.visitStrangerRuleCheck(operationReq);
break; break;
case "查询偷菜规则": case "查询偷菜规则":
result = helpServiceProxy.stealStrangerRuleCheck(operationReq); result = helpService.stealStrangerRuleCheck(operationReq);
break; break;
case "查询偷菜简报规则": case "查询偷菜简报规则":
result = helpServiceProxy.stealReportRuleCheck(operationReq); result = helpService.stealReportRuleCheck(operationReq);
break; break;
case "查询拜访好友规则": case "查询拜访好友规则":
result = helpServiceProxy.visitFriendRuleCheck(operationReq); result = helpService.visitFriendRuleCheck(operationReq);
break; break;
case "查询好友申请规则": case "查询好友申请规则":
result = helpServiceProxy.addFriendRuleCheck(operationReq); result = helpService.addFriendRuleCheck(operationReq);
break; break;
case "查询好友帮助规则": case "查询好友帮助规则":
result = helpServiceProxy.helpFriendRuleCheck(operationReq); result = helpService.helpFriendRuleCheck(operationReq);
break; break;
case "查询好友帮助报酬规则": case "查询好友帮助报酬规则":
result = helpServiceProxy.helpFriendAwardRuleCheck(operationReq); result = helpService.helpFriendAwardRuleCheck(operationReq);
break; break;
case "查询帮助简报规则": case "查询帮助简报规则":
result = helpServiceProxy.helpReportRuleCheck(operationReq); result = helpService.helpReportRuleCheck(operationReq);
break; break;
case "查询购买物品规则": case "查询购买物品规则":
result = helpServiceProxy.buyGoodsRuleCheck(operationReq); result = helpService.buyGoodsRuleCheck(operationReq);
break; break;
case "查询出售物品规则": case "查询出售物品规则":
result = helpServiceProxy.sellItemsRuleCheck(operationReq); result = helpService.sellItemsRuleCheck(operationReq);
break; break;
case "查询日常任务规则": case "查询日常任务规则":
result = helpServiceProxy.dailyTaskRuleCheck(operationReq); result = helpService.dailyTaskRuleCheck(operationReq);
break; break;
case "查询排行榜规则": case "查询排行榜规则":
result = helpServiceProxy.rankingListRuleCheck(operationReq); result = helpService.rankingListRuleCheck(operationReq);
break; break;
case "查询排行榜操作规则": case "查询排行榜操作规则":
result = helpServiceProxy.rankingListRuleLookCheck(operationReq); result = helpService.rankingListRuleLookCheck(operationReq);
break; break;
case "重开引导指令": case "重开引导指令":
result = helpServiceProxy.backgroundStoryCheck(operationReq); result = helpService.backgroundStoryCheck(operationReq);
break; break;
case "查询货币说明": case "查询货币说明":
result = helpServiceProxy.moneyExplainCheck(operationReq); result = helpService.moneyExplainCheck(operationReq);
break; break;
case "询问建议": case "询问建议":
result = adviseServiceProxy.adviseWithout(operationReq); result = adviseService.adviseWithout(operationReq);
break; break;
case "询问种植建议": case "询问种植建议":
result = adviseServiceProxy.adviseByPlant(operationReq); result = adviseService.adviseByPlant(operationReq);
break; break;
case "询问宠物建议": case "询问宠物建议":
result = adviseServiceProxy.adviseByPet(operationReq); result = adviseService.adviseByPet(operationReq);
break; break;
case "询问物品建议": case "询问物品建议":
result = adviseServiceProxy.adviseByItem(operationReq); result = adviseService.adviseByItem(operationReq);
break; break;
case "询问花圃建议": case "询问花圃建议":
result = adviseServiceProxy.adviseByNursery(operationReq); result = adviseService.adviseByNursery(operationReq);
break; break;
case "询问货币建议": case "询问货币建议":
result = adviseServiceProxy.adviseByMoney(operationReq); result = adviseService.adviseByMoney(operationReq);
break; break;
case "同意建议": case "同意建议":
result = adviseServiceProxy.adviseAgree(operationReq); result = adviseService.adviseAgree(operationReq);
break; break;
case "拒绝建议": case "拒绝建议":
result = adviseServiceProxy.adviseRefuse(operationReq); result = adviseService.adviseRefuse(operationReq);
break; break;
} }
log.info(operationReq.getUid() + "已完成操作:【" + commonRequest.getVars().get操作名() + "】"); log.info(operationReq.getUid() + "已完成操作:【" + commonRequest.getVars().get操作名() + "】");
return result; return DataTrimUtil.AdjustParams(uid, result, operationReq);
} }
} }
...@@ -21,6 +21,7 @@ import com.qiwuai.garden.service.plantService.impl.PlantServiceImpl; ...@@ -21,6 +21,7 @@ import com.qiwuai.garden.service.plantService.impl.PlantServiceImpl;
import com.qiwuai.garden.service.socialService.impl.SocialServiceImpl; import com.qiwuai.garden.service.socialService.impl.SocialServiceImpl;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -35,7 +36,8 @@ import java.util.stream.Collectors; ...@@ -35,7 +36,8 @@ import java.util.stream.Collectors;
public class AdviseServiceImpl implements AdviseService { public class AdviseServiceImpl implements AdviseService {
Logger log = LoggerFactory.getLogger(AdviseServiceImpl.class); Logger log = LoggerFactory.getLogger(AdviseServiceImpl.class);
//从yml配置文件中取出对话过期时间 //从yml配置文件中取出对话过期时间
String expireTime = YamlUtil.getValueByKey("expireTime"); @Value("${expireTime}")
private String expireTime;
GardenerServiceImpl gardenerService = (GardenerServiceImpl) GetBeanUtil.getBean("gardenerServiceImpl"); GardenerServiceImpl gardenerService = (GardenerServiceImpl) GetBeanUtil.getBean("gardenerServiceImpl");
......
...@@ -18,6 +18,7 @@ import com.qiwuai.garden.pojo.*; ...@@ -18,6 +18,7 @@ import com.qiwuai.garden.pojo.*;
import com.qiwuai.garden.service.backPackService.BackPackService; import com.qiwuai.garden.service.backPackService.BackPackService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
......
...@@ -21,6 +21,7 @@ import com.qiwuai.garden.service.gardenerService.GardenerService; ...@@ -21,6 +21,7 @@ import com.qiwuai.garden.service.gardenerService.GardenerService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -39,10 +40,14 @@ import java.util.stream.Stream; ...@@ -39,10 +40,14 @@ import java.util.stream.Stream;
public class GardenerServiceImpl implements GardenerService { public class GardenerServiceImpl implements GardenerService {
private Logger log = LoggerFactory.getLogger(GardenerServiceImpl.class); private Logger log = LoggerFactory.getLogger(GardenerServiceImpl.class);
//从yml配置文件中取出对话过期时间
@Value("${expireTime}")
private String expireTime;
@Value("${configFilePath}")
private String configFilePath;
@Autowired @Autowired
private GardenerMapper gardenerMapper; private GardenerMapper gardenerMapper;
//从yml配置文件中取出对话过期时间
String expireTime = YamlUtil.getValueByKey("expireTime");
@Override @Override
public CommonResponse enterGame(OperationRequest operationReq) throws ParseException { public CommonResponse enterGame(OperationRequest operationReq) throws ParseException {
...@@ -175,7 +180,7 @@ public class GardenerServiceImpl implements GardenerService { ...@@ -175,7 +180,7 @@ public class GardenerServiceImpl implements GardenerService {
e.printStackTrace(); e.printStackTrace();
} }
//--------------生成新的玩家地址---------------- //--------------生成新的玩家地址----------------
String location = TimingAcquisition.generateAddress(hostAddress); String location = TimingAcquisition.generateAddress(configFilePath, hostAddress);
region = TypeConvertUtil.extractChinese(location); region = TypeConvertUtil.extractChinese(location);
String num = location.replace(region, ""); String num = location.replace(region, "");
gardenDto.setZone(region); gardenDto.setZone(region);
......
...@@ -16,6 +16,7 @@ import com.qiwuai.garden.service.marketService.MarketService; ...@@ -16,6 +16,7 @@ import com.qiwuai.garden.service.marketService.MarketService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -31,7 +32,8 @@ public class MarketServiceImpl implements MarketService { ...@@ -31,7 +32,8 @@ public class MarketServiceImpl implements MarketService {
Logger log = LoggerFactory.getLogger(MarketServiceImpl.class); Logger log = LoggerFactory.getLogger(MarketServiceImpl.class);
//从yml配置文件中取出对话过期时间 //从yml配置文件中取出对话过期时间
String expireTime = YamlUtil.getValueByKey("expireTime"); @Value("${expireTime}")
private String expireTime;
@Override @Override
public CommonResponse buyCheck(OperationRequest operationReq) { public CommonResponse buyCheck(OperationRequest operationReq) {
...@@ -217,14 +219,29 @@ public class MarketServiceImpl implements MarketService { ...@@ -217,14 +219,29 @@ public class MarketServiceImpl implements MarketService {
commonResponse.setData(resultVarsResponse); commonResponse.setData(resultVarsResponse);
return commonResponse; return commonResponse;
} }
//商品总价
int price = itemPrice.multiply(new BigDecimal(number)).intValue();
if (price < 0) {
log.info(uid + "的货币不足");
//获取对应话术
String text = SpeechUtil.getMarketSpeech(Constants.SPEECH_ASIDE, "buy_fail_money");
text += SpeechUtil.getMarketSpeech(gender, "buy_fail_money");
text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName());
commonResponse.setCode(1);
commonResponse.setMsg("成功");
resultResponse.set反馈ID(400107);
resultResponse.set反馈文本(text);
resultResponse.set后台附加返回("购买物品回复3");
resultVarsResponse.setVars(resultResponse);
commonResponse.setData(resultVarsResponse);
return commonResponse;
}
//保存玩家这轮的请求信息,itemId和数量均保存,用于下一步的确认购买操作 //保存玩家这轮的请求信息,itemId和数量均保存,用于下一步的确认购买操作
operationReq.setItemId(itemId); operationReq.setItemId(itemId);
operationReq.setItemTypeId(itemConfig.getItemTypeId()); operationReq.setItemTypeId(itemConfig.getItemTypeId());
operationReq.setNumber(number); operationReq.setNumber(number);
operationReq.setOperationLabel(Constants.BUY_GOODS); operationReq.setOperationLabel(Constants.BUY_GOODS);
CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); CacheUtil.put(uid, operationReq, Long.parseLong(expireTime));
//商品总价
int price = itemPrice.multiply(new BigDecimal(number)).intValue();
//获取对应话术 //获取对应话术
String text = SpeechUtil.getMarketSpeech(Constants.SPEECH_ASIDE, "buy_check_success"); String text = SpeechUtil.getMarketSpeech(Constants.SPEECH_ASIDE, "buy_check_success");
text = SpeechUtil.speechReplaceNum(text, number.toString(), goodsName, String.valueOf(price), moneyConfig.getName()); text = SpeechUtil.speechReplaceNum(text, number.toString(), goodsName, String.valueOf(price), moneyConfig.getName());
...@@ -529,7 +546,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -529,7 +546,7 @@ public class MarketServiceImpl implements MarketService {
commonResponse.setData(resultVarsResponse); commonResponse.setData(resultVarsResponse);
return commonResponse; return commonResponse;
} }
if (item.getItemNum() == 0) { if (item.getItemNum() <= 0) {
log.info(uid + "玩家背包还没有该物品"); log.info(uid + "玩家背包还没有该物品");
//获取对应话术 //获取对应话术
String text = SpeechUtil.getMarketSpeech(Constants.SPEECH_ASIDE, "sell_check_fail_none"); String text = SpeechUtil.getMarketSpeech(Constants.SPEECH_ASIDE, "sell_check_fail_none");
...@@ -604,6 +621,26 @@ public class MarketServiceImpl implements MarketService { ...@@ -604,6 +621,26 @@ public class MarketServiceImpl implements MarketService {
return commonResponse; return commonResponse;
} }
int price = number * itemConfig.getPrice(); int price = number * itemConfig.getPrice();
if (price < 0) {
log.info(uid + "玩家出售物品数量大于背包有的数量");
//获取对应话术
String text = SpeechUtil.getMarketSpeech(Constants.SPEECH_ASIDE, "sell_check_fail_num");
text = SpeechUtil.speechReplaceNum(text, itemConfig.getName());
//保存玩家这轮的请求信息,用于下一步的操作
operationReq.setItemId(itemId);
operationReq.setItemTypeId(itemTypeId);
operationReq.setNumber(item.getItemNum()); //保存最大数量,提供给下一步操作
operationReq.setOperationLabel(Constants.SELL_ITEMS);
CacheUtil.put(uid, operationReq, Long.parseLong(expireTime));
commonResponse.setCode(1);
commonResponse.setMsg("成功");
resultResponse.set反馈ID(400216);
resultResponse.set反馈文本(text);
resultResponse.set后台附加返回("出售物品回复1");
resultVarsResponse.setVars(resultResponse);
commonResponse.setData(resultVarsResponse);
return commonResponse;
}
//获取对应话术 //获取对应话术
String text = SpeechUtil.getMarketSpeech(Constants.SPEECH_ASIDE, "sell_check_success"); String text = SpeechUtil.getMarketSpeech(Constants.SPEECH_ASIDE, "sell_check_success");
text = SpeechUtil.speechReplaceNum(text, number.toString(), itemConfig.getName(), String.valueOf(price), money.getName()); text = SpeechUtil.speechReplaceNum(text, number.toString(), itemConfig.getName(), String.valueOf(price), money.getName());
......
...@@ -17,6 +17,7 @@ import com.qiwuai.garden.service.nurseryService.NurseryService; ...@@ -17,6 +17,7 @@ import com.qiwuai.garden.service.nurseryService.NurseryService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -31,7 +32,8 @@ public class NurseryServiceImpl implements NurseryService { ...@@ -31,7 +32,8 @@ public class NurseryServiceImpl implements NurseryService {
@Autowired @Autowired
private NurseryMapper nurseryMapper; private NurseryMapper nurseryMapper;
//从yml配置文件中取出对话过期时间 //从yml配置文件中取出对话过期时间
String expireTime = YamlUtil.getValueByKey("expireTime"); @Value("${expireTime}")
private String expireTime;
@Override @Override
public List<NurseryPojo> findAll() { public List<NurseryPojo> findAll() {
......
...@@ -18,6 +18,7 @@ import com.qiwuai.garden.service.petService.PetService; ...@@ -18,6 +18,7 @@ import com.qiwuai.garden.service.petService.PetService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -30,7 +31,8 @@ public class PetServiceImpl implements PetService { ...@@ -30,7 +31,8 @@ public class PetServiceImpl implements PetService {
private Logger log = LoggerFactory.getLogger(PetServiceImpl.class); private Logger log = LoggerFactory.getLogger(PetServiceImpl.class);
//从yml配置文件中取出对话过期时间 //从yml配置文件中取出对话过期时间
String expireTime = YamlUtil.getValueByKey("expireTime"); @Value("${expireTime}")
private String expireTime;
@Override @Override
public CommonResponse petView(OperationRequest operationReq) { public CommonResponse petView(OperationRequest operationReq) {
......
...@@ -20,6 +20,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -20,6 +20,7 @@ import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -43,7 +44,8 @@ public class PlantServiceImpl implements PlantService { ...@@ -43,7 +44,8 @@ public class PlantServiceImpl implements PlantService {
private AttributeMapper plantAttributeMapper; private AttributeMapper plantAttributeMapper;
//从yml配置文件中取出对话过期时间 //从yml配置文件中取出对话过期时间
String expireTime = YamlUtil.getValueByKey("expireTime"); @Value("${expireTime}")
private String expireTime;
public List<PlantPojo> plantSearch() { public List<PlantPojo> plantSearch() {
List<PlantPojo> plantList = plantMapper.searchAll(); List<PlantPojo> plantList = plantMapper.searchAll();
......
...@@ -17,6 +17,7 @@ import com.qiwuai.garden.pojo.ItemPojo; ...@@ -17,6 +17,7 @@ import com.qiwuai.garden.pojo.ItemPojo;
import com.qiwuai.garden.service.rankingService.RankingService; import com.qiwuai.garden.service.rankingService.RankingService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -29,7 +30,8 @@ import java.util.stream.Collectors; ...@@ -29,7 +30,8 @@ import java.util.stream.Collectors;
public class RankingServiceImpl implements RankingService { public class RankingServiceImpl implements RankingService {
Logger log = LoggerFactory.getLogger(RankingServiceImpl.class); Logger log = LoggerFactory.getLogger(RankingServiceImpl.class);
//从yml配置文件中取出对话过期时间 //从yml配置文件中取出对话过期时间
String expireTime = YamlUtil.getValueByKey("expireTime"); @Value("${expireTime}")
private String expireTime;
@Override @Override
public CommonResponse checkRankingList(OperationRequest operationReq) { public CommonResponse checkRankingList(OperationRequest operationReq) {
...@@ -374,6 +376,18 @@ public class RankingServiceImpl implements RankingService { ...@@ -374,6 +376,18 @@ public class RankingServiceImpl implements RankingService {
int fightRanking = RankingUtil.getRankingByUid(Constants.FIGHT_RANKING, place, uid); int fightRanking = RankingUtil.getRankingByUid(Constants.FIGHT_RANKING, place, uid);
//友情榜名次 //友情榜名次
int friendshipRanking = RankingUtil.getRankingByUid(Constants.FRIENDSHIP_RANKING, place, uid); int friendshipRanking = RankingUtil.getRankingByUid(Constants.FRIENDSHIP_RANKING, place, uid);
//今日新增玩家还没有进行排行
if (moneyRanking == -1) {
//获取对应话术
String text = SpeechUtil.getRankingSpeech(Constants.SPEECH_ASIDE, "check_self_no_ranking");
commonResponse.setCode(1);
commonResponse.setMsg("成功");
resultResponse.set反馈ID(700209);
resultResponse.set反馈文本(text);
resultVarsResponse.setVars(resultResponse);
commonResponse.setData(resultVarsResponse);
return commonResponse;
}
//玩家未提供了榜单和地区,即查看世界排名 //玩家未提供了榜单和地区,即查看世界排名
if (StringUtils.isEmpty(rankingName) && StringUtils.isEmpty(place)) { if (StringUtils.isEmpty(rankingName) && StringUtils.isEmpty(place)) {
//获取对应话术 //获取对应话术
...@@ -546,6 +560,18 @@ public class RankingServiceImpl implements RankingService { ...@@ -546,6 +560,18 @@ public class RankingServiceImpl implements RankingService {
int fightRanking = RankingUtil.getRankingByUid(Constants.FIGHT_RANKING, place, uidSide); int fightRanking = RankingUtil.getRankingByUid(Constants.FIGHT_RANKING, place, uidSide);
//友情榜名次 //友情榜名次
int friendshipRanking = RankingUtil.getRankingByUid(Constants.FRIENDSHIP_RANKING, place, uidSide); int friendshipRanking = RankingUtil.getRankingByUid(Constants.FRIENDSHIP_RANKING, place, uidSide);
//今日新增玩家还没有进行排行
if (moneyRanking == -1) {
//获取对应话术
String text = SpeechUtil.getRankingSpeech(Constants.SPEECH_ASIDE, "check_player_no_ranking");
commonResponse.setCode(1);
commonResponse.setMsg("成功");
resultResponse.set反馈ID(700311);
resultResponse.set反馈文本(text);
resultVarsResponse.setVars(resultResponse);
commonResponse.setData(resultVarsResponse);
return commonResponse;
}
//玩家未提供了榜单和地区,即查看世界排名 //玩家未提供了榜单和地区,即查看世界排名
if (StringUtils.isEmpty(rankingName) && StringUtils.isEmpty(place)) { if (StringUtils.isEmpty(rankingName) && StringUtils.isEmpty(place)) {
//获取对应话术 //获取对应话术
......
...@@ -18,6 +18,7 @@ import com.qiwuai.garden.service.taskService.impl.TaskServiceImpl; ...@@ -18,6 +18,7 @@ import com.qiwuai.garden.service.taskService.impl.TaskServiceImpl;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -32,7 +33,8 @@ import java.util.stream.Stream; ...@@ -32,7 +33,8 @@ import java.util.stream.Stream;
public class SocialServiceImpl implements SocialService { public class SocialServiceImpl implements SocialService {
Logger log = LoggerFactory.getLogger(SocialServiceImpl.class); Logger log = LoggerFactory.getLogger(SocialServiceImpl.class);
//从yml配置文件中取出对话过期时间 //从yml配置文件中取出对话过期时间
String expireTime = YamlUtil.getValueByKey("expireTime"); @Value("${expireTime}")
private String expireTime;
@Autowired @Autowired
private TaskServiceImpl taskServiceImpl; private TaskServiceImpl taskServiceImpl;
...@@ -6009,7 +6011,7 @@ public class SocialServiceImpl implements SocialService { ...@@ -6009,7 +6011,7 @@ public class SocialServiceImpl implements SocialService {
//留言内容为空,提示玩家输入留言内容 //留言内容为空,提示玩家输入留言内容
if (StringUtils.isEmpty(message)) { if (StringUtils.isEmpty(message)) {
//获取对应话术 //获取对应话术
String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "leave_message_check"); String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "leave_message_check_context");
commonResponse.setCode(1); commonResponse.setCode(1);
commonResponse.setMsg("成功"); commonResponse.setMsg("成功");
resultResponse.set反馈ID(501101); resultResponse.set反馈ID(501101);
...@@ -6019,28 +6021,76 @@ public class SocialServiceImpl implements SocialService { ...@@ -6019,28 +6021,76 @@ public class SocialServiceImpl implements SocialService {
commonResponse.setData(resultVarsResponse); commonResponse.setData(resultVarsResponse);
return commonResponse; return commonResponse;
} }
//留言内容包含敏感词汇,判定失败 //当前留言只允许留qq、微信和电话
List<String> sensitiveWordList = PersistenceUtil.getContentFromFile("sensitiveWords.xls"); int result = TypeConvertUtil.checkContext(message);
for (String sensitive : sensitiveWordList) { //留言内容格式不对
if (message.contains(sensitive)) { if (result == 4) {
log.info(uid + "的留言内容包含敏感词汇:" + sensitive); String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "leave_message_check_context");
//保存玩家这轮的请求信息,用于下一步操作
operationReq.setAddress(address);
operationReq.setMessage(null);
operationReq.setOperationLabel(Constants.LEAVE_MESSAGE);
CacheUtil.put(uid, operationReq, Long.parseLong(expireTime));
//获取对应话术
String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "leave_message_fail_sensitive_words");
commonResponse.setCode(1); commonResponse.setCode(1);
commonResponse.setMsg("成功"); commonResponse.setMsg("成功");
resultResponse.set反馈ID(501105); resultResponse.set反馈ID(501112);
resultResponse.set反馈文本(text); resultResponse.set反馈文本(text);
resultResponse.set后台附加返回("请说明留言内容"); resultResponse.set后台附加返回("请说明留言内容");
resultVarsResponse.setVars(resultResponse); resultVarsResponse.setVars(resultResponse);
commonResponse.setData(resultVarsResponse); commonResponse.setData(resultVarsResponse);
return commonResponse; return commonResponse;
} }
//微信格式不对
if (result == 1) {
commonResponse.setCode(1);
commonResponse.setMsg("成功");
resultResponse.set反馈ID(501113);
resultResponse.set反馈文本("【旁白@正常】微信号格式不对哦。");
resultResponse.set后台附加返回("请说明留言内容");
resultVarsResponse.setVars(resultResponse);
commonResponse.setData(resultVarsResponse);
return commonResponse;
} }
//qq格式不对
if (result == 2) {
commonResponse.setCode(1);
commonResponse.setMsg("成功");
resultResponse.set反馈ID(501114);
resultResponse.set反馈文本("【旁白@正常】QQ号格式不对哦。");
resultResponse.set后台附加返回("请说明留言内容");
resultVarsResponse.setVars(resultResponse);
commonResponse.setData(resultVarsResponse);
return commonResponse;
}
//手机号码格式不对
if (result == 3) {
commonResponse.setCode(1);
commonResponse.setMsg("成功");
resultResponse.set反馈ID(501115);
resultResponse.set反馈文本("【旁白@正常】手机号码格式不对哦。");
resultResponse.set后台附加返回("请说明留言内容");
resultVarsResponse.setVars(resultResponse);
commonResponse.setData(resultVarsResponse);
return commonResponse;
}
message = TypeConvertUtil.contextChange(message);
//留言内容包含敏感词汇,判定失败
// List<String> sensitiveWordList = PersistenceUtil.getContentFromFile("sensitiveWords.xls");
// for (String sensitive : sensitiveWordList) {
// if (message.contains(sensitive)) {
// log.info(uid + "的留言内容包含敏感词汇:" + sensitive);
// //保存玩家这轮的请求信息,用于下一步操作
// operationReq.setAddress(address);
// operationReq.setMessage(null);
// operationReq.setOperationLabel(Constants.LEAVE_MESSAGE);
// CacheUtil.put(uid, operationReq, Long.parseLong(expireTime));
// //获取对应话术
// String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "leave_message_fail_sensitive_words");
// commonResponse.setCode(1);
// commonResponse.setMsg("成功");
// resultResponse.set反馈ID(501105);
// resultResponse.set反馈文本(text);
// resultResponse.set后台附加返回("请说明留言内容");
// resultVarsResponse.setVars(resultResponse);
// commonResponse.setData(resultVarsResponse);
// return commonResponse;
// }
// }
//获取对应话术 //获取对应话术
String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "leave_message_double_check"); String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "leave_message_double_check");
text = SpeechUtil.speechReplaceNum(text, message); text = SpeechUtil.speechReplaceNum(text, message);
......
...@@ -17,6 +17,7 @@ import com.qiwuai.garden.pojo.TaskTypePojo; ...@@ -17,6 +17,7 @@ import com.qiwuai.garden.pojo.TaskTypePojo;
import com.qiwuai.garden.service.taskService.TaskService; import com.qiwuai.garden.service.taskService.TaskService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -29,7 +30,8 @@ import java.util.stream.Collectors; ...@@ -29,7 +30,8 @@ import java.util.stream.Collectors;
public class TaskServiceImpl implements TaskService { public class TaskServiceImpl implements TaskService {
Logger log = LoggerFactory.getLogger(TaskServiceImpl.class); Logger log = LoggerFactory.getLogger(TaskServiceImpl.class);
//从yml配置文件中取出对话过期时间 //从yml配置文件中取出对话过期时间
String expireTime = YamlUtil.getValueByKey("expireTime"); @Value("${expireTime}")
private String expireTime;
@Override @Override
public CommonResponse checkTask(OperationRequest operationReq) { public CommonResponse checkTask(OperationRequest operationReq) {
......
...@@ -12,7 +12,7 @@ spring: ...@@ -12,7 +12,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/crazy_garden?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC url: jdbc:mysql://localhost:3306/crazy_garden?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
username: root username: root
password: 38A0O1jEPOE password: R91jKARPj23dtqZ4wfc2F
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
druid: druid:
initial-size: 5 initial-size: 5
...@@ -53,15 +53,15 @@ expireTime: 180000 ...@@ -53,15 +53,15 @@ expireTime: 180000
#玩家无操作时长,默认下线 #玩家无操作时长,默认下线
offlineTime: 180000 offlineTime: 180000
userFilePath: /home/crazyGarden/crazyGardenUser/ userFilePath: /home/jiaoyou/projects/crazyGarden/crazyGardenUser/
speechFilePath: /home/crazyGarden/crazyGardenSpeech/ speechFilePath: /home/jiaoyou/projects/crazyGarden/crazyGardenSpeech/
configFilePath: /home/crazyGarden/config/ configFilePath: /home/jiaoyou/projects/crazyGarden/config/
messageFilePath: /home/crazyGarden/message/ messageFilePath: /home/jiaoyou/projects/crazyGarden/message/
reportFilePath: /home/crazyGarden/report/ reportFilePath: /home/jiaoyou/projects/crazyGarden/report/
#动态词组更新秘钥 #动态词组更新秘钥
appSecret: Wl4zX6mEAjK5uT2M appSecret: Wl4zX6mEAjK5uT2M
......
...@@ -69,7 +69,7 @@ appSecret: nnPGsrbMriXdrRNISQeb ...@@ -69,7 +69,7 @@ appSecret: nnPGsrbMriXdrRNISQeb
updatePhraseUrl: http://hw-gz24.heyqiwu.cn:8082/out/phrase updatePhraseUrl: http://hw-gz24.heyqiwu.cn:8082/out/phrase
#分享关系查看地址 #分享关系查看地址
shareRelationUrl: https://hw-gz26.heyqiwu.cn/api/tongyong/ shareRelationUrl: http://tx-gz10.heyqiwu.cn/api/tongyong/
#分享链接通道 #分享链接通道
shareChannelId: zhuimenggarden-server-test shareChannelId: zhuimenggarden-server-test
#分享链接秘钥 #分享链接秘钥
......
...@@ -53,15 +53,15 @@ expireTime: 180000 ...@@ -53,15 +53,15 @@ expireTime: 180000
#玩家无操作时长,默认下线 #玩家无操作时长,默认下线
offlineTime: 180000 offlineTime: 180000
userFilePath: /home/secretGarden/secretGardenUser/ userFilePath: /home/jiaoyou/projects/secretGarden/secretGardenUser/
speechFilePath: /home/secretGarden/secretGardenSpeech/ speechFilePath: /home/jiaoyou/projects/secretGarden/secretGardenSpeech/
configFilePath: /home/secretGarden/config/ configFilePath: /home/jiaoyou/projects/secretGarden/config/
messageFilePath: /home/secretGarden/message/ messageFilePath: /home/jiaoyou/projects/secretGarden/message/
reportFilePath: /home/secretGarden/report/ reportFilePath: /home/jiaoyou/projects/secretGarden/report/
#动态词组更新秘钥 #动态词组更新秘钥
appSecret: nnPGsrbMriXdrRNISQeb appSecret: nnPGsrbMriXdrRNISQeb
...@@ -69,7 +69,7 @@ appSecret: nnPGsrbMriXdrRNISQeb ...@@ -69,7 +69,7 @@ appSecret: nnPGsrbMriXdrRNISQeb
updatePhraseUrl: http://hw-gz24.heyqiwu.cn:8082/out/phrase updatePhraseUrl: http://hw-gz24.heyqiwu.cn:8082/out/phrase
#分享关系查看地址 #分享关系查看地址
shareRelationUrl: https://hw-gz26.heyqiwu.cn/api/tongyong/ shareRelationUrl: http://tx-gz10.heyqiwu.cn/api/tongyong/
#分享链接通道 #分享链接通道
shareChannelId: zhuimenggarden-server-test shareChannelId: zhuimenggarden-server-test
#分享链接秘钥 #分享链接秘钥
......
...@@ -12,7 +12,7 @@ spring: ...@@ -12,7 +12,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/secret_garden?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC url: jdbc:mysql://localhost:3306/secret_garden?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
username: root username: root
password: 38A0O1jEPOE password: R91jKARPj23dtqZ4wfc2F
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
druid: druid:
initial-size: 5 initial-size: 5
...@@ -53,15 +53,15 @@ expireTime: 180000 ...@@ -53,15 +53,15 @@ expireTime: 180000
#玩家无操作时长,默认下线 #玩家无操作时长,默认下线
offlineTime: 180000 offlineTime: 180000
userFilePath: /home/secretGarden/secretGardenUser/ userFilePath: /home/jiaoyou/projects/secretGarden/secretGardenUser/
speechFilePath: /home/secretGarden/secretGardenSpeech/ speechFilePath: /home/jiaoyou/projects/secretGarden/secretGardenSpeech/
configFilePath: /home/secretGarden/config/ configFilePath: /home/jiaoyou/projects/secretGarden/config/
messageFilePath: /home/secretGarden/message/ messageFilePath: /home/jiaoyou/projects/secretGarden/message/
reportFilePath: /home/secretGarden/report/ reportFilePath: /home/jiaoyou/projects/secretGarden/report/
#动态词组更新秘钥 #动态词组更新秘钥
appSecret: Wl4zX6mEAjK5uT2M appSecret: Wl4zX6mEAjK5uT2M
......
...@@ -12,7 +12,7 @@ spring: ...@@ -12,7 +12,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/secret_garden?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC url: jdbc:mysql://localhost:3306/secret_garden?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
username: root username: root
password: 38A0O1jEPOE password: dgKNTmt2iLHNjEQajkDEZkq8
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
druid: druid:
initial-size: 5 initial-size: 5
...@@ -53,15 +53,15 @@ expireTime: 180000 ...@@ -53,15 +53,15 @@ expireTime: 180000
#玩家无操作时长,默认下线 #玩家无操作时长,默认下线
offlineTime: 180000 offlineTime: 180000
userFilePath: /home/secretGarden/secretGardenUser/ userFilePath: /home/jiaoyou/projects/secretGarden/secretGardenUser/
speechFilePath: /home/secretGarden/secretGardenSpeech/ speechFilePath: /home/jiaoyou/projects/secretGarden/secretGardenSpeech/
configFilePath: /home/secretGarden/config/ configFilePath: /home/jiaoyou/projects/secretGarden/config/
messageFilePath: /home/secretGarden/message/ messageFilePath: /home/jiaoyou/projects/secretGarden/message/
reportFilePath: /home/secretGarden/report/ reportFilePath: /home/jiaoyou/projects/secretGarden/report/
#动态词组更新秘钥 #动态词组更新秘钥
appSecret: nnPGsrbMriXdrRNISQeb appSecret: nnPGsrbMriXdrRNISQeb
...@@ -69,7 +69,7 @@ appSecret: nnPGsrbMriXdrRNISQeb ...@@ -69,7 +69,7 @@ appSecret: nnPGsrbMriXdrRNISQeb
updatePhraseUrl: http://hw-gz24.heyqiwu.cn:8082/out/phrase updatePhraseUrl: http://hw-gz24.heyqiwu.cn:8082/out/phrase
#分享关系查看地址 #分享关系查看地址
shareRelationUrl: https://hw-gz26.heyqiwu.cn/api/tongyong/ shareRelationUrl: http://tx-gz10.heyqiwu.cn/api/tongyong/
#分享链接通道 #分享链接通道
shareChannelId: zhuimenggarden-server-test shareChannelId: zhuimenggarden-server-test
#分享链接秘钥 #分享链接秘钥
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<Configuration status="fatal"> <Configuration status="fatal">
<!--打印在本地,根据具体存储地址填写--> <!--打印在本地,根据具体存储地址填写-->
<Properties> <Properties>
<Property name="baseDir" value="/home/secretGarden/logs"/> <Property name="baseDir" value="/home/jiaoyou/projects/secretGarden/logs"/>
</Properties> </Properties>
<Appenders> <Appenders>
......
...@@ -39,6 +39,8 @@ aside: ...@@ -39,6 +39,8 @@ aside:
check_region_friendship_ranking: check_region_friendship_ranking:
- 【旁白@正常】第【1】名是【2】,共帮助好友收获植物【3】次 - 【旁白@正常】第【1】名是【2】,共帮助好友收获植物【3】次
#查看本人排名 #查看本人排名
check_self_no_ranking:
- 【旁白@正常】榜单每天刷新一次,你当前还没有进行排名。
check_self_rich_ranking: check_self_rich_ranking:
- 【旁白@正常】你在富豪榜上排名为第【1】名。 - 【旁白@正常】你在富豪榜上排名为第【1】名。
check_self_fight_ranking: check_self_fight_ranking:
...@@ -56,6 +58,8 @@ aside: ...@@ -56,6 +58,8 @@ aside:
check_self_local_ranking: check_self_local_ranking:
- 【旁白@正常】你在本地区的富豪榜上排名为第【1】名。你在战斗榜上排名为第【2】名。你在友情榜上排名为第【3】名。 - 【旁白@正常】你在本地区的富豪榜上排名为第【1】名。你在战斗榜上排名为第【2】名。你在友情榜上排名为第【3】名。
#查看玩家排名 #查看玩家排名
check_player_no_ranking:
- 【旁白@正常】榜单每天刷新一次,玩家【1】还未进行排名。
check_player_rich_ranking: check_player_rich_ranking:
- 【旁白@正常】玩家【1】在富豪榜上排名为第【2】名。 - 【旁白@正常】玩家【1】在富豪榜上排名为第【2】名。
check_player_fight_ranking: check_player_fight_ranking:
......
...@@ -178,6 +178,8 @@ aside: ...@@ -178,6 +178,8 @@ aside:
address_self_check: address_self_check:
- 【旁白@正常】你的地址为【1】。 - 【旁白@正常】你的地址为【1】。
#好友留言 #好友留言
leave_message_check_context:
- 【旁白@正常】目前的留言功能尚未开放,您可以先给好友留下联系方式以便联系,暂且支持微信、QQ或者手机号码哦。请按以下方式说出要留言的内容:微信+微信号、QQ+QQ号、或者手机号码+手机号。如微信zhanghao123。
leave_message_check: leave_message_check:
- 【旁白@正常】好的,请留下你要留言的内容。 - 【旁白@正常】好的,请留下你要留言的内容。
leave_message_double_check: leave_message_double_check:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment