package com.gingersoft.supply_chain.mvp.utils;

import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.jess.arms.mvp.IView;

/**
 * @author 宇航.
 * User: admin
 * Date: 2021/1/8
 * Time: 12:22
 * Use:
 */
public class ResultUtils {

    public static boolean isSuccess(BaseResult baseResult, String msg, IView view) {
        if (baseResult.isSuccess()) {
            return true;
        } else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
            view.showMessage(baseResult.getErrMsg());
            return false;
        } else {
            view.showMessage(msg);
            return false;
        }
    }
}
