示例#1
0
        /// <summary>
        /// 临时二维码请求
        /// </summary>
        public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO<string> CreateTempQrcode(Jinher.AMP.BTP.Deploy.CustomDTO.WeChat.TempQrcodeDTO param, Deploy.CustomDTO.ResultDTO<string> tokenInfo)
        {
            var ret = new Deploy.CustomDTO.ResultDTO<string> { ResultCode = 0, isSuccess = false };

            if (tokenInfo == null)
            {
                ret.Message = "获取微信access_token失败";
                return ret;
            }
            //获取token失败
            if (!tokenInfo.isSuccess)
            {
                ret.Message = tokenInfo.Message;
                return ret;
            }

            var token = tokenInfo.Data;
            var url = string.Format(CreateQrCodeUrl, token);
            var postJson = param.GetPostJson;


            var respText = WebRequestHelper.SendWebRequest(url, postJson, "Post", "application/json");
            var respInfo = JsonToDict(respText);

            if (respInfo.isSuccess)
            {
                var respDict = respInfo.Data;
                if (respDict.ContainsKey("ticket"))
                {
                    LogHelper.Info(string.Format("调用GetTempQrcode成功,参数access_token:{0}, 返回:{1}",
                        token, respText));
                    ret.Data = respDict["ticket"].ToString(); //成功
                    ret.isSuccess = true;
                }
                else
                    ret.Message = "返回的数据中没有ticket项,返回数据是:" + respText;
            }
            else
                ret.Message = respInfo.Message; //返回错误详情

            return ret;
        }
示例#2
0
 /// <summary>
 /// 临时二维码请求
 /// </summary>
 public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <string> CreateTempQrcodeExt(Jinher.AMP.BTP.Deploy.CustomDTO.WeChat.TempQrcodeDTO param)
 {
     TPS.WeChatQrCodeSV worker = new WeChatQrCodeSV();
     return(worker.CreateTempQrcode(param));
 }
示例#3
0
 /// <summary>
 /// 临时二维码请求
 /// </summary>
 public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO<string> CreateTempQrcode(Jinher.AMP.BTP.Deploy.CustomDTO.WeChat.TempQrcodeDTO param)
 {
     //获取token
     var tokenInfo = GetToken(param);
     return CreateTempQrcode(param, tokenInfo);
 }