|
@ -11,6 +11,7 @@ import java.security.cert.CertificateException;
|
11
|
11
|
import java.security.cert.X509Certificate;
|
12
|
12
|
import java.util.HashMap;
|
13
|
13
|
import java.util.Map;
|
|
14
|
import java.util.Random;
|
14
|
15
|
import java.util.UUID;
|
15
|
16
|
import java.util.concurrent.ConcurrentHashMap;
|
16
|
17
|
|
|
@ -247,7 +248,17 @@ public class PushService {
|
247
|
248
|
@Get
|
248
|
249
|
@Path("/token")
|
249
|
250
|
public String getToken(){
|
250
|
|
return this.token;
|
|
251
|
String ret = this.token;
|
|
252
|
if(ret!=null){
|
|
253
|
int len = ret.length();
|
|
254
|
Random random = new Random();
|
|
255
|
int idx = random.nextInt(len-1);
|
|
256
|
if(idx<1 || idx >=len){
|
|
257
|
return ret;
|
|
258
|
}
|
|
259
|
return ret.substring(idx)+ret.substring(0,idx)+"_"+idx;
|
|
260
|
}
|
|
261
|
return null;
|
251
|
262
|
}
|
252
|
263
|
|
253
|
264
|
@Path("/bindTags")
|
|
@ -429,9 +440,9 @@ public class PushService {
|
429
|
440
|
Map<String,Object> androidMessage = this.createAndriodMessage(title, content, pl_str);
|
430
|
441
|
Map<String,Object> iosMessage = this.createIosMessage(title, content, pl_str);
|
431
|
442
|
androidMessage.put("requestid",this.allocateRequesstId());
|
432
|
|
androidMessage.put("alias",alias);
|
|
443
|
androidMessage.put("alias","A_"+alias);
|
433
|
444
|
iosMessage.put("requestid",this.allocateRequesstId());
|
434
|
|
iosMessage.put("alias",alias);
|
|
445
|
iosMessage.put("alias","I_"+alias);
|
435
|
446
|
|
436
|
447
|
// System.out.println(JsonService.toJson(androidMessage));
|
437
|
448
|
// System.out.println(JsonService.toJson(iosMessage));
|
|
@ -536,9 +547,11 @@ public class PushService {
|
536
|
547
|
PushService s = new PushService();
|
537
|
548
|
// s.buildToken();
|
538
|
549
|
// s.checkToken();
|
539
|
|
// TOKEN_MAP.put("authtoken", "ef60d2aa2bc3193fc99a99ef43906cee70658156dfb41156acc35f7e7b7fb3dd");
|
|
550
|
TOKEN_MAP.put("authtoken", "c3bbeb7aac006871f228d48e5da846933bfd2109e1d20fac3c8c0a3f3ccebd7d");
|
540
|
551
|
long l = System.currentTimeMillis();
|
541
|
|
s.toApp("title_" + l, "content_" + l, "payload_" + l);
|
|
552
|
//s.toApp("title_" + l, "content_" + l, "payload_" + l);
|
|
553
|
s.pushWithAlias("title_" + l, "content_" + l, "payload_" + l,"A21F6D7BD4C549A1A2ABC415DE7701BD");
|
|
554
|
System.out.println(l);
|
542
|
555
|
|
543
|
556
|
// s.applyBadge(1, "f293af1f1cc043185ee9d921b63c4807", "D380AD6865B61F4D179DBB208EE3C7268A672AB9821385050596608A186F6023");
|
544
|
557
|
// for(int i = 0 ;i < 100;++i){
|