QiFeng.ZWY.Model/Wechat/JsTicket.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace QiFeng.LMSD.Model.WeChat
{
    public class JsTicket
    {
        public static string getnonstr(int length)
        {
            string str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            string str2 = "";
            Random random = new Random();
            for (int i = 0; i < length; i++)
            {
                int startIndex = random.Next(0, str.Length);
                str2 = str2 + str.Substring(startIndex, 1);
            }
            return str2;
        }

        public static string getSign(string nonstr, string ticket, double timestamp, string url)
        {
            string format = "jsapi_ticket={0}&noncestr={1}&timestamp={2}&url={3}";
            format = string.Format(format, new object[] { ticket, nonstr, timestamp, url });
            SHA1 sha = new SHA1CryptoServiceProvider();
            byte[] bytes = new ASCIIEncoding().GetBytes(format);
            return BitConverter.ToString(sha.ComputeHash(bytes)).Replace("-", "");
        }

        public int errcode { get; set; }

        public string errmsg { get; set; }

        public int expires_in { get; set; }

        public DateTime get_time { get; set; }

        public string ticket { get; set; }
    }

    public class JsTicketForWeb
    {
        public string NonceStr { get; set; }

        public string JsTimeStamp { get; set; }

        public string Signature { get; set; }

        public string AppId { get; set; }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。