|
|
@ -115,49 +115,9 @@ public class LoginWebBridge { |
|
|
|
if(StringUtils.isEmpty(userName)){ |
|
|
|
if(StringUtils.isEmpty(userName)){ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if(!StringUtils.isEmpty(this.userName)){ |
|
|
|
|
|
|
|
updateMessageCount(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.userName = userName; |
|
|
|
this.userName = userName; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 定时取后台论坛消息 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
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 (res.equals(FAILED_MESSAGE_STATUS)) { |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
JSONObject jo = new JSONObject(res); |
|
|
|
|
|
|
|
if (jo.getString("status").equals(SUCCESS_MESSAGE_STATUS)) { |
|
|
|
|
|
|
|
setMessageCount(Integer.parseInt(jo.getString("message"))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
FRContext.getLogger().info(e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
sleep(CHECK_MESSAGE_TIME); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
updateMessageThread.start(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 设置获取的消息长度,并设置显示 |
|
|
|
* 设置获取的消息长度,并设置显示 |
|
|
|
* @param count |
|
|
|
* @param count |
|
|
|