iff-d35ba34bac8a77dd765e7845cba4f33a581e1d05L35">35 47
             timer.cancel();
36 48
         }
@@ -61,17 +73,31 @@ public class BriefsPresenter implements BriefsContract.Presenter,BaseInteractor.
61 73
     }
62 74
 
63 75
     private String getNextOrderMessage(){
76
+        currentMsg = null;
64 77
         if(briefsBean == null || briefsBean.msgList==null || briefsBean.msgList.size()==0){
65 78
             return NULL_STR;
66 79
         }
67
-        return briefsBean.msgList.get(new Random().nextInt(briefsBean.msgList.size())).content;
80
+        currentMsg =  briefsBean.msgList.get(new Random().nextInt(briefsBean.msgList.size()));
81
+        currentMsg.content = formatOrderContent(currentMsg);
82
+        return currentMsg.content;
83
+    }
84
+
85
+    private String formatOrderContent(MessageBean messageBean){
86
+        return App.getAppContext().getString(R.string.customer_bought_photo_money,
87
+                new java.text.DecimalFormat("#.00").format(messageBean.totalFee*1.0f/100));
68 88
     }
69 89
 
70 90
     private String getNextSystemMessage(){
91
+        currentSystemMsg = null;
71 92
         if(briefsBean == null || briefsBean.systemMsgList==null || briefsBean.systemMsgList.size()==0){
72 93
             return NULL_STR;
73 94
         }
74
-        return briefsBean.systemMsgList.get(new Random().nextInt(briefsBean.systemMsgList.size())).content;
95
+        currentSystemMsg = briefsBean.systemMsgList.get(new Random().nextInt(briefsBean.systemMsgList.size()));
96
+        return currentSystemMsg.content;
75 97
     }
76 98
 
99
+    @Override
100
+    public void onBoxStatusFetched(String boxNo, String boxStatus, String boxStatusCode) {
101
+        briefsView.updateBoxInfo(boxNo,boxStatus+"("+boxStatusCode+")");
102
+    }
77 103
 }

+ 63 - 1
app/src/main/java/ai/pai/lensman/main/QueryBoxStatusInteractor.java

@@ -1,18 +1,80 @@
1 1
 package ai.pai.lensman.main;
2 2
 
3 3
 
4
+import android.os.AsyncTask;
5
+
6
+import com.android.common.executors.ThreadExecutor;
7
+
8
+import org.json.JSONObject;
9
+
4 10
 import ai.pai.lensman.base.BaseInteractor;
11
+import ai.pai.lensman.utils.BoxUrlContainer;
12
+import ai.pai.lensman.utils.HttpPostTask;
5 13
 
6 14
 public class QueryBoxStatusInteractor  implements BaseInteractor{
15
+    
16
+    private HttpPostTask queryBoxTask;
17
+    private BoxStatusListener listener;
18
+
19
+    public QueryBoxStatusInteractor(BoxStatusListener listener){
20
+        this.listener = listener;
21
+    }
7 22
 
8 23
     @Override
9 24
     public void startJob() {
25
+        cancelJob();
26
+        queryBoxTask = new HttpPostTask(null){
10 27
 
28
+            String boxStatusNum;
29
+            String boxStatusMsg;
30
+            String boxNo;
31
+            @Override
32
+            protected boolean parseResponse(String response) {
33
+                try{
34
+                    JSONObject json = new JSONObject(response);
35
+                    int status = json.getInt("status");
36
+                    if(status == 200){
37
+                        boxNo = json.getString("no.");
38
+                        JSONObject boxStatus = json.getJSONObject("status");
39
+                        boxStatusMsg = boxStatus.getString("msg");
40
+                        boxStatusNum = boxStatus.getString("code");
41
+                        return true;
42
+                    }
43
+                }catch (Exception e){
44
+                    e.printStackTrace();
45
+                }
46
+                return false;
47
+            }
48
+
49
+            @Override
50
+            protected void onPostFail() {
51
+                super.onPostFail();
52
+            }
53
+
54
+            @Override
55
+            protected void onPostSuccess() {
56
+                super.onPostSuccess();
57
+                if(listener!=null){
58
+                    listener.onBoxStatusFetched(boxNo,boxStatusMsg,boxStatusNum);
59
+                }
60
+            }
61
+        };
62
+        queryBoxTask.executeOnExecutor(ThreadExecutor.getInstance().getExecutor(), BoxUrlContainer.BOX_INFO_URL);
11 63
     }
12 64
 
13 65
     @Override
14 66
     public void cancelJob() {
15
-
67
+        if(queryBoxTask==null){
68
+            return;
69
+        }
70
+        if(queryBoxTask.getStatus()== AsyncTask.Status.RUNNING){
71
+            queryBoxTask.cancel(true);
72
+        }
73
+        queryBoxTask = null;
16 74
     }
17 75
 
76
+    public interface BoxStatusListener{
77
+
78
+        void onBoxStatusFetched(String boxNo, String boxStatus, String boxStatusCode);
79
+    }
18 80
 }

