Exemple #1
0
        /// <summary>
        /// 统一下单接口
        /// </summary>
        /// <param name="payMode">参数</param>
        /// <returns></returns>
        public ReturnModels <xml> Unifiedorder(string key, PayMode payMode)
        {
            var result = new ReturnModels <xml>();

            if (payMode != null)
            {
                try
                {
                    payMode.sign = CommTool.MD5MakeSigne(payMode.ToDictionary(), key);
                    var parmxml = payMode.ToDictionary();
                    var rdata   = HttpSendResult.SendRequest(this.url, parmxml.ToXML(), "POST", "text/xml");
                    result.RetrnData = rdata.Deserialize <xml>();
                }
                catch (Exception ex)
                {
                    result.HasError = true;
                    result.Message  = ex.Message;
                }
            }
            else
            {
                result.HasError = true;
                result.Message  = "支付参数为空对象。";
            }
            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="access_token">调用接口凭证</param>
        /// <param name="openid">普通用户标识,对该公众帐号唯一</param>
        /// <returns></returns>
        public string GetUserInfo(string access_token, string openid)
        {
            string result = null;
            var    url    = baseurl + "?" + string.Format("access_token={0}&openid={1}&lang=zh_CN", access_token, openid);

            result = HttpSendResult.SendRequest(url, null, "get");
            return(result);
        }
Exemple #3
0
        /// <summary>
        /// 刷新access_token(如果需要)
        /// </summary>
        /// <param name="appid">公众号的唯一标识</param>
        /// <param name="refresh_token">填写通过access_token获取到的refresh_token参数</param>
        /// <returns></returns>
        public string Getrefresh_token(string appid, string refresh_token)
        {
            string result = null;
            var    url    = baseurl + "?" + string.Format("appid={0}&grant_type=refresh_token&refresh_token={1}", appid, refresh_token);

            result = HttpSendResult.SendRequest(url, null, "get");
            return(result);
        }
Exemple #4
0
        /// <summary>
        /// 获取jsapi_ticket,开发者必须在自己的服务全局缓存jsapi_ticket
        /// </summary>
        /// <param name="access_token">access_token</param>
        /// <returns></returns>
        public string GetJsapi_Ticket(string access_token, string Type)
        {
            string result = string.Empty;
            var    url    = baseurl + "?" + string.Format("access_token={0}&type={1}", access_token, Type);

            result = HttpSendResult.SendRequest(url, null, "get");
            return(result);
        }
Exemple #5
0
        /// <summary>
        /// 通过code换取网页授权access_token
        /// </summary>
        /// <param name="appid">公众号的唯一标识</param>
        /// <param name="secret">公众号的appsecret</param>
        /// <param name="code">填写第一步获取的code参数</param>
        /// <returns></returns>
        public string GetAccess_token(string appid, string secret, string code)
        {
            string result = null;
            var    url    = baseurl + "?" + string.Format("appid={0}&secret={1}&code={2}&grant_type=authorization_code", appid, secret, code);

            result = HttpSendResult.SendRequest(url, null, "get");
            return(result);
        }