This commit is contained in:
Putoo
2026-06-05 18:06:38 +08:00
parent 5195407266
commit 1927e3f960
17 changed files with 575 additions and 27 deletions

View File

@@ -6,6 +6,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AJwtSecurityTokenHandler_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003Ff9d3fc33fd2fba97d4e718534a67f1d3c61e492634cd51c4798ce5621f780f3_003FJwtSecurityTokenHandler_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AList_00601_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F51505665371d472f8bdbc333fa4d888cf49938_003F0e_003F7279c963_003FList_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APoAction_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F8fb1d14dca1046e78e0684daa8bc3a1b7800_003Fb7_003F35e46383_003FPoAction_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARandomAssist_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa380d649d5b2495d9bfa0fa24f13662b6400_003F90_003F676312fd_003FRandomAssist_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASqlSetup_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F72993acb059c49dcbba437a858c0b0942000_003F46_003F2e14505d_003FSqlSetup_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASqlSugarScopeProvider_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6c0f22f0a47643a3b2a40899acd2044c2e3a00_003Fc5_003F4738d33f_003FSqlSugarScopeProvider_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStringAssist_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa380d649d5b2495d9bfa0fa24f13662b6400_003Fee_003F90da4dea_003FStringAssist_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

View File

@@ -0,0 +1,57 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_skill
{
/// <summary>
/// usId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string usId { get; set; }
/// <summary>
/// userId
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? userId { get; set; }
/// <summary>
/// skill
/// </summary>
[SugarColumn(IsNullable = true)]
public int? skill { get; set; }
/// <summary>
/// code
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? code { get; set; }
/// <summary>
/// name
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? name { get; set; }
/// <summary>
/// lev
/// </summary>
[SugarColumn(IsNullable = true)]
public int? lev { get; set; }
/// <summary>
/// sign
/// </summary>
[SugarColumn(IsNullable = true)]
public string? sign { get; set; }
/// <summary>
/// remark
/// </summary>
[SugarColumn(IsNullable = true)]
public string? remark { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace Application.Domain.Entity;
public class MapResModel
{
public string resId { get; set; }
public string resName { get; set; }
public int lev { get; set; }
public long lockTime { get; set; }
public int needVigour { get; set; }
public int gather { get; set; }
}

View File

@@ -18,6 +18,12 @@ namespace Application.Domain.Entity
[SugarColumn(Length = 50, IsNullable = true)]
public string? mapId { get; set; }
/// <summary>
/// 等级
/// </summary>
[SugarColumn(IsNullable = true)]
public int? lev { get; set; }
/// <summary>
/// 资源名称
/// </summary>
@@ -45,8 +51,8 @@ namespace Application.Domain.Entity
/// <summary>
/// 成功率
/// </summary>
[SugarColumn(Length = 18, IsNullable = true)]
public decimal? okRadio { get; set; }
[SugarColumn(IsNullable = true)]
public int? okRadio { get; set; }
/// <summary>
/// 采集锁定时间
@@ -54,4 +60,4 @@ namespace Application.Domain.Entity
[SugarColumn(IsNullable = true)]
public int? gatherTime { get; set; }
}
}
}

View File

