BLL/!/Init.cs
(完整代码) 2KBusing System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using UAP;
namespace BLL
{
public class Init
{
static string js = null, css = null, area = null;
public static void Start()
{
//C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis -i
//全局CSS压缩缓存
UAP.Router.Add("/!/css", delegate(Match match, HttpContext c, bool h)
{
if (css == null || Current.HOST.Equals("localhost"))
{
css = string.Join("", Directory.GetFiles(c.Server.MapPath("/!/auto-generate"), "*.css", SearchOption.AllDirectories).Select(f => File.ReadAllText(f)).ToArray());
if (Current.HOST != "localhost")
{
css = UAP.Function.Compression.CssCompress(css, UAP.Function.CssCompressLevel.Line);
}
}
c.Response.Cache.SetCacheability(HttpCacheability.Public);
c.Response.Cache.SetExpires(DateTime.Now.AddDays(1));
c.Response.Cache.SetLastModified(DateTime.Now);
c.Response.ContentType = "text/css; charset=utf-8";
c.Response.Write(css);
return true;
});
//全局CSS压缩缓存
UAP.Router.Add("/!/cls", delegate(Match match, HttpContext c, bool h)
{
js = css = null;
return true;
});
#region 配置微信参数
using (var db = UAP.DataBase.Get())
{
db.Connect();
JSON config = db.getJson("select top 1 id,appid,appSecret,mch_id,[key] from ec_config where isactive=1", 0);
WeiXing.Config.appid = config["appid"];
WeiXing.Config.AppSecret = config["appSecret"];
WeiXing.Config.mch_id = config["mch_id"];
WeiXing.Config.key = config["key"];
}
#endregion
//开启全局 cshtml -> razor 直接访问视图引擎
UAP.Router.AddRazorEngine();
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。