增加
This commit is contained in:
@@ -20,6 +20,6 @@ public class NoticeService:INoticeService,ITransient
|
||||
public async Task<List<game_notice>> GetNoticeData(int page, int limit, RefAsync<int> total)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
||||
return await db.Queryable<game_notice>().ToPageListAsync(page, limit, total);
|
||||
return await db.Queryable<game_notice>().OrderByDescending(it=>it.addTime).ToPageListAsync(page, limit, total);
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,11 @@ public class GameAccountService : IGameAccountService, ITransient
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_account>();
|
||||
var data = await db.Queryable<game_account>().Where(it => it.openId == openId).FirstAsync();
|
||||
await _redisClient.AddHashAsync(key, openId, data);
|
||||
if (data != null)
|
||||
{
|
||||
await _redisClient.AddHashAsync(key, openId, data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -41,7 +45,11 @@ public class GameAccountService : IGameAccountService, ITransient
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_account>();
|
||||
var data = await db.Queryable<game_account>().Where(it => it.accId == accId).FirstAsync();
|
||||
await _redisClient.AddHashAsync(key, accId, data);
|
||||
if (data != null)
|
||||
{
|
||||
await _redisClient.AddHashAsync(key, accId, data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -86,7 +94,7 @@ public class GameAccountService : IGameAccountService, ITransient
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<game_account> Regist(string userName, string nick, string pwd, string remAccId = "",
|
||||
public async Task<game_account> Regist(string userName, string nick, string pwd, string remAccId = "",
|
||||
string openId = "")
|
||||
{
|
||||
game_account result = new game_account();
|
||||
@@ -116,12 +124,13 @@ public class GameAccountService : IGameAccountService, ITransient
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
|
||||
await _dbClient.AsTenant().CommitTranAsync();
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = null;
|
||||
await _dbClient.AsTenant().RollbackTranAsync();
|
||||
await _dbClient.AsTenant().RollbackTranAsync();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -12,11 +12,13 @@ namespace Application.Web.Controllers.Pub
|
||||
{
|
||||
private readonly IAreaService _areaService;
|
||||
private readonly INoticeService _noticeService;
|
||||
private readonly IGameAccountService _accountService;
|
||||
|
||||
public PubController(IAreaService areaService, INoticeService noticeService)
|
||||
public PubController(IAreaService areaService, INoticeService noticeService,IGameAccountService accountService)
|
||||
{
|
||||
_areaService = areaService;
|
||||
_noticeService = noticeService;
|
||||
_accountService = accountService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -28,16 +30,35 @@ namespace Application.Web.Controllers.Pub
|
||||
public async Task<IPoAction> GetMain(string? sid)
|
||||
{
|
||||
bool isOnline = false;
|
||||
game_account account = new game_account();
|
||||
if (!string.IsNullOrEmpty(sid))
|
||||
{
|
||||
isOnline = true;
|
||||
account = await _accountService.GetAccInfoByToken(sid);
|
||||
if (account != null)
|
||||
{
|
||||
isOnline = true;
|
||||
}
|
||||
}
|
||||
|
||||
var areaData = await _areaService.GetAreaData();
|
||||
var notice = await _noticeService.GetNoticeDataByTake(5);
|
||||
|
||||
int OnCount = 100;
|
||||
return PoAction.Ok(new { area = areaData, notice, isOnline, onCount = OnCount });
|
||||
return PoAction.Ok(new { area = areaData, notice, isOnline, onCount = OnCount,account });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取公告列表
|
||||
/// </summary>
|
||||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> GetNoticeData(int page,int limit)
|
||||
{
|
||||
RefAsync<int> total = 0;
|
||||
var data = await _noticeService.GetNoticeData(page, limit, total);
|
||||
return PoAction.Ok(new { data, total=total.Value });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ 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;
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<div class="pagination">
|
||||
<!-- 第一行:导航按钮 -->
|
||||
<div class="pagination-nav">
|
||||
<span v-if="currentPage !== 1" @click="changePage('first')">首页 . </span>
|
||||
<span v-if="currentPage !== 1" @click="changePage('prev')">上一页 .</span>
|
||||
<span v-if="currentPage !== totalPages" @click="changePage('next')">下一页 .</span>
|
||||
<span v-if="currentPage !== totalPages" @click="changePage('last')">尾页</span>
|
||||
<span v-if="currentPage > 1" @click="changePage('first')">首页 . </span>
|
||||
<span v-if="currentPage > 1" @click="changePage('prev')">上一页 .</span>
|
||||
<span v-if="currentPage < totalPages" @click="changePage('next')">下一页 .</span>
|
||||
<span v-if="currentPage < totalPages" @click="changePage('last')">尾页</span>
|
||||
</div>
|
||||
<!-- 第二行:页码信息与跳转 -->
|
||||
<div class="pagination-info">
|
||||
@@ -20,16 +20,20 @@
|
||||
<script setup lang="ts">
|
||||
interface Props {
|
||||
currentPage: number;
|
||||
totalPages: number;
|
||||
limit: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
currentPage: 1,
|
||||
totalPages: 1,
|
||||
limit:10,
|
||||
total: 1,
|
||||
});
|
||||
|
||||
let currentPage = ref(props.currentPage)
|
||||
let totalPages = ref(props.totalPages)
|
||||
let currentPage = ref(props.currentPage);
|
||||
let limit = ref(props.limit);
|
||||
let total = ref(props.total);
|
||||
let totalPages = total.value / limit.value;
|
||||
|
||||
const emit = defineEmits(['pageChange'])
|
||||
|
||||
@@ -38,14 +42,14 @@ const changePage = (type: any) => {
|
||||
if (type == 'input' && currentPage.value < 1) {
|
||||
currentPage.value = 1
|
||||
}
|
||||
if (type == 'input' && currentPage.value > totalPages.value) {
|
||||
currentPage.value = totalPages.value
|
||||
if (type == 'input' && currentPage.value > totalPages) {
|
||||
currentPage.value = totalPages
|
||||
}
|
||||
|
||||
if (type == 'prev' && currentPage.value == 1) {
|
||||
return
|
||||
}
|
||||
if (type == 'next' && currentPage.value == totalPages.value) {
|
||||
if (type == 'next' && currentPage.value == totalPages) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -57,7 +61,7 @@ const changePage = (type: any) => {
|
||||
} else if (type == 'next') {
|
||||
currentPage.value++
|
||||
} else if (type == 'last') {
|
||||
currentPage.value = totalPages.value
|
||||
currentPage.value = totalPages
|
||||
}
|
||||
emit('pageChange', currentPage.value)
|
||||
}
|
||||
@@ -68,11 +72,11 @@ const changePage = (type: any) => {
|
||||
<style scoped>
|
||||
.pagination {
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.pagination-nav {
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.pagination-nav span {
|
||||
@@ -96,7 +100,7 @@ const changePage = (type: any) => {
|
||||
}
|
||||
|
||||
.page-input {
|
||||
width: 50px;
|
||||
width: 30px;
|
||||
padding: 2px 4px;
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
|
||||
1
Web/src/pages/area/my.vue
Normal file
1
Web/src/pages/area/my.vue
Normal file
@@ -0,0 +1 @@
|
||||
<template></template>
|
||||
26
Web/src/pages/customer/about.vue
Normal file
26
Web/src/pages/customer/about.vue
Normal file
@@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="content">
|
||||
<Abar href="/">首页</Abar>>关于
|
||||
</div>
|
||||
<div class="content">
|
||||
驰骋四海是2022年初自主设计的一款以大航海时代为背景的wap文字游戏,希望给大家呈现一种不一样的怀旧场景。
|
||||
</div>
|
||||
<Abar href="/">返回游戏首页</Abar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
layout: layout.empty,
|
||||
middleware: middleware.loading
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
PageLoading.Close();
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
27
Web/src/pages/customer/cooperation.vue
Normal file
27
Web/src/pages/customer/cooperation.vue
Normal file
@@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="content">
|
||||
<Abar href="/">首页</Abar>>合作
|
||||
</div>
|
||||
<div class="content">
|
||||
商务合作请联系:<br />
|
||||
客服QQ:290555931
|
||||
</div>
|
||||
<Abar href="/">返回游戏首页</Abar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
layout: layout.empty,
|
||||
middleware: middleware.loading
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
PageLoading.Close();
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -10,14 +10,14 @@
|
||||
</div>
|
||||
<div class="content" style="font-size:17px" v-if="isOnline">
|
||||
<div>
|
||||
亲爱的 <strong style="color:red">探玩玩家</strong>,欢迎来到驰骋四海·社区版!
|
||||
亲爱的 <strong style="color:red">{{ AccountInfo.nick }}</strong>,欢迎来到驰骋四海!
|
||||
</div>
|
||||
<div style="margin-top:5px;">
|
||||
<div>
|
||||
➢<a href="http://m.twbar.cn/Home/Index?sid=KrWxKypJuDO0zFKrTig0bG">返回探玩驿站</a>
|
||||
➢<a :href='"http://m.twbar.cn/Regain/ToMain?openid=" + AccountInfo.openId'>返回探玩驿站</a>
|
||||
</div>
|
||||
<div>
|
||||
➸<a href="http://m.twbar.cn/b/1145?sid=KrWxKypJuDO0zFKrTig0bG">游戏论坛</a>
|
||||
➸<a :href='"http://m.twbar.cn/Regain/ToBbs?openid=" + AccountInfo.openId + "&bbs=1146"'>游戏论坛</a>
|
||||
➸<a @click.stop="offOnline">退出游戏</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -27,12 +27,11 @@
|
||||
</div>
|
||||
<div class="common" v-if="isOnline">
|
||||
<div class="title">
|
||||
=====☆<a class="" href="/Pallet/GameOpen/GameUser?sid=klxy7ADn96CBYGWQ9AG4xPqFC2Ib6Ty1Kx">我的区服</a>☆=====
|
||||
=====☆<Abar href="/area/my">我的区服</Abar>☆=====
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="item">
|
||||
<a
|
||||
href="/LoginGame/LoginOk?sid=W6Wg8iH9gY7wIBNSEdtFcQ3KbI5YiKDo">✧【1区】新手村✰村长(男)</a>
|
||||
<Abar href="/">✧【1区】新手村✰村长(男)</Abar>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -50,11 +49,11 @@
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
=====☆<a class="" href="/Pallet/Notice/Index?sid=klxy7ADn96CBYGWQ9AG4xPqFC2Ib6Ty1Kx">官方公告</a>☆=====
|
||||
=====☆<Abar href="/news/">官方公告</Abar>☆=====
|
||||
</div>
|
||||
<div>
|
||||
<div class="item" v-for="(item, index) in noticeData" :key="index">
|
||||
{{ index + 1 }}.<Abar :href='"/login/register?id=" + item.noticeId'>{{ item.title }}</Abar>
|
||||
{{ index + 1 }}.<Abar :href='"/news/info?id=" + item.noticeId'>{{ item.title }}</Abar>
|
||||
</div>
|
||||
<span v-if="noticeData.length == 0">暂无公告.</span>
|
||||
</div>
|
||||
@@ -63,9 +62,9 @@
|
||||
=====☆服务导航☆=====
|
||||
</div>
|
||||
<div class="content">
|
||||
<Abar href="/customer">客服</Abar>
|
||||
.<a class="" href="/Index/About?sid=klxy7ADn96CBYGWQ9AG4xPqFC2Ib6Ty1Kx">关于</a>.<a class=""
|
||||
href="/Index/Cooperation?sid=klxy7ADn96CBYGWQ9AG4xPqFC2Ib6Ty1Kx">合作</a>
|
||||
<Abar href="/customer">客服</Abar>.
|
||||
<Abar href="/customer/about">关于</Abar>.
|
||||
<Abar href="/customer/cooperation">合作</Abar>
|
||||
</div>
|
||||
<div class="foot">
|
||||
<div class="timeService">
|
||||
@@ -85,15 +84,19 @@ const areaData = ref<Array<any>>([]);
|
||||
const noticeData = ref<Array<any>>([]);
|
||||
const isOnline = ref(false);
|
||||
const OnCount = ref(0);
|
||||
const AccountInfo = ref<any>();
|
||||
|
||||
const Initialize = async (): Promise<void> => {
|
||||
var result = await PubService.GetMain(StateHelper.Sid);
|
||||
if (result.code == 0) {
|
||||
isOnline.value = result.data.isOnline;
|
||||
if (isOnline.value == false) {
|
||||
StateHelper.OffOnline();
|
||||
}
|
||||
areaData.value = result.data?.area;
|
||||
noticeData.value = result.data.notice;
|
||||
isOnline.value = result.data.isOnline;
|
||||
OnCount.value = result.data.onCount;
|
||||
|
||||
AccountInfo.value = result.data.account;
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowToast(result.msg, "fail");
|
||||
|
||||
1
Web/src/pages/login/register.vue
Normal file
1
Web/src/pages/login/register.vue
Normal file
@@ -0,0 +1 @@
|
||||
<template></template>
|
||||
59
Web/src/pages/news/index.vue
Normal file
59
Web/src/pages/news/index.vue
Normal file
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
<Abar href="/">首页</Abar>>官方公告
|
||||
</div>
|
||||
<div class="common">
|
||||
<div class="item border" v-for="(item, index) in data" :key="index">
|
||||
{{ index + 1 }}.<Abar :href='"/news/info?id=" + item.noticeId'>{{ item.title }}</Abar>
|
||||
</div>
|
||||
<span v-if="data.length == 0">暂无公告.</span>
|
||||
</div>
|
||||
<div class="content">
|
||||
<Pagination :currentPage="currentPage" :limit="10" :total="totalPages" @pageChange="handlePageChange" />
|
||||
</div>
|
||||
<Abar href="/">返回游戏首页</Abar>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
definePageMeta({
|
||||
layout: layout.empty,
|
||||
middleware: 'page-loading'
|
||||
})
|
||||
|
||||
const currentPage = ref<number>(1);
|
||||
const totalPages = ref<number>(0);
|
||||
const data = ref<Array<any>>([]);
|
||||
|
||||
const handlePageChange = async (page: number): Promise<void> => {
|
||||
currentPage.value = page;
|
||||
await BindData();
|
||||
console.log('跳转到第', page, '页');
|
||||
};
|
||||
|
||||
const BindData = async (): Promise<void> => {
|
||||
var result = await PubService.GetNoticeData(currentPage.value, 10);
|
||||
console.log(result);
|
||||
if (result.code == 0) {
|
||||
data.value = result.data.data;
|
||||
totalPages.value = result.data.total;
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowToast(result.msg, "fail");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await BindData();
|
||||
}
|
||||
finally {
|
||||
|
||||
PageLoading.Close();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
1
Web/src/pages/news/info.vue
Normal file
1
Web/src/pages/news/info.vue
Normal file
@@ -0,0 +1 @@
|
||||
<template></template>
|
||||
@@ -6,4 +6,12 @@ export class PubService {
|
||||
static async GetMain(sid: string) {
|
||||
return await ApiService.Request("get", "/Pub/GetMain", { sid });
|
||||
}
|
||||
|
||||
/**
|
||||
* GetNoticeData
|
||||
* GET /Pub/GetNoticeData
|
||||
*/
|
||||
static async GetNoticeData(page: number, limit: number) {
|
||||
return await ApiService.Request("get", "/Pub/GetNoticeData", { page, limit });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user