/// <summary> /// 设置泛型响应信息,并返回 /// </summary> /// <typeparam name="TRes"></typeparam> /// <param name="res"></param> /// <param name="sysRet"></param> /// <param name="eMsg"></param> /// <returns></returns> public static TRes WithResp <TRes>(this TRes res, SysRespTypes sysRet, string eMsg) where TRes : Resp { return(res.WithResp((int)sysRet, (int)RespTypes.Success, eMsg)); }
/// <summary> /// 【系统响应】是否是对应的类型 /// </summary> /// <param name="res"></param> /// <param name="type"></param> /// <returns></returns> public static bool IsSysRespType(this BasicMos.Resp.Resp res, SysRespTypes type) => res.sys_ret == (int)type;
/// <summary> /// 直接设置泛型响应信息,并返回 /// </summary> /// <typeparam name="TRes"></typeparam> /// <param name="res"></param> /// <param name="sysRet"></param> /// <param name="ret"></param> /// <param name="eMsg"></param> /// <returns></returns> public static TRes WithResp <TRes>(this TRes res, SysRespTypes sysRet, RespTypes ret, string eMsg) where TRes : BasicMos.Resp.Resp { return(res.WithResp((int)sysRet, (int)ret, eMsg)); }
/// <summary> /// 构造响应类 /// </summary> /// <param name="sysRet">【系统/框架】 响应标识</param> /// <param name="message">响应信息描述</param> public Resp(SysRespTypes sysRet, string message = null) { this.sys_ret = (int)sysRet; this.msg = message; }