package com.rv.share.fragment;

import android.os.Bundle;
import android.text.TextUtils;

import com.frame.rv.config.RvFrameConfig;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseFragment;
import com.rv.home.rv.module.ApiConfig;
import com.rv.home.rv.module.basic.presenter.CommonPresenter;
import com.rv.share.R;
import com.rv.share.bean.IncomeRecordsBean;
import com.yuyife.okgo.OkGoUtil;

import java.util.HashMap;
import java.util.Map;

public class InComeRecordFragment extends BaseFragment<CommonPresenter> {

    public static InComeRecordFragment getInstance() {
        InComeRecordFragment fragment = new InComeRecordFragment();
        return fragment;
    }

    @Override
    public int getViewLayout() {
        return R.layout.fragment_income_record;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {

    }

    @Override
    protected void loadData(Bundle savedInstanceState) {

        getIncomeData();

    }

    private void getIncomeData() {
        if (!TextUtils.isEmpty(OkGoUtil.getToken())) {
            Map<String, Object> header = new HashMap<>();
            header.put("Authorization", OkGoUtil.getToken());

            Map<String, Object> map = new HashMap<>();
            map.put("code", "0101");
            mPresenter.getData(RvFrameConfig.HOST, 0, ApiConfig.HTTP_URL_INCOME_RECORD, IncomeRecordsBean.class, map, header, true);
        }
    }

    @Override
    public void onShowResult(int requestType, BaseBean result) {
        if (requestType == 0) {
            IncomeRecordsBean bean = (IncomeRecordsBean) result;
            if (bean.isRel() && bean.getData() != null) {

            }
        }

    }
}
