diff --git a/NewLife.YuqueWeb/Areas/Yuque/Controllers/BookController.cs b/NewLife.YuqueWeb/Areas/Yuque/Controllers/BookController.cs
new file mode 100644
index 0000000..4607948
--- /dev/null
+++ b/NewLife.YuqueWeb/Areas/Yuque/Controllers/BookController.cs
@@ -0,0 +1,44 @@
+using Microsoft.AspNetCore.Mvc;
+using NewLife.Cube;
+using NewLife.Web;
+using NewLife.YuQueWeb.Entity;
+using XCode.Membership;
+
+namespace NewLife.YuqueWeb.Areas.Yuque.Controllers
+{
+ [YuqueArea]
+ [Menu(90, true, Icon = "fa-tachometer")]
+ public class BookController : EntityController<Book>
+ {
+ protected override IEnumerable<Book> Search(Pager p)
+ {
+ var enable = p["enable"]?.ToBoolean();
+
+ var start = p["dtStart"].ToDateTime();
+ var end = p["dtEnd"].ToDateTime();
+
+ p.RetrieveState = true;
+
+ return Book.Search(null, null, enable, start, end, p["Q"], p);
+ }
+
+ /// <summary>同步知识库</summary>
+ /// <returns></returns>
+ [EntityAuthorize(PermissionFlags.Update)]
+ public ActionResult SyncRepo()
+ {
+ var count = 0;
+ var ids = GetRequest("keys").SplitAsInt();
+ if (ids.Length > 0)
+ foreach (var id in ids)
+ {
+ var team = Book.FindById(id);
+ if (team != null)
+ {
+ }
+ }
+
+ return JsonRefresh($"共刷新[{count}]个知识库");
+ }
+ }
+}
\ No newline at end of file
diff --git a/NewLife.YuqueWeb/Areas/Yuque/Controllers/DocumentController.cs b/NewLife.YuqueWeb/Areas/Yuque/Controllers/DocumentController.cs
new file mode 100644
index 0000000..84c7c1d
--- /dev/null
+++ b/NewLife.YuqueWeb/Areas/Yuque/Controllers/DocumentController.cs
@@ -0,0 +1,24 @@
+using NewLife.Cube;
+using NewLife.Web;
+using NewLife.YuQueWeb.Entity;
+using XCode.Membership;
+
+namespace NewLife.YuqueWeb.Areas.Yuque.Controllers
+{
+ [YuqueArea]
+ [Menu(80)]
+ public class DocumentController : EntityController<Document>
+ {
+ protected override IEnumerable<Document> Search(Pager p)
+ {
+ var bookId = p["bookId"].ToInt(-1);
+
+ var start = p["dtStart"].ToDateTime();
+ var end = p["dtEnd"].ToDateTime();
+
+ p.RetrieveState = true;
+
+ return Document.Search(null, null, bookId, start, end, p["Q"], p);
+ }
+ }
+}
\ No newline at end of file
diff --git a/NewLife.YuqueWeb/Areas/Yuque/Views/_ViewImports.cshtml b/NewLife.YuqueWeb/Areas/Yuque/Views/_ViewImports.cshtml
new file mode 100644
index 0000000..9e05a44
--- /dev/null
+++ b/NewLife.YuqueWeb/Areas/Yuque/Views/_ViewImports.cshtml
@@ -0,0 +1,7 @@
+@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
+@using NewLife
+@using NewLife.Cube
+@using NewLife.Reflection
+@using NewLife.Web
+@using XCode
+@using XCode.Membership
diff --git a/NewLife.YuqueWeb/Areas/Yuque/Views/Book/_List_Search.cshtml b/NewLife.YuqueWeb/Areas/Yuque/Views/Book/_List_Search.cshtml
new file mode 100644
index 0000000..d102a79
--- /dev/null
+++ b/NewLife.YuqueWeb/Areas/Yuque/Views/Book/_List_Search.cshtml
@@ -0,0 +1,10 @@
+@using NewLife;
+@using NewLife.Web;
+@using NewLife.Cube;
+@using XCode;
+@{
+ var fact = ViewBag.Factory as IEntityFactory;
+ var page = ViewBag.Page as Pager;
+}
+@await Html.PartialAsync("_Enable", "")
+@await Html.PartialAsync("_DateRange")
\ No newline at end of file
diff --git a/NewLife.YuqueWeb/Areas/Yuque/Views/Book/_List_Toolbar_Batch.cshtml b/NewLife.YuqueWeb/Areas/Yuque/Views/Book/_List_Toolbar_Batch.cshtml
new file mode 100644
index 0000000..4518135
--- /dev/null
+++ b/NewLife.YuqueWeb/Areas/Yuque/Views/Book/_List_Toolbar_Batch.cshtml
@@ -0,0 +1,16 @@
+@using NewLife.Common;
+@using NewLife
+@using NewLife.Cube
+@using NewLife.Reflection
+@using NewLife.Web
+@using XCode
+@using XCode.Membership
+@{
+ var set = ViewBag.PageSetting as PageSetting;
+}
+@if (set.EnableSelect)
+{
+ <button type="button" class="btn btn-purple btn-sm" data-action="action" data-url="@Url.Action("SyncRepo")" data-fields="keys" disabled>
+ 同步知识库
+ </button>
+}
\ No newline at end of file
diff --git a/NewLife.YuqueWeb/Areas/Yuque/YuqueArea.cs b/NewLife.YuqueWeb/Areas/Yuque/YuqueArea.cs
index 39254bd..36698f7 100644
--- a/NewLife.YuqueWeb/Areas/Yuque/YuqueArea.cs
+++ b/NewLife.YuqueWeb/Areas/Yuque/YuqueArea.cs
@@ -5,7 +5,7 @@ namespace NewLife.YuqueWeb.Areas.Yuque;
/// <summary>语雀管理区域注册</summary>
[DisplayName("语雀管理")]
-[Menu(-2, true, Icon = "fa-tachometer")]
+[Menu(80, true, Icon = "fa-tachometer")]
public class YuqueArea : AreaBase
{
/// <inheritdoc />
diff --git "a/NewLife.YuqueWeb/Entity/\347\237\245\350\257\206\345\272\223.Biz.cs" "b/NewLife.YuqueWeb/Entity/\347\237\245\350\257\206\345\272\223.Biz.cs"
index 9c2d88e..4ddd15e 100644
--- "a/NewLife.YuqueWeb/Entity/\347\237\245\350\257\206\345\272\223.Biz.cs"
+++ "b/NewLife.YuqueWeb/Entity/\347\237\245\350\257\206\345\272\223.Biz.cs"
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
@@ -170,17 +170,19 @@ namespace NewLife.YuQueWeb.Entity
/// <summary>高级查询</summary>
/// <param name="code">编码。路径唯一标识,默认取Slug</param>
/// <param name="name">名称</param>
+ /// <param name="enable">启用</param>
/// <param name="start">更新时间开始</param>
/// <param name="end">更新时间结束</param>
/// <param name="key">关键字</param>
/// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
/// <returns>实体列表</returns>
- public static IList<Book> Search(String code, String name, DateTime start, DateTime end, String key, PageParameter page)
+ public static IList<Book> Search(String code, String name, Boolean? enable, DateTime start, DateTime end, String key, PageParameter page)
{
var exp = new WhereExpression();
if (!code.IsNullOrEmpty()) exp &= _.Code == code;
if (!name.IsNullOrEmpty()) exp &= _.Name == name;
+ if (enable != null) exp &= _.Enable == enable;
exp &= _.UpdateTime.Between(start, end);
if (!key.IsNullOrEmpty()) exp &= _.Code.Contains(key) | _.Name.Contains(key) | _.Type.Contains(key) | _.UserName.Contains(key) | _.Slug.Contains(key) | _.Namespace.Contains(key) | _.CreateUser.Contains(key) | _.CreateIP.Contains(key) | _.UpdateUser.Contains(key) | _.UpdateIP.Contains(key) | _.Remark.Contains(key);
diff --git a/NewLife.YuqueWeb/NewLife.YuqueWeb.csproj b/NewLife.YuqueWeb/NewLife.YuqueWeb.csproj
index 82e0a34..2fffe17 100644
--- a/NewLife.YuqueWeb/NewLife.YuqueWeb.csproj
+++ b/NewLife.YuqueWeb/NewLife.YuqueWeb.csproj
@@ -4,16 +4,15 @@
<OutputType>Library</OutputType>
<TargetFramework>net6.0</TargetFramework>
<AssemblyTitle>语雀Web</AssemblyTitle>
- <Description>自动语雀内容到本系统,对外呈现内容页面</Description>
+ <Description>自动同步语雀内容到本系统,对外呈现内容页面</Description>
<Company>新生命开发团队</Company>
<Copyright>©2002-2022 NewLife</Copyright>
<VersionPrefix>1.0</VersionPrefix>
<VersionSuffix>$([System.DateTime]::Now.ToString(`yyyy.MMdd`))</VersionSuffix>
<Version>$(VersionPrefix).$(VersionSuffix)</Version>
<FileVersion>$(Version)</FileVersion>
- <AssemblyVersion>5.0.*</AssemblyVersion>
+ <AssemblyVersion>$(VersionPrefix).*</AssemblyVersion>
<Deterministic>false</Deterministic>
- <OutputPath>..\Bin</OutputPath>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
@@ -25,7 +24,7 @@
<Authors>$(Company)</Authors>
<PackageProjectUrl>https://www.yuque.com/smartstone/cube</PackageProjectUrl>
<PackageIcon>leaf.png</PackageIcon>
- <RepositoryUrl>https://github.com/NewLifeX/NewLife.Cube</RepositoryUrl>
+ <RepositoryUrl>https://github.com/NewLifeX/NewLife.Yuque</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>新生命团队;X组件;NewLife;$(AssemblyName)</PackageTags>
<PackageReleaseNotes>新增MenuAttribute优化控制器菜单管理;新增魔方管理区域;增强OAuth配置</PackageReleaseNotes>
diff --git a/NewLife.YuqueWeb/YuqueService.cs b/NewLife.YuqueWeb/YuqueService.cs
index 6987249..a917b39 100644
--- a/NewLife.YuqueWeb/YuqueService.cs
+++ b/NewLife.YuqueWeb/YuqueService.cs
@@ -29,7 +29,7 @@ public static class YuqueService
/// <param name="app"></param>
/// <param name="env"></param>
/// <returns></returns>
- public static IApplicationBuilder UseYuque(this IApplicationBuilder app, IWebHostEnvironment env)
+ public static IApplicationBuilder UseYuque(this IApplicationBuilder app, IWebHostEnvironment env = null)
{
using var span = DefaultTracer.Instance?.NewSpan(nameof(UseYuque));
diff --git a/YqWeb/Program.cs b/YqWeb/Program.cs
index f11e9ed..765fd7b 100644
--- a/YqWeb/Program.cs
+++ b/YqWeb/Program.cs
@@ -1,21 +1,23 @@
-var builder = WebApplication.CreateBuilder(args);
+using NewLife.Cube;
+using NewLife.Log;
+using NewLife.YuQueWeb;
-// Add services to the container.
-builder.Services.AddRazorPages();
+XTrace.UseConsole();
-var app = builder.Build();
+var builder = WebApplication.CreateBuilder(args);
+var services = builder.Services;
-// Configure the HTTP request pipeline.
-if (!app.Environment.IsDevelopment())
-{
- app.UseExceptionHandler("/Error");
-}
-app.UseStaticFiles();
+var star = services.AddStardust(null);
-app.UseRouting();
+services.AddControllersWithViews();
+services.AddYuque();
+services.AddCube();
+var app = builder.Build();
+app.UseYuque();
+app.UseCube(builder.Environment);
app.UseAuthorization();
+app.MapControllerRoute(name: "default", pattern: "{controller=Index}/{action=Index}/{id?}");
+app.MapControllerRoute(name: "default2", pattern: "{area=Admin}/{controller=Index}/{action=Index}/{id?}");
-app.MapRazorPages();
-
-app.Run();
+app.Run();
\ No newline at end of file
diff --git a/YqWeb/YqWeb.csproj b/YqWeb/YqWeb.csproj
index f8c2544..c34c132 100644
--- a/YqWeb/YqWeb.csproj
+++ b/YqWeb/YqWeb.csproj
@@ -2,11 +2,27 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
+ <AssemblyTitle>语雀Web</AssemblyTitle>
+ <Description>自动同步语雀内容到本系统,对外呈现内容页面</Description>
+ <Company>新生命开发团队</Company>
+ <Copyright>©2002-2022 NewLife</Copyright>
+ <VersionPrefix>1.0</VersionPrefix>
+ <VersionSuffix>$([System.DateTime]::Now.ToString(`yyyy.MMdd`))</VersionSuffix>
+ <Version>$(VersionPrefix).$(VersionSuffix)</Version>
+ <FileVersion>$(Version)</FileVersion>
+ <AssemblyVersion>5.0.*</AssemblyVersion>
+ <Deterministic>false</Deterministic>
+ <OutputPath>..\Bin\Web</OutputPath>
+ <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
+ <PackageReference Include="NewLife.Stardust.Extensions" Version="2.0.2022.404" />
+ </ItemGroup>
+
+ <ItemGroup>
<ProjectReference Include="..\NewLife.YuQueWeb\NewLife.YuqueWeb.csproj" />
</ItemGroup>