Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliang-wt committed Jun 12, 2022
2 parents 9149112 + 8030d35 commit af5e535
Show file tree
Hide file tree
Showing 68 changed files with 1,540 additions and 132 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## v6.x.x

##6.2.3(2022-6-12)
* **新增:** QuartzRepeatAttribute增加了DelaySeconds参数,可以控制延迟多少秒启动服务
* **修改:** 恢复LoginUserInfo中的UserId以兼容老系统
* **修改:** 修复Layui模式下Combobox处理默认值的问题
* **修改:** 修复登录时Token会加长的问题
* **修改:** 现在DoEdit方法会自动检查继承TreePoco的模型,其父级ID不能被修改为本身ID
* **修改:** 增加了一些验证,避免中间件报错,提高性能

##6.2.2(2022-6-7)
* **HotFix:** 修复附件上传问题

Expand Down Expand Up @@ -78,10 +86,17 @@

## v5.x.x

##5.9.3(2022-6-12)
* **新增:** QuartzRepeatAttribute增加了DelaySeconds参数,可以控制延迟多少秒启动服务
* **修改:** 恢复LoginUserInfo中的UserId以兼容老系统
* **修改:** 修复Layui模式下Combobox处理默认值的问题
* **修改:** 修复登录时Token会加长的问题
* **修改:** 现在DoEdit方法会自动检查继承TreePoco的模型,其父级ID不能被修改为本身ID
* **修改:** 增加了一些验证,避免中间件报错,提高性能

##5.9.2(2022-6-7)
* **HotFix:** 修复附件上传问题


##5.9.1(2022-6-7)

* **新增:** 新增CanNotEditAttribute,用于标记在模型属性上,指明该字段不应该被修改。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

protected override async Task OnInitializedAsync()
{
AllParents = await WtmBlazor.Api.CallItemsApi("/api/_FrameworkUser/GetFrameworkRoles", placeholder: WtmBlazor.Localizer["Sys.PleaseSelect"]);
AllParents = await WtmBlazor.Api.CallItemsApi("/api/_account/GetFrameworkRoles", placeholder: WtmBlazor.Localizer["Sys.PleaseSelect"]);
}

private async Task Submit(EditContext context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

protected override async Task OnInitializedAsync()
{
AllParents = await WtmBlazor.Api.CallItemsApi("/api/_FrameworkUser/GetFrameworkRoles", placeholder: WtmBlazor.Localizer["Sys.PleaseSelect"]);
AllParents = await WtmBlazor.Api.CallItemsApi("/api/_account/GetFrameworkRoles", placeholder: WtmBlazor.Localizer["Sys.PleaseSelect"]);
var rv = await WtmBlazor.Api.CallAPI<FrameworkTenantVM>($"/api/_FrameworkTenant/{id}");
Model = rv.Data;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

protected override async Task OnInitializedAsync()
{
AllParents = await WtmBlazor.Api.CallItemsApi("/api/_FrameworkUser/GetFrameworkRoles", placeholder: WtmBlazor.Localizer["Sys.PleaseSelect"]);
AllParents = await WtmBlazor.Api.CallItemsApi("/api/_account/GetFrameworkRoles", placeholder: WtmBlazor.Localizer["Sys.PleaseSelect"]);
var rv = await WtmBlazor.Api.CallAPI<FrameworkTenantVM>($"/api/_FrameworkTenant/{id}");
Model = rv.Data;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public override void AfterDoSearcher()
Dictionary<string, string> groupdata = new Dictionary<string, string>();
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
var dd = Wtm.CallAPI<List<ComboSelectListItem>>("mainhost", "/api/_frameworkuser/GetFrameworkGroups").Result;
var dd = Wtm.CallAPI<List<ComboSelectListItem>>("mainhost", "/api/_account/GetFrameworkGroups").Result;
if(dd.Data != null)
{
foreach (var item in dd.Data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public override void Validate()
string user = null;
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
var check = Wtm.CallAPI<List<ComboSelectListItem>>("mainhost", "/api/_frameworkuser/GetUserById").Result;
var check = Wtm.CallAPI<List<ComboSelectListItem>>("mainhost", "/api/_account/GetUserById").Result;
if (check.Data != null)
{
user = check.Data.Where(x => x.Value.ToString() == Entity.UserCode).Select(x => x.Value.ToString()).FirstOrDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ namespace WalkingTec.Mvvm.Admin.Api
[AllRights]
public class AccountController : BaseApiController
{
private readonly ILogger _logger;
private readonly ITokenService _authService;
public AccountController(
ILogger<AccountController> logger,
ITokenService authService)
{
_logger = logger;
_authService = authService;
}

[AllowAnonymous]
[HttpPost("[action]")]
Expand Down Expand Up @@ -211,6 +202,79 @@ public async Task<IActionResult> Logout()
}
}

[HttpGet("GetFrameworkRoles")]
[ActionDescription("GetRoles")]
[AllRights]
public IActionResult GetFrameworkRoles()
{
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
return Request.RedirectCall(Wtm, "/api/_account/GetFrameworkRoles").Result;
}
return Ok(DC.Set<FrameworkRole>().GetSelectListItems(Wtm, x => x.RoleName, x => x.RoleCode));
}

[HttpGet("GetFrameworkGroups")]
[ActionDescription("GetGroups")]
[AllRights]
public IActionResult GetFrameworkGroups()
{
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
return Request.RedirectCall(Wtm, "/api/_account/GetFrameworkGroups").Result;
}
return Ok(DC.Set<FrameworkGroup>().GetSelectListItems(Wtm, x => x.GroupName, x => x.GroupCode));
}

[HttpGet("GetFrameworkGroupsTree")]
[ActionDescription("GetGroupsTree")]
[AllRights]
public IActionResult GetFrameworkGroupsTree()
{
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
return Request.RedirectCall(Wtm, "/api/_account/GetFrameworkGroupsTree").Result;
}
return Ok(DC.Set<FrameworkGroup>().GetTreeSelectListItems(Wtm, x => x.GroupName, x => x.GroupCode));
}


[HttpGet("GetUserById")]
[AllRights]
public IActionResult GetUserById(string keywords)
{
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
return Request.RedirectCall(Wtm, "/api/_account/GetUserById").Result;
}
var users = DC.Set<FrameworkUser>().Where(x => x.ITCode.ToLower().StartsWith(keywords.ToLower())).GetSelectListItems(Wtm, x => x.Name + "(" + x.ITCode + ")", x => x.ITCode);
return Ok(users);
}

[HttpGet("GetUserByGroup")]
[AllRights]
public IActionResult GetUserByGroup(string keywords)
{
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
return Request.RedirectCall(Wtm, "/api/_account/GetUserByGroup").Result;
}
var users = DC.Set<FrameworkUserGroup>().Where(x => x.GroupCode == keywords).Select(x => x.UserCode).ToList();
return Ok(users);
}

