Пример #1
0
        /// <summary>
        /// 短信验证码是否正确
        /// </summary>
        /// <param name="phone">手机号码</param>
        /// <param name="code">短信验证码</param>
        /// <returns></returns>
        public static bool CheckAuthCode(String phone, String code)
        {
            return(true);

            var nonce   = OSecurity.GetRandomString(16);
            var curTime = OSecurity.DateTimeToTimeStamp(DateTime.Now).ToString();
            var sha1    = OSecurity.SHA1(appSecret + nonce + curTime);
            var errcode = ORequest.RequestPost("https://api.netease.im/sms/verifycode.action",
                                               "&phone=" + phone,
                                               "code",
                                               new WebHeaderCollection
            {
                { "AppKey", appKey },
                { "Nonce", nonce },
                { "CurTime", curTime },
                { "CheckSum", sha1 }
            });


            if (errcode == "200")
            {
                return(true);
            }
            return(false);
        }
Пример #2
0
        public static string WXJSSign(string nonce, Int64 timestamp, string url)
        {
            string str = "jsapi_ticket=" + GetJsapiTicket() +
                         "&noncestr=" + nonce +
                         "&timestamp=" + timestamp.ToString() +
                         "&url=" + url;

            str = OSecurity.SHA1(str);
            return(str);
        }