1.获取邮件列表
LeyoEmail.getInstance().getEmailInfo(activity, new LeyoEmailInfoCallback() {
@Override
public void onSuccess(String emailInfo) {
try {
JSONArray dataArray = new JSONArray(emailInfo);
for (int i = 0; i < dataArray.length(); i++) {
JSONObject dataJSON = (JSONObject) dataArray.get(i);
int id = dataJSON.getInt("id");
int template_id= dataJSON.getInt("template_id");
String title = dataJSON.getString("title");
String content = dataJSON.getString("content");
int is_read = dataJSON.getInt("is_read");
int is_receive = dataJSON.getInt("is_receive");
String create_date = dataJSON.getString("create_date");
JSONArray award_prop_array = new JSONArray(dataJSON.getString("award_prop"));
for (int j = 0; j < award_prop_array.length(); j++) {
JSONObject award_prop_data = (JSONObject) award_prop_array.get(j);
String productId = award_prop_data.getString("productId");
String productName = award_prop_data.getString("productName");
String num = award_prop_data.getString("num");
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailed(String msg) {
}
});
参数说明:
字段名称 | 类型 | 说明 |
---|---|---|
activity | Activity | Activity上下文对象 |
callback | LeyoEmailInfoCallback | 邮件列表回调 |
邮件列表内容格式:
[
{
"id":4,
"template_id":0,
"title":"",
"content":"",
"award_prop":"[{\"productId\":\"1001\",\"productName\":\"\\u94bb\\u77f3100\",\"num\":\"11\"},{\"productId\":\"1002\",\"productName\":\"\\u94bb\\u77f3200\",\"num\":\"22\"}]",
"is_read":1,
"is_receive":1,
"create_date":"2023-11-09 14:19:36"
}
]