This commit is contained in:
2026-07-15 23:04:46 +08:00
parent 4ef892e15e
commit c94b3ce200
28 changed files with 562 additions and 10 deletions

View File

@@ -0,0 +1,89 @@
using Microsoft.AspNetCore.Mvc;
namespace Application.Web.Admin.Controllers;
public class AccMoneyController : Controller
{
private readonly IUnitUserAccService _accService;
private readonly IUnitUserService _userService;
private readonly IMessageService _messageService;
public AccMoneyController(IUnitUserAccService accService, IUnitUserService userService,
IMessageService messageService)
{
_accService = accService;
_userService = userService;
_messageService = messageService;
}
// GET
public IActionResult Index()
{
return View();
}
[HttpPost]
public async Task<IActionResult> UpAcc(string u, long c, string t, string r, string p)
{
string url = "/AccMoney/Index";
var user = await _userService.GetUserInfoByUserNo(u);
if (user == null)
{
TempData["msg"] = "用户不存在!";
return Redirect(url);
}
if (await _accService.UpdateUserAccBath(user.userId, 1, t, c, p, r))
{
TempData["msg"] = "发放成功!";
string accName = GetCurrName(t);
string msg =$"亲爱的玩家,您的【{accName}】账户有变动,账户额度+{c},备注:[{r}];祝您驰骋四海,纵横天下!";
await _messageService.SendMaill(user.userId, "账户操作通知", msg, new List<TowerGet>());
return Redirect(url);
}
else
{
TempData["msg"] = "发放失败!";
return Redirect(url);
}
}
public static string GetCurrName(string accType)
{
string result = string.Empty;
switch (accType)
{
case "copper":
result = "铜贝";
break;
case "cowry":
result = "金贝";
break;
case "gold":
result = "金元";
break;
case "teach":
result = "师德";
break;
case "renown":
result = "声望";
break;
case "charm":
result = "魅力";
break;
case "enemy":
result = "罪恶值";
break;
}
return result;
}
}

View File

@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
namespace Application.Web.Admin.Controllers;
public class IndexController : Controller
{
// GET
public IActionResult Index()
{
return View();
}
}

View File

@@ -0,0 +1,97 @@
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace Application.Web.Admin.Controllers;
public class SendMailController : Controller
{
private readonly IMessageService _messageService;
private readonly IGameGoodsService _goodsService;
private readonly IUnitUserService _userService;
public SendMailController(IMessageService messageService,IGameGoodsService goodsService,IUnitUserService userService)
{
_messageService = messageService;
_goodsService = goodsService;
_userService = userService;
}
// GET
public IActionResult Index()
{
return View();
}
[HttpPost]
public async Task<IActionResult> Send(string id, string name, string sign, string awData, int goods, int count, string remark, int type)
{
string url = "/SendMail/Index";
List<TowerGet> award = new List<TowerGet>();
if (string.IsNullOrEmpty(awData))
{
if (goods != 0)
{
var goodsInfo = await _goodsService.GetGoodsInfo(goods);
if (goodsInfo == null)
{
TempData["msg"] = "物品不存在!";
return Redirect(url);
}
TowerGet add = new TowerGet();
add.code = GameEnum.PropCode.Goods.ToString();
add.name = goodsInfo.goodsName;
add.parameter = goods.ToString();
add.count = count;
award.Add(add);
}
}
else
{
award = JsonConvert.DeserializeObject<List<TowerGet>>(awData);
}
int index = 0;
List<string> users = new List<string>();
if (type == 0)
{
string[] ids = id.Split(',');
foreach (string item in ids)
{
var userInfo = await _userService.GetUserInfoByUserNo(item.Trim());
if (userInfo == null)
{
continue;
}
index++;
users.Add(userInfo.userId);
}
}
else if (type == 1)
{
DateTime time = TimeAssist.GetDateTimeYMD(0);
var data = await _userService.GetOnlineUserByTime(TimeExtend.GetTimeStampBySeconds(time));
foreach (var item in data)
{
users.Add(item.userId);
index++;
}
}
else
{
var data = await _userService.GetOnlineUserByTime(0);
foreach (var item in data)
{
users.Add(item.userId);
index++;
}
}
if (await _messageService.SendMaill(users, name, sign, award))
{
TempData["msg"] = string.Format("发放成功,共完成{0}个!", index);
return Redirect(url);
}
else
{
TempData["msg"] = "发放失败!";
return Redirect(url);
}
}
}