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);
|
}
|
});
|
}
|
}
|