@@ -0,0 +1,45 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Resource")]
public class game_skill
{
/// <summary>
/// skill
/// </summary>
[SugarColumn(IsPrimaryKey = true)]
public int skill { get; set; }
/// <summary>
/// code
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? code { get; set; }
/// <summary>
/// name
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? name { get; set; }
/// <summary>
/// lev
/// </summary>
[SugarColumn(IsNullable = true)]
public int? lev { get; set; }
/// <summary>
/// sign
/// </summary>
[SugarColumn(IsNullable = true)]
public string? sign { get; set; }
/// <summary>
/// remark
/// </summary>
[SugarColumn(IsNullable = true)]
public string? remark { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
namespace Application.Domain;
public static class SkillEnum
{
public enum code
{
GATHER,//采集术
FISH,//钓鱼术
DIVE,//潜水术
NEGOTI,//谈判术
FINANC,//理财术
ATK,//攻击术
DEFENCE,//防御术
AGILE,//敏捷术
RIDI,//乘骑术
WING,//翼形术
Collect,//采集术
}
}

View File

@@ -65,7 +65,11 @@ public interface IGameMapService
#region
Task<game_city_map_res> GetMapResInfo(string resId);
Task<List<game_city_map_res>> GetMapRes(string mapId);
Task<List<MapResModel>> GetMapResData(string mapId, int area);
Task<long> GetMapResLockTime(string resId, int area);
Task SetMapResLockTime(string resId, int area, int lockTime);
#endregion
}

View File

@@ -0,0 +1,11 @@
namespace Application.Domain;
public interface IGameSkillService
{
Task<game_skill> GetGameSkillInfo(int skillId);
Task<unit_user_skill> GetUserSkillInfo(string userId, string code);
Task<List<AttrItem>> GetUserSkillAttr(string userId);
Task<List<unit_user_skill>> GetUserSkill(string userId);
Task<bool> UpdateUserSkill(string userId, int skillId);
}

View File

@@ -877,14 +877,15 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
public async Task<game_city_map_bus> GetMapBusInfo(int busId)
{
string key = string.Format(BaseCache.BaseCacheKeys, "CITY_MAP_BUS","BUS_INFO");
string key = string.Format(BaseCache.BaseCacheKeys, "CITY_MAP_BUS", "BUS_INFO");
if (await redis.HExistsHashAsync(key, busId.ToString()))
{
return await redis.GetHashAsync<game_city_map_bus>(key, busId.ToString());
}
var db = DbClient.AsTenant().GetConnectionWithAttr<game_city_map_bus>();
var data = await db.Queryable<game_city_map_bus>().Where(it => it.busId == busId).SingleAsync();
await redis.AddHashAsync(key,busId.ToString(), data);
var data = await db.Queryable<game_city_map_bus>().Where(it => it.busId == busId).SingleAsync();
await redis.AddHashAsync(key, busId.ToString(), data);
return data;
}
@@ -924,7 +925,19 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
#endregion
#region
public async Task<game_city_map_res> GetMapResInfo(string resId)
{
string key = string.Format(BaseCache.BaseCacheKeys, "CityData", "MapResInfo");
var data = await redis.GetHashAsync<game_city_map_res>(key, resId);
if (data == null)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<game_city_map_res>();
data = await db.Queryable<game_city_map_res>().Where(it => it.resId == resId).SingleAsync();
await redis.AddHashAsync(key, resId, data);
}
return data;
}
public async Task<List<game_city_map_res>> GetMapRes(string mapId)
{
string key = string.Format(BaseCache.BaseCacheKeys, "CityData", "MapRes");
@@ -933,12 +946,56 @@ public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
{
var db = DbClient.AsTenant().GetConnectionWithAttr<game_city_map_res>();
data = await db.Queryable<game_city_map_res>().Where(it => it.mapId == mapId).ToListAsync();
await redis.AddHashAsync(key, mapId,data);
await redis.AddHashAsync(key, mapId, data);
}
return data;
}
public async Task<List<MapResModel>> GetMapResData(string mapId, int area)
{
var data = await GetMapRes(mapId);
List<MapResModel> result = new List<MapResModel>();
foreach (var item in data)
{
long lockTime = await GetMapResLockTime(item.resId, area);
MapResModel temp = new MapResModel()
{
resId = item.resId,
resName = item.resName,
lev = (int)item.lev,
lockTime = lockTime,
needVigour = (int)item.needVigour,
gather = (int)item.gatherTime
};
result.Add(temp);
}
return result;
}
public async Task<long> GetMapResLockTime(string resId, int area)
{
long result = 0;
string key = string.Format(BaseCache.BaseCacheKeys, "CityData", "MapResLockTime");
string field = $"{area}_{resId}";
if (await redis.HExistsHashAsync(key, field))
{
long lockTime = await redis.GetHashAsync<long>(key, field);
result = lockTime - TimeExtend.GetTimeStampSeconds;
result = result <= 0 ? 0 : result;
}
return result;
}
public async Task SetMapResLockTime(string resId, int area, int lockTime)
{
string key = string.Format(BaseCache.BaseCacheKeys, "CityData", "MapResLockTime");
string field = $"{area}_{resId}";
long atTime = TimeExtend.GetTimeStampSeconds + lockTime;
await redis.AddHashAsync(key, field, atTime);
}
#endregion
}

View File