+ 3 - 0
app/src/main/java/ai/pai/lensman/utils/BoxUrlContainer.java

@@ -23,6 +23,7 @@ public class BoxUrlContainer {
23 23
      */
24 24
     public static String FETCH_ORIGIN_URL = BASE_URL +"fetch_origin";
25 25
 
26
+    public static String BOX_INFO_URL = BASE_URL+"box_info";
26 27
 
27 28
 
28 29
     public static void resetIPHost(String ip) {
@@ -41,6 +42,8 @@ public class BoxUrlContainer {
41 42
         PHOTO_PATH_PREFIX_URL = BASE_URL + "static/";
42 43
 
43 44
         FETCH_ORIGIN_URL = BASE_URL +"fetch_origin";
45
+
46
+        BOX_INFO_URL = BASE_URL+"box_info";
44 47
     }
45 48
 
46 49
 

+ 12 - 1
app/src/main/java/ai/pai/lensman/utils/UrlContainer.java

@@ -51,8 +51,19 @@ public class UrlContainer {
51 51
      */
52 52
     public static final String ORIGIN_PHOTO_UPLOAD_URL = HOST_URL+"l/origin_upload";
53 53
 
54
-
54
+    /**
55
+     * user_id  # 用户唯一标识
56
+     feedback  # 反馈内容,数据库 text 类型存储
57
+     src  # 用户反馈来源,0 拍爱用户端,1 拍爱摄影师端,不传默认 0
58
+     */
55 59
     public static final String FEEDBACK_URL = HOST_URL +"op/feedback";
56 60
 
61
+    /**
62
+     * user_id  # 用户唯一标识
63
+     nomark  # 无水印价格(单位:分)
64
+     origin  # 高清图价格(单位:分)
65
+     */
66
+    public static final String PRICE_FIX_URL = HOST_URL+"l/price_fix";
67
+
57 68
 
58 69
 }

+ 2 - 0
app/src/main/res/values/strings.xml

@@ -142,4 +142,6 @@
142 142
 
143 143
     <string name="check_update_processing">正在检查更新</string>
144 144
 
145
+    <string name="customer_bought_photo_money">用户 ¥%s 购买了高清图</string>
146
+
145 147
 </resources>

+ 1 - 1
build.gradle

@@ -5,7 +5,7 @@ buildscript {
5 5
         jcenter()
6 6
     }
7 7
     dependencies {
8
-        classpath 'com.android.tools.build:gradle:2.1.3'
8
+        classpath 'com.android.tools.build:gradle:2.2.0-rc2'
9 9
         classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
10 10
         // NOTE: Do not place your application dependencies here; they belong
11 11
         // in the individual module build.gradle files

adminSystem - Gogs: Go Git Service

説明なし

package.json 1.8KB

    { "_from": "http-parser-js@>=0.4.0", "_id": "http-parser-js@0.4.11", "_inBundle": false, "_integrity": "sha1-W3IIScZQkDwn5SFjPZRpbulfNSk=", "_location": "/http-parser-js", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "http-parser-js@>=0.4.0", "name": "http-parser-js", "escapedName": "http-parser-js", "rawSpec": ">=0.4.0", "saveSpec": null, "fetchSpec": ">=0.4.0" }, "_requiredBy": [ "/websocket-driver" ], "_resolved": "http://registry.npm.taobao.org/http-parser-js/download/http-parser-js-0.4.11.tgz", "_shasum": "5b720849c650903c27e521633d94696ee95f3529", "_spec": "http-parser-js@>=0.4.0", "_where": "/Users/FFIB/Desktop/data_visualization/node_modules/websocket-driver", "author": { "name": "Tim Caswell", "url": "https://github.com/creationix" }, "bugs": { "url": "https://github.com/creationix/http-parser-js/issues" }, "bundleDependencies": false, "contributors": [ { "name": "Jimb Esser", "url": "https://github.com/Jimbly" }, { "name": "Lawrence Rowe", "url": "https://github.com/lrowe" }, { "name": "Jan Schär", "url": "https://github.com/jscissr" }, { "name": "Paul Rütter", "url": "https://github.com/paulrutter" } ], "deprecated": false, "description": "A pure JS HTTP parser for node.", "files": [ "http-parser.js" ], "homepage": "https://github.com/creationix/http-parser-js#readme", "keywords": [ "http" ], "license": "MIT", "main": "http-parser.js", "name": "http-parser-js", "repository": { "type": "git", "url": "git://github.com/creationix/http-parser-js.git" }, "scripts": { "test": "python tests/test.py && node tests/iojs/test-http-parser-durability.js" }, "version": "0.4.11" }