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