package com.danding.yang800.Presenter;

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

import com.danding.yang800.Fragment.MarketPlatformFrag;
import com.danding.yang800.General.HttpCallBack;
import com.danding.yang800.MaketShopInfoActivity;
import com.danding.yang800.Util.VolleyUtil;

import org.json.JSONObject;

import java.util.HashMap;

public class MarketShopInfoPresenter {
    private MaketShopInfoActivity context;
    SharedPreferences sp;

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

    public void getInfo() {
        HashMap<String, String> map = new HashMap<>();
        new VolleyUtil(context).request(context, "user.promotion.receive.info", true, map, new HttpCallBack() {
            @Override
            public void onSuccess(JSONObject json) {
                try {
//                    Gson gson = new Gson();
//                    GiftInfoVO bean = gson.fromJson(json.toString(), GiftInfoVO.class);
//                    GiftInfoVO.ResultBean result = bean.getResult();
//                    String skuName = result.getSkuName();
//                    String imageUrl = result.getImageUrl();
//                    String content = result.getContent();
//                    double marketPrice = result.getMarketPrice();
//                    String priceStr = new DecimalFormat("0.00").format(marketPrice);
//                    String priceArray[] = StringUtil.splitDouble(priceStr);
//                    String priceInt = "";
//                    String price = "";
//                    if (priceArray.length == 2) {
//                        priceInt = priceArray[0] + ".";
//                        price = priceArray[1];
//                    }
                } catch (Exception e) {

                }

            }

            @Override
            public void onerrSuccess() {

            }

            @Override
            public void onCatch() {

            }

            @Override
            public void onFail() {

            }
        });
    }


}