@@ -0,0 +1,120 @@
using Newtonsoft.Json;
namespace Application.Domain;
public class GameSkillService(ISqlSugarClient DbClient, IRedisCache redis) : IGameSkillService, ITransient
{
public async Task<game_skill> GetGameSkillInfo(int skillId)
{
string key = string.Format(BaseCache.BaseCacheKeys, "SkillData", "SkillInfo");
var data = await redis.GetHashAsync<game_skill>(key, skillId.ToString());
if (data == null)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<game_skill>();
data = await db.Queryable<game_skill>().Where(it => it.skill == skillId).SingleAsync();
await redis.AddHashAsync(key, skillId.ToString(), data);
}
return data;
}
private string GetUserSkillKey(string userId, string code)
{
return $"{userId}_{code}";
}
public async Task<unit_user_skill> GetUserSkillInfo(string userId, string code)
{
string usId = GetUserSkillKey(userId, code);
string key = string.Format(BaseCache.BaseCacheKeys, "SkillData", "UserSkill");
if (await redis.HExistsHashAsync(key,usId))
{
return await redis.GetHashAsync<unit_user_skill>(key,usId);
}
else
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_skill>();
var data = await db.Queryable<unit_user_skill>().Where(it => it.usId == usId).SingleAsync();
await redis.AddHashAsync(key,usId, data);
return data;
}
}
public async Task<List<AttrItem>> GetUserSkillAttr(string userId)
{
List<AttrItem> result = new List<AttrItem>();
string key = string.Format(BaseCache.BaseCacheKeys, "SkillData", "UserSkillAttr");
if (await redis.HExistsHashAsync(key,userId))
{
result = await redis.GetHashAsync<List<AttrItem>>(key,userId);
}
else
{
var data = await GetUserSkill(userId);
foreach (var item in data)
{
if (item.code == nameof(SkillEnum.code.ATK) || item.code ==nameof(SkillEnum.code.DEFENCE) ||
item.code == nameof(SkillEnum.code.AGILE))
{
List<AttrItem> attr = JsonConvert.DeserializeObject<List<AttrItem>>(item.sign);
result.AddRange(attr);
}
}
await redis.AddHashAsync(key,userId, result);
}
return result;
}
public async Task<List<unit_user_skill>> GetUserSkill(string userId)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_skill>();
return await db.Queryable<unit_user_skill>().Where(it => it.userId == userId)
.OrderBy(it => it.name, OrderByType.Asc).ToListAsync();
}
private async Task ClearUserSkillInfo(string userId, string code)
{
string usId = GetUserSkillKey(userId, code);
string key = string.Format(BaseCache.BaseCacheKeys, "SkillData", "UserSkill");
await redis.DelHashAsync(key,usId);
key = string.Format(BaseCache.BaseCacheKeys, "SkillData", "UserSkillAttr");
await redis.DelHashAsync(key);
}
public async Task<bool> UpdateUserSkill(string userId, int skillId)
{
bool result = false;
var skillInfo = await GetGameSkillInfo(skillId);
if (skillInfo != null)
{
unit_user_skill usInfo = new unit_user_skill();
usInfo.usId = GetUserSkillKey(userId, skillInfo.code);
usInfo.userId = userId;
usInfo.code = skillInfo.code;
usInfo.skill = skillInfo.skill;
usInfo.name = skillInfo.name;
usInfo.lev = skillInfo.lev;
usInfo.sign = skillInfo.sign;
usInfo.remark = skillInfo.remark;
var userSkill = await GetUserSkillInfo(userId, skillInfo.code);
if (userSkill == null)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_skill>();
result = await db.Insertable(usInfo).ExecuteCommandAsync() > 0;
}
else if (userSkill.lev < skillInfo.lev)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_skill>();
result = await db.Updateable(usInfo).ExecuteCommandAsync() > 0;
}
}
if (result)
{
await ClearUserSkillInfo(userId, skillInfo.code);
}
return result;
}
}

View File

