23123
This commit is contained in:
25
Application.Web.Admin/Application.Web.Admin.csproj
Normal file
25
Application.Web.Admin/Application.Web.Admin.csproj
Normal file
@@ -0,0 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="applicationsettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Service\Application.Domain.Entity\Application.Domain.Entity.csproj" />
|
||||
<ProjectReference Include="..\Service\Application.Domain\Application.Domain.csproj" />
|
||||
<ProjectReference Include="..\Service\Application.Service.Pub\Application.Service.Pub.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Areas\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
89
Application.Web.Admin/Controllers/AccMoneyController.cs
Normal file
89
Application.Web.Admin/Controllers/AccMoneyController.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
12
Application.Web.Admin/Controllers/IndexController.cs
Normal file
12
Application.Web.Admin/Controllers/IndexController.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Application.Web.Admin.Controllers;
|
||||
|
||||
public class IndexController : Controller
|
||||
{
|
||||
// GET
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
97
Application.Web.Admin/Controllers/SendMailController.cs
Normal file
97
Application.Web.Admin/Controllers/SendMailController.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Application.Web.Admin/GlobalUsing.cs
Normal file
13
Application.Web.Admin/GlobalUsing.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
global using Photon.Core;
|
||||
global using Photon.Core.Jwt;
|
||||
global using Photon.Core.Services;
|
||||
global using Photon.Core.SqlSugar;
|
||||
global using Photon.Core.Assist;
|
||||
global using Photon.Core.Timer;
|
||||
global using SqlSugar;
|
||||
|
||||
global using Application.Service.Pub;
|
||||
global using Application.Domain;
|
||||
global using Application.Domain.Entity;
|
||||
global using Microsoft.AspNetCore.Authorization;
|
||||
global using Microsoft.AspNetCore.Mvc;
|
||||
65
Application.Web.Admin/Program.cs
Normal file
65
Application.Web.Admin/Program.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using Photon.Core.Redis;
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.Inject(new List<string> {
|
||||
"Application.Web.Admin","Application.Domain"
|
||||
});//框架初始化
|
||||
|
||||
builder.Configuration.RegisterConfig();//注入配置
|
||||
builder.Services.InjectRedis(builder.Configuration);
|
||||
builder.Services.InjectSql(builder.Configuration);
|
||||
|
||||
//日志
|
||||
builder.Logging.InjectLog();
|
||||
// Add services to the container.
|
||||
|
||||
|
||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||
|
||||
#region 配置跨域处理,允许所有来源
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("all", builder =>
|
||||
{
|
||||
builder.AllowAnyOrigin() //允许任何来源的主机访问
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader();
|
||||
});
|
||||
});
|
||||
|
||||
#endregion 配置跨域处理,允许所有来源
|
||||
|
||||
|
||||
builder.Services.AddSignalR();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.Services.UseInject();//启用框架
|
||||
app.Configuration.UseConfig();//启用配置
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseCors("all");
|
||||
app.UseStaticFiles();
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Index}/{action=Index}/{id?}")
|
||||
.WithStaticAssets();
|
||||
|
||||
SnowflakeAssist.Initialize(0, 0);
|
||||
app.Run();
|
||||
23
Application.Web.Admin/Properties/launchSettings.json
Normal file
23
Application.Web.Admin/Properties/launchSettings.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:5270",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7023;http://localhost:5270",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
24
Application.Web.Admin/Views/AccMoney/Index.cshtml
Normal file
24
Application.Web.Admin/Views/AccMoney/Index.cshtml
Normal file
@@ -0,0 +1,24 @@
|
||||
<form method="post" action="/AccMoney/UpAcc">
|
||||
ID:<input type="text" value="" name="u" /><br />
|
||||
充值账户:
|
||||
<select name="t">
|
||||
<option value="copper">铜贝</option>
|
||||
<option value="gold">金元</option>
|
||||
<option value="cowry">金贝</option>
|
||||
<option value="teach">师德</option>
|
||||
<option value="renown">声望</option>
|
||||
<option value="charm">魅力</option>
|
||||
<option value="enemy">罪恶值</option>
|
||||
</select><br />
|
||||
金额:<input type="number" value="" name="c" /><br />
|
||||
充值类型:
|
||||
<select name="p">
|
||||
<option value="其他">其他</option>
|
||||
<option value="充值">充值</option>
|
||||
</select><br />
|
||||
备注:<input type="text" value="" name="r" /><br />
|
||||
<input type="submit" value="发放" />
|
||||
<div style="color:red">
|
||||
* @TempData["msg"]
|
||||
</div>
|
||||
</form>
|
||||
7
Application.Web.Admin/Views/Index/Index.cshtml
Normal file
7
Application.Web.Admin/Views/Index/Index.cshtml
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
<div>
|
||||
1.<a href="/SendMail/Index">邮件发放</a>
|
||||
</div>
|
||||
<div>
|
||||
2.<a href="/AccMoney/Index">账户充值</a>
|
||||
</div>
|
||||
26
Application.Web.Admin/Views/SendMail/Index.cshtml
Normal file
26
Application.Web.Admin/Views/SendMail/Index.cshtml
Normal file
@@ -0,0 +1,26 @@
|
||||
<div>
|
||||
<form action="/SendMail/Send" method="post">
|
||||
发送类型:<select name="type">
|
||||
<option value="0">指定玩家</option>
|
||||
<option value="1">当天在线</option>
|
||||
<option value="2">全部玩家</option>
|
||||
</select><br />
|
||||
ID:<textarea name="id" cols="10" style="width:300px" rows="5"></textarea><br />
|
||||
邮件主题:<input name="name" type="text" /> <br />
|
||||
邮件内容:<textarea name="sign" cols="10" style="width:300px" rows="5"></textarea><br />
|
||||
=======附件=====<br />
|
||||
多附件字符:<textarea name="awData" cols="10" style="width:300px" rows="5"></textarea><br />
|
||||
<br />
|
||||
*当只有一个附件时,可以填写以下内容。
|
||||
<br />
|
||||
物品ID:<input name="goods" type="text" /><br />
|
||||
数量:<input type="number" name="count" /><br />
|
||||
说明:<input type="text" name="remark" /><br />
|
||||
<br />
|
||||
<br />
|
||||
<input type="submit" value="发送" />
|
||||
</form>
|
||||
<div style="color:red">
|
||||
* @TempData["msg"]
|
||||
</div>
|
||||
</div>
|
||||
20
Application.Web.Admin/Views/Shared/_Layout.cshtml
Normal file
20
Application.Web.Admin/Views/Shared/_Layout.cshtml
Normal file
@@ -0,0 +1,20 @@
|
||||
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="/css/table.css" asp-append-version="true" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="foot" style="margin-bottom:10px">
|
||||
<a href="/">返回首页</a>
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
@RenderBody()
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
3
Application.Web.Admin/Views/_ViewStart.cshtml
Normal file
3
Application.Web.Admin/Views/_ViewStart.cshtml
Normal file
@@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
||||
43
Application.Web.Admin/applicationsettings.json
Normal file
43
Application.Web.Admin/applicationsettings.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"AutoProgram": 0,
|
||||
"Redis": {
|
||||
"connection": "81.70.212.61:6379,password=kx.20260711,defaultdatabase=5"
|
||||
},
|
||||
"SqlData": [
|
||||
{
|
||||
"type": 0,
|
||||
"name": "Kg.SeaTime.Game",
|
||||
"connect": "data source=81.70.212.61;database=kg.seatime.game;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
||||
},
|
||||
{
|
||||
"type": 0,
|
||||
"name": "Kg.SeaTime.Resource",
|
||||
"connect": "data source=81.70.212.61;database=kg.seatime.resource;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
||||
},
|
||||
{
|
||||
"type": 0,
|
||||
"name": "Kg.SeaTime.Log",
|
||||
"connect": "data source=81.70.212.61;database=kg.seatime.log;user id=root;password=1f5ozxRGE3Y;pooling=true;port=3306;sslmode=Required;charset=utf8mb4;"
|
||||
}
|
||||
],
|
||||
"JwtTokenOptions": {
|
||||
"Issuer": "kx.seatime",
|
||||
"Audience": "kx.seatime",
|
||||
"SecurityKey": "46055HR0n7FeNHhDKAYD2i9ZsdsYn4jn"
|
||||
},
|
||||
"ResUrl": {
|
||||
"local": "http://192.168.0.142:5298",
|
||||
"resUrl": "http://localhost:12206",
|
||||
"imgCDN": "/",
|
||||
"videoCDN": "/"
|
||||
},
|
||||
"Sms": {
|
||||
"SmsType": 1,
|
||||
"AccessKey": "AKIDVptgCRP5UcT4PTGm1yf5E6pKYVBajeKn",
|
||||
"Secret": "FG2atxlKflcEclgKhnc9XeU3LM6YjdGf",
|
||||
"signName": "探玩驿站",
|
||||
"TemplateCode": "963929",
|
||||
"SmsSdkAppId": "1400523979",
|
||||
"SmsOnTime": 300
|
||||
}
|
||||
}
|
||||
8
Application.Web.Admin/appsettings.Development.json
Normal file
8
Application.Web.Admin/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Application.Web.Admin/appsettings.json
Normal file
9
Application.Web.Admin/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
25
Application.Web.Admin/wwwroot/css/table.css
Normal file
25
Application.Web.Admin/wwwroot/css/table.css
Normal file
@@ -0,0 +1,25 @@
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
table td, table th {
|
||||
border: 1px solid #cad9ea;
|
||||
color: #666;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
table thead th {
|
||||
background-color: #CCE8EB;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
table tr:nth-child(odd) {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
table tr:nth-child(even) {
|
||||
background: #F5FAFA;
|
||||
}
|
||||
Reference in New Issue
Block a user