diff --git a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java index 90d84059b3..c671f0fdcd 100644 --- a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java +++ b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java @@ -30,7 +30,6 @@ import java.net.URI; import java.net.URLEncoder; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.HashMap; /** * @author neil @@ -191,44 +190,11 @@ public class UserInfoLabel extends UILabel { return; } - if (StringUtils.isEmpty(this.userName)) { - updateMessageCount(); - } //往designerenvmanger里写一下 DesignerEnvManager.getEnvManager().setBBSName(userName); this.userName = userName; } - private void updateMessageCount() { - //启动获取消息更新的线程 - //登陆状态, 根据存起来的用户名密码, 每1分钟发起一次请求, 更新消息条数. - Thread updateMessageThread = new Thread(new Runnable() { - - @Override - public void run() { - sleep(CHECK_MESSAGE_TIME); - //从env中获取username, 因为如果注销的话, env的里username会被清空. - while (StringUtils.isNotEmpty(DesignerEnvManager.getEnvManager().getBBSName())) { - HashMap para = new HashMap(); - para.put("username", encode(encode(userName))); - HttpClient getMessage = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.message"), para); - getMessage.asGet(); - if (getMessage.isServerAlive()) { - try { - String res = getMessage.getResponseText(); - if (StringUtils.isNotEmpty(res)) { - setMessageCount(Integer.parseInt(res)); - } - } catch (Exception e) { - } - } - sleep(CHECK_MESSAGE_TIME); - } - } - }); - updateMessageThread.start(); - } - private String encode(String str) { try { return URLEncoder.encode(str, EncodeConstants.ENCODING_UTF_8); diff --git a/designer_base/src/com/fr/design/extra/LoginWebBridge.java b/designer_base/src/com/fr/design/extra/LoginWebBridge.java index 5a23734fcc..de0be5c91d 100644 --- a/designer_base/src/com/fr/design/extra/LoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/LoginWebBridge.java @@ -6,10 +6,8 @@ import com.fr.design.dialog.UIDialog; import com.fr.design.extra.ucenter.Client; import com.fr.design.extra.ucenter.XMLHelper; import com.fr.design.gui.ilable.UILabel; -import com.fr.general.ComparatorUtils; import com.fr.general.SiteCenter; import com.fr.general.http.HttpClient; -import com.fr.json.JSONObject; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; import javafx.scene.web.WebEngine; @@ -19,7 +17,6 @@ import java.awt.*; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URLEncoder; -import java.util.HashMap; import java.util.LinkedList; public class LoginWebBridge { @@ -122,41 +119,6 @@ public class LoginWebBridge { return client.isServerAlive(); } - /** - * 定时取后台论坛消息 - */ - public void updateMessageCount() { - //启动获取消息更新的线程 - //登陆状态, 根据存起来的用户名密码, 每1分钟发起一次请求, 更新消息条数. - Thread updateMessageThread = new Thread(new Runnable() { - @Override - public void run() { - sleep(CHECK_MESSAGE_TIME); - while (StringUtils.isNotEmpty(DesignerEnvManager.getEnvManager().getBBSName())) { - HashMap para = new HashMap<>(); - int uid = DesignerEnvManager.getEnvManager().getBbsUid(); - para.put("uid", String.valueOf(uid)); - HttpClient getMessage = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.message"), para); - getMessage.asGet(); - if (getMessage.isServerAlive()) { - try { - String res = getMessage.getResponseText(); - if (!ComparatorUtils.equals(res, FAILED_MESSAGE_STATUS)) { - JSONObject jo = new JSONObject(res); - if (SUCCESS_MESSAGE_STATUS.equals(jo.optString("status"))) { - setMessageCount(Integer.parseInt(jo.getString("message"))); - } - } - } catch (Exception ignore) { - } - } - sleep(CHECK_MESSAGE_TIME); - } - } - }); - updateMessageThread.start(); - } - /** * 设置获取的消息长度,并设置显示 *