[HttpGet("GetUserByRole")]
[AllRights]
public IActionResult GetUserByRole(string keywords)
{
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
return Request.RedirectCall(Wtm, "/api/_account/GetUserByRole").Result;
}
var users = DC.Set<FrameworkUserRole>().Where(x => x.RoleCode == keywords).Select(x => x.UserCode).ToList();
return Ok(users);
}

}

public class SimpleLogin
Expand Down
2 changes: 1 addition & 1 deletion demo/WalkingTec.Mvvm.ConsoleDemo/JobTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace WalkingTec.Mvvm.ConsoleDemo
{
[QuartzRepeat(5,0,true)]
[QuartzRepeat(5,0,true,30)]
public class JobTest : WtmJob
{
public override Task Execute(IJobExecutionContext context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ namespace WalkingTec.Mvvm.Admin.Api
[AllRights]
public class AccountController : BaseApiController
{
private readonly ILogger _logger;
private readonly ITokenService _authService;
public AccountController(
ILogger<AccountController> logger,
ITokenService authService)
{
_logger = logger;
_authService = authService;
}

[AllowAnonymous]
[HttpPost("[action]")]
Expand Down Expand Up @@ -211,6 +202,79 @@ public async Task<IActionResult> Logout()
}
}

[HttpGet("GetFrameworkRoles")]
[ActionDescription("GetRoles")]
[AllRights]
public IActionResult GetFrameworkRoles()
{
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
return Request.RedirectCall(Wtm, "/api/_account/GetFrameworkRoles").Result;
}
return Ok(DC.Set<FrameworkRole>().GetSelectListItems(Wtm, x => x.RoleName, x => x.RoleCode));
}

[HttpGet("GetFrameworkGroups")]
[ActionDescription("GetGroups")]
[AllRights]
public IActionResult GetFrameworkGroups()
{
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
return Request.RedirectCall(Wtm, "/api/_account/GetFrameworkGroups").Result;
}
return Ok(DC.Set<FrameworkGroup>().GetSelectListItems(Wtm, x => x.GroupName, x => x.GroupCode));
}

[HttpGet("GetFrameworkGroupsTree")]
[ActionDescription("GetGroupsTree")]
[AllRights]
public IActionResult GetFrameworkGroupsTree()
{
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
return Request.RedirectCall(Wtm, "/api/_account/GetFrameworkGroupsTree").Result;
}
return Ok(DC.Set<FrameworkGroup>().GetTreeSelectListItems(Wtm, x => x.GroupName, x => x.GroupCode));
}


[HttpGet("GetUserById")]
[AllRights]
public IActionResult GetUserById(string keywords)
{
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
return Request.RedirectCall(Wtm, "/api/_account/GetUserById").Result;
}
var users = DC.Set<FrameworkUser>().Where(x => x.ITCode.ToLower().StartsWith(keywords.ToLower())).GetSelectListItems(Wtm, x => x.Name + "(" + x.ITCode + ")", x => x.ITCode);
return Ok(users);
}

