|
|
@@ -2,6 +2,7 @@ using molilian.core;
|
|
|
using dodohold.core;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using System.Text.Json;
|
|
|
+using System.Net;
|
|
|
namespace molilian.api.Controllers
|
|
|
{
|
|
|
[ApiController]
|
|
|
@@ -29,6 +30,45 @@ namespace molilian.api.Controllers
|
|
|
}
|
|
|
|
|
|
|
|
|
+ [HttpPost]
|
|
|
+ public async Task<ActionResult> update([FromBody] JsonElement form)
|
|
|
+ {
|
|
|
+ int id = form.Read<int>("id", 0);
|
|
|
+ string name = form.Read<string>("name", string.Empty);
|
|
|
+ string val = form.Read<string>("val", string.Empty);
|
|
|
+
|
|
|
+ if (id == 0)
|
|
|
+ {
|
|
|
+ return new APIResult(new { data = new { success = false, msg = "更新失败,请检查输入的cookie" } });
|
|
|
+ }
|
|
|
+
|
|
|
+ int result = 0;
|
|
|
+ switch (name)
|
|
|
+ {
|
|
|
+ case "enable_fake_click":
|
|
|
+ case "status":
|
|
|
+ bool bVal = val.Equals("True");
|
|
|
+ result = new DBContext.Table("tk_pool")
|
|
|
+ .Add(name, bVal)
|
|
|
+ .Add("last_time", DateTime.Now)
|
|
|
+ .Where("id=@id", new { id })
|
|
|
+ .Update();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return new APIResult(new { data = new { success = false, msg = "更新失败,未授权操作" } });
|
|
|
+ }
|
|
|
+
|
|
|
+ TkPoolCore.Refresh();
|
|
|
+
|
|
|
+ bool success = result > 0;
|
|
|
+
|
|
|
+ return new APIResult(new
|
|
|
+ {
|
|
|
+ data = new { success, msg = success ? "更新成功" : "更新失败,请检查输入信息" },
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 账号列表
|
|
|
/// </summary>
|