package com.qiwu.chatbotbackend.entity; import java.io.IOException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.concurrent.ExecutionException; import com.qiwu.chatbotbackend.GameEnvironment.GameEnv; import com.qiwu.chatbotbackend.processing.ChatCacheController; import org.springframework.beans.factory.DisposableBean; import javax.annotation.PreDestroy; public class ChatCache3 implements DisposableBean { // private String chatKey = "不知道"; private String chatKey = ""; private String botAccount = ""; private Map infoPoint = null; private GameEnv gameEnv = null; private boolean reloading = false; public String getBotAccount() { return botAccount; } public void setBotAccount(String botAccount) { this.botAccount = botAccount; } public boolean isReloading() { return reloading; } public void setReloading(boolean reloading) { this.reloading = reloading; } public Map getInfoPoint() { return infoPoint; } public void setInfoPoint(Map infoPoint) { this.infoPoint = infoPoint; } public GameEnv getGameEnv() { return gameEnv; } public void setGameEnv(GameEnv gameEnv) { this.gameEnv = gameEnv; } public ChatCache3(String chatKey, GameEnv gameEnv, Map infoPoint) { this.chatKey = chatKey; this.gameEnv = gameEnv; this.infoPoint = infoPoint; } @Override public void destroy() throws IOException { } public ChatCache3(UserInfo userInfo) throws Exception { try { gameEnv = new GameEnv(userInfo.botAccount); } catch (Exception e) { System.out.println("游戏平台初始化失败"); e.printStackTrace(); } String k; this.botAccount = userInfo.botAccount; infoPoint = new HashMap(); Iterator iit = userInfo.varInitialMap.keySet().iterator(); while (iit.hasNext()) { k = iit.next(); infoPoint.put(k, userInfo.varInitialMap.get(k)); } infoPoint.put("lastUpdateTime", String.valueOf(System.currentTimeMillis())); } }