Android_tadlayout来展示订单

来源:互联网 发布:matlab向量化编程 编辑:程序博客网 时间:2024/05/24 02:16

先将获取到的信息传到订单当中
model层

public class IndentModel {    private HashMap<String, String> map = new HashMap<>();    public void verifyIndentCarInfo(int uid,Double price, final IIndentPreasenter iIndentPresenter){        map.put("uid",uid+"");        map.put("price",price+"");        OkHttpUtils.getInstance().doPost("http://120.27.23.105/product/createOrder", map, new CallBack() {            @Override            public void onFailed(String msg) {                iIndentPresenter.onFailed("请求失败");            }            @Override            public void onSuccess(String request) {                try {                    JSONObject object = new JSONObject(request);                    String code = object.optString("code");                    String msg = object.optString("msg");                    if ("0".equals(code)){                        iIndentPresenter.onSuccess(msg);                    }else {                        iIndentPresenter.onFailed(msg);                    }                } catch (JSONException e) {                    e.printStackTrace();                }            }        });    }}

接口

public interface IIndentPreasenter {    void onSuccess(String msg);    void onFailed(String msg);}public interface IIndentView {    void onSuccess(String msg);    void onFailed(String msg);}

presenter层

public class IndentPresenter implements IIndentPreasenter{    private IIndentView iIndentView;    private IndentModel indentModel;    public IndentPresenter(IIndentView iIndentView){        this.iIndentView = iIndentView;        indentModel = new IndentModel();    }    //执行集合信息    public void excuteIndentData(int uid,double price){        //传到model        indentModel.verifyIndentCarInfo(uid,price,this);    }    @Override    public void onSuccess(String msg) {        iIndentView.onSuccess(msg);    }    @Override    public void onFailed(String msg) {        iIndentView.onFailed(msg);    }}