/// <summary>
        /// 登录凭证校验
        /// </summary>
        /// <param name="js_code"></param>
        /// <returns></returns>
        public string Jscode2session(Enums.Wechat.AppKey appKey, string js_code)
        {
            var wechatAppConfig = AllServices.WechatAppConfigService.GetSingle(appKey);

            if (wechatAppConfig == null)
            {
                throw new Exception("数据库中没有找到配置");
            }

            var url      = string.Format("https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code", wechatAppConfig.Appid, wechatAppConfig.Secret, js_code);
            var response = HttpHelper.Get(url);

            return(response);
        }
Beispiel #2
0
        public int Add(Enums.Wechat.AppKey AppKey, string Appid, string Openid, string MchId, string OutTradeNo, string Body, string RequestData, int TotalFee, bool IsPaySuccessed, string PayResult, string prepay_id)
        {
            Wechat_PayOrder model = new Wechat_PayOrder();

            model.Id          = StringHelper.GetUUID().ToString();
            model.Create_Time = DateTime.Now;

            model.FromKey        = AppKey.ToString();
            model.Appid          = Appid;
            model.Openid         = Openid;
            model.MchId          = MchId;
            model.OutTradeNo     = OutTradeNo;
            model.Body           = Body;
            model.RequestData    = RequestData;
            model.TotalFee       = TotalFee;
            model.IsPaySuccessed = IsPaySuccessed;
            model.PayResult      = PayResult;
            model.PrepayId       = prepay_id;

            return(base.Add(model));
        }