admin
2022-01-12 4a7367a869ef12375ea6678ca44e102b8919c624
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package cn.jpush.api.report;
 
import cn.jiguang.common.resp.BaseResult;
import cn.jiguang.common.resp.ResponseWrapper;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.annotations.Expose;
import com.google.gson.reflect.TypeToken;
 
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
 
public class GroupMessageDetailResult extends BaseResult {
 
    // what is this?
    private static final Type JSON_OBJECT_TYPE = new TypeToken<List<JsonObject>>() {}.getType();
    private static final Type RECEIVED_TYPE = new TypeToken<List<Received>>() {}.getType();
 
    @Expose
    public List<Received> received_list = new ArrayList<>();
 
    public static class Received {
        @Expose
        public String group_msgids;
        @Expose
        public JpushDetail jpush;
        @Expose
        public JsonObject android_pns;
        @Expose
        public IosDetail ios;
        @Expose
        public WinphoeDetail winphone;
    }
 
    public static class JpushDetail {
        @Expose
        public long target;
        @Expose
        public int online_push;
        @Expose
        public int received;
        @Expose
        public int click;
        @Expose
        public int msg_click;
    }
 
    public static class WinphoeDetail {
        @Expose
        public long mpns_target;
        @Expose
        public int mpns_sent;
        @Expose
        public int click;
    }
 
    public static class IosDetail {
        @Expose
        public long apns_target;
        @Expose
        public int apns_sent;
        @Expose
        public int apns_received;
        @Expose
        public int apns_click;
        @Expose
        public int msg_target;
        @Expose
        public int msg_received;
    }
 
 
    static GroupMessageDetailResult fromResponse(ResponseWrapper responseWrapper) {
        GroupMessageDetailResult result = new GroupMessageDetailResult();
        if (responseWrapper.isServerResponse()) {
            List<JsonObject> tempList = _gson.fromJson(responseWrapper.responseContent, JSON_OBJECT_TYPE);
            for (JsonObject jsonObject : tempList) {
                if (jsonObject.isJsonNull() || jsonObject.get("android_pns").isJsonNull()) {
                    continue;
                }
                Received received = _gson.fromJson(jsonObject, Received.class);
                result.received_list.add(received);
            }
        }
 
        result.setResponseWrapper(responseWrapper);
        return result;
    }
}