/// <summary> /// 获取授权后的URL /// </summary> /// <returns></returns> public async Task <ReturnJson> GetRedirectUrl() { try { string url = string.Format(WeChatOauth2Url, WeChatAppId, WeChatRedirectUrl); return(ReturnJson.ToResult(ReturnCode.Success, new { redirectURL = url })); } catch (Exception e) { return(ReturnJson.ToResult(ReturnCode.ServiceError, e.Message)); } }
public static ReturnJson ToResult(ReturnCode code) { ReturnJson retJson = new ReturnJson { Code = ((int)code).ToString(), Res = new Receive { Data = new { }, Msg = code.GetEnumText() } }; return(retJson); }
public static ReturnJson ToResult(ReturnCode code, string msg, object data = null) { ReturnJson retJson = new ReturnJson { Code = ((int)code).ToString(), Res = new Receive { Data = data ?? new { }, Msg = msg ?? code.GetEnumText() } }; return(retJson); }