优化代码

This commit is contained in:
不做码农 2022-09-14 21:49:04 +08:00
parent c372c9a9e2
commit 875ebac95c
3 changed files with 7 additions and 6 deletions

View File

@ -48,7 +48,7 @@ namespace ZR.Admin.WebApi.Controllers
public IActionResult Index()
{
return Ok("看到这里页面说明你已经成功启动了本项目:)\n\n" +
"如果觉得项目有用,打赏作者喝杯咖啡作为奖励\n☛☛http://www.izhaorui.cn/doc\n");
"如果觉得项目有用,打赏作者喝杯咖啡作为奖励\n☛☛http://www.izhaorui.cn/doc/support.html\n");
}
/// <summary>

View File

@ -227,9 +227,11 @@ namespace ZR.Admin.WebApi.Controllers
[ActionPermissionFilter(Permission = "tool:gen:preview")]
public IActionResult Preview(long tableId = 0, int VueVersion = 0)
{
GenerateDto dto = new();
dto.TableId = tableId;
dto.VueVersion = VueVersion;
GenerateDto dto = new()
{
TableId = tableId,
VueVersion = VueVersion
};
if (dto == null || dto.TableId <= 0)
{
throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空");

View File

@ -21,8 +21,7 @@ namespace ZR.Admin.WebApi.Extensions
var url = $"{httpReq.Scheme}://{httpReq.Host.Value}";
var referer = httpReq.Headers["Referer"].ToString();
if (referer.Contains(GlobalConstant.DevApiProxy))
url = referer.Substring(0,
referer.IndexOf(GlobalConstant.DevApiProxy, StringComparison.InvariantCulture) + GlobalConstant.DevApiProxy.Length - 1);
url = referer[..(referer.IndexOf(GlobalConstant.DevApiProxy, StringComparison.InvariantCulture) + GlobalConstant.DevApiProxy.Length - 1)];
swaggerDoc.Servers =
new List<OpenApiServer>
{