mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2025-12-05 08:09:04 +00:00
添加了权限
This commit is contained in:
parent
aa3b923a6f
commit
d6d7beaa6f
@ -2783,7 +2783,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
|||||||
FunGameService.SetUserConfigAndReleaseSemaphoreSlim(userid, pc, user);
|
FunGameService.SetUserConfigAndReleaseSemaphoreSlim(userid, pc, user);
|
||||||
|
|
||||||
string msg = "";
|
string msg = "";
|
||||||
if (user.IsAdmin || userid > 0)
|
if (user.IsAdmin)
|
||||||
{
|
{
|
||||||
PluginConfig pc2 = FunGameService.GetUserConfig(targetid, out _);
|
PluginConfig pc2 = FunGameService.GetUserConfig(targetid, out _);
|
||||||
if (pc2.Count > 0)
|
if (pc2.Count > 0)
|
||||||
|
|||||||
@ -187,8 +187,19 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
if (e.Detail.StartsWith("添加公告"))
|
if (e.Detail.StartsWith("添加公告"))
|
||||||
{
|
{
|
||||||
e.UseNotice = false;
|
e.UseNotice = false;
|
||||||
|
string author = "FunGame";
|
||||||
|
FunGameConstant.UserIdAndUsername.TryGetValue(uid, out User? user);
|
||||||
|
if (user is null || (!user.IsAdmin && !user.IsOperator))
|
||||||
|
{
|
||||||
|
await SendAsync(e, "公告", "你没有权限使用此指令。");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
author = user.Username;
|
||||||
|
}
|
||||||
string detail = e.Detail.Replace("添加公告", "").Trim();
|
string detail = e.Detail.Replace("添加公告", "").Trim();
|
||||||
string[] strings = detail.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
|
string[] strings = detail.Split(["\r\n", "\r", "\n"], StringSplitOptions.RemoveEmptyEntries);
|
||||||
string title = $"#Unknown";
|
string title = $"#Unknown";
|
||||||
if (strings.Length > 1)
|
if (strings.Length > 1)
|
||||||
{
|
{
|
||||||
@ -210,11 +221,6 @@ namespace Oshima.FunGame.WebAPI.Services
|
|||||||
}
|
}
|
||||||
detail = strings[0].Trim();
|
detail = strings[0].Trim();
|
||||||
}
|
}
|
||||||
string author = "FunGame";
|
|
||||||
if (FunGameConstant.UserIdAndUsername.TryGetValue(uid, out User? user) && user != null)
|
|
||||||
{
|
|
||||||
author = user.Username;
|
|
||||||
}
|
|
||||||
FunGameService.Notices.Add(title, new NoticeModel()
|
FunGameService.Notices.Add(title, new NoticeModel()
|
||||||
{
|
{
|
||||||
Title = title,
|
Title = title,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user