Commit ce5f3361 authored by fangzhipeng's avatar fangzhipeng

修复一些问题

parent 49b2510e
result.png

1.47 KB | W: | H:

result.png

1.48 KB | W: | H:

result.png
result.png
result.png
result.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -193,7 +193,7 @@ public class WeChat { ...@@ -193,7 +193,7 @@ public class WeChat {
Pattern pattern = Pattern.compile("retcode:\"(.*)\",selector:\"(.*)\""); Pattern pattern = Pattern.compile("retcode:\"(.*)\",selector:\"(.*)\"");
Matcher m = pattern.matcher(msg); Matcher m = pattern.matcher(msg);
m.find(); m.find();
if ("2".equals(m.group(2))) { if (!"0".equals(m.group(2))) {
receiveMsg(); receiveMsg();
} }
return m.group(1); return m.group(1);
...@@ -350,16 +350,17 @@ public class WeChat { ...@@ -350,16 +350,17 @@ public class WeChat {
break; break;
} }
} }
SYNC_TIMER.schedule(new TimerTask() { new ReceiveMsgThread().start();
@Override // SYNC_TIMER.schedule(new TimerTask() {
public void run() { // @Override
try { // public void run() {
sync(); // try {
} catch (Exception e) { // sync();
e.printStackTrace(); // } catch (Exception e) {
} // e.printStackTrace();
} // }
}, 1000, 2000); // }
// }, 1000, 2000);
} }
private void initMyAcount(JSONObject msgObject) { private void initMyAcount(JSONObject msgObject) {
...@@ -397,4 +398,17 @@ public class WeChat { ...@@ -397,4 +398,17 @@ public class WeChat {
System.out.println(m.find()); System.out.println(m.find());
} }
class ReceiveMsgThread extends Thread {
@Override
public void run() {
while (true) {
try {
sync();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment