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
|
}
|
|
|
@@ -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
|
|
|
|
@@ -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
|
}
|
|
|
@@ -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>
|
|
|
@@ -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
|