Преглед на файлове

😁优化调整GoView服务插件

zuohuaijun преди 2 години
родител
ревизия
1dd86bd871
променени са 17 файла, в които са добавени 240 реда и са изтрити 252 реда
  1. 1 1
      Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj
  2. 1 1
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/Admin.NET.Plugin.GoView.csproj
  3. 9 2
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/Entity/GoViewPro.cs
  4. 3 3
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/Entity/GoViewProData.cs
  5. 1 1
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/Enum/GoViewProState.cs
  6. 2 1
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/GlobalUsings.cs
  7. 1 1
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/GoView.json
  8. 20 20
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/GoViewPro/Dto/GoViewProInput.cs
  9. 7 7
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/GoViewPro/Dto/GoViewProOutput.cs
  10. 84 84
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/GoViewPro/GoViewProService.cs
  11. 1 1
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/GoViewSys/Dto/GoViewLoginInput.cs
  12. 15 16
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/GoViewSys/Dto/GoViewLoginOutput.cs
  13. 17 0
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/GoViewSys/Dto/GoViewOssUrlOutput.cs
  14. 69 0
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/GoViewSys/GoViewSysService.cs
  15. 0 13
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/System/Dto/OssUrlOutput.cs
  16. 0 74
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/System/SystemService.cs
  17. 9 27
      Admin.NET/Plugins/Admin.NET.Plugin.GoView/Util/GoViewResultProvider.cs

+ 1 - 1
Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj

@@ -32,7 +32,7 @@
     <PackageReference Include="OnceMi.AspNetCore.OSS" Version="1.1.9" />
     <PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="2.30.0" />
     <PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="2.19.0" />
-    <PackageReference Include="SqlSugarCore" Version="5.1.4.84" />
+    <PackageReference Include="SqlSugarCore" Version="5.1.4.85" />
     <PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.2" />
     <PackageReference Include="UAParser" Version="3.1.47" />
     <PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />

+ 1 - 1
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Admin.NET.Plugin.GoView.csproj

@@ -20,7 +20,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <None Update="Application.json">
+    <None Update="GoView.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
   </ItemGroup>

+ 9 - 2
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Entity/GoViewProject.cs → Admin.NET/Plugins/Admin.NET.Plugin.GoView/Entity/GoViewPro.cs

@@ -4,7 +4,7 @@
 /// GoView 项目表
 /// </summary>
 [SugarTable(null, "GoView 项目表")]
-public class GoViewProject : EntityTenant
+public class GoViewPro : EntityTenant
 {
     /// <summary>
     /// 项目名称
@@ -17,7 +17,7 @@ public class GoViewProject : EntityTenant
     /// 项目状态
     /// </summary>
     [SugarColumn(ColumnDescription = "项目状态")]
-    public GoViewProjectState State { get; set; }
+    public GoViewProState State { get; set; } = GoViewProState.UnPublish;
 
     /// <summary>
     /// 预览图片Url
@@ -32,4 +32,11 @@ public class GoViewProject : EntityTenant
     [SugarColumn(ColumnDescription = "项目备注", Length = 512)]
     [MaxLength(512)]
     public string? Remarks { get; set; }
+
+    ///// <summary>
+    ///// 项目数据
+    ///// </summary>
+    //[SugarColumn(IsIgnore = true)]
+    //[Navigate(NavigateType.OneToOne, nameof(Id))]
+    //public GoViewProData GoViewProData { get; set; }
 }

+ 3 - 3
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Entity/GoViewProjectData.cs → Admin.NET/Plugins/Admin.NET.Plugin.GoView/Entity/GoViewProData.cs

@@ -4,12 +4,12 @@
 /// GoView 项目数据表
 /// </summary>
 [SugarTable(null, "GoView 项目数据表")]