[HttpGet("GetUserByGroup")]
[AllRights]
public IActionResult GetUserByGroup(string keywords)
{
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
return Request.RedirectCall(Wtm, "/api/_account/GetUserByGroup").Result;
}
var users = DC.Set<FrameworkUserGroup>().Where(x => x.GroupCode == keywords).Select(x => x.UserCode).ToList();
return Ok(users);
}

[HttpGet("GetUserByRole")]
[AllRights]
public IActionResult GetUserByRole(string keywords)
{
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
return Request.RedirectCall(Wtm, "/api/_account/GetUserByRole").Result;
}
var users = DC.Set<FrameworkUserRole>().Where(x => x.RoleCode == keywords).Select(x => x.UserCode).ToList();
return Ok(users);
}

}

public class SimpleLogin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public async Task<IActionResult> GetFile([FromServices] WtmFileProvider fp, stri
}
var ms = new MemoryStream();
oimage.Mutate(x => x.Resize(width.Value, height.Value));
oimage.SaveAsJpeg(ms);
ms.Position = 0;
await ms?.CopyToAsync(Response.Body);
file.DataStream.Dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public ActionResult Enable(Guid id, bool enable)
[AllRights]
public ActionResult GetUserById(string keywords)
{
WalkingTec.Mvvm.Admin.Api.FrameworkUserController userapi = new Mvvm.Admin.Api.FrameworkUserController();
WalkingTec.Mvvm.Admin.Api.AccountController userapi = new WalkingTec.Mvvm.Admin.Api.AccountController();
userapi.Wtm = Wtm;
var rv = userapi.GetUserById(keywords) as OkObjectResult;
List<ComboSelectListItem> users = new List<ComboSelectListItem>();
Expand Down Expand Up @@ -369,7 +369,7 @@ public IActionResult ExportExcel(FrameworkUserListVM vm)
[AllRights]
public IActionResult GetFrameworkRoles()
{
WalkingTec.Mvvm.Admin.Api.FrameworkUserController userapi = new Mvvm.Admin.Api.FrameworkUserController();
WalkingTec.Mvvm.Admin.Api.AccountController userapi = new WalkingTec.Mvvm.Admin.Api.AccountController();
userapi.Wtm = Wtm;
var rv = userapi.GetFrameworkRoles() as OkObjectResult;
List<ComboSelectListItem> users = new List<ComboSelectListItem>();
Expand All @@ -387,7 +387,7 @@ public IActionResult GetFrameworkRoles()
[AllRights]
public IActionResult GetFrameworkGroups()
{
WalkingTec.Mvvm.Admin.Api.FrameworkUserController userapi = new Mvvm.Admin.Api.FrameworkUserController();
WalkingTec.Mvvm.Admin.Api.AccountController userapi = new WalkingTec.Mvvm.Admin.Api.AccountController();
userapi.Wtm = Wtm;
var rv = userapi.GetFrameworkGroupsTree() as OkObjectResult;
List<TreeSelectListItem> users = new List<TreeSelectListItem>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public override void AfterDoSearcher()
Dictionary<string, string> groupdata = new Dictionary<string, string>();
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
var dd = Wtm.CallAPI<List<ComboSelectListItem>>("mainhost", "/api/_frameworkuser/GetFrameworkGroups").Result;
var dd = Wtm.CallAPI<List<ComboSelectListItem>>("mainhost", "/api/_account/GetFrameworkGroups").Result;
if(dd.Data != null)
{
foreach (var item in dd.Data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public override void Validate()
string user = null;
if (ConfigInfo.HasMainHost && Wtm.LoginUserInfo?.CurrentTenant == null)
{
var check = Wtm.CallAPI<List<ComboSelectListItem>>("mainhost", "/api/_frameworkuser/GetUserById").Result;
var check = Wtm.CallAPI<List<ComboSelectListItem>>("mainhost", "/api/_account/GetUserById").Result;
if (check.Data != null)
{
user = check.Data.Where(x => x.Value.ToString() == Entity.UserCode).Select(x => x.Value.ToString()).FirstOrDefault();
Expand Down
6 changes: 4 additions & 2 deletions demo/WalkingTec.Mvvm.Demo/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"Console": {
"IncludeScopes": true,
"LogLevel": {
"Default": "Information"
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Debug": {
Expand Down Expand Up @@ -37,7 +39,7 @@
//}
],
"CookiePre": "WTMa", //cookie前缀
"IsQuickDebug": true, //是否启用debug模式
"IsQuickDebug": false, //是否启用debug模式
"EnableTenant": true, //是否启动多租户
"SyncDb": true, //是否自动同步数据库
"EncryptKey": "", //加密密钥
Expand Down
Loading

0 comments on commit af5e535

Please sign in to comment.