Esempio n. 1
0
        /// <summary>是否是本网站文件</summary>
        public static bool IsLocalFile(string url)
        {
            url = Asp.ResolveUrl(url);
            Uri uri = new Uri(url);

            return(uri.Host.ToLower() == Asp.Host.ToLower());
        }
Esempio n. 2
0
        /// <summary>调用微信扫一扫</summary>
        /// <param name="openId"></param>
        /// <param name="phone"></param>
        public static void WeChatScan(System.Web.UI.Page page, string openId, string phone)
        {
            var url  = string.Format("{0}/wx/wxscan3rd.shtml", Host);
            var dict = new Dictionary <string, string>();
            var json = string.Format("{{\"cmpId\":{0},\"phone\":\"{1}\",\"openId\":\"{2}\"}}", CmpId, phone, openId);

            dict.Add("data", json);
            dict.Add("accessToken", AccesToken);
            Asp.CreateFormAndPost(page, url, dict);
        }
Esempio n. 3
0
        /// <summary>记录日志到数据库</summary>
        public static void LogToDb(string message, LogLevel level = LogLevel.Info, string operater = "", string from = "Web", string ip = "")
        {
            Log(level, message.GetSummary(50));
            if (operater.IsNullOrEmpty())
            {
                operater = (Common.LoginUser != null) ? Common.LoginUser.NickName : "Unknown";
            }
            var log = new Log
            {
                Lvl      = level,
                Operator = operater,
                Message  = message,
                Summary  = message.GetSummary(50),
                LogDt    = DateTime.Now,
                From     = from,
                IP       = ip.IsNullOrEmpty() ? Asp.GetClientIP() : ip
            };

            log.Save(false);
        }