package com.genlot.ninglottery.module.cash;

import android.os.Bundle;

import com.genlot.nativesdk.sender.EventToken;
import com.genlot.nativesdk.sender.TCPSender;
import com.genlot.ninglottery.base.BasePresenter;
import com.genlot.ninglottery.toolkit.LogTool;


class CashPresenter extends BasePresenter<ICashView> {

    /**
     * 兑奖
     * @param featureCode  特征码
     */
    public void t101009Cash(String featureCode) {
        getView().showLoading();
        TCPSender.t101009Cash(EventToken.T_CASH, 1, featureCode, new TCPSender.SenderCallback() {
            @Override
            public void onSenderSuccess(Bundle bundle) {
                long cashTime = bundle.getLong(EventToken.EVENT_KEY_RESULT_OBJECT);
                LogTool.logI("cashTime = " + cashTime);
                getView().onCashSuccess(cashTime);
            }

            @Override
            public void onSenderFail(int tradingCode, String message) {
                getView().dismissLoading();
                getView().showToast(message);
            }

        });
    }


}
