/// <summary> /// 获取 用户信息 /// </summary> /// <param name="entity">签名参数</param> /// <param name="code">临时授权码</param> /// <returns></returns> public static DingTalk_User_ResultEntity User(DingTalk_User_RequestEntity entity, string code) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); var hwr = Core.HttpTo.HWRequest(DingTalkConfig.API_User + "?" + pars, "POST", new { tmp_auth_code = code }.ToJson()); hwr.ContentType = "application/json"; var result = Core.HttpTo.Url(hwr); var ro = result.ToJObject(); if (ro["errcode"].ToString() == "0") { result = result.ToJObject()["user_info"].ToJson(); } else { return(null); } var outmo = LoginBase.ResultOutput <DingTalk_User_ResultEntity>(result); return(outmo); }
/// <summary> /// Step2:获取授权过的Access Token /// </summary> /// <param name="entity"></param> /// <returns></returns> public static Taobao_AccessToken_ResultEntity AccessToken(Taobao_AccessToken_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); string result = Core.HttpTo.Post(TaobaoConfig.API_AccessToken, pars); var outmo = LoginBase.ResultOutput <Taobao_AccessToken_ResultEntity>(result); return(outmo); }
/// <summary> /// Step3:获取用户信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static WeChat_OpenId_get_user_info_ResultEntity Get_User_Info(WeChat_OpenAPI_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); string result = NetnrCore.HttpTo.Get(WeChatConfig.API_UserInfo + "?" + pars); var outmo = LoginBase.ResultOutput <WeChat_OpenId_get_user_info_ResultEntity>(result.Replace("\r\n", "")); return(outmo); }
/// <summary> /// Step2:通过Authorization Code获取Access Token、openid /// </summary> /// <param name="entity"></param> /// <returns></returns> public static WeChat_AccessToken_ResultEntity AccessToken(WeChat_AccessToken_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); string result = NetnrCore.HttpTo.Get(WeChatConfig.API_AccessToken + "?" + pars); var outmo = LoginBase.ResultOutput <WeChat_AccessToken_ResultEntity>(result); return(outmo); }
/// <summary> /// 获取access_token /// </summary> /// <param name="entity"></param> /// <returns></returns> public static DingTalk_AccessToken_ResultEntity AccessToken(DingTalk_AccessToken_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); var result = Core.HttpTo.Get(DingTalkConfig.API_AccessToken + "?" + pars); var outmo = LoginBase.ResultOutput <DingTalk_AccessToken_ResultEntity>(result); return(outmo); }
/// <summary> /// 获取 用户信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static Gitee_User_ResultEntity User(Gitee_User_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); var result = Core.HttpTo.Get(GiteeConfig.API_User + "?" + pars); var outmo = LoginBase.ResultOutput <Gitee_User_ResultEntity>(result); return(outmo); }
/// <summary> /// 获取 access token /// </summary> /// <param name="entity"></param> /// <returns></returns> public static Google_AccessToken_ResultEntity AccessToken(Google_AccessToken_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); var result = NetnrCore.HttpTo.Post(GoogleConfig.API_AccessToken, pars); var outmo = LoginBase.ResultOutput <Google_AccessToken_ResultEntity>(result); return(outmo); }
/// <summary> /// 获取access_token /// </summary> /// <param name="entity"></param> /// <returns></returns> public static StackOverflow_AccessToken_ResultEntity AccessToken(StackOverflow_AccessToken_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); var result = Core.HttpTo.Post(StackOverflowConfig.API_AccessToken, pars); result = "{\"" + result.Replace("=", "\":\"").Replace("&", "\",\"") + "\"}"; var outmo = LoginBase.ResultOutput <StackOverflow_AccessToken_ResultEntity>(result); return(outmo); }
/// <summary> /// 获取 用户信息 /// </summary> /// <param name="entity">签名参数</param> /// <returns></returns> public static StackOverflow_User_ResultEntity User(StackOverflow_User_RequestEntity entity) { if (!LoginBase.IsValid(entity)) { return(null); } string pars = LoginBase.EntityToPars(entity); string result = Core.HttpTo.Get(StackOverflowConfig.API_User + "?" + pars); StackOverflow_User_ResultEntity outmo = null; var jo = result.ToJObject(); if (jo.ContainsKey("items")) { outmo = LoginBase.ResultOutput <StackOverflow_User_ResultEntity>(jo["items"][0].ToJson()); } return(outmo); }