-public class GoViewProjectData : EntityTenant
+public class GoViewProData : EntityTenant
 {
     /// <summary>
-    /// 项目参数
+    /// 项目内容
     /// </summary>
-    [SugarColumn(ColumnDescription = "项目参数", ColumnDataType = StaticConfig.CodeFirst_BigString)]
+    [SugarColumn(ColumnDescription = "项目内容", ColumnDataType = StaticConfig.CodeFirst_BigString)]
     public string? Content { get; set; }
 
     /// <summary>

+ 1 - 1
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Enum/GoViewProjectState.cs → Admin.NET/Plugins/Admin.NET.Plugin.GoView/Enum/GoViewProState.cs

@@ -4,7 +4,7 @@ namespace Admin.NET.Plugin.GoView.Enum;
 /// GoView 项目状态
 /// </summary>
 [Description("GoView 项目状态")]
-public enum GoViewProjectState
+public enum GoViewProState
 {
     /// <summary>
     /// 未发布

+ 2 - 1
Admin.NET/Plugins/Admin.NET.Plugin.GoView/GlobalUsings.cs

@@ -18,7 +18,8 @@ global using Microsoft.AspNetCore.Mvc;
 global using Microsoft.AspNetCore.Mvc.Filters;
 global using Newtonsoft.Json;
 global using SqlSugar;
+global using System.Collections;
 global using System.ComponentModel;
 global using System.ComponentModel.DataAnnotations;
 global using System.Data;
-global using System.Linq.Dynamic.Core;
+global using System.Linq.Dynamic.Core;

+ 1 - 1
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Application.json → Admin.NET/Plugins/Admin.NET.Plugin.GoView/GoView.json

@@ -5,7 +5,7 @@
         "Group": "GoView",
         "Title": "GoView",
         "Description": "GoView 是一个高效的拖拽式低代码数据可视化开发平台,将图表或页面元素封装为基础组件,无需编写代码即可制作数据大屏,减少心智负担。<br/><a href='https://www.mtruning.club/'>https://www.mtruning.club</a>",
-        "Version": "v1.2.6",
+        "Version": "1.2.6",
         "License": {
             "Name": "MIT",
             "Url": "https://gitee.com/dromara/go-view/blob/master/LICENSE"

+ 20 - 20
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/Project/Dto/ProjectInput.cs → Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/GoViewPro/Dto/GoViewProInput.cs

@@ -3,7 +3,7 @@
 /// <summary>
 /// GoView 新增项目
 /// </summary>
-public class ProjectCreateInput
+public class GoViewProCreateInput
 {
     /// <summary>
     /// 项目名称
@@ -21,26 +21,10 @@ public class ProjectCreateInput
     public string IndexImage { get; set; }
 }
 
-/// <summary>
-/// GoView 保存项目
-/// </summary>
-public class ProjectSaveDataInput
-{
-    /// <summary>
-    /// 项目Id
-    /// </summary>
-    public long ProjectId { get; set; }
-
-    /// <summary>
-    /// 项目参数
-    /// </summary>
-    public string Content { get; set; }
-}
-
 /// <summary>
 /// GoView 编辑项目
 /// </summary>
-public class ProjectEditInput
+public class GoViewProEditInput
 {
     /// <summary>
     /// 项目Id
@@ -61,7 +45,7 @@ public class ProjectEditInput
 /// <summary>
 /// GoView 修改项目发布状态
 /// </summary>
-public class ProjectPublishInput
+public class GoViewProPublishInput
 {
     /// <summary>
     /// 项目Id
@@ -71,5 +55,21 @@ public class ProjectPublishInput
     /// <summary>
     /// 项目状态
     /// </summary>
-    public GoViewProjectState State { get; set; }
+    public GoViewProState State { get; set; }
+}
+
+/// <summary>
+/// GoView 保存项目数据
+/// </summary>
+public class GoViewProSaveDataInput
+{
+    /// <summary>
+    /// 项目Id
+    /// </summary>
+    public long ProjectId { get; set; }
+
+    /// <summary>
+    /// 项目内容
+    /// </summary>
+    public string Content { get; set; }
 }

+ 7 - 7
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/Project/Dto/ProjectOutput.cs → Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/GoViewPro/Dto/GoViewProOutput.cs

@@ -3,7 +3,7 @@
 /// <summary>
 /// GoView 项目 Item
 /// </summary>
-public class ProjectItemOutput
+public class GoViewProItemOutput
 {
     /// <summary>
     /// 项目Id
@@ -18,7 +18,7 @@ public class ProjectItemOutput
     /// <summary>
     /// 项目状态
     /// </summary>
-    public GoViewProjectState State { get; set; }
+    public GoViewProState State { get; set; }
 
     /// <summary>
     /// 创建时间
@@ -42,12 +42,12 @@ public class ProjectItemOutput
 }
 
 /// <summary>
-/// GoView 项目 Detail
+/// GoView 项目详情
 /// </summary>
-public class ProjectDetailOutput : ProjectItemOutput
+public class GoViewProDetailOutput : GoViewProItemOutput
 {
     /// <summary>
-    /// 项目参数
+    /// 项目内容
     /// </summary>
     public string Content { get; set; }
 }
@@ -55,7 +55,7 @@ public class ProjectDetailOutput : ProjectItemOutput
 /// <summary>
 /// GoView 新增项目输出
 /// </summary>
-public class ProjectCreateOutput
+public class GoViewProCreateOutput
 {
     /// <summary>
     /// 项目Id
@@ -66,7 +66,7 @@ public class ProjectCreateOutput
 /// <summary>
 /// GoView 上传项目输出
 /// </summary>
-public class ProjectUploadOutput
+public class GoViewProUploadOutput
 {
     /// <summary>
     /// Id

+ 84 - 84
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/Project/ProjectService.cs → Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/GoViewPro/GoViewProService.cs

@@ -5,20 +5,20 @@
 /// </summary>
 [UnifyProvider("GoView")]
 [ApiDescriptionSettings(GoViewConst.GroupName, Module = "goview", Name = "project", Order = 100)]
-public class ProjectService : IDynamicApiController
+public class GoViewProService : IDynamicApiController
 {
-    private readonly SqlSugarRepository<GoViewProject> _goViewProjectRep;
-    private readonly SqlSugarRepository<GoViewProjectData> _goViewProjectDataRep;
+    private readonly SqlSugarRepository<GoViewPro> _goViewProRep;
+    private readonly SqlSugarRepository<GoViewProData> _goViewProDataRep;
     private readonly SqlSugarRepository<SysFile> _sysFileRep;
     private readonly SysFileService _fileService;
 
-    public ProjectService(SqlSugarRepository<GoViewProject> goViewProjectRep,
-        SqlSugarRepository<GoViewProjectData> goViewProjectDataRep,
+    public GoViewProService(SqlSugarRepository<GoViewPro> goViewProjectRep,
+        SqlSugarRepository<GoViewProData> goViewProjectDataRep,
         SqlSugarRepository<SysFile> fileRep,
         SysFileService fileService)
     {
-        _goViewProjectRep = goViewProjectRep;
-        _goViewProjectDataRep = goViewProjectDataRep;
+        _goViewProRep = goViewProjectRep;
+        _goViewProDataRep = goViewProjectDataRep;
         _sysFileRep = fileRep;
         _fileService = fileService;
     }
@@ -26,65 +26,105 @@ public class ProjectService : IDynamicApiController
     /// <summary>
     /// 获取项目列表
     /// </summary>
-    [DisplayName("项目列表")]
-    public async Task<List<ProjectItemOutput>> GetList([FromQuery] int page = 1, [FromQuery] int limit = 12)
+    /// <param name="page"></param>
+    /// <param name="limit"></param>
+    /// <returns></returns>
+    [DisplayName("获取项目列表")]
+    public async Task<List<GoViewProItemOutput>> GetList([FromQuery] int page = 1, [FromQuery] int limit = 12)
     {
-        var pagedList = await _goViewProjectRep.AsQueryable()
-            .Select(u => new ProjectItemOutput(), true)
+        var res = await _goViewProRep.AsQueryable()
+            .Select(u => new GoViewProItemOutput(), true)
             .ToPagedListAsync(page, limit);
-
-        UnifyContext.Fill(pagedList.Total);
-        return pagedList.Items.ToList();
+        return res.Items.ToList();
     }
 
     /// <summary>
     /// 新增项目
     /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
     [ApiDescriptionSettings(Name = "Create")]
     [DisplayName("新增项目")]
-    public async Task<ProjectCreateOutput> Create(ProjectCreateInput input)
+    public async Task<GoViewProCreateOutput> Create(GoViewProCreateInput input)
     {
-        var project = input.Adapt<GoViewProject>();
-        project.State = GoViewProjectState.UnPublish;
-
-        project = await _goViewProjectRep.AsInsertable(project).ExecuteReturnEntityAsync();
-
-        return new ProjectCreateOutput
+        var project = await _goViewProRep.AsInsertable(input.Adapt<GoViewPro>()).ExecuteReturnEntityAsync();
+        return new GoViewProCreateOutput
         {
             Id = project.Id
         };
     }
 
     /// <summary>
-    /// 获取项目
+    /// 修改项目
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    [DisplayName("修改项目")]
+    public async Task Edit(GoViewProEditInput input)
+    {
+        await _goViewProRep.AsUpdateable(input.Adapt<GoViewPro>()).IgnoreColumns(true).ExecuteCommandAsync();
+    }
+
+    /// <summary>
+    /// 删除项目
+    /// </summary>
+    [ApiDescriptionSettings(Name = "Delete")]
+    [DisplayName("删除项目")]
+    [UnitOfWork]
+    public async Task Delete([FromQuery] string ids)
+    {
+        var idList = ids.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(u => Convert.ToInt64(u)).ToList();
+        await _goViewProRep.AsDeleteable().Where(u => idList.Contains(u.Id)).ExecuteCommandAsync();
+        await _goViewProDataRep.AsDeleteable().Where(u => idList.Contains(u.Id)).ExecuteCommandAsync();
+    }
+
+    /// <summary>
+    /// 修改发布状态
+    /// </summary>
+    [HttpPut]
+    [DisplayName("修改发布状态")]
+    public async Task Publish(GoViewProPublishInput input)
+    {
+        await _goViewProRep.AsUpdateable()
+            .SetColumns(u => new GoViewPro
+            {
+                State = input.State
+            })
+            .Where(u => u.Id == input.Id)
+            .ExecuteCommandAsync();
+    }
+
+    /// <summary>
+    /// 获取项目数据
     /// </summary>
+    /// <param name="projectId"></param>
+    /// <returns></returns>
     [AllowAnonymous]
     [ApiDescriptionSettings(Name = "GetData")]
-    [DisplayName("获取项目")]
-    public async Task<ProjectDetailOutput> GetData([FromQuery] long projectId)
+    [DisplayName("获取项目数据")]
+    public async Task<GoViewProDetailOutput> GetData([FromQuery] long projectId)
     {
-        var projectData = await _goViewProjectDataRep.GetFirstAsync(u => u.Id == projectId);
+        var projectData = await _goViewProDataRep.GetFirstAsync(u => u.Id == projectId);
         if (projectData == null) return null;
 
-        var project = await _goViewProjectRep.GetFirstAsync(u => u.Id == projectId);
-
-        var projectDetail = project.Adapt<ProjectDetailOutput>();
+        var project = await _goViewProRep.GetFirstAsync(u => u.Id == projectId);
+        var projectDetail = project.Adapt<GoViewProDetailOutput>();
         projectDetail.Content = projectData.Content;
 
         return projectDetail;
     }
 
     /// <summary>
-    /// 保存项目
+    /// 保存项目数据
     /// </summary>
     [ApiDescriptionSettings(Name = "save/data")]
-    [DisplayName("保存项目")]
-    public async Task SaveData([FromForm] ProjectSaveDataInput input)
+    [DisplayName("保存项目数据")]
+    public async Task SaveData([FromForm] GoViewProSaveDataInput input)
     {
-        if (await _goViewProjectDataRep.IsAnyAsync(u => u.Id == input.ProjectId))
+        if (await _goViewProDataRep.IsAnyAsync(u => u.Id == input.ProjectId))
         {
-            await _goViewProjectDataRep.AsUpdateable()
-                .SetColumns(u => new GoViewProjectData
+            await _goViewProDataRep.AsUpdateable()
+                .SetColumns(u => new GoViewProData
                 {
                     Content = input.Content
                 })
@@ -93,7 +133,7 @@ public class ProjectService : IDynamicApiController
         }
         else
         {
-            await _goViewProjectDataRep.InsertAsync(new GoViewProjectData
+            await _goViewProDataRep.InsertAsync(new GoViewProData
             {
                 Id = input.ProjectId,
                 Content = input.Content,
@@ -101,52 +141,11 @@ public class ProjectService : IDynamicApiController
         }
     }
 
-    /// <summary>
-    /// 修改项目
-    /// </summary>
-    [DisplayName("修改项目")]
-    public async Task Edit(ProjectEditInput input)
-    {
-        // 前端只传修改的字段,更新时需要忽略空列
-        var project = await _goViewProjectRep.GetFirstAsync(u => u.Id == input.Id);
-        input.Adapt(project);
-        await _goViewProjectRep.AsUpdateable(project).IgnoreColumns(true).ExecuteCommandAsync();
-    }
-
-    /// <summary>
-    /// 删除项目
-    /// </summary>
-    [ApiDescriptionSettings(Name = "Delete")]
-    [DisplayName("删除项目")]
-    [UnitOfWork]
-    public async Task Delete([FromQuery] string ids)
-    {
-        var idList = ids.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(u => Convert.ToInt64(u)).ToList();
-        await _goViewProjectRep.AsDeleteable().Where(u => idList.Contains(u.Id)).ExecuteCommandAsync();
-        await _goViewProjectDataRep.AsDeleteable().Where(u => idList.Contains(u.Id)).ExecuteCommandAsync();
-    }
-
-    /// <summary>
-    /// 修改发布状态
-    /// </summary>
-    [HttpPut]
-    [DisplayName("修改发布状态")]
-    public async Task Publish(ProjectPublishInput input)
-    {
-        await _goViewProjectRep.AsUpdateable()
-            .SetColumns(u => new GoViewProject
-            {
-                State = input.State
-            })
-            .Where(u => u.Id == input.Id)
-            .ExecuteCommandAsync();
-    }
-
     /// <summary>
     /// 上传预览图
     /// </summary>
     [DisplayName("上传预览图")]
-    public async Task<ProjectUploadOutput> Upload(IFormFile @object)
+    public async Task<GoViewProUploadOutput> Upload(IFormFile @object)
     {
         /*
          * 前端逻辑(useSync.hook.ts 的 dataSyncUpdate 方法):
@@ -157,7 +156,7 @@ public class ProjectService : IDynamicApiController
         //文件名格式示例 13414795568325_index_preview.png
         var fileNameSplit = @object.FileName.Split('_');
         var idStr = fileNameSplit[0];
-        if (!long.TryParse(idStr, out var id)) return new ProjectUploadOutput();
+        if (!long.TryParse(idStr, out var id)) return new GoViewProUploadOutput();
 
         //将预览图转换成 Base64
         var ms = new MemoryStream();
@@ -165,10 +164,10 @@ public class ProjectService : IDynamicApiController
         var base64Image = Convert.ToBase64String(ms.ToArray());
 
         //保存
-        if (await _goViewProjectDataRep.IsAnyAsync(u => u.Id == id))
+        if (await _goViewProDataRep.IsAnyAsync(u => u.Id == id))
         {
-            await _goViewProjectDataRep.AsUpdateable()
-                .SetColumns(u => new GoViewProjectData
+            await _goViewProDataRep.AsUpdateable()
+                .SetColumns(u => new GoViewProData
                 {
                     IndexImageData = base64Image
                 })
@@ -177,14 +176,14 @@ public class ProjectService : IDynamicApiController
         }
         else
         {
-            await _goViewProjectDataRep.InsertAsync(new GoViewProjectData
+            await _goViewProDataRep.InsertAsync(new GoViewProData
             {
                 Id = id,
                 IndexImageData = base64Image,
             });
         }
 
-        var output = new ProjectUploadOutput
+        var output = new GoViewProUploadOutput
         {
             Id = id,
             BucketName = null,
@@ -238,11 +237,12 @@ public class ProjectService : IDynamicApiController
     /// </summary>
     /// <returns></returns>
     [AllowAnonymous]
+    [NonUnify]
     [ApiDescriptionSettings(Name = "GetIndexImage")]
     [DisplayName("获取预览图")]
     public async Task<IActionResult> GetIndexImage(long id)
     {
-        var projectData = await _goViewProjectDataRep.AsQueryable().IgnoreColumns(u => u.Content).FirstAsync(u => u.Id == id);
+        var projectData = await _goViewProDataRep.AsQueryable().IgnoreColumns(u => u.Content).FirstAsync(u => u.Id == id);
         if (projectData?.IndexImageData == null)
             return new NoContentResult();
 

+ 1 - 1
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/System/Dto/LoginInput.cs → Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/GoViewSys/Dto/GoViewLoginInput.cs

@@ -3,7 +3,7 @@
 /// <summary>
 /// 登录输入
 /// </summary>
-public class LoginInput
+public class GoViewLoginInput
 {
     /// <summary>
     /// 用户名

+ 15 - 16
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/System/Dto/LoginOutput.cs → Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/GoViewSys/Dto/GoViewLoginOutput.cs

@@ -3,45 +3,44 @@
 /// <summary>
 /// 登录输出
 /// </summary>
-public class LoginOutput
+public class GoViewLoginOutput
 {
     /// <summary>
-    /// 登录 token
+    /// 用户信息
     /// </summary>
-    public LoginToken Token { get; set; }
+    public GoViewLoginUserInfo Userinfo { get; set; }
 
     /// <summary>
-    /// 用户信息
+    /// Token
     /// </summary>
-    [JsonProperty("userinfo")]
-    public LoginUserInfo UserInfo { get; set; }
+    public GoViewLoginToken Token { get; set; }
 }
 
 /// <summary>
 /// 登录 Token
 /// </summary>
-public class LoginToken
+public class GoViewLoginToken
 {
     /// <summary>
-    /// token 值
+    /// Token 名
     /// </summary>
-    public string TokenValue { get; set; }
+    public string TokenName { get; set; } = "Authorization";
 
     /// <summary>
-    /// token key
+    /// Token 值
     /// </summary>
-    public string TokenName { get; set; } = "Authorization";
+    public string TokenValue { get; set; }
 }
 
 /// <summary>
 /// 用户信息
 /// </summary>
-public class LoginUserInfo
+public class GoViewLoginUserInfo
 {
     /// <summary>
-    /// 昵称
+    /// 用户 Id
     /// </summary>
-    public string Nickname { get; set; }
+    public string Id { get; set; }
 
     /// <summary>
     /// 用户名
@@ -49,7 +48,7 @@ public class LoginUserInfo
     public string Username { get; set; }
 
     /// <summary>
-    /// 用户 id
+    /// 昵称
     /// </summary>
-    public string Id { get; set; }
+    public string Nickname { get; set; }
 }

+ 17 - 0
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/GoViewSys/Dto/GoViewOssUrlOutput.cs

@@ -0,0 +1,17 @@
+namespace Admin.NET.Plugin.GoView.Service.Dto;
+
+/// <summary>
+/// 获取 OSS 上传接口输出
+/// </summary>
+public class GoViewOssUrlOutput
+{
+    /// <summary>
+    /// 桶名
+    /// </summary>
+    public string BucketName { get; set; }
+
+    /// <summary>
+    /// BucketURL 地址
+    /// </summary>
+    public string BucketURL { get; set; }
+}

+ 69 - 0
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/GoViewSys/GoViewSysService.cs

@@ -0,0 +1,69 @@
+namespace Admin.NET.Plugin.GoView.Service;
+
+/// <summary>
+/// 系统登录服务
+/// </summary>
+[UnifyProvider("GoView")]
+[ApiDescriptionSettings(GoViewConst.GroupName, Module = "goview", Name = "sys", Order = 500)]
+public class GoViewSysService : IDynamicApiController
+{
+    private readonly SysAuthService _sysAuthService;
+    private readonly SqlSugarRepository<SysUser> _sysUserRep;
+
+    public GoViewSysService(SysAuthService sysAuthService, SqlSugarRepository<SysUser> sysUserRep)
+    {
+        _sysAuthService = sysAuthService;
+        _sysUserRep = sysUserRep;
+    }
+
+    /// <summary>
+    /// GoView 登录
+    /// </summary>
+    /// <returns></returns>
+    [AllowAnonymous]
+    [DisplayName("GoView 登录")]
+    public async Task<GoViewLoginOutput> Login(GoViewLoginInput input)
+    {
+        var loginResult = await _sysAuthService.Login(new LoginInput()
+        {
+            Account = input.Username,
+            Password = input.Password,
+        });
+
+        var sysUser = await _sysUserRep.AsQueryable().Filter(null, true).FirstAsync(u => u.Account.Equals(input.Username));
+        return new GoViewLoginOutput()
+        {
+            Userinfo = new GoViewLoginUserInfo
+            {
+                Id = sysUser.Id.ToString(),
+                Username = sysUser.Account,
+                Nickname = sysUser.NickName,
+            },
+            Token = new GoViewLoginToken
+            {
+                TokenValue = $"Bearer {loginResult.AccessToken}"
+            }
+        };
+    }
+
+    /// <summary>
+    /// GoView 退出
+    /// </summary>
+    [DisplayName("GoView 退出")]
+    public void GetLogout()
+    {
+        _sysAuthService.Logout();
+    }
+
+    /// <summary>
+    /// 获取 OSS 上传接口
+    /// </summary>
+    /// <returns></returns>
+    [AllowAnonymous]
+    [ApiDescriptionSettings(Name = "GetOssInfo")]
+    [DisplayName("获取 OSS 上传接口")]
+    public Task<GoViewOssUrlOutput> GetOssInfo()
+    {
+        return Task.FromResult(new GoViewOssUrlOutput { BucketURL = "" });
+    }
+}

+ 0 - 13
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/System/Dto/OssUrlOutput.cs

@@ -1,13 +0,0 @@
-namespace Admin.NET.Plugin.GoView.Service.Dto;
-
-/// <summary>
-/// 获取 oss 上传接口输出
-/// </summary>
-public class OssUrlOutput
-{
-    /// <summary>
-    /// bucket 地址
-    /// </summary>
-    [JsonProperty("bucketURL")]
-    public string BucketUrl { get; set; }
-}

+ 0 - 74
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Service/System/SystemService.cs

@@ -1,74 +0,0 @@
-using LoginInput = Admin.NET.Plugin.GoView.Service.Dto.LoginInput;
-using LoginOutput = Admin.NET.Plugin.GoView.Service.Dto.LoginOutput;
-
-namespace Admin.NET.Plugin.GoView.Service;
-
-/// <summary>
-/// 系统登录服务
-/// </summary>
-[UnifyProvider("GoView")]
-[ApiDescriptionSettings(GoViewConst.GroupName, Module = "goview", Name = "sys", Order = 500)]
-public class SystemService : IDynamicApiController
-{
-    private readonly SysAuthService _sysAuthService;
-    private readonly SqlSugarRepository<SysUser> _userRep;
-
-    public SystemService(SysAuthService sysAuthService, SqlSugarRepository<SysUser> userRep)
-    {
-        _sysAuthService = sysAuthService;
-        _userRep = userRep;
-    }
-
-    /// <summary>
-    /// GoView 登录
-    /// </summary>
-    /// <returns></returns>
-    [AllowAnonymous]
-    [DisplayName("GoView 登录")]
-    public async Task<LoginOutput> Login(LoginInput input)
-    {
-        var loginResult = await _sysAuthService.Login(new Core.Service.LoginInput()
-        {
-            Account = input.Username,
-            Password = input.Password,
-        });
-
-        var user = await _userRep.AsQueryable().Includes(t => t.SysOrg).Filter(null, true).FirstAsync(u => u.Account.Equals(input.Username));
-
-        return new LoginOutput()
-        {
-            UserInfo = new LoginUserInfo
-            {
-                Id = user.Id + "",
-                Username = user.Account,
-                Nickname = user.NickName,
-            },
-            Token = new LoginToken
-            {
-                TokenValue = $"Bearer {loginResult.AccessToken}",
-            }
-        };
-    }
-
-    /// <summary>
-    /// GoView 退出
-    /// </summary>
-    [HttpGet]
-    [DisplayName("GoView 退出")]
-    public void Logout()
-    {
-        _sysAuthService.Logout();
-    }
-
-    /// <summary>
-    /// 获取 OSS 上传接口
-    /// </summary>
-    /// <returns></returns>
-    [AllowAnonymous]
-    [ApiDescriptionSettings(Name = "GetOssInfo")]
-    [DisplayName("获取 OSS 上传接口")]
-    public Task<OssUrlOutput> GetOssInfo()
-    {
-        return Task.FromResult(new OssUrlOutput { BucketUrl = "" });
-    }
-}

+ 9 - 27
Admin.NET/Plugins/Admin.NET.Plugin.GoView/Util/GoViewResultProvider.cs

@@ -76,34 +76,23 @@ public class GoViewResultProvider : IUnifyResultProvider
     /// <param name="data"></param>
     /// <param name="errors"></param>
     /// <returns></returns>
-    private static GoViewResult RESTfulResult(int statusCode, bool succeeded = default, object data = default, object errors = default)
+    private static GoViewResult<object> RESTfulResult(int statusCode, bool succeeded = default, object data = default, object errors = default)
     {
-        if (data == null)
+        return new GoViewResult<object>
         {
-            return new GoViewResult
-            {
-                Code = statusCode,
-                Msg = errors is null or string ? (errors + "") : JSON.Serialize(errors),
-            };
-        }
-        else
-        {
-            var parseCount = int.TryParse(UnifyContext.Take() + "", out var count);
-            return new GoViewResult<object>
-            {
-                Code = statusCode,
-                Msg = errors is null or string ? (errors + "") : JSON.Serialize(errors),
-                Data = data,
-                Count = parseCount ? count : null,
-            };
-        }
+            Code = statusCode,
+            Msg = errors is null or string ? (errors + "") : JSON.Serialize(errors),
+            Data = data,
+            Count = data != null && data.GetType().IsGenericType && data.GetType().GetGenericTypeDefinition() == typeof(List<>) ? ((IList)data).Count : null
+        };
     }
 }
 
 /// <summary>
 /// GoView 返回结果
 /// </summary>
-public class GoViewResult
+/// <typeparam name="T"></typeparam>
+public class GoViewResult<T>
 {
     /// <summary>
     /// 状态码
@@ -114,14 +103,7 @@ public class GoViewResult
     /// 信息
     /// </summary>
     public string Msg { get; set; }
-}
 
-/// <summary>
-/// GoView 返回结果
-/// </summary>
-/// <typeparam name="T"></typeparam>
-public class GoViewResult<T> : GoViewResult
-{
     /// <summary>
     /// 数据
     /// </summary>