Exemple #1
0
        /// <summary>
        /// Step3:获取个人信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public static AliPay_User_ResultEntity User(AliPay_User_RequestEntity entity)
        {
            Signature(entity);

            if (!LoginBase.IsValid(entity))
            {
                return(null);
            }

            string pars   = LoginBase.EntityToPars(entity);
            string result = Core.HttpTo.Get(AliPayConfig.API_Gateway + "?" + pars);

            AliPay_User_ResultEntity outmo = null;

            if (result.Contains("alipay_user_info_share_response"))
            {
                outmo = result.ToJObject()["alipay_user_info_share_response"].ToJson().ToEntity <AliPay_User_ResultEntity>();
            }

            if (result.Contains("error_response"))
            {
                outmo = result.ToJObject()["error_response"].ToJson().ToEntity <AliPay_User_ResultEntity>();
            }

            return(outmo);
        }
Exemple #2
0
        /// <summary>
        /// Step3:获取个人信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public static AliPay_User_ResultEntity User(AliPay_User_RequestEntity entity)
        {
            Signature(entity);

            if (!LoginBase.IsValid(entity))
            {
                return(null);
            }

            string pars   = LoginBase.EntityToPars(entity);
            string result = NetnrCore.HttpTo.Get(AliPayConfig.API_Gateway + "?" + pars);

            string jkey = string.Empty;

            if (result.Contains("alipay_user_info_share_response"))
            {
                jkey = "alipay_user_info_share_response";
            }
            if (result.Contains("error_response"))
            {
                jkey = "error_response";
            }
            if (!string.IsNullOrEmpty(jkey))
            {
                var outmo = NetnrCore.ToEntity <AliPay_User_ResultEntity>(NetnrCore.ToJson(JObject.Parse(result)[jkey]));
                return(outmo);
            }

            return(null);
        }