mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2025-04-23 20:39:36 +08:00
更新 UserDaily API
This commit is contained in:
parent
6e6ad0b14c
commit
46d1d64e1c
@ -3,6 +3,8 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Milimoe.FunGame.Core.Api.Utility;
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
using Oshima.Core.Configs;
|
||||
using Oshima.Core.Models;
|
||||
using Oshima.Core.Utils;
|
||||
|
||||
namespace Oshima.Core.Controllers
|
||||
@ -74,5 +76,11 @@ namespace Oshima.Core.Controllers
|
||||
{
|
||||
return NetworkUtility.JsonSerialize($"Your Name received successfully: {name}.");
|
||||
}
|
||||
|
||||
[HttpPost("bind")]
|
||||
public string Post([FromBody] BindQQ b)
|
||||
{
|
||||
return NetworkUtility.JsonSerialize("绑定失败,请稍后再试。");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
19
OshimaCore/Controllers/TestController.cs
Normal file
19
OshimaCore/Controllers/TestController.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Milimoe.FunGame.Core.Api.Utility;
|
||||
|
||||
namespace Oshima.Core.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class TestController(ILogger<TestController> logger) : ControllerBase
|
||||
{
|
||||
private readonly ILogger<TestController> _logger = logger;
|
||||
|
||||
[HttpGet("gethmacsha512")]
|
||||
public string UseHMACSHA512(string msg, string key)
|
||||
{
|
||||
return msg.Encrypt(key);
|
||||
}
|
||||
}
|
||||
}
|
@ -13,19 +13,19 @@ namespace Oshima.Core.Controllers
|
||||
{
|
||||
private readonly ILogger<UserDailyController> _logger = logger;
|
||||
|
||||
[HttpGet("{user_id}", Name = "GetUserDaily")]
|
||||
[HttpPost("get/{user_id}", Name = "GetUserDaily")]
|
||||
public UserDaily Get(long user_id)
|
||||
{
|
||||
return UserDailyUtil.GetUserDaily(user_id);
|
||||
}
|
||||
|
||||
[HttpGet("v/{user_id}", Name = "ViewUserDaily")]
|
||||
[HttpGet("view/{user_id}", Name = "ViewUserDaily")]
|
||||
public UserDaily View(long user_id)
|
||||
{
|
||||
return UserDailyUtil.ViewUserDaily(user_id);
|
||||
}
|
||||
|
||||
[HttpGet("open/{open_id}", Name = "GetOpenUserDaily")]
|
||||
[HttpPost("open/{open_id}", Name = "GetOpenUserDaily")]
|
||||
public UserDaily Open(string open_id)
|
||||
{
|
||||
if (QQOpenID.QQAndOpenID.TryGetValue(open_id, out long qq) && qq != 0)
|
||||
@ -35,7 +35,7 @@ namespace Oshima.Core.Controllers
|
||||
return new(0, 0, "你似乎没有绑定QQ呢,请先发送【绑定+QQ号】(如:绑定123456789)再使用哦!");
|
||||
}
|
||||
|
||||
[HttpGet("r/{user_id}", Name = "RemoveUserDaily")]
|
||||
[HttpPost("remove/{user_id}", Name = "RemoveUserDaily")]
|
||||
public string Remove(long user_id)
|
||||
{
|
||||
return UserDailyUtil.RemoveDaily(user_id);
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Milimoe.FunGame.Core.Library.Common.Addon;
|
||||
using Milimoe.FunGame.Core.Library.Exception;
|
||||
using Oshima.Core.Configs;
|
||||
using Oshima.Core.Utils;
|
||||
using Oshima.FunGame.OshimaModules;
|
||||
@ -22,7 +21,7 @@ namespace Oshima.Core.WebAPI
|
||||
if (input.Length >= 4 && input[..4].Equals(".osm", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
//MasterCommand.Execute(read, GeneralSettings.Master, false, GeneralSettings.Master, false);
|
||||
WriteLine("试图使用 .osm 指令:" + input);
|
||||
Controller.WriteLine("试图使用 .osm 指令:" + input);
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,8 +58,9 @@ namespace Oshima.Core.WebAPI
|
||||
// 清空运势
|
||||
Daily.ClearDaily();
|
||||
Console.ForegroundColor = ConsoleColor.Magenta;
|
||||
Console.WriteLine("已重置所有人的今日运势。");
|
||||
Console.WriteLine("\r已重置所有人的今日运势。");
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Console.Write("\r> ");
|
||||
}
|
||||
if (now.Hour == 0 && now.Minute == 1)
|
||||
{
|
||||
@ -71,31 +71,12 @@ namespace Oshima.Core.WebAPI
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine(e);
|
||||
Console.WriteLine("\r" + e);
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Console.Write("\r> ");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected override bool BeforeLoad(params object[] objs)
|
||||
{
|
||||
if (objs.Length > 0 && objs[0] is Dictionary<string, object> delegates)
|
||||
{
|
||||
if (delegates.TryGetValue("WriteLine", out object? value) && value is Action<string> a)
|
||||
{
|
||||
WriteLine = a;
|
||||
}
|
||||
if (delegates.TryGetValue("Error", out value) && value is Action<Exception> e)
|
||||
{
|
||||
Error = e;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public Action<string> WriteLine { get; set; } = new Action<string>(Console.WriteLine);
|
||||
public Action<Exception> Error { get; set; } = new Action<Exception>(e => Console.WriteLine(e.GetErrorInfo()));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user