@@ -18,10 +18,11 @@ public class MapController : ControllerBase
private readonly IMessageService _messageService;
private readonly IUnitUserWeight _weightService;
private readonly IUnitUserAccService _accService;
private readonly IGameSkillService _skillService;
private readonly IGameGoodsService _goodsService;
public MapController(IUnitUserService userService, IGameMapService mapService, IGameChatService chatService,
IUnitUserAttrService attrService, IMessageService messageService, IUnitUserWeight weightService,
IUnitUserAccService accService)
IUnitUserAccService accService, IGameSkillService skillService,IGameGoodsService goodsService)
{
_userService = userService;
_mapService = mapService;
@@ -30,6 +31,8 @@ public class MapController : ControllerBase
_messageService = messageService;
_weightService = weightService;
_accService = accService;
_skillService = skillService;
_goodsService = goodsService;
}
#region
@@ -118,10 +121,10 @@ public class MapController : ControllerBase
}
//地图资源
List<game_city_map_res> mapRes = new List<game_city_map_res>();
List<MapResModel> mapRes = new List<MapResModel>();
if (mapInfo.isRes == 1)
{
mapRes = await _mapService.GetMapRes(mapInfo.mapId);
mapRes = await _mapService.GetMapResData(mapInfo.mapId, area);
}
#endregion
@@ -635,4 +638,78 @@ public class MapController : ControllerBase
}
#endregion
#region
/// <summary>
/// 采集接口
/// </summary>
/// <param name="resId"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> CollectMapRes(string resId)
{
var resInfo = await _mapService.GetMapResInfo(resId);
if (resInfo == null)
{
return PoAction.Message("特产不存在!");
}
var userId = StateHelper.userId;
int area = StateHelper.areaId;
var onMap = await _mapService.GetUserOnMap(userId);
if (onMap.mapId != resInfo.mapId)
{
return PoAction.Message("特产不存在!");
}
long lockTime = await _mapService.GetMapResLockTime(resId, area);
if (lockTime > 0)
{
return PoAction.Message($"{lockTime}秒后可采集!");
}
var skillInfo = await _skillService.GetUserSkillInfo(userId, nameof(SkillEnum.code.Collect));
if (skillInfo == null)
{
return PoAction.Message("未学习采集术!");
}
if (skillInfo.lev < resInfo.lev)
{
return PoAction.Message($"需要{resInfo.lev}级采集术才可以采集哦!");
}
var myVigour = await _attrService.GetUserVigourInfo(userId);
Console.WriteLine($"{myVigour.vitality }-{resInfo.needVigour}");
if (myVigour.vitality < resInfo.needVigour)
{
return PoAction.Message("活力不足!");
}
if (await _attrService.UpdateUserVigour(userId, 0, (int)resInfo.needVigour))
{
await _mapService.SetMapResLockTime(resId, area, (int)resInfo.gatherTime);
if (RandomAssist.CheakRandom((int)resInfo.okRadio))
{
//采集成功
string[] counts = resInfo.count.Split('-');
int onCount =
RandomAssist.GetFormatedNumeric(Convert.ToInt32(counts[0]), Convert.ToInt32(counts[1]) + 1);
await _goodsService.UpdateUserGoods(userId, 1, (int)resInfo.goodsId, onCount, "采集获得");
return PoAction.Ok(resInfo.gatherTime, $"成功采集{resInfo.resName}×{onCount}!");
}
else
{
await _mapService.SetMapResLockTime(resId, area, (int)resInfo.gatherTime);
return PoAction.Ok(resInfo.gatherTime, "抱歉,采集失败!提升技能会提高成功率哦!");
}
}
else
{
return PoAction.Message("采集失败,请稍后尝试!");
}
}
#endregion
}

View File

@@ -15,10 +15,10 @@ public class UserController : ControllerBase
private readonly IUnitUserRelationService _relationService;
private readonly IGameGoodsService _goodsService;
private readonly IGameChatService _chatService;
private readonly IGameSkillService _skillService;
public UserController(IUnitUserService userService, IUnitUserAttrService attrService,
IUnitUserAccService accService, IGameMapService mapService, IUnitUserRelationService relationService,
IGameGoodsService goodsService, IGameChatService chatService)
IGameGoodsService goodsService, IGameChatService chatService,IGameSkillService skillService)
{
_userService = userService;
_attrService = attrService;
@@ -27,6 +27,7 @@ public class UserController : ControllerBase
_relationService = relationService;
_goodsService = goodsService;
_chatService = chatService;
_skillService = skillService;
}
@@ -280,4 +281,16 @@ public class UserController : ControllerBase
return PoAction.Message("操作失败,请稍后尝试!");
}
}
/// <summary>
/// 获取用户技能
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction>GetUserSkill()
{
var userId = StateHelper.userId;
var data = await _skillService.GetUserSkill(userId);
return PoAction.Ok(data);
}
}

View File

@@ -21,9 +21,6 @@ body {
.main {}
div {
margin: 5px 2px;
}
div img {
margin-right: 2px;
@@ -38,13 +35,21 @@ div img {
max-height: 120px;
}
.head {}
.head {
margin: 5px 2px;
}
.title {}
.title {
margin: 5px 2px;
}
.content {}
.content {
margin: 5px 2px;
}
.item {}
.item {
margin: 5px 2px;
}
.border {
border-bottom: 1px dashed #9f8d8d;
@@ -54,7 +59,9 @@ div img {
height: 5px;
}
.foot {}
.foot {
margin: 5px 2px;
}
a {
color: #1e5494;
@@ -91,7 +98,9 @@ a:focus {
color: red;
}
.common {}
.common {
margin: 5px 2px;
}
.common img {
margin-right: 2px;

View File

@@ -31,7 +31,7 @@
<div class="content" v-if="mapRes.length > 0">
特产:<br>
<div class="item" v-for="item in mapRes">
<Abutton>{{item.resName}}</Abutton>
<Abutton @click="showResProp(item)">{{ item.resName }}({{ item.lev }})</Abutton>
</div>
</div>
@@ -89,6 +89,20 @@
</div>
</GamePopup>
<GamePopup v-model:show="showRes" title="【采集】" style="width: 60%;">
<!-- 自定义内容 -->
<div class="content">
物品名称{{ showResData.resName }}<br>
采集要求{{ showResData.lev }}级采集术<br>
消耗活力{{ showResData.needVigour }}<br>
冷却时间{{ showResData.gather }}<br>
</div>
<div class="content" style="max-height: 300px;text-align: center; margin-top: 15px;;">
<van-button type="success" :disabled="resLockDiff > 0 ? true : false" @click="CollectRes">
{{ resLockDiff > 0 ? `${resLockDiff}秒后可采集` : "立即采集" }}
</van-button>
</div>
</GamePopup>
</template>
<script setup lang="ts">
definePageMeta({
@@ -132,8 +146,6 @@ const BindData = async (map: string): Promise<void> => {
mapRes.value = result.data.mapRes;
MapVent(result.data.mapInfo.near);
onMap.value = mapInfo.value.mapId;
console.log(result.data);
}
else if (result.code == 103) {
PageExtend.Redirect("/map/runing");
@@ -235,4 +247,46 @@ const StartToMap = () => {
}
/**采集相关 */
const showRes = ref(false);
const showResData = ref<any>({});
const resLockDiff = ref(0);
const reslockTimer = ref(0) // 定时器实例
const showResProp = async (data: any) => {
showRes.value = true;
showResData.value = data;
resLockDiff.value = data.lockTime;
if (resLockDiff.value > 0) {
reslockTimer.value = setInterval(async () => {
resLockRun();
}, 1000)
}
}
const resLockRun = () => {
if (resLockDiff.value > 0) {
resLockDiff.value = resLockDiff.value - 1;
}
else {
clearInterval(reslockTimer.value);
}
}
const CollectRes = async () => {
MessageExtend.LoadingToast("采集中...");
let result = await MapService.CollectMapRes(showResData.value.resId);
MessageExtend.LoadingClose();
if (result.code == 0) {
resLockDiff.value = result.data;
MessageExtend.ShowToast(result.msg);
clearInterval(reslockTimer.value);
reslockTimer.value = setInterval(async () => {
resLockRun();
}, 1000)
}
else {
MessageExtend.ShowDialog("提示", result.msg);
}
}
</script>

View File

@@ -1 +1,49 @@
<template></template>
<template>
<div class="content">我的技能</div>
<div class="content">
<div class="item" v-for="(item,index) in data" :key="index">
{{index+1}}.<Abutton @click="showView(item)">{{item.name}}({{item.lev}})</Abutton>
</div>
<span v-if="data.length==0">暂无技能.</span>
</div>
<GamePopup v-model:show="showInfo" title="【技能说明】" style="width: 50%;">
<!-- 自定义内容 -->
<div class="content" v-html="onShow.remark">
</div>
</GamePopup>
</template>
<script setup lang="ts">
definePageMeta({
layout: layout.default,
middleware: middleware.loading
})
const data = ref<Array<any>>([]);
const showInfo = ref(false);
const onShow = ref<any>({});
onMounted(async () => {
try {
await BindData();
}
finally {
PageLoading.Close();
}
})
const BindData = async () => {
let result = await UserService.GetUserSkill();
if (result.code == 0) {
data.value = result.data;
}
else {
MessageExtend.ShowDialog("技能", result.msg);
}
}
const showView = (data: any) => {
showInfo.value = true;
onShow.value = data;
}
</script>

View File

@@ -86,4 +86,12 @@ export class MapService {
static async GetNpcInfo(npcId: number) {
return await ApiService.Request("get", "/Map/Map/GetNpcInfo", { npcId });
}
/**
* 采集接口
* GET /Map/Map/CollectMapRes
*/
static async CollectMapRes(resId: string) {
return await ApiService.Request("get", "/Map/Map/CollectMapRes", { resId });
}
}

View File

@@ -57,4 +57,12 @@ export class UserService {
static async UpdateUserSign(sign: string) {
return await ApiService.Request("post", "/User/User/UpdateUserSign", { sign });
}
/**
* 获取用户技能
* GET /User/User/GetUserSkill
*/
static async GetUserSkill() {
return await ApiService.Request("get", "/User/User/GetUserSkill");
}
}