feat: 增加更改系统运行模式接口便于维护系统

#Comment
comment 网页直接敲命令即可更改演示模式
api/Admin?salt=BootstrapAdmin-Salt&model=1&authCode=ucct
This commit is contained in:
Argo Zhang (Win) 2019-08-09 14:12:35 +08:00
parent 6476146148
commit e4aad63bd8
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
using Microsoft.AspNetCore.Mvc;
namespace Bootstrap.Client.Controllers
{
/// <summary>
/// 运维管理接口
/// </summary>
[Route("api/[controller]")]
[ApiController]
public class AdminController : ControllerBase
{
/// <summary>
/// 更改系统运行模式 1 为演示模式 0 为正常模式
/// </summary>
[HttpGet]
public bool Get([FromQuery]string authCode, string salt, int model)
{
var ret = false;
// 检查授权
if (Longbow.Security.Cryptography.LgbCryptography.ComputeHash(authCode, salt) == "3lpCnRu7qqiAbIrx7gNRUB0mPXgJC3wGoyPJED3KeoA=")
{
using (var db = Longbow.Data.DbManager.Create("ba"))
{
db.Execute("Update Dicts Set Code = @0 Where Category = @1 and Name = @2", model, "系统设置", "演示系统");
}
ret = true;
}
return ret;
}
}
}