222
This commit is contained in:
@@ -0,0 +1,81 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Application.Domain.Entity
|
||||||
|
{
|
||||||
|
[Tenant("Kg.SeaTime.Resource")]
|
||||||
|
public class game_goods
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// goodsId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true)]
|
||||||
|
public int goodsId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// goodsName
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? goodsName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// lev
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? lev { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// code
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// img
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? img { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// tips
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public string? tips { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// source
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public string? source { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// weight
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? weight { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// sysPrice
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 18, IsNullable = true)]
|
||||||
|
public decimal? sysPrice { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// content
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public string? content { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 0不可交易1可交易
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? isDeal { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 0不可赠送 1可赠送
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? isGive { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
10
Service/Application.Domain/Enum/GameEnum.cs
Normal file
10
Service/Application.Domain/Enum/GameEnum.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public class GameEnum
|
||||||
|
{
|
||||||
|
public enum LogCode
|
||||||
|
{
|
||||||
|
减少,
|
||||||
|
增加
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public interface IGameEquService
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public interface IGameGoodsService
|
||||||
|
{
|
||||||
|
#region 道具资源
|
||||||
|
|
||||||
|
Task<game_goods> GetGoodsInfo(int goodsId);
|
||||||
|
Task<string> GetGoodsContent(int goodsId);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 个人道具
|
||||||
|
|
||||||
|
Task<unit_user_goods> GetUserGoodsInfo(string ugId);
|
||||||
|
Task<unit_user_goods> GetUserGoodsInfo(string userId, int goodsId);
|
||||||
|
Task<int> GetUserGoodsCount(string userId, int goodsId);
|
||||||
|
|
||||||
|
Task<List<unit_user_goods>> GetUserGoodsData(string userId, List<string> code, string search, int page,
|
||||||
|
int limit, RefAsync<int> total);
|
||||||
|
|
||||||
|
Task<bool> UpdateUserGoods(string userId, int op, int goodsId, int count, string remark = "");
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ public interface IGameMapService
|
|||||||
|
|
||||||
Task<game_city> GetCityInfo(int cityId);
|
Task<game_city> GetCityInfo(int cityId);
|
||||||
Task<game_city_map> GetMapInfo(string mapId);
|
Task<game_city_map> GetMapInfo(string mapId);
|
||||||
|
Task<List<game_city_map>> GetMapCity(int cityId);
|
||||||
Task<int> GetMapCityByMapId(string mapId);
|
Task<int> GetMapCityByMapId(string mapId);
|
||||||
Task<List<game_city_npc>> GetMapNpc(string mapId);
|
Task<List<game_city_npc>> GetMapNpc(string mapId);
|
||||||
Task<game_city_npc> GetNpcInfo(int npcId);
|
Task<game_city_npc> GetNpcInfo(int npcId);
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGameEquService, ITransient
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
using System.Reflection.Metadata;
|
||||||
|
|
||||||
|
namespace Application.Domain;
|
||||||
|
|
||||||
|
public class GameGoodsService(ISqlSugarClient DbClient, IRedisCache redis) : IGameEquService, ITransient
|
||||||
|
{
|
||||||
|
#region 道具资源
|
||||||
|
|
||||||
|
public async Task<game_goods> GetGoodsInfo(int goodsId)
|
||||||
|
{
|
||||||
|
string key = string.Format(BaseCache.BaseCacheKey, "GoodsData");
|
||||||
|
var data = await redis.GetHashAsync<game_goods>(key, goodsId.ToString());
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_goods>();
|
||||||
|
data = await db.Queryable<game_goods>().Where(it => it.goodsId == goodsId).SingleAsync();
|
||||||
|
await redis.AddHashAsync(key, goodsId.ToString(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<string> GetGoodsContent(int goodsId)
|
||||||
|
{
|
||||||
|
var goodsInfo = await GetGoodsInfo(goodsId);
|
||||||
|
if (goodsInfo == null)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return goodsInfo.content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 个人道具
|
||||||
|
|
||||||
|
public async Task<unit_user_goods> GetUserGoodsInfo(string ugId)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_goods>();
|
||||||
|
return await db.Queryable<unit_user_goods>().Where(it => it.ugId == ugId).SingleAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<unit_user_goods> GetUserGoodsInfo(string userId, int goodsId)
|
||||||
|
{
|
||||||
|
string ugId = GetUserGoodsKey(userId, goodsId);
|
||||||
|
return await GetUserGoodsInfo(ugId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<int> GetUserGoodsCount(string userId, int goodsId)
|
||||||
|
{
|
||||||
|
var info = await GetUserGoodsInfo(userId, goodsId);
|
||||||
|
return info == null ? 0 : (int)info.count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<unit_user_goods>> GetUserGoodsData(string userId, List<string> code, string search, int page,
|
||||||
|
int limit, RefAsync<int> total)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_goods>();
|
||||||
|
return await db.Queryable<unit_user_goods>().Where(it => it.userId == userId && it.count > 0)
|
||||||
|
.WhereIF(code.Count > 0, it => code.Contains(it.code))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(search), it => it.goodsName.Contains(search))
|
||||||
|
.OrderBy(it => it.lev, OrderByType.Desc)
|
||||||
|
.OrderBy(it => it.count, OrderByType.Desc)
|
||||||
|
.ToPageListAsync(page, limit, total);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<bool> UpdateUserGoods(string userId, int op, int goodsId, int count, string remark = "")
|
||||||
|
{
|
||||||
|
bool isOk = false;
|
||||||
|
unit_user_goods UserGoods = new unit_user_goods();
|
||||||
|
string ugId = GetUserGoodsKey(userId, goodsId);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_goods>();
|
||||||
|
UserGoods = await db.Queryable<unit_user_goods>().Where(it => it.ugId == ugId).SingleAsync();
|
||||||
|
await DbClient.AsTenant().BeginTranAsync();
|
||||||
|
if (op == 1) //增加
|
||||||
|
{
|
||||||
|
if (UserGoods == null)
|
||||||
|
{
|
||||||
|
var goodsInfo = await GetGoodsInfo(goodsId);
|
||||||
|
UserGoods = new unit_user_goods();
|
||||||
|
UserGoods.ugId = ugId;
|
||||||
|
UserGoods.userId = userId;
|
||||||
|
UserGoods.goodsId = goodsId;
|
||||||
|
UserGoods.count = count;
|
||||||
|
UserGoods.lev = goodsInfo.lev;
|
||||||
|
UserGoods.code = goodsInfo.code;
|
||||||
|
UserGoods.goodsName = goodsInfo.goodsName;
|
||||||
|
UserGoods.weight = goodsInfo.weight;
|
||||||
|
UserGoods.sysPrice = goodsInfo.sysPrice;
|
||||||
|
UserGoods.isDeal = goodsInfo.isDeal;
|
||||||
|
UserGoods.isGive = goodsInfo.isGive;
|
||||||
|
isOk = await db.Insertable(UserGoods).ExecuteCommandAsync() > 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isOk = await db.Updateable<unit_user_goods>().SetColumns(it => it.count == it.count + count)
|
||||||
|
.Where(it => it.ugId == ugId).ExecuteCommandAsync() > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isOk = await db.Updateable<unit_user_goods>().SetColumns(it => it.count == it.count - count)
|
||||||
|
.Where(it => it.ugId == ugId).ExecuteCommandAsync() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
await DbClient.AsTenant().CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
await DbClient.AsTenant().RollbackTranAsync();
|
||||||
|
isOk = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isOk)
|
||||||
|
{
|
||||||
|
//更新负重
|
||||||
|
|
||||||
|
//添加日志
|
||||||
|
|
||||||
|
await AddGoodsLog(userId, goodsId, op, count, remark);
|
||||||
|
}
|
||||||
|
|
||||||
|
return isOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<bool> AddGoodsLog(string userId, int goodsId, int code, int count, string remark)
|
||||||
|
{
|
||||||
|
unit_user_goods_log bagLog = new unit_user_goods_log();
|
||||||
|
bagLog.logId = StringAssist.NewGuid;
|
||||||
|
bagLog.userId = userId;
|
||||||
|
bagLog.goodsId = goodsId;
|
||||||
|
bagLog.code = code == 0 ? bagLog.code = nameof(GameEnum.LogCode.减少) : bagLog.code = nameof(GameEnum.LogCode.增加);
|
||||||
|
bagLog.count = count;
|
||||||
|
bagLog.addTime = DateTime.Now;
|
||||||
|
bagLog.remark = remark;
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_goods_log>();
|
||||||
|
return await db.Insertable(bagLog).SplitTable().ExecuteCommandAsync() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 辅助
|
||||||
|
|
||||||
|
private string GetUserGoodsKey(string userId, int goodsId)
|
||||||
|
{
|
||||||
|
return $"{userId}_{goodsId}";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -1,27 +1,18 @@
|
|||||||
namespace Application.Domain;
|
namespace Application.Domain;
|
||||||
|
|
||||||
public class GameMapService : IGameMapService, ITransient
|
public class GameMapService (ISqlSugarClient DbClient, IRedisCache redis): IGameMapService, ITransient
|
||||||
{
|
{
|
||||||
private readonly ISqlSugarClient _dbClient;
|
|
||||||
private readonly IRedisCache _redisClient;
|
|
||||||
|
|
||||||
public GameMapService(ISqlSugarClient dbClient, IRedisCache redisClient)
|
|
||||||
{
|
|
||||||
_dbClient = dbClient;
|
|
||||||
_redisClient = redisClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region 城市地图数据
|
#region 城市地图数据
|
||||||
|
|
||||||
public async Task<game_city> GetCityInfo(int cityId)
|
public async Task<game_city> GetCityInfo(int cityId)
|
||||||
{
|
{
|
||||||
string key = string.Format(BaseCache.BaseCacheKeys, "MapCityData", "CityData");
|
string key = string.Format(BaseCache.BaseCacheKeys, "MapCityData", "CityData");
|
||||||
var data = await _redisClient.GetHashAsync<game_city>(key, cityId.ToString());
|
var data = await redis.GetHashAsync<game_city>(key, cityId.ToString());
|
||||||
if (data == null)
|
if (data == null)
|
||||||
{
|
{
|
||||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_city>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_city>();
|
||||||
data = await db.Queryable<game_city>().Where(it => it.cityId == cityId).SingleAsync();
|
data = await db.Queryable<game_city>().Where(it => it.cityId == cityId).SingleAsync();
|
||||||
await _redisClient.AddHashAsync(key, cityId.ToString(), data);
|
await redis.AddHashAsync(key, cityId.ToString(), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
@@ -30,17 +21,28 @@ public class GameMapService : IGameMapService, ITransient
|
|||||||
public async Task<game_city_map> GetMapInfo(string mapId)
|
public async Task<game_city_map> GetMapInfo(string mapId)
|
||||||
{
|
{
|
||||||
string key = string.Format(BaseCache.BaseCacheKeys, "MapCityData", "MapData");
|
string key = string.Format(BaseCache.BaseCacheKeys, "MapCityData", "MapData");
|
||||||
var data = await _redisClient.GetHashAsync<game_city_map>(key, mapId);
|
var data = await redis.GetHashAsync<game_city_map>(key, mapId);
|
||||||
if (data == null)
|
if (data == null)
|
||||||
{
|
{
|
||||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_city_map>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_city_map>();
|
||||||
data = await db.Queryable<game_city_map>().Where(it => it.mapId == mapId).SingleAsync();
|
data = await db.Queryable<game_city_map>().Where(it => it.mapId == mapId).SingleAsync();
|
||||||
await _redisClient.AddHashAsync(key, mapId, data);
|
await redis.AddHashAsync(key, mapId, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
public async Task<List<game_city_map>> GetMapCity(int cityId)
|
||||||
|
{
|
||||||
|
string key = string.Format(BaseCache.BaseCacheKeys, "MapCityData", "CityShowMap");
|
||||||
|
var data = await redis.GetHashAsync<List<game_city_map>>(key, cityId.ToString());
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_city_map>();
|
||||||
|
data = await db.Queryable<game_city_map>().Where(it => it.cityId == cityId && it.show == 1).ToListAsync();
|
||||||
|
await redis.AddHashAsync(key, cityId.ToString(), data);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
public async Task<int> GetMapCityByMapId(string mapId)
|
public async Task<int> GetMapCityByMapId(string mapId)
|
||||||
{
|
{
|
||||||
var data = await GetMapInfo(mapId);
|
var data = await GetMapInfo(mapId);
|
||||||
@@ -57,12 +59,12 @@ public class GameMapService : IGameMapService, ITransient
|
|||||||
public async Task<List<game_city_npc>> GetMapNpc(string mapId)
|
public async Task<List<game_city_npc>> GetMapNpc(string mapId)
|
||||||
{
|
{
|
||||||
string key = string.Format(BaseCache.BaseCacheKeys, "MapCityData", "NpcData");
|
string key = string.Format(BaseCache.BaseCacheKeys, "MapCityData", "NpcData");
|
||||||
var data = await _redisClient.GetHashAsync<List<game_city_npc>>(key, mapId);
|
var data = await redis.GetHashAsync<List<game_city_npc>>(key, mapId);
|
||||||
if (data == null)
|
if (data == null)
|
||||||
{
|
{
|
||||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_city_npc>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_city_npc>();
|
||||||
data = await db.Queryable<game_city_npc>().Where(it => it.mapId == mapId && it.status == 1).ToListAsync();
|
data = await db.Queryable<game_city_npc>().Where(it => it.mapId == mapId && it.status == 1).ToListAsync();
|
||||||
await _redisClient.AddHashAsync(key, mapId, data);
|
await redis.AddHashAsync(key, mapId, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
@@ -70,12 +72,12 @@ public class GameMapService : IGameMapService, ITransient
|
|||||||
public async Task<game_city_npc> GetNpcInfo(int npcId)
|
public async Task<game_city_npc> GetNpcInfo(int npcId)
|
||||||
{
|
{
|
||||||
string key = string.Format(BaseCache.BaseCacheKeys, "MapCityData", "NpcInfo");
|
string key = string.Format(BaseCache.BaseCacheKeys, "MapCityData", "NpcInfo");
|
||||||
var data = await _redisClient.GetHashAsync<game_city_npc>(key, npcId.ToString());
|
var data = await redis.GetHashAsync<game_city_npc>(key, npcId.ToString());
|
||||||
if (data == null)
|
if (data == null)
|
||||||
{
|
{
|
||||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_city_npc>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_city_npc>();
|
||||||
data = await db.Queryable<game_city_npc>().Where(it => it.npcId == npcId).SingleAsync();
|
data = await db.Queryable<game_city_npc>().Where(it => it.npcId == npcId).SingleAsync();
|
||||||
await _redisClient.AddHashAsync(key, npcId.ToString(),data);
|
await redis.AddHashAsync(key, npcId.ToString(),data);
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -98,14 +100,14 @@ public class GameMapService : IGameMapService, ITransient
|
|||||||
public async Task<unit_user_online> GetUserOnMap(string userId)
|
public async Task<unit_user_online> GetUserOnMap(string userId)
|
||||||
{
|
{
|
||||||
string key = string.Format(UserCache.BaseCacheKey, "UserOnline");
|
string key = string.Format(UserCache.BaseCacheKey, "UserOnline");
|
||||||
if (await _redisClient.HExistsHashAsync(key, userId))
|
if (await redis.HExistsHashAsync(key, userId))
|
||||||
{
|
{
|
||||||
return await _redisClient.GetHashAsync<unit_user_online>(key, userId);
|
return await redis.GetHashAsync<unit_user_online>(key, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<unit_user_online>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_online>();
|
||||||
var data = await db.Queryable<unit_user_online>().Where(it => it.userId == userId).SingleAsync();
|
var data = await db.Queryable<unit_user_online>().Where(it => it.userId == userId).SingleAsync();
|
||||||
await _redisClient.AddHashAsync(key, userId, data);
|
await redis.AddHashAsync(key, userId, data);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,9 +119,9 @@ public class GameMapService : IGameMapService, ITransient
|
|||||||
onLine.ip = ip;
|
onLine.ip = ip;
|
||||||
onLine.upTime = TimeAssist.GetTimeStampNum;
|
onLine.upTime = TimeAssist.GetTimeStampNum;
|
||||||
string key = string.Format(UserCache.BaseCacheKey, "UserOnline");
|
string key = string.Format(UserCache.BaseCacheKey, "UserOnline");
|
||||||
if (await _redisClient.AddHashAsync(key, userId, onLine))
|
if (await redis.AddHashAsync(key, userId, onLine))
|
||||||
{
|
{
|
||||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<unit_user_online>();
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_online>();
|
||||||
await db.Updateable<unit_user_online>(onLine).ExecuteCommandAsync();
|
await db.Updateable<unit_user_online>(onLine).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class MapController : ControllerBase
|
|||||||
npcData = npcData.FindAll(it => GameTool.AreaVerify(StateHelper.areaId, it.areaId));
|
npcData = npcData.FindAll(it => GameTool.AreaVerify(StateHelper.areaId, it.areaId));
|
||||||
//城市信息
|
//城市信息
|
||||||
var cityInfo = await _mapService.GetCityInfo((int)mapInfo.cityId);
|
var cityInfo = await _mapService.GetCityInfo((int)mapInfo.cityId);
|
||||||
|
var cityShow = await _mapService.GetMapCity(cityInfo.cityId);
|
||||||
#region 更新在线
|
#region 更新在线
|
||||||
|
|
||||||
string ip = ComHelper.GetClientUserIp(HttpContext);
|
string ip = ComHelper.GetClientUserIp(HttpContext);
|
||||||
@@ -61,7 +61,7 @@ public class MapController : ControllerBase
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
object ret = new { mapInfo, cityInfo, npcData, chatData };
|
object ret = new { mapInfo, cityInfo, npcData, chatData,cityShow };
|
||||||
|
|
||||||
return PoAction.Ok(ret);
|
return PoAction.Ok(ret);
|
||||||
}
|
}
|
||||||
|
|||||||
99
Web/src/components/Business/GamePopup.vue
Normal file
99
Web/src/components/Business/GamePopup.vue
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 游戏风格弹出层 -->
|
||||||
|
|
||||||
|
<van-popup v-model:show="visible" round :style="{ padding: '0px' }" closeable close-icon="close">
|
||||||
|
<div class="popup-header">
|
||||||
|
<div class="popup-title">
|
||||||
|
{{ title }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="popup-content">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</van-popup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
// 字段名、类型、默认值
|
||||||
|
isShow: Boolean,
|
||||||
|
title: String
|
||||||
|
})
|
||||||
|
const visible = ref(props.isShow)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 弹出层整体样式 */
|
||||||
|
:deep(.game-popup) {
|
||||||
|
width: 82%;
|
||||||
|
max-width: 360px;
|
||||||
|
border-radius: 20px !important;
|
||||||
|
background: linear-gradient(135deg, #1e1e2f 0%, #292947 100%);
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 标题栏 */
|
||||||
|
.popup-header {
|
||||||
|
position: relative;
|
||||||
|
padding: 18px 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 标题文字 */
|
||||||
|
.popup-title {
|
||||||
|
margin-top: -8px;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 关闭按钮 */
|
||||||
|
.close-btn {
|
||||||
|
position: absolute;
|
||||||
|
right: 16px;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 内容区域 */
|
||||||
|
.popup-content {
|
||||||
|
margin-top: -35px;
|
||||||
|
padding: 15px 15px;
|
||||||
|
color: #e0e0e0;
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 1.6;
|
||||||
|
min-height: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 底部按钮栏 */
|
||||||
|
.popup-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 14px 20px;
|
||||||
|
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 按钮通用样式 */
|
||||||
|
.footer-btn {
|
||||||
|
border-radius: 12px !important;
|
||||||
|
padding: 6px 18px !important;
|
||||||
|
font-size: 14px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 取消按钮 */
|
||||||
|
.cancel-btn {
|
||||||
|
color: #b0b0b0 !important;
|
||||||
|
border-color: #444455 !important;
|
||||||
|
background: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 确认按钮 */
|
||||||
|
.confirm-btn {
|
||||||
|
background: linear-gradient(90deg, #7b43ff, #5c3dff) !important;
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -33,8 +33,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<Abar href="/">*公聊频道发言规范</Abar><br />
|
<Abar href="/customer/chat">*公聊频道发言规范</Abar><br />
|
||||||
<Abar href="/">*游戏用户守则规范</Abar>
|
<Abar href="/customer/rule">*游戏用户守则规范</Abar>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -82,7 +82,6 @@ const Refresh = async (): Promise<void> => {
|
|||||||
MessageExtend.LoadingToast("刷新中...");
|
MessageExtend.LoadingToast("刷新中...");
|
||||||
await BindData(type.value);
|
await BindData(type.value);
|
||||||
MessageExtend.LoadingClose();
|
MessageExtend.LoadingClose();
|
||||||
MessageExtend.Notify("刷新成功!", "success");
|
|
||||||
PageExtend.ScrollToTop();
|
PageExtend.ScrollToTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
34
Web/src/pages/customer/chat.vue
Normal file
34
Web/src/pages/customer/chat.vue
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<template>
|
||||||
|
<div class="content">
|
||||||
|
【公共聊天规范】
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
为了给各位玩家营造一个健康、规范、和谐的聊天环境,现对聊天室做出相关规定,请各位玩家自觉遵守,如有违反官方客服将会根据本规定进行相应的处理。<br>
|
||||||
|
公聊规定:<br>
|
||||||
|
1、不得在刷屏(刷屏指:在公聊频道,短时间内出现同样或相似信息5遍及5遍以上);<br>
|
||||||
|
2、不得侮辱、诽谤、谩骂、恐吓他人,或进行其他恶意攻击;<br>
|
||||||
|
3、不得在聊天室发布含有挑衅性质的言辞;<br>
|
||||||
|
4、不得在聊天室宣传外网或群链接;<br>
|
||||||
|
5、不得在聊天室发布未经航海时代官方允许的商业广告;<br>
|
||||||
|
6、禁止在聊天室发表传播违反国家法律规定的言论(包含但不限于:泄露国家机密,宣传封建迷信、民族歧视,散布谣言,制造恐慌等)。<br>
|
||||||
|
<br>
|
||||||
|
处罚措施:<br>
|
||||||
|
违反以上规定,受到管理员和其他玩家的提醒后,应立即改正,<br>
|
||||||
|
1、对于拒不改正者,官方客服将根据情节严重与否,做出相应的警告、封禁处理。<br>
|
||||||
|
2、对于屡次违反规定者,官方客服将根据情节严重程度,做出相应的封禁处理。<br>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
definePageMeta({
|
||||||
|
layout: layout.default,
|
||||||
|
middleware: 'page-loading'
|
||||||
|
})
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
PageLoading.Close();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
37
Web/src/pages/customer/rule.vue
Normal file
37
Web/src/pages/customer/rule.vue
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<template>
|
||||||
|
<div class="content">
|
||||||
|
【用户守则】
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
游戏用户守则:<br>
|
||||||
|
一、帐号清理规则<br>
|
||||||
|
①官方有权对长期未登录游戏的账号做出账号回收处理。<br>
|
||||||
|
二、账号管理规则<br>
|
||||||
|
①、冒充官方人员或游戏币商人在游戏中行骗者,发布虚假信息者,官方有权长期封禁其帐号。<br>
|
||||||
|
②、提高安全防范意识,妥善保管帐号和密码,因帐号被盗造成的游戏损失,都不会得到游戏管理团队任何形式的补偿,由玩家自行负责。<br>
|
||||||
|
③、所有注册帐号只可用于玩家进行正常的游戏,不得用于对游戏进行恶意攻击或破坏,官方有权对任何不符合游戏规则的帐号进行封号。<br>
|
||||||
|
④、玩家游戏时使用的角色名等自定义命名均不得使用违反国家法规、带侮辱性的词语、“官方”字眼和游戏内NPC、怪物等游戏资源名字,不得故意注册和其他玩家相似的名字,如有违反,官方有权强制要求其更改或封禁帐号。<br>
|
||||||
|
⑤、辱骂官方人员者、诋毁游戏者,官方有权封禁其帐号。<br>
|
||||||
|
三、游戏漏洞规则<br>
|
||||||
|
①、驰骋四海游戏运营团队鼓励玩家报告游戏中出现的问题和漏洞,一经证实将获得奖励。<br>
|
||||||
|
②、所有利用游戏中的漏洞进行非法谋利或恶意攻击的行为被严格禁止,一经发现,帐号将被封禁。<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
航海时代游戏运营团队保留解释、更改和添加游戏规则的权利,本守则自公布之时起生效。<br>
|
||||||
|
2022.5.26<br>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
definePageMeta({
|
||||||
|
layout: layout.default,
|
||||||
|
middleware: 'page-loading'
|
||||||
|
})
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
PageLoading.Close();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -5,8 +5,8 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
{{ cityInfo.cityName }}·{{ mapInfo.mapName }}
|
{{ cityInfo.cityName }}·{{ mapInfo.mapName }}
|
||||||
<Abutton @click="Refresh">刷新</Abutton>
|
<Abutton @click="Refresh">刷新</Abutton>
|
||||||
<Abar href="">任务</Abar>
|
<Abar href="/task/">任务</Abar>
|
||||||
<Abar href="">消息</Abar>
|
<Abar href="/message/">消息</Abar>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="notification">
|
<div class="notification">
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
您看到:
|
您看到:
|
||||||
<a class="" href="/Map/Index/MapUser/16_27?sid=W6Wg8iH9gY7wIBNSEdtFcQ3KbI5YiKDo">
|
<a class="" href="/Map/Index/MapUser/16_27?sid=W6Wg8iH9gY7wIBNSEdtFcQ3KbI5YiKDo">1111
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
【<a class="" href="/Map/Index/MapCity/16_27?sid=W6Wg8iH9gY7wIBNSEdtFcQ3KbI5YiKDo">城内地图</a>】.<a class=""
|
【<Abutton @click="ShowCityProp">城内地图</Abutton>】.<a class=""
|
||||||
href="/Business/Help/Index?sid=W6Wg8iH9gY7wIBNSEdtFcQ3KbI5YiKDo">帮助</a>.<a class=""
|
href="/Business/Help/Index?sid=W6Wg8iH9gY7wIBNSEdtFcQ3KbI5YiKDo">帮助</a>.<a class=""
|
||||||
href="/Privilege/Purdiam/MapTo?sid=W6Wg8iH9gY7wIBNSEdtFcQ3KbI5YiKDo">传送</a><br />
|
href="/Privilege/Purdiam/MapTo?sid=W6Wg8iH9gY7wIBNSEdtFcQ3KbI5YiKDo">传送</a><br />
|
||||||
</div>
|
</div>
|
||||||
@@ -45,16 +45,30 @@
|
|||||||
<MapMenu></MapMenu>
|
<MapMenu></MapMenu>
|
||||||
</div>
|
</div>
|
||||||
<Footer></Footer>
|
<Footer></Footer>
|
||||||
|
<!-- 城内地图 -->
|
||||||
|
<GamePopup v-model:show="showCity" title="【城市地图】">
|
||||||
|
<!-- 自定义内容 -->
|
||||||
|
<div class="">
|
||||||
|
<span v-for="(item, index) in cityShow" :key="index">
|
||||||
|
<Abutton @click="ChangeMap(item.mapId)">{{ item.mapName }}</Abutton>
|
||||||
|
<br v-if="(index + 1) % 4 == 0">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</GamePopup>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
layout: layout.empty,
|
layout: layout.empty,
|
||||||
middleware: 'page-loading'
|
middleware: 'page-loading'
|
||||||
})
|
})
|
||||||
|
const onMap = ref('');
|
||||||
const mapInfo = ref<any>({});
|
const mapInfo = ref<any>({});
|
||||||
const cityInfo = ref<any>({});
|
const cityInfo = ref<any>({});
|
||||||
const npcData = ref<Array<any>>([]);
|
const npcData = ref<Array<any>>([]);
|
||||||
const chatData = ref<Array<any>>([]);
|
const chatData = ref<Array<any>>([]);
|
||||||
|
const cityShow = ref<Array<any>>([]);
|
||||||
|
// 城内地图显示
|
||||||
|
const showCity = ref(false)
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
@@ -73,7 +87,9 @@ const BindData = async (map: string): Promise<void> => {
|
|||||||
cityInfo.value = result.data.cityInfo;
|
cityInfo.value = result.data.cityInfo;
|
||||||
npcData.value = result.data.npcData;
|
npcData.value = result.data.npcData;
|
||||||
chatData.value = result.data.chatData;
|
chatData.value = result.data.chatData;
|
||||||
|
cityShow.value = result.data.cityShow;
|
||||||
MapVent(result.data.mapInfo.near);
|
MapVent(result.data.mapInfo.near);
|
||||||
|
onMap.value = mapInfo.value.mapId;
|
||||||
console.log(result.data);
|
console.log(result.data);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -87,7 +103,6 @@ const Refresh = async (): Promise<void> => {
|
|||||||
MessageExtend.LoadingToast("刷新中...");
|
MessageExtend.LoadingToast("刷新中...");
|
||||||
await BindData("");
|
await BindData("");
|
||||||
MessageExtend.LoadingClose();
|
MessageExtend.LoadingClose();
|
||||||
MessageExtend.Notify("刷新成功!", "success");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,4 +118,18 @@ const MapVent = (near: Array<any>): void => {
|
|||||||
mapBei.value = near.find(item => item.positition == '北');
|
mapBei.value = near.find(item => item.positition == '北');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**城市地图切换 */
|
||||||
|
const ShowCityProp = () => {
|
||||||
|
showCity.value = true;
|
||||||
|
}
|
||||||
|
let changLock = true;//切换锁
|
||||||
|
const ChangeMap = async (mapId: string): Promise<void> => {
|
||||||
|
if (mapId != onMap.value && changLock) {
|
||||||
|
changLock = false;
|
||||||
|
await BindData(mapId);
|
||||||
|
changLock = true;
|
||||||
|
}
|
||||||
|
showCity.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
1
Web/src/pages/message/index.vue
Normal file
1
Web/src/pages/message/index.vue
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<template></template>
|
||||||
3
Web/src/pages/task/index.vue
Normal file
3
Web/src/pages/task/index.vue
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
Reference in New Issue
Block a user