package com.tejia.lijin.app.ui.gold.presenter;
|
|
import android.content.Context;
|
|
import com.tejia.lijin.app.ShoppingApplication;
|
import com.tejia.lijin.app.ui.gold.base.BasePresenter;
|
import com.tejia.lijin.app.ui.gold.contract.GoldExchangeContract;
|
import com.tejia.lijin.app.ui.gold.model.GoldExchangeModel;
|
import com.tejia.lijin.app.util.user.UserUtil;
|
|
import org.json.JSONObject;
|
|
/**
|
* 金币兑换Presenter,数据处理
|
*/
|
public class GoldExchangePresenter extends BasePresenter<GoldExchangeContract.goldExchageInfo> {
|
|
Context mContext;
|
GoldExchangeModel model;
|
|
public GoldExchangePresenter(Context context) {
|
this.mContext = context;
|
model = new GoldExchangeModel();
|
}
|
|
/*
|
金币兑换列表数据获取
|
*/
|
public void getGoldExchangeList(Context context, int page) {
|
|
model.getGoldExchangeList(context, UserUtil.getUid(ShoppingApplication.application), page, new GoldExchangeContract.goldExchangeListCallback() {
|
@Override
|
public void onSuccess(JSONObject jsonObject) {
|
mView.get().onGainListDataSuccess(jsonObject);
|
}
|
|
@Override
|
public void onFailure(String errorStr) {
|
mView.get().onGainListDataFailure(errorStr);
|
}
|
});
|
}
|
|
/*
|
金币兑换物品验证V
|
*/
|
public void goExchangeGoodsVerify(Context context, String id) {
|
|
model.goExchangeGoodsVerify(context, UserUtil.getUid(ShoppingApplication.application), id, new GoldExchangeContract.goldExchangeListCallback() {
|
@Override
|
public void onSuccess(JSONObject jsonObject) {
|
mView.get().onGoExchangeVerifySuccess(jsonObject);
|
}
|
|
@Override
|
public void onFailure(String errorStr) {
|
mView.get().onGoExchangeVerifyFailure(errorStr);
|
}
|
});
|
}
|
|
/*
|
金币兑换物品
|
*/
|
public void goExchangeGoods(Context context, final String id) {
|
|
model.goExchangeGoods(context, UserUtil.getUid(ShoppingApplication.application), id, new GoldExchangeContract.goldExchangeListCallback() {
|
@Override
|
public void onSuccess(JSONObject jsonObject) {
|
mView.get().onGoExchangeSuccess(jsonObject, id);
|
}
|
|
@Override
|
public void onFailure(String errorStr) {
|
mView.get().onGoExchangeFailure(errorStr);
|
}
|
});
|
}
|
|
}
|