diff --git a/Kx.SeaTime.sln.DotSettings.user b/Kx.SeaTime.sln.DotSettings.user new file mode 100644 index 0000000..74ba5cd --- /dev/null +++ b/Kx.SeaTime.sln.DotSettings.user @@ -0,0 +1,3 @@ + + ForceIncluded + ForceIncluded \ No newline at end of file diff --git a/Service/Application.Domain.Entity/DB_Resource/Game/game_area.cs b/Service/Application.Domain.Entity/DB_Resource/Game/game_area.cs new file mode 100644 index 0000000..0135b34 --- /dev/null +++ b/Service/Application.Domain.Entity/DB_Resource/Game/game_area.cs @@ -0,0 +1,39 @@ +using SqlSugar; +using System; + +namespace Application.Domain.Entity +{ + [Tenant("Kg.SeaTime.Resource")] + public class game_area + { + /// + /// areaId + /// + [SugarColumn(IsPrimaryKey = true)] + public int areaId { get; set; } + + /// + /// name + /// + [SugarColumn(Length = 255, IsNullable = true)] + public string? name { get; set; } + + /// + /// 状态 + /// + [SugarColumn(IsNullable = true)] + public int? status { get; set; } + + /// + /// 开放时间 + /// + [SugarColumn(IsNullable = true)] + public DateTime? opTime { get; set; } + + /// + /// 添加时间 + /// + [SugarColumn(IsNullable = true)] + public DateTime? addTime { get; set; } + } +} diff --git a/Service/Application.Domain.Entity/DB_Resource/Game/game_notice.cs b/Service/Application.Domain.Entity/DB_Resource/Game/game_notice.cs new file mode 100644 index 0000000..0a2fcd1 --- /dev/null +++ b/Service/Application.Domain.Entity/DB_Resource/Game/game_notice.cs @@ -0,0 +1,39 @@ +using SqlSugar; +using System; + +namespace Application.Domain.Entity +{ + [Tenant("Kg.SeaTime.Resource")] + public class game_notice + { + /// + /// noticeId + /// + [SugarColumn(IsPrimaryKey = true, Length = 50)] + public string noticeId { get; set; } + + /// + /// title + /// + [SugarColumn(Length = 50, IsNullable = true)] + public string? title { get; set; } + + /// + /// sign + /// + [SugarColumn(IsNullable = true)] + public string? sign { get; set; } + + /// + /// addTime + /// + [SugarColumn(IsNullable = true)] + public DateTime? addTime { get; set; } + + /// + /// endTime + /// + [SugarColumn(IsNullable = true)] + public DateTime? endTime { get; set; } + } +} diff --git a/Service/Application.Domain/Services/Interface/Pub/INoticeService.cs b/Service/Application.Domain/Services/Interface/Pub/INoticeService.cs new file mode 100644 index 0000000..594e14a --- /dev/null +++ b/Service/Application.Domain/Services/Interface/Pub/INoticeService.cs @@ -0,0 +1,7 @@ +namespace Application.Domain; + +public interface INoticeService +{ + Task> GetNoticeDataByTake(int take); + Task> GetNoticeData(int page, int limit, RefAsync total); +} \ No newline at end of file diff --git a/Service/Application.Domain/Services/Service/Pub/NoticeService.cs b/Service/Application.Domain/Services/Service/Pub/NoticeService.cs new file mode 100644 index 0000000..b4cabef --- /dev/null +++ b/Service/Application.Domain/Services/Service/Pub/NoticeService.cs @@ -0,0 +1,25 @@ +namespace Application.Domain; + +public class NoticeService:INoticeService,ITransient +{ + private readonly ISqlSugarClient _dbClient; + private readonly IRedisCache _redisClient; + + public NoticeService(ISqlSugarClient dbClient, IRedisCache redisClient) + { + _dbClient = dbClient; + _redisClient = redisClient; + } + + public async Task> GetNoticeDataByTake(int take) + { + var db = _dbClient.AsTenant().GetConnectionWithAttr(); + return await db.Queryable().Take(take).OrderByDescending(it=>it.addTime).ToListAsync(); + } + + public async Task> GetNoticeData(int page, int limit, RefAsync total) + { + var db = _dbClient.AsTenant().GetConnectionWithAttr(); + return await db.Queryable().ToPageListAsync(page, limit, total); + } +} \ No newline at end of file diff --git a/Service/Application.Web/Controllers/Login/LoginController.cs b/Service/Application.Web/Controllers/Login/LoginController.cs index b1bf704..8da3a4e 100644 --- a/Service/Application.Web/Controllers/Login/LoginController.cs +++ b/Service/Application.Web/Controllers/Login/LoginController.cs @@ -25,6 +25,7 @@ namespace Application.Web.Controllers.Login [HttpPost] public async Task Login([FromBody] LoginParms parms) { + HttpContext.Request.QueryString return PoAction.Ok(parms.code); } /// diff --git a/Service/Application.Web/Controllers/Pub/PubController.cs b/Service/Application.Web/Controllers/Pub/PubController.cs new file mode 100644 index 0000000..1f36623 --- /dev/null +++ b/Service/Application.Web/Controllers/Pub/PubController.cs @@ -0,0 +1,31 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace Application.Web.Controllers.Pub +{ + + /// + /// 公共接口 + /// + [Route("[controller]/[action]")] + [ApiController] + public class PubController : ControllerBase + { + private readonly IAreaService _areaService; + public PubController(IAreaService areaService) + { + _areaService = areaService; + } + + /// + /// 获取首页信息 + /// + /// + [HttpGet] + public async Task GetMain() + { + var areaData = await _areaService.GetAreaData(); + return PoAction.Ok(new{area=areaData}); + } + } +} diff --git a/Web/src/extends/PageExtend.ts b/Web/src/extends/PageExtend.ts index 23b210b..8a96e38 100644 --- a/Web/src/extends/PageExtend.ts +++ b/Web/src/extends/PageExtend.ts @@ -1,5 +1,11 @@ export class PageExtend { - public static Redirect(route: string) { - navigateTo(route, { replace: true }) + public static Redirect(route: string) { + navigateTo(route, { replace: true }) + } + + public static QueryString(params: string): string { + const route = useRoute() + const value = route.query[params] + return value ? String(value) : '' } } \ No newline at end of file diff --git a/Web/src/pages/index.vue b/Web/src/pages/index.vue index 284c7d9..335d54c 100644 --- a/Web/src/pages/index.vue +++ b/Web/src/pages/index.vue @@ -87,7 +87,7 @@ 小G报时(18:33) -
+
{{ index }} - {{ item.name }}
@@ -102,7 +102,7 @@ definePageMeta({ const areaData = ref([]); - + const Initialize = async (): Promise => { var result = await PubService.GetMain(); @@ -120,6 +120,10 @@ const Initialize = async (): Promise => { // await navigateTo('/auth/login', { replace: true }) onMounted(async () => { + const id = PageExtend.QueryString("id"); + + MessageExtend.Notify("success", id); + await Initialize(); //alert(1); diff --git a/Web/src/services/Index/PubService.ts b/Web/src/services/Index/PubService.ts new file mode 100644 index 0000000..719c510 --- /dev/null +++ b/Web/src/services/Index/PubService.ts @@ -0,0 +1,9 @@ +export class PubService { + /** + * 获取首页信息 + * GET /Pub/GetMain + */ + static async GetMain() { + return await ApiService.Request("get", "/Pub/GetMain"); + } +}