|
|
@ -6,10 +6,8 @@ import com.fr.design.dialog.UIDialog; |
|
|
|
import com.fr.design.extra.ucenter.Client; |
|
|
|
import com.fr.design.extra.ucenter.Client; |
|
|
|
import com.fr.design.extra.ucenter.XMLHelper; |
|
|
|
import com.fr.design.extra.ucenter.XMLHelper; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
|
|
|
import com.fr.general.SiteCenter; |
|
|
|
import com.fr.general.SiteCenter; |
|
|
|
import com.fr.general.http.HttpClient; |
|
|
|
import com.fr.general.http.HttpClient; |
|
|
|
import com.fr.json.JSONObject; |
|
|
|
|
|
|
|
import com.fr.stable.EncodeConstants; |
|
|
|
import com.fr.stable.EncodeConstants; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import javafx.scene.web.WebEngine; |
|
|
|
import javafx.scene.web.WebEngine; |
|
|
@ -19,7 +17,6 @@ import java.awt.*; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.net.URI; |
|
|
|
import java.net.URI; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.LinkedList; |
|
|
|
import java.util.LinkedList; |
|
|
|
|
|
|
|
|
|
|
|
public class LoginWebBridge { |
|
|
|
public class LoginWebBridge { |
|
|
@ -122,41 +119,6 @@ public class LoginWebBridge { |
|
|
|
return client.isServerAlive(); |
|
|
|
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<String, String> 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(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 设置获取的消息长度,并设置显示 |
|
|
|
* 设置获取的消息长度,并设置显示 |
|
|
|
* |
|
|
|
* |
|
|
|