admin
2021-05-08 f93ff67ed4681f416a653370aa1e7995a56940ef
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
package com.tejia.lijin.app.ui.gold.model;
 
import android.content.Context;
 
import com.tejia.lijin.app.BasicTextHttpResponseHandler;
import com.tejia.lijin.app.ShoppingApi;
import com.tejia.lijin.app.ui.gold.contract.GoldExchangeContract;
 
import org.apache.http.Header;
import org.json.JSONObject;
 
/**
 * 金币兑换Model,进行网络请求
 */
public class GoldExchangeModel {
    /*
       金币兑换列表数据获取
        */
    public void getGoldExchangeList(Context context, String uid, int page, final GoldExchangeContract.goldExchangeListCallback callback) {
        ShoppingApi.getExchangeList(context, uid, page + "", new BasicTextHttpResponseHandler() {
            @Override
            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
                super.onSuccessPerfect(statusCode, headers, jsonObject);
                callback.onSuccess(jsonObject);
            }
 
            @Override
            public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) {
                super.onFailure(statusCode, headers, jsonObject, e);
                callback.onFailure(jsonObject);
            }
        });
    }
 
    /*
       金币兑换验证
        */
    public void goExchangeGoodsVerify(Context context, String uid, String id, final GoldExchangeContract.goldExchangeListCallback callback) {
        ShoppingApi.goExchangeGoodsVerify(context, uid, id, new BasicTextHttpResponseHandler() {
            @Override
            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
                super.onSuccessPerfect(statusCode, headers, jsonObject);
                callback.onSuccess(jsonObject);
            }
 
            @Override
            public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) {
                super.onFailure(statusCode, headers, jsonObject, e);
                callback.onFailure(jsonObject);
            }
        });
    }
 
    /*
       金币兑换物品
        */
    public void goExchangeGoods(Context context, String uid, String id, final GoldExchangeContract.goldExchangeListCallback callback) {
        ShoppingApi.goExchangeGoods(context, uid, id, new BasicTextHttpResponseHandler() {
            @Override
            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
                super.onSuccessPerfect(statusCode, headers, jsonObject);
                callback.onSuccess(jsonObject);
            }
 
            @Override
            public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) {
                super.onFailure(statusCode, headers, jsonObject, e);
                callback.onFailure(jsonObject);
            }
        });
    }
}