コード例 #1
0
 /// <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));
     }
 }
コード例 #2
0
        public static ReturnJson ToResult(ReturnCode code)
        {
            ReturnJson retJson = new ReturnJson
            {
                Code = ((int)code).ToString(),
                Res  = new Receive
                {
                    Data = new { },
                    Msg  = code.GetEnumText()
                }
            };

            return(retJson);
        }
コード例 #3
0
        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);
        }