admin
2021-05-14 1b4b3fed2569ac21ad6feb0a3a2c051175e7c36e
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
package com.tejia.lijin.app.model;
 
import android.content.Context;
 
import com.tejia.lijin.app.BasicTextHttpResponseHandler;
import com.tejia.lijin.app.ShoppingApi;
import com.tejia.lijin.app.contract.SelectionStoreHouse31Contract;
 
import org.apache.http.Header;
import org.json.JSONObject;
 
 
/**
 * 分享库 Model
 */
public class SelectionStoreHouse31Model {
    /**
     * 小黄条
     *
     * @param callBack
     */
    public void getAppPageNotification(Context mContext, String type, final SelectionStoreHouse31Contract.onStoreHouseCallBack callBack) {
        ShoppingApi.getAppPageNotification(mContext, type, new BasicTextHttpResponseHandler() {
            @Override
            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
                if (jsonObject.optString("code").equalsIgnoreCase("0")) {
                    callBack.onSuccess(jsonObject);
                }
            }
 
            @Override
            public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
                super.onFailure(statusCode, headers, responseString, throwable);
                callBack.onFail("");
            }
        });
    }
 
    /**
     * 分享库列表
     *
     * @param callBack
     */
    public void getSelectioStoreHouseList(Context mContext, String page, Long uid, String goodsType, final SelectionStoreHouse31Contract.onStoreHouseCallBack callBack) {
        ShoppingApi.getSelectioStoreHouseList(mContext, page, uid, goodsType, new BasicTextHttpResponseHandler() {
            @Override
            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
                callBack.onSuccess(jsonObject);
            }
 
            @Override
            public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
                super.onFailure(statusCode, headers, responseString, throwable);
                callBack.onFail("");
            }
        });
    }
 
    /**
     * 删除分享库商品
     *
     * @param ids 删除列表ID
     */
    public void deleteSelectStoreHouse(Context mContext, String ids, Long uid, final SelectionStoreHouse31Contract.onStoreHouseCallBack callBack) {
        ShoppingApi.deleteSelectStoreHouse(mContext, ids, uid, new BasicTextHttpResponseHandler() {
            @Override
            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
                if (jsonObject.optString("code").equalsIgnoreCase("0")) {
                    callBack.onSuccess(jsonObject);
                }
            }
 
            @Override
            public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
                super.onFailure(statusCode, headers, responseString, throwable);
                callBack.onFail(responseString + "");
            }
        });
    }
}