@Override
public void updateUserInfo(BriefsBean bean) {
-
+ uploadPhotoNumText.setText(String.valueOf(bean.todayUpload));
+ captureNumText.setText(String.valueOf(bean.todayUpload));
+ averageMoneyText.setText(String.valueOf(bean.avgIncome));
+ todayIncomingText.setText(String.valueOf(bean.todayIncome));
+ totalIncomingText.setText(String.valueOf(bean.todayIncome));
+ todayCaptureHoursText.setText(String.valueOf(bean.todayUpload));
}
}
@@ -3,13 +3,19 @@ package ai.pai.lensman.briefs; |
||
3 | 3 |
import android.os.AsyncTask; |
4 | 4 |
|
5 | 5 |
import com.android.common.executors.ThreadExecutor; |
6 |
+import com.android.common.utils.JSONParseUtils; |
|
6 | 7 |
|
8 |
+import org.json.JSONArray; |
|
7 | 9 |
import org.json.JSONObject; |
8 | 10 |
|
11 |
+import java.util.ArrayList; |
|
9 | 12 |
import java.util.HashMap; |
10 | 13 |
|
11 | 14 |
import ai.pai.lensman.base.BaseInteractor; |
12 | 15 |
import ai.pai.lensman.bean.BriefsBean; |
16 |
+import ai.pai.lensman.bean.GroupPhotoItem; |
|
17 |
+import ai.pai.lensman.bean.MessageBean; |
|
18 |
+import ai.pai.lensman.bean.SystemMessageBean; |
|
13 | 19 |
import ai.pai.lensman.db.Preferences; |
14 | 20 |
import ai.pai.lensman.utils.HttpPostTask; |
15 | 21 |
import ai.pai.lensman.utils.UrlContainer; |
@@ -42,7 +48,46 @@ public class BriefsInteractor implements BaseInteractor { |
||
42 | 48 |
JSONObject json = new JSONObject(response); |
43 | 49 |
int status = json.getInt("status"); |
44 | 50 |
if(status == 200){ |
51 |
+ JSONObject data = json.getJSONObject("data"); |
|
45 | 52 |
bean = new BriefsBean(); |
53 |
+ bean.avgIncome =(float)data.getDouble("avg_income"); |
|
54 |
+ bean.todayIncome = (float)data.getDouble("today_income"); |
|
55 |
+ bean.todayUpload = data.getInt("today_upload"); |
|
56 |
+ JSONObject msgObj = data.getJSONObject("messages"); |
|
57 |
+ JSONArray systemMsgArray = msgObj.getJSONArray("system"); |
|
58 |
+ |
|
59 |
+ if(systemMsgArray!=null && systemMsgArray.length()>0){ |
|
60 |
+ ArrayList<SystemMessageBean> systemMsgList = new ArrayList<>(); |
|
61 |
+ for(int k = 0 ;k<systemMsgArray.length();k++){ |
|
62 |
+ JSONObject systemMsgObj = systemMsgArray.getJSONObject(k); |
|
63 |
+ SystemMessageBean bean = new SystemMessageBean(); |
|
64 |
+ bean.content = JSONParseUtils.getJSONString(systemMsgObj.getString("content")); |
|
65 |
+ bean.isRead = systemMsgObj.getBoolean("read"); |
|
66 |
+ bean.url = JSONParseUtils.getJSONString(systemMsgObj.getString("url")); |
|
67 |
+ bean.msgId =JSONParseUtils.getJSONString(systemMsgObj.getString("pk")); |
|
68 |
+ bean.title = JSONParseUtils.getJSONString(systemMsgObj.getString("title")); |
|
69 |
+ systemMsgList.add(bean); |
|
70 |
+ } |
|
71 |
+ bean.systemMsgList = systemMsgList; |
|
72 |
+ } |
|
73 |
+ JSONArray msgArray = msgObj.getJSONArray("orders"); |
|
74 |
+ if(msgArray!=null && msgArray.length()>0){ |
|
75 |
+ ArrayList<MessageBean> msgList = new ArrayList<>(); |
|
76 |
+ for(int count = 0; count<msgArray.length();count++){ |
|
77 |
+ JSONObject childMsg = msgArray.getJSONObject(count); |
|
78 |
+ MessageBean childBean = new MessageBean(); |
|
79 |
+ childBean.createTime = JSONParseUtils.getJSONString(childMsg.getString("created_at")); |
|
80 |
+ childBean.isRead = childMsg.getBoolean("read"); |
|
81 |
+ childBean.msgId = childMsg.getString("pk"); |
|
82 |
+ childBean.senderName = JSONParseUtils.getJSONString(childMsg.getString("from_nickname")); |
|
83 |
+ childBean.senderAvatarUrl = JSONParseUtils.getJSONString(childMsg.getString("from_avatar")); |
|
84 |
+ childBean.content = JSONParseUtils.getJSONString(childMsg.getString("msg_content")); |
|
85 |
+ JSONObject photoObj = childMsg.getJSONObject("group_photo_info"); |
|
86 |
+ childBean.photoItem = GroupPhotoItem.parseFromJSON(photoObj); |
|
87 |
+ msgList.add(childBean); |
|
88 |
+ } |
|
89 |
+ bean.msgList = msgList; |
|
90 |
+ } |
|
46 | 91 |
return true; |
47 | 92 |
}else{ |
48 | 93 |
message = json.getString("message"); |
@@ -65,7 +110,7 @@ public class BriefsInteractor implements BaseInteractor { |
||
65 | 110 |
listener.onInteractSuccess(bean); |
66 | 111 |
} |
67 | 112 |
}; |
68 |
- fetchInfoTask.executeOnExecutor(ThreadExecutor.getInstance().getExecutor(), UrlContainer.SESSION_IDS_CREATE); |
|
113 |
+ fetchInfoTask.executeOnExecutor(ThreadExecutor.getInstance().getExecutor(), UrlContainer.BRIEFS_URL); |
|
69 | 114 |
} |
70 | 115 |
|
71 | 116 |
@Override |
@@ -35,6 +35,8 @@ public class UrlContainer { |
||
35 | 35 |
*/ |
36 | 36 |
public static final String WX_LOGIN_URL = HOST_URL+"l/wx/authorize"; |
37 | 37 |
|
38 |
+ public static final String BRIEFS_URL = HOST_URL+"l/brief"; |
|
39 |
+ |
|
38 | 40 |
|
39 | 41 |
|
40 | 42 |
} |
@@ -34,7 +34,6 @@ |
||
34 | 34 |
android:gravity="center" |
35 | 35 |
android:paddingLeft="10dp" |
36 | 36 |
android:paddingRight="10dp" |
37 |
- android:singleLine="true" |
|
38 | 37 |
android:text="@string/settings" |
39 | 38 |
android:textColor="@color/text_white" |
40 | 39 |
android:textSize="@dimen/action_bar_title_medium_text_size" /> |
@@ -59,5 +58,19 @@ |
||
59 | 58 |
|
60 | 59 |
</LinearLayout> |
61 | 60 |
|
61 |
+ <ScrollView |
|
62 |
+ android:layout_below="@id/title_bar_with_back_btn" |
|
63 |
+ android:layout_width="match_parent" |
|
64 |
+ android:layout_height="match_parent"> |
|
65 |
+ |
|
66 |
+ <LinearLayout |
|
67 |
+ android:layout_width="match_parent" |
|
68 |
+ android:layout_height="wrap_content" |
|
69 |
+ android:orientation="vertical"> |
|
70 |
+ |
|
71 |
+ |
|
72 |
+ </LinearLayout> |
|
73 |
+ </ScrollView> |
|
74 |
+ |
|
62 | 75 |
|
63 | 76 |
</RelativeLayout> |