Example #1
0
        /// <summary>
        /// 反序列化包含OpenId和SessionKey的Json数据包
        /// </summary>
        /// <param name="code">Json数据包</param>
        /// <returns>包含OpenId和SessionKey的类</returns>
        public OpenIdAndSessionKey DecodeOpenIdAndSessionKey(WechatLoginInfo loginInfo)
        {
            OpenIdAndSessionKey oiask = JsonConvert.DeserializeObject <OpenIdAndSessionKey>(GetOpenIdAndSessionKeyString(loginInfo.code));

            if (!String.IsNullOrEmpty(oiask.errcode))
            {
                return(null);
            }
            return(oiask);
        }
Example #2
0
 /// <summary>
 /// 根据微信小程序平台提供的签名验证算法验证用户发来的数据是否有效
 /// </summary>
 /// <param name="loginInfo">登陆信息</param>
 /// <param name="idAndKey">包含OpenId和SessionKey的类</param>
 /// <returns>True:资料有效,False:资料无效</returns>
 public bool VaildateUserInfo(WechatLoginInfo loginInfo, OpenIdAndSessionKey idAndKey)
 {
     return(VaildateUserInfo(loginInfo, idAndKey.session_key));
 }
Example #3
0
 /// <summary>
 /// 根据微信小程序平台提供的签名验证算法验证用户发来的数据是否有效
 /// </summary>
 /// <param name="loginInfo">登陆信息</param>
 /// <param name="sessionKey">从服务端获取的SessionKey</param>
 /// <returns>True:资料有效,False:资料无效</returns>
 public bool VaildateUserInfo(WechatLoginInfo loginInfo, string sessionKey)
 {
     return(VaildateUserInfo(loginInfo.rawData, loginInfo.signature, sessionKey));
 }