12121
This commit is contained in:
@@ -20,6 +20,8 @@ namespace Application.Domain
|
||||
HandleExchangeData,//处理兑换数据
|
||||
HandleTaskLog,//处理任务日志
|
||||
HandelTaskUser,//处理角色任务
|
||||
HandleClearChat,//清理频道信息
|
||||
HandleMessageData,//处理消息类
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,5 +105,22 @@
|
||||
var taskService = App.GetService<IGameTaskService>();
|
||||
await taskService.HandleUserTask();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清理频道信息
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
[EventSubscribe(BusEventsEnum.BusEventsName.HandleClearChat, NumRetries = 0,RetryTimeout = 999999999)]
|
||||
public async Task HandleClearChat(EventHandlerExecutingContext context)
|
||||
{
|
||||
var chatService = App.GetService<IGameChatService>();
|
||||
await chatService.ClearChat();
|
||||
}
|
||||
[EventSubscribe(BusEventsEnum.BusEventsName.HandleMessageData, NumRetries = 0,RetryTimeout = 999999999)]
|
||||
public async Task HandleMessageData(EventHandlerExecutingContext context)
|
||||
{
|
||||
var messageService = App.GetService<IMessageService>();
|
||||
await messageService.HandleMessageData();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,8 @@ public static class GameEnum
|
||||
UpdateExchangeData,//更新兑换的记录
|
||||
UpdateTaskLog,//更新任务日志
|
||||
UpdateTaskUser,//更新角色任务
|
||||
ClearChat,//清理频道信息
|
||||
ClearMessage,//清理个人消息信息
|
||||
}
|
||||
public enum PropCode//游戏资源编码
|
||||
{
|
||||
|
||||
@@ -12,4 +12,5 @@ public interface IGameChatService
|
||||
Task<bool> SendChat(string userId, string code, string sign, string par = "");
|
||||
Task<game_chat> GetChatInfo(string chatId);
|
||||
Task<bool> DeleteChat(string chatId, string opUser);
|
||||
Task ClearChat();
|
||||
}
|
||||
@@ -53,4 +53,6 @@ public interface IMessageService
|
||||
Task<bool> SendBroadcast(string userId, string code, string msg);
|
||||
|
||||
#endregion
|
||||
|
||||
Task HandleMessageData();
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
public interface INoticeService
|
||||
{
|
||||
Task<List<game_notice>> GetNoticeDataByTake(int take);
|
||||
Task<List<game_notice>> GetNoticeDataByMap();
|
||||
Task<List<game_notice>> GetNoticeData(int page, int limit, RefAsync<int> total);
|
||||
Task<game_notice> GetNoticeInfo(string id);
|
||||
}
|
||||
@@ -181,4 +181,11 @@ public class GameChatService : IGameChatService, ITransient
|
||||
.Where(it => it.chatId == chatId)
|
||||
.ExecuteCommandAsync() > 0;
|
||||
}
|
||||
|
||||
public async Task ClearChat()
|
||||
{
|
||||
long time = TimeExtend.GetTimeStampSeconds;
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_chat>();
|
||||
await db.Deleteable<game_chat>().Where(it => it.delTime < time).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
@@ -827,7 +827,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
|
||||
|
||||
private async Task<List<game_equ_make>> GetEquMakeData(int goodsId)
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "EquData", "EquUpData");
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "EquData", "EquMakeData");
|
||||
if (await redis.HExistsHashAsync(key, goodsId.ToString()))
|
||||
{
|
||||
return await redis.GetHashAsync<List<game_equ_make>>(key, goodsId.ToString());
|
||||
|
||||
@@ -435,4 +435,21 @@ public class MessageService(ISqlSugarClient DbClient, IRedisCache redis) : IMess
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public async Task HandleMessageData()
|
||||
{
|
||||
long time = TimeExtend.GetTimeStampSeconds;
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_message>();
|
||||
|
||||
await db.Deleteable<unit_user_mail>().Where(it => it.endTime < time && it.isRead == 1)
|
||||
.ExecuteCommandAsync(); //清理邮件
|
||||
await db.Deleteable<unit_user_message>().Where(it => it.endTime < time && it.isRead == 1)
|
||||
.ExecuteCommandAsync(); //清理消息
|
||||
await db.Deleteable<unit_user_message_event>().Where(it => it.endTime < time).ExecuteCommandAsync(); //清理通知
|
||||
//删除缓存
|
||||
string msgKey = string.Format(UserCache.BaseCacheKeys, "Message", "MsgCount");
|
||||
string eventKey = string.Format(UserCache.BaseCacheKeys, "Message", "EventCount");
|
||||
string mailKey = string.Format(UserCache.BaseCacheKeys, "Message", "MailCount");
|
||||
await redis.DelAsync(msgKey, eventKey, mailKey);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public class NoticeService:INoticeService,ITransient
|
||||
public class NoticeService : INoticeService, ITransient
|
||||
{
|
||||
private readonly ISqlSugarClient _dbClient;
|
||||
private readonly IRedisCache _redisClient;
|
||||
@@ -14,13 +14,14 @@ public class NoticeService:INoticeService,ITransient
|
||||
public async Task<List<game_notice>> GetNoticeDataByTake(int take)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
||||
return await db.Queryable<game_notice>().Take(take).OrderByDescending(it=>it.addTime).ToListAsync();
|
||||
return await db.Queryable<game_notice>().Take(take).OrderByDescending(it => it.addTime).ToListAsync();
|
||||
}
|
||||
|
||||
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>().OrderByDescending(it=>it.addTime).ToPageListAsync(page, limit, total);
|
||||
return await db.Queryable<game_notice>().OrderByDescending(it => it.addTime)
|
||||
.ToPageListAsync(page, limit, total);
|
||||
}
|
||||
|
||||
public async Task<game_notice> GetNoticeInfo(string id)
|
||||
@@ -28,4 +29,19 @@ public class NoticeService:INoticeService,ITransient
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
||||
return await db.Queryable<game_notice>().Where(it => it.noticeId == id).SingleAsync();
|
||||
}
|
||||
|
||||
public async Task<List<game_notice>> GetNoticeDataByMap()
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKey, "Notice");
|
||||
if (await _redisClient.ExistsAsync(key))
|
||||
{
|
||||
return await _redisClient.GetAsync<List<game_notice>>(key);
|
||||
}
|
||||
|
||||
DateTime time = DateTime.Now;
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
||||
var data = await db.Queryable<game_notice>().OrderByDescending(it => it.endTime > time).ToListAsync();
|
||||
await _redisClient.SetAsync(key, data, 3600);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -105,5 +105,17 @@ public class GameAutoJobService(ISqlSugarClient DbClient, IRedisCache redis, ITi
|
||||
await _eventPublisher.PublishAsync(new ChannelEventSource(BusEventsEnum.BusEventsName.HandelTaskUser,
|
||||
data));
|
||||
}
|
||||
else if (data.code == nameof(GameEnum.JobCode.ClearChat)) //清理频道信息
|
||||
{
|
||||
var _eventPublisher = App.GetService<IEventPublisher>();
|
||||
await _eventPublisher.PublishAsync(new ChannelEventSource(BusEventsEnum.BusEventsName.HandleClearChat,
|
||||
data));
|
||||
}
|
||||
else if (data.code == nameof(GameEnum.JobCode.ClearMessage)) //清理频道信息
|
||||
{
|
||||
var _eventPublisher = App.GetService<IEventPublisher>();
|
||||
await _eventPublisher.PublishAsync(new ChannelEventSource(BusEventsEnum.BusEventsName.HandleMessageData,
|
||||
data));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,12 +23,13 @@ public class MapController : ControllerBase
|
||||
private readonly IGameFightService _fightService;
|
||||
private readonly IOnHookService _hookService;
|
||||
private readonly IGameTaskService _taskService;
|
||||
private readonly INoticeService _noticeService;
|
||||
|
||||
public MapController(IUnitUserService userService, IGameMapService mapService, IGameChatService chatService,
|
||||
IUnitUserAttrService attrService, IMessageService messageService, IUnitUserWeight weightService,
|
||||
IUnitUserAccService accService, IGameSkillService skillService, IGameGoodsService goodsService,
|
||||
IGameTeamService teamService, IGameMonsterService monsterService, IGameFightService fightService,
|
||||
IOnHookService hookService, IGameTaskService taskService)
|
||||
IOnHookService hookService, IGameTaskService taskService,INoticeService noticeService)
|
||||
{
|
||||
_userService = userService;
|
||||
_mapService = mapService;
|
||||
@@ -44,6 +45,7 @@ public class MapController : ControllerBase
|
||||
_fightService = fightService;
|
||||
_hookService = hookService;
|
||||
_taskService = taskService;
|
||||
_noticeService = noticeService;
|
||||
}
|
||||
|
||||
#region 地图相关
|
||||
@@ -146,6 +148,8 @@ public class MapController : ControllerBase
|
||||
var onHook = await _hookService.GetUserOnHook(userId);
|
||||
isHook = (int)onHook.status;
|
||||
|
||||
var notice = await _noticeService.GetNoticeDataByMap();
|
||||
|
||||
object ret = new
|
||||
{
|
||||
mapInfo,
|
||||
@@ -163,6 +167,7 @@ public class MapController : ControllerBase
|
||||
fightId,
|
||||
gameTips,
|
||||
isHook,
|
||||
notice,
|
||||
taskCount = taskData.Count
|
||||
};
|
||||
|
||||
|
||||
@@ -296,6 +296,7 @@ public class RecoverController : ControllerBase
|
||||
myEqu = myEqu.FindAll(it =>
|
||||
it.isAppr == 1 && it.durability < it.maxdurability && it.useEndTime > TimeExtend.GetTimeStampSeconds);
|
||||
int need = myEqu.Sum(it => (int)it.maxdurability - (int)it.durability);
|
||||
need = need * 500;
|
||||
if (need < 1)
|
||||
{
|
||||
return PoAction.Message("耐久已满,无需恢复!");
|
||||
@@ -351,6 +352,7 @@ public class RecoverController : ControllerBase
|
||||
}
|
||||
|
||||
int need = (int)equInfo.maxdurability - (int)equInfo.durability;
|
||||
need = need * 500;
|
||||
var myAcc = await _accService.GetUserAccInfo(userId, nameof(AccEnum.AccType.copper));
|
||||
if (need > myAcc)
|
||||
{
|
||||
|
||||
@@ -257,6 +257,15 @@ public class GiveController : ControllerBase
|
||||
{
|
||||
return PoAction.Message("玩家不存在!");
|
||||
}
|
||||
//此处判断赠送玩家的设置
|
||||
var roleConfig = await _userService.GetUserConfigInfo(fromInfo.userId);
|
||||
if (roleConfig.giveRole == 1)//判断是否为好友
|
||||
{
|
||||
if (await _relationService.CheckIsFriend(userId, fromInfo.userId)==false)
|
||||
{
|
||||
return PoAction.Message("玩家设置了拒绝陌生人赠送!");
|
||||
}
|
||||
}
|
||||
|
||||
if (type == 0)
|
||||
{
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
统一配置中心
|
||||
*/
|
||||
export class BaseConfig {
|
||||
// public static BaseUrl: string = 'https://localhost:7198'
|
||||
// public static BaseMediaUrl: string = 'https://localhost:7198/'
|
||||
public static BaseUrl:string="http://v3.pccsh.com";
|
||||
public static BaseMediaUrl:string="http://v3.pccsh.com";
|
||||
public static BaseUrl: string = 'https://localhost:7198'
|
||||
public static BaseMediaUrl: string = 'https://localhost:7198/'
|
||||
// public static BaseUrl:string="http://v3.pccsh.com";
|
||||
// public static BaseMediaUrl:string="http://v3.pccsh.com";
|
||||
}
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
{{ index + 1 }}.<GameEqu :equ-data="item" :show-lev="1" :show-url="true"></GameEqu>
|
||||
<span>({{ item.durability }}/{{ item.maxdurability }})</span>
|
||||
<span v-if="item.durability < item.maxdurability">
|
||||
[<Abutton @click="retEqu(item.ueId)">修复({{ item.maxdurability - item.durability }}铜)</Abutton>]
|
||||
[<Abutton @click="retEqu(item.ueId)">修复({{ GameTool.FormatCopper((item.maxdurability -
|
||||
item.durability) * 500) }})</Abutton>
|
||||
]
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -24,7 +26,7 @@
|
||||
<div class="content" style="font-size: 16px;">
|
||||
说明:<br>
|
||||
1.装备仅可修复当前穿戴中的装备。<br>
|
||||
2.每修复1点耐久消耗1铜贝。
|
||||
2.每修复1点耐久消耗500铜。
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@@ -51,7 +53,7 @@ const BindData = async (): Promise<void> => {
|
||||
allCopper.value = result.data.need;
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("强化装备", result.msg);
|
||||
MessageExtend.ShowDialog("修理装备", result.msg);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<template>
|
||||
<GameBroadcast :data="broadcast"></GameBroadcast>
|
||||
<div class="content" v-if="notice.length > 0">
|
||||
<div class="item" style="font-size:15px;" v-for="item in notice">
|
||||
<i class="broad-system"></i>
|
||||
<Abar :href='"/news/info?id=" + item.noticeId'>{{ item.title }}</Abar>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content" v-if="isHook == 1">
|
||||
<div class="item" style="font-size:15px;font-weight:bold;color:green">
|
||||
<i class="dup"></i>
|
||||
@@ -147,6 +153,7 @@ const gameTips = ref('');
|
||||
const isHook = ref(0);
|
||||
const mapGoods = ref<Array<any>>([]);
|
||||
const taskCount = ref(0);
|
||||
const notice = ref<Array<any>>([]);
|
||||
// 城内地图显示
|
||||
const showCity = ref(false);
|
||||
|
||||
@@ -183,6 +190,7 @@ const BindData = async (map: string): Promise<void> => {
|
||||
mapGoods.value = result.data.mapGoods;
|
||||
isHook.value = result.data.isHook;
|
||||
taskCount.value = result.data.taskCount;
|
||||
notice.value = result.data.notice;
|
||||
// console.log(result)
|
||||
}
|
||||
else if (result.code == 103) {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<Abutton @click="btnChoice">使用物品</Abutton>
|
||||
</div>
|
||||
<div class="common" v-if="data.isDeal == 1">
|
||||
<Abutton @click="saleState=true">寄售</Abutton>
|
||||
<Abutton @click="saleState = true">寄售</Abutton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
物品名称:{{ data.goodsName }}<br>
|
||||
物品数量:{{ count }}<br>
|
||||
</div>
|
||||
<div class="common" style="text-align: center;">
|
||||
<div class="common" style="text-align: center;">
|
||||
<span style="font-size: 16px;">使用数量:</span><input type="number" class="search-ipt" v-model="useCount"><br>
|
||||
<button class="ipt-btn" name="serch" @click="UseGoods" style="margin-top: 15px;">确认</button>
|
||||
</div>
|
||||
@@ -86,8 +86,9 @@
|
||||
<div class="common" style="margin-top: 10px;">
|
||||
物品名称:{{ data.goodsName }}<br>
|
||||
物品数量:{{ count }}<br>
|
||||
<span style="font-size: 16px;">寄售价格:</span><input type="number" class="search-ipt" v-model="salePrice" />铜贝<br>
|
||||
<span style="font-size: 16px;">寄售数量:</span><input type="number" class="search-ipt" v-model="saleCount" />
|
||||
<span style="font-size: 16px;">寄售价格:</span><input type="number" class="search-ipt"
|
||||
v-model="salePrice" />铜贝<br>
|
||||
<span style="font-size: 16px;">寄售数量:</span><input type="number" class="search-ipt" v-model="saleCount" />
|
||||
</div>
|
||||
<div class="common" style="text-align: center;">
|
||||
<button class="ipt-btn" name="serch" @click="SaleOk" style="margin-top: 15px;">寄售</button>
|
||||
@@ -162,6 +163,10 @@ const showUse = () => {
|
||||
const showUseNumView = ref(false);
|
||||
|
||||
const UseGoods = async () => {
|
||||
if (useCount.value <= 0) {
|
||||
MessageExtend.ShowToast("使用数量不能小于0!", "fail")
|
||||
return;
|
||||
}
|
||||
MessageExtend.LoadingToast("使用中...");
|
||||
let result = await GoodsService.UseGoods(Number(goodsId), useCount.value);
|
||||
MessageExtend.LoadingClose();
|
||||
@@ -203,13 +208,21 @@ const saleState = ref(false);
|
||||
const salePrice = ref(1);
|
||||
const saleCount = ref(1);
|
||||
const SaleOk = async () => {
|
||||
if (saleCount.value <= 0) {
|
||||
MessageExtend.ShowToast("寄售数量不能小于0!", "fail")
|
||||
return;
|
||||
}
|
||||
if (salePrice.value <= 0) {
|
||||
MessageExtend.ShowToast("寄售价格不能小于0!", "fail")
|
||||
return;
|
||||
}
|
||||
MessageExtend.LoadingToast("寄售中...");
|
||||
let result = await TradeService.Trade(1, goodsId, salePrice.value, saleCount.value);
|
||||
MessageExtend.LoadingClose();
|
||||
if (result.code == 0) {
|
||||
saleState.value =false;
|
||||
saleState.value = false;
|
||||
await BindData();
|
||||
MessageExtend.Notify("寄售成功!","success");
|
||||
MessageExtend.Notify("寄售成功!", "success");
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("寄售装备", result.msg);
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
<div class="content">
|
||||
<div class="common" v-if="type == '0'">
|
||||
<div class="item" v-for="(item, index) in data" :key="index">
|
||||
{{ PageExtend.GetPageIndex(currentPage, 10, index + 1) }}.
|
||||
<Abar :href='"/prop/equ?ue=" + item.ueId'>{{ item.equName }}({{ item.lev }}级)</Abar>
|
||||
{{ PageExtend.GetPageIndex(currentPage, 10, index + 1) }}.
|
||||
<Abar :href='"/prop/equ?ue=" + item.ueId'><span v-html=" EquTool.ConvertEquName(item, 0)"></span>({{ item.lev }}级)</Abar>
|
||||
[<Abutton @click="SaleView(item)">赠送</Abutton>]
|
||||
</div>
|
||||
</div>
|
||||
@@ -97,6 +97,8 @@ const BindData = async (): Promise<void> => {
|
||||
total.value = result.data.total;
|
||||
userNo.value = result.data.userNo;
|
||||
nick.value = result.data.nick;
|
||||
console.log(result);
|
||||
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("提示", result.msg);
|
||||
|
||||
Reference in New Issue
Block a user