package com.danding.yang800.Presenter;

import android.content.Context;
import android.content.SharedPreferences;

import com.danding.yang800.General.HttpCallBack;
import com.danding.yang800.GiftInfoActivity;
import com.danding.yang800.MentorActivity;
import com.danding.yang800.Util.StringUtil;
import com.danding.yang800.Util.VolleyUtil;
import com.danding.yang800.Vo.GiftInfoVO;
import com.google.gson.Gson;

import org.json.JSONObject;

import java.text.DecimalFormat;
import java.util.HashMap;

public class MentorActivityPresenter {
    private MentorActivity context;
    SharedPreferences sp;

    public MentorActivityPresenter(MentorActivity context) {
        sp = context.getSharedPreferences("variable", Context.MODE_PRIVATE);
        this.context = context;
    }

    public void getInfo(String storeId) {
        context.initDialog();
        HashMap<String, String> map = new HashMap<>();
        map.put("storeId", storeId);
        new VolleyUtil(context).request(context, "store.guildImg", true, map, new HttpCallBack() {
            @Override
            public void onSuccess(JSONObject json) {
                try {
                    String result=StringUtil.toString(json.getString("result"));
                    context.update(result);
                } catch (Exception e) {
                    context.dismissDialog();
                }

            }

            @Override
            public void onerrSuccess() {
                context.dismissDialog();
            }

            @Override
            public void onCatch() {

            }

            @Override
            public void onFail() {
                context.dismissDialog();
            }
        });
    }


}
