From 6774ed2d4f107734b3dbf9bf9dea3fab6851bd8c Mon Sep 17 00:00:00 2001 From: neil Date: Thu, 1 Jun 2017 15:12:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C=20?= =?UTF-8?q?=E8=AE=BA=E5=9D=9B=E6=B6=88=E6=81=AF=E5=B1=8F=E8=94=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/bbs/UserInfoLabel.java | 34 ----------------- .../com/fr/design/extra/LoginWebBridge.java | 38 ------------------- 2 files changed, 72 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java index 90d84059b..c671f0fdc 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 5a23734fc..de0be5c91 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(); - } - /** * 设置获取的消息长度,并设置显示 *