This commit is contained in:
Putoo
2026-05-20 18:32:54 +08:00
parent 2c85872abd
commit 784bc66ef6
51 changed files with 1818 additions and 106 deletions

View File

@@ -1,4 +1,4 @@
using SqlSugar;
using SqlSugar;
using System;
namespace Application.Domain.Entity
@@ -72,4 +72,4 @@ namespace Application.Domain.Entity
[SugarColumn(Length = 50, IsNullable = true)]
public string? openId { get; set; }
}
}
}

View File

@@ -1,4 +1,4 @@
using SqlSugar;
using SqlSugar;
using System;
namespace Application.Domain.Entity
@@ -83,11 +83,5 @@ namespace Application.Domain.Entity
/// </summary>
[SugarColumn(IsNullable = true)]
public DateTime? addTime { get; set; }
/// <summary>
/// 最后更新时间
/// </summary>
[SugarColumn(IsNullable = true)]
public DateTime? upTime { get; set; }
}
}

View File

@@ -0,0 +1,39 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_acc
{
/// <summary>
/// userId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string userId { get; set; }
/// <summary>
/// 海贝
/// </summary>
[SugarColumn(IsNullable = true)]
public long? cowry { get; set; }
/// <summary>
/// 金
/// </summary>
[SugarColumn(IsNullable = true)]
public long? gold { get; set; }
/// <summary>
/// 师德
/// </summary>
[SugarColumn(IsNullable = true)]
public long? teach { get; set; }
/// <summary>
/// 声望
/// </summary>
[SugarColumn(IsNullable = true)]
public long? renown { get; set; }
}
}

View File

@@ -0,0 +1,63 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_acc_log
{
/// <summary>
/// accId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 36)]
public string accId { get; set; }
/// <summary>
/// userId
/// </summary>
[SugarColumn(Length = 36, IsNullable = true)]
public string? userId { get; set; }
/// <summary>
/// accType
/// </summary>
[SugarColumn(Length = 255, IsNullable = true)]
public string? accType { get; set; }
/// <summary>
/// code
/// </summary>
[SugarColumn(Length = 255, IsNullable = true)]
public string? code { get; set; }
/// <summary>
/// name
/// </summary>
[SugarColumn(Length = 255, IsNullable = true)]
public string? name { get; set; }
/// <summary>
/// amount
/// </summary>
[SugarColumn(Length = 18, IsNullable = true)]
public decimal? amount { get; set; }
/// <summary>
/// addTime
/// </summary>
[SugarColumn(IsNullable = true)]
public DateTime? addTime { get; set; }
/// <summary>
/// endTime
/// </summary>
[SugarColumn(IsNullable = true)]
public DateTime? endTime { get; set; }
/// <summary>
/// remark
/// </summary>
[SugarColumn(Length = 255, IsNullable = true)]
public string? remark { get; set; }
}
}

View File

@@ -0,0 +1,63 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_attr
{
/// <summary>
/// userId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string userId { get; set; }
/// <summary>
/// lev
/// </summary>
[SugarColumn(IsNullable = true)]
public int? lev { get; set; }
/// <summary>
/// minAtk
/// </summary>
[SugarColumn(IsNullable = true)]
public int? minAtk { get; set; }
/// <summary>
/// maxAtk
/// </summary>
[SugarColumn(IsNullable = true)]
public int? maxAtk { get; set; }
/// <summary>
/// defense
/// </summary>
[SugarColumn(IsNullable = true)]
public int? defense { get; set; }
/// <summary>
/// agility
/// </summary>
[SugarColumn(IsNullable = true)]
public int? agility { get; set; }
/// <summary>
/// upBlood
/// </summary>
[SugarColumn(IsNullable = true)]
public int? upBlood { get; set; }
/// <summary>
/// upMorale
/// </summary>
[SugarColumn(IsNullable = true)]
public int? upMorale { get; set; }
/// <summary>
/// levUpdate
/// </summary>
[SugarColumn(IsNullable = true)]
public long? levUpdate { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_blood
{
/// <summary>
/// userId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string userId { get; set; }
/// <summary>
/// blood
/// </summary>
[SugarColumn(IsNullable = true)]
public int? blood { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_copper
{
/// <summary>
/// userId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string userId { get; set; }
/// <summary>
/// 铜
/// </summary>
[SugarColumn(IsNullable = true)]
public long? copper { get; set; }
}
}

View File

@@ -0,0 +1,267 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_equ
{
/// <summary>
/// ueId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string ueId { get; set; }
/// <summary>
/// userId
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? userId { get; set; }
/// <summary>
/// owerId
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? owerId { get; set; }
/// <summary>
/// equId
/// </summary>
[SugarColumn(IsNullable = true)]
public int? equId { get; set; }
/// <summary>
/// equName
/// </summary>
[SugarColumn(IsNullable = true)]
public string? equName { get; set; }
/// <summary>
/// unitEquName
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? unitEquName { get; set; }
/// <summary>
/// lev
/// </summary>
[SugarColumn(IsNullable = true)]
public int? lev { get; set; }
/// <summary>
/// quality
/// </summary>
[SugarColumn(IsNullable = true)]
public int? quality { get; set; }
/// <summary>
/// qualityName
/// </summary>
[SugarColumn(Length = 255, IsNullable = true)]
public string? qualityName { get; set; }
/// <summary>
/// qualityAttr
/// </summary>
[SugarColumn(Length = 2000, IsNullable = true)]
public string? qualityAttr { get; set; }
/// <summary>
/// sex
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? sex { 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>
/// sign
/// </summary>
[SugarColumn(Length = 100, IsNullable = true)]
public string? sign { get; set; }
/// <summary>
/// minAtk
/// </summary>
[SugarColumn(IsNullable = true)]
public int? minAtk { get; set; }
/// <summary>
/// maxAtk
/// </summary>
[SugarColumn(IsNullable = true)]
public int? maxAtk { get; set; }
/// <summary>
/// Defense
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Defense { get; set; }
/// <summary>
/// Agility
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Agility { get; set; }
/// <summary>
/// Blood
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Blood { get; set; }
/// <summary>
/// Morale
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Morale { get; set; }
/// <summary>
/// suitCode
/// </summary>
[SugarColumn(Length = 255, IsNullable = true)]
public string? suitCode { get; set; }
/// <summary>
/// durability
/// </summary>
[SugarColumn(IsNullable = true)]
public int? durability { get; set; }
/// <summary>
/// maxdurability
/// </summary>
[SugarColumn(IsNullable = true)]
public int? maxdurability { get; set; }
/// <summary>
/// isIntensify
/// </summary>
[SugarColumn(IsNullable = true)]
public int? isIntensify { get; set; }
/// <summary>
/// intensifyLev
/// </summary>
[SugarColumn(IsNullable = true)]
public int? intensifyLev { get; set; }
/// <summary>
/// holeCount
/// </summary>
[SugarColumn(IsNullable = true)]
public int? holeCount { get; set; }
/// <summary>
/// opTime
/// </summary>
[SugarColumn(IsNullable = true)]
public int? opTime { get; set; }
/// <summary>
/// useEndTime
/// </summary>
[SugarColumn(IsNullable = true)]
public DateTime? useEndTime { get; set; }
/// <summary>
/// weight
/// </summary>
[SugarColumn(IsNullable = true)]
public int? weight { get; set; }
/// <summary>
/// isLock
/// </summary>
[SugarColumn(IsNullable = true)]
public int? isLock { get; set; }
/// <summary>
/// sysPrice
/// </summary>
[SugarColumn(Length = 10, IsNullable = true)]
public decimal? sysPrice { get; set; }
/// <summary>
/// canEqualUp
/// </summary>
[SugarColumn(IsNullable = true)]
public int? canEqualUp { get; set; }
/// <summary>
/// EquAttr
/// </summary>
[SugarColumn(IsNullable = true)]
public string? EquAttr { get; set; }
/// <summary>
/// EquMent
/// </summary>
[SugarColumn(IsNullable = true)]
public string? EquMent { get; set; }
/// <summary>
/// EquAwaken
/// </summary>
[SugarColumn(IsNullable = true)]
public string? EquAwaken { get; set; }
/// <summary>
/// GemMent
/// </summary>
[SugarColumn(IsNullable = true)]
public string? GemMent { get; set; }
/// <summary>
/// isDeal
/// </summary>
[SugarColumn(IsNullable = true)]
public int? isDeal { get; set; }
/// <summary>
/// isGive
/// </summary>
[SugarColumn(IsNullable = true)]
public int? isGive { get; set; }
/// <summary>
/// score
/// </summary>
[SugarColumn(IsNullable = true)]
public int? score { get; set; }
/// <summary>
/// start
/// </summary>
[SugarColumn(IsNullable = true)]
public int? start { get; set; }
/// <summary>
/// exp
/// </summary>
[SugarColumn(IsNullable = true)]
public int? exp { get; set; }
/// <summary>
/// startAttr
/// </summary>
[SugarColumn(IsNullable = true)]
public string? startAttr { get; set; }
/// <summary>
/// swallow
/// </summary>
[SugarColumn(IsNullable = true)]
public string? swallow { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_exp
{
/// <summary>
/// userId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string userId { get; set; }
/// <summary>
/// exp
/// </summary>
[SugarColumn(IsNullable = true)]
public long? exp { get; set; }
/// <summary>
/// upExp
/// </summary>
[SugarColumn(IsNullable = true)]
public long? upExp { get; set; }
}
}

View File

@@ -0,0 +1,45 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_friend
{
/// <summary>
/// fId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string fId { get; set; }
/// <summary>
/// sId
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? sId { get; set; }
/// <summary>
/// mId
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? mId { get; set; }
/// <summary>
/// near
/// </summary>
[SugarColumn(IsNullable = true)]
public int? near { get; set; }
/// <summary>
/// status
/// </summary>
[SugarColumn(IsNullable = true)]
public int? status { get; set; }
/// <summary>
/// addTime
/// </summary>
[SugarColumn(IsNullable = true)]
public DateTime? addTime { get; set; }
}
}

View File

@@ -0,0 +1,75 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_goods
{
/// <summary>
/// ugId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string ugId { get; set; }
/// <summary>
/// userId
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? userId { get; set; }
/// <summary>
/// goodsId
/// </summary>
[SugarColumn(IsNullable = 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>
/// count
/// </summary>
[SugarColumn(Length = 65, IsNullable = true)]
public decimal? count { 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>
/// 0不可交易1可交易
/// </summary>
[SugarColumn(IsNullable = true)]
public int? isDeal { get; set; }
/// <summary>
/// 0不可赠送 1可赠送
/// </summary>
[SugarColumn(IsNullable = true)]
public int? isGive { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_morale
{
/// <summary>
/// userId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string userId { get; set; }
/// <summary>
/// morale
/// </summary>
[SugarColumn(IsNullable = true)]
public long? morale { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_online
{
/// <summary>
/// userId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string userId { get; set; }
/// <summary>
/// mapId
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? mapId { get; set; }
/// <summary>
/// ip
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? ip { get; set; }
/// <summary>
/// upTime
/// </summary>
[SugarColumn(IsNullable = true)]
public long? upTime { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_vigour
{
/// <summary>
/// 活力表
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string userId { get; set; }
/// <summary>
/// 当前活力
/// </summary>
[SugarColumn(IsNullable = true)]
public long? vitality { get; set; }
/// <summary>
/// 最大活力
/// </summary>
[SugarColumn(IsNullable = true)]
public long? upVitality { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[SugarColumn(IsNullable = true)]
public string? upTime { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_weight
{
/// <summary>
/// userId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string userId { get; set; }
/// <summary>
/// onWeight
/// </summary>
[SugarColumn(IsNullable = true)]
public int? onWeight { get; set; }
/// <summary>
/// maxWeight
/// </summary>
[SugarColumn(IsNullable = true)]
public int? maxWeight { get; set; }
}
}

View File

@@ -0,0 +1,57 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Game")]
public class unit_user_weight_log
{
/// <summary>
/// logId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string logId { get; set; }
/// <summary>
/// userId
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? userId { get; set; }
/// <summary>
/// goodsId
/// </summary>
[SugarColumn(IsNullable = true)]
public int? goodsId { get; set; }
/// <summary>
/// goodsName
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? goodsName { get; set; }
/// <summary>
/// weight
/// </summary>
[SugarColumn(IsNullable = true)]
public int? weight { get; set; }
/// <summary>
/// count
/// </summary>
[SugarColumn(IsNullable = true)]
public int? count { get; set; }
/// <summary>
/// sum
/// </summary>
[SugarColumn(IsNullable = true)]
public int? sum { get; set; }
/// <summary>
/// addTime
/// </summary>
[SugarColumn(IsNullable = true)]
public DateTime? addTime { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace Application.Domain.Entity;
public class MapNear
{
public string mapId { get; set; }
public string Name { get; set; }
public string positition { get; set; }
}

View File

@@ -1,4 +1,4 @@
using SqlSugar;
using SqlSugar;
using System;
namespace Application.Domain.Entity

View File

@@ -0,0 +1,69 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Resource")]
public class game_city
{
/// <summary>
/// cityId
/// </summary>
[SugarColumn(IsPrimaryKey = true)]
public int cityId { get; set; }
/// <summary>
/// cityName
/// </summary>
[SugarColumn(Length = 20, IsNullable = true)]
public string? cityName { get; set; }
/// <summary>
/// parent
/// </summary>
[SugarColumn(IsNullable = true)]
public int? parent { get; set; }
/// <summary>
/// type
/// </summary>
[SugarColumn(Length = 20, IsNullable = true)]
public string? type { get; set; }
/// <summary>
/// toMap
/// </summary>
[SugarColumn(Length = 20, IsNullable = true)]
public string? toMap { get; set; }
/// <summary>
/// 城市范围x起始坐标
/// </summary>
[SugarColumn(IsNullable = true)]
public int? x_s { get; set; }
/// <summary>
/// 城市范围x结束坐标
/// </summary>
[SugarColumn(IsNullable = true)]
public int? x_e { get; set; }
/// <summary>
/// 城市范围y起始坐标
/// </summary>
[SugarColumn(IsNullable = true)]
public int? y_s { get; set; }
/// <summary>
/// 城市范围y结束坐标
/// </summary>
[SugarColumn(IsNullable = true)]
public int? y_e { get; set; }
/// <summary>
/// sort
/// </summary>
[SugarColumn(IsNullable = true)]
public int? sort { get; set; }
}
}

View File

@@ -0,0 +1,117 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Resource")]
public class game_city_map
{
/// <summary>
/// mapId
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 20)]
public string mapId { get; set; }
/// <summary>
/// mapName
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? mapName { get; set; }
/// <summary>
/// x
/// </summary>
[SugarColumn(IsNullable = true)]
public int? x { get; set; }
/// <summary>
/// y
/// </summary>
[SugarColumn(IsNullable = true)]
public int? y { get; set; }
/// <summary>
/// code
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? code { get; set; }
/// <summary>
/// cityId
/// </summary>
[SugarColumn(IsNullable = true)]
public int? cityId { get; set; }
/// <summary>
/// isPk
/// </summary>
[SugarColumn(IsNullable = true)]
public int? isPk { get; set; }
/// <summary>
/// show
/// </summary>
[SugarColumn(IsNullable = true)]
public int? show { get; set; }
/// <summary>
/// isHome
/// </summary>
[SugarColumn(IsNullable = true)]
public int? isHome { get; set; }
/// <summary>
/// 是否可采集 0不可采集 2可采集
/// </summary>
[SugarColumn(IsNullable = true)]
public int? isRes { get; set; }
/// <summary>
/// isBus
/// </summary>
[SugarColumn(IsNullable = true)]
public int? isBus { get; set; }
/// <summary>
/// retMap
/// </summary>
[SugarColumn(Length = 20, IsNullable = true)]
public string? retMap { get; set; }
/// <summary>
/// near
/// </summary>
[SugarColumn(IsNullable = true,IsJson = true)]
public List<MapNear> near { get; set; }
/// <summary>
/// tips
/// </summary>
[SugarColumn(Length = 255, IsNullable = true)]
public string? tips { get; set; }
/// <summary>
/// 是否查看附近的人0不显示 1显示
/// </summary>
[SugarColumn(IsNullable = true)]
public int? lookUser { get; set; }
/// <summary>
/// 附近人显示方式0不限制1当前区
/// </summary>
[SugarColumn(IsNullable = true)]
public int? lookArea { get; set; }
/// <summary>
/// 进入权限0不限制1验证
/// </summary>
[SugarColumn(IsNullable = true)]
public int? inRole { get; set; }
/// <summary>
/// 锁定时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? lockTime { get; set; }
}
}

View File

@@ -0,0 +1,57 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Resource")]
public class game_city_map_res
{
/// <summary>
/// 资源id
/// </summary>
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string resId { get; set; }
/// <summary>
/// 地图id
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? mapId { get; set; }
/// <summary>
/// 资源名称
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? resName { get; set; }
/// <summary>
/// 对应物品ID
/// </summary>
[SugarColumn(IsNullable = true)]
public int? goodsId { get; set; }
/// <summary>
/// 获取资源数量
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? count { get; set; }
/// <summary>
/// 采集需要数量
/// </summary>
[SugarColumn(IsNullable = true)]
public int? needVigour { get; set; }
/// <summary>
/// 成功率
/// </summary>
[SugarColumn(Length = 18, IsNullable = true)]
public decimal? okRadio { get; set; }
/// <summary>
/// 采集锁定时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? gatherTime { get; set; }
}
}

View File

@@ -0,0 +1,63 @@
using SqlSugar;
using System;
namespace Application.Domain.Entity
{
[Tenant("Kg.SeaTime.Resource")]
public class game_city_npc
{
/// <summary>
/// npcId
/// </summary>
[SugarColumn(IsPrimaryKey = true)]
public int npcId { get; set; }
/// <summary>
/// areaId
/// </summary>
[SugarColumn(Length = 255, IsNullable = true)]
public string? areaId { get; set; }
/// <summary>
/// mapId
/// </summary>
[SugarColumn(Length = 20, IsNullable = true)]
public string? mapId { get; set; }
/// <summary>
/// npcName
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? npcName { get; set; }
/// <summary>
/// tips
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? tips { get; set; }
/// <summary>
/// code
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? code { get; set; }
/// <summary>
/// story
/// </summary>
[SugarColumn(IsNullable = true)]
public string? story { get; set; }
/// <summary>
/// status
/// </summary>
[SugarColumn(IsNullable = true)]
public int? status { get; set; }
/// <summary>
/// bus
/// </summary>
[SugarColumn(IsNullable = true)]
public string? bus { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
using SqlSugar;
using SqlSugar;
using System;
namespace Application.Domain.Entity

View File

@@ -1,4 +1,5 @@
global using Photon.Core;
global using SqlSugar;
global using Application.Domain.Entity;
global using Photon.Core.Redis;
global using Photon.Core.Redis;
global using Photon.Core.Assist;

View File

@@ -0,0 +1,21 @@
namespace Application.Domain;
public interface IGameMapService
{
#region
Task<game_city> GetCityInfo(int cityId);
Task<game_city_map> GetMapInfo(string mapId);
Task<int> GetMapCityByMapId(string mapId);
Task<List<game_city_npc>> GetMapNpc(string mapId);
Task<game_city_npc> GetNpcInfo(int npcId);
#endregion
#region
Task<string> GetUserOnMapId(string userId);
Task<unit_user_online> GetUserOnMap(string userId);
Task UpdateUserOnMap(string userId, string ip, string mapId);
#endregion
}

View File

@@ -9,6 +9,7 @@ public interface IUnitUserService
Task<unit_user> GetUserInfoByUserNo(string userNo);
Task<unit_user> GetUserInfoByToken(string token);
#endregion
#region

View File

@@ -0,0 +1,128 @@
namespace Application.Domain;
public class GameMapService : IGameMapService, ITransient
{
private readonly ISqlSugarClient _dbClient;
private readonly IRedisCache _redisClient;
public GameMapService(ISqlSugarClient dbClient, IRedisCache redisClient)
{
_dbClient = dbClient;
_redisClient = redisClient;
}
#region
public async Task<game_city> GetCityInfo(int cityId)
{
string key = string.Format(BaseCache.BaseCacheKeys, "MapCityData", "CityData");
var data = await _redisClient.GetHashAsync<game_city>(key, cityId.ToString());
if (data == null)
{
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_city>();
data = await db.Queryable<game_city>().Where(it => it.cityId == cityId).SingleAsync();
await _redisClient.AddHashAsync(key, cityId.ToString(), data);
}
return data;
}
public async Task<game_city_map> GetMapInfo(string mapId)
{
string key = string.Format(BaseCache.BaseCacheKeys, "MapCityData", "MapData");
var data = await _redisClient.GetHashAsync<game_city_map>(key, mapId);
if (data == null)
{
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_city_map>();
data = await db.Queryable<game_city_map>().Where(it => it.mapId == mapId).SingleAsync();
await _redisClient.AddHashAsync(key, mapId, data);
}
return data;
}
public async Task<int> GetMapCityByMapId(string mapId)
{
var data = await GetMapInfo(mapId);
if (data != null)
{
return (int)data.cityId;
}
else
{
return 0;
}
}
public async Task<List<game_city_npc>> GetMapNpc(string mapId)
{
string key = string.Format(BaseCache.BaseCacheKeys, "MapCityData", "NpcData");
var data = await _redisClient.GetHashAsync<List<game_city_npc>>(key, mapId);
if (data == null)
{
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_city_npc>();
data = await db.Queryable<game_city_npc>().Where(it => it.mapId == mapId && it.status == 1).ToListAsync();
await _redisClient.AddHashAsync(key, mapId, data);
}
return data;
}
public async Task<game_city_npc> GetNpcInfo(int npcId)
{
string key = string.Format(BaseCache.BaseCacheKeys, "MapCityData", "NpcInfo");
var data = await _redisClient.GetHashAsync<game_city_npc>(key, npcId.ToString());
if (data == null)
{
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_city_npc>();
data = await db.Queryable<game_city_npc>().Where(it => it.npcId == npcId).SingleAsync();
await _redisClient.AddHashAsync(key, npcId.ToString(),data);
}
return data;
}
#endregion
#region
public async Task<string> GetUserOnMapId(string userId)
{
var data = await GetUserOnMap(userId);
if (data == null)
{
return "16_27";
}
return data.mapId;
}
public async Task<unit_user_online> GetUserOnMap(string userId)
{
string key = string.Format(UserCache.BaseCacheKey, "UserOnline");
if (await _redisClient.HExistsHashAsync(key, userId))
{
return await _redisClient.GetHashAsync<unit_user_online>(key, userId);
}
var db = _dbClient.AsTenant().GetConnectionWithAttr<unit_user_online>();
var data = await db.Queryable<unit_user_online>().Where(it => it.userId == userId).SingleAsync();
await _redisClient.AddHashAsync(key, userId, data);
return data;
}
public async Task UpdateUserOnMap(string userId, string ip, string mapId)
{
unit_user_online onLine = new unit_user_online();
onLine.userId = userId;
onLine.mapId = mapId;
onLine.ip = ip;
onLine.upTime = TimeAssist.GetTimeStampNum;
string key = string.Format(UserCache.BaseCacheKey, "UserOnline");
if (await _redisClient.AddHashAsync(key, userId, onLine))
{
var db = _dbClient.AsTenant().GetConnectionWithAttr<unit_user_online>();
await db.Updateable<unit_user_online>(onLine).ExecuteCommandAsync();
}
}
#endregion
}

View File

@@ -14,11 +14,13 @@ public class UnitUserService : IUnitUserService, ITransient
}
#region
public async Task<List<unit_user>> GetUserDataByAccId(string accId)
{
var db = _dbClient.AsTenant().GetConnectionWithAttr<unit_user>();
return await db.Queryable<unit_user>().Where(it => it.accId == accId).ToListAsync();
}
public async Task<unit_user> GetUserInfoByUserId(string userId)
{
string key = string.Format(UserCache.BaseCacheKeys, "UserInfo", "UserId");
@@ -35,6 +37,7 @@ public class UnitUserService : IUnitUserService, ITransient
return data;
}
public async Task<unit_user> GetUserInfoByUserNo(string userNo)
{
string key = string.Format(UserCache.BaseCacheKeys, "UserInfo", "UserNo");
@@ -68,6 +71,7 @@ public class UnitUserService : IUnitUserService, ITransient
return data;
}
private async Task ClearUserInfo(int type, string id)
{
unit_user result = new unit_user();
@@ -81,17 +85,17 @@ public class UnitUserService : IUnitUserService, ITransient
result = await GetUserInfoByToken(id);
break;
}
await _redisClient.DelHashAsync(string.Format(UserCache.BaseCacheKeys, "UserInfo","UserId"), result.userId);
await _redisClient.DelHashAsync(string.Format(UserCache.BaseCacheKeys, "UserInfo","UserNo"), result.userNo);
await _redisClient.DelHashAsync(string.Format(UserCache.BaseCacheKeys, "UserInfo","Sid"), result.token);
await _redisClient.DelHashAsync(string.Format(UserCache.BaseCacheKeys, "UserInfo", "UserId"), result.userId);
await _redisClient.DelHashAsync(string.Format(UserCache.BaseCacheKeys, "UserInfo", "UserNo"), result.userNo);
await _redisClient.DelHashAsync(string.Format(UserCache.BaseCacheKeys, "UserInfo", "Sid"), result.token);
}
#endregion
#region
public async Task<unit_user> Register(int areaId, string accId)
{
unit_user result = new unit_user();
@@ -114,7 +118,6 @@ public class UnitUserService : IUnitUserService, ITransient
result.regOk = 0;
result.isSystem = 0;
result.addTime = DateTime.Now;
result.upTime = DateTime.Now;
bool isok = db.Insertable(result).ExecuteCommand() > 0;
if (!isok)
{
@@ -131,6 +134,7 @@ public class UnitUserService : IUnitUserService, ITransient
return result;
}
public async Task<bool> RegisterUserInfo(string userId, string nick, string sex)
{
var db = _dbClient.AsTenant().GetConnectionWithAttr<unit_user>();
@@ -140,17 +144,74 @@ public class UnitUserService : IUnitUserService, ITransient
.Where(it => it.userId == userId).ExecuteCommandAsync() > 0;
if (result)
{
//注册配置信息
await ClearUserInfo(0, userId);//清理个人信息表缓存
//注册账户
unit_user_acc acc = new unit_user_acc();
acc.userId = userId;
acc.cowry = 0;
acc.gold = 0;
acc.teach = 0;
acc.renown = 0;
db.Insertable(acc).AddQueue();
//注册游戏货币
unit_user_copper copper = new unit_user_copper();
copper.userId = userId;
copper.copper = 0;
db.Insertable(copper).AddQueue();
//注册个人基础属性
unit_user_attr userAttr = GameTool.GetAttrData(1);
userAttr.userId = userId;
db.Insertable(userAttr).AddQueue();
//注册个人血量
unit_user_blood blood = new unit_user_blood();
blood.userId = userId;
blood.blood = userAttr.upBlood;
db.Insertable(blood).AddQueue();
//注册士气
unit_user_morale morale = new unit_user_morale();
morale.userId = userId;
morale.morale = userAttr.upMorale;
db.Insertable(morale).AddQueue();
//注册等级经验
unit_user_exp exp = new unit_user_exp();
exp.userId = userId;
exp.exp = 0;
exp.upExp = GameTool.GetUserUpExp(1);
db.Insertable(exp).AddQueue();
//注册负重
unit_user_weight weight = new unit_user_weight();
weight.userId = userId;
weight.onWeight = 0;
weight.maxWeight = 100;
db.Insertable(weight).AddQueue();
//注册活力
unit_user_vigour vitality = new unit_user_vigour();
vitality.userId = userId;
vitality.vitality = 50;
vitality.upVitality = 50;
vitality.upTime = TimeAssist.GetDateTimeYMDString(0);
db.Insertable(vitality).AddQueue();
//注册在线
unit_user_online online = new unit_user_online();
online.userId = userId;
online.ip = "";
online.mapId = "16_27";
online.upTime = TimeAssist.GetTimeStampNum;
db.Insertable(online).AddQueue();
await db.SaveQueuesAsync(false);
await ClearUserInfo(0, userId);
}
return result;
}
private async Task<int> GetUserNo()
{
int No = 0;

View File

@@ -0,0 +1,41 @@
using Photon.Core.Assist;
namespace Application.Domain;
public class GameTool
{
/// <summary>
/// 获取等级基础属性
/// </summary>
/// <param name="lev"></param>
/// <returns></returns>
public static unit_user_attr GetAttrData(int lev)
{
unit_user_attr data = new unit_user_attr();
data.lev = lev;
data.minAtk = lev + 2;
data.maxAtk = lev + Convert.ToInt32(lev * 0.05) + 4;
data.defense = lev;
data.agility = lev;
data.upBlood = ((lev - 1) * 5) + 80;
data.upMorale = 100 + (lev / 5) * 10;
data.levUpdate = TimeAssist.GetTimeStampNum;
return data;
}
/// <summary>
/// 获取等级升级经验
/// </summary>
/// <param name="lev"></param>
/// <returns></returns>
public static long GetUserUpExp(int lev)
{
long result = 50 * ((lev * lev * lev) + (5 * lev)) - 80;
return result;
}
public static bool AreaVerify( int area,string areas)
{
List<string> onArea = new List<string>() {"0",area.ToString() };
return onArea.Any(it => areas.Contains(it));
}
}

View File

@@ -0,0 +1,55 @@
using System.IdentityModel.Tokens.Jwt;
using System.Text;
using Microsoft.IdentityModel.Tokens;
namespace Application.Service.Pub;
public class JwtTool
{
public static async Task<TokenValidationResult> ParseWithValidationAsync(
string jwtToken,
TokenValidationParameters validationParameters)
{
if (string.IsNullOrWhiteSpace(jwtToken))
throw new ArgumentNullException(nameof(jwtToken));
if (validationParameters == null)
throw new ArgumentNullException(nameof(validationParameters));
var handler = new JwtSecurityTokenHandler();
// 异步验证并解析
return await handler.ValidateTokenAsync(jwtToken, validationParameters);
}
public static async Task<JwtSecurityToken?> ParseWithSecretKeyAsync(string jwtToken, string secretKey)
{
var validationParams = new TokenValidationParameters
{
// 必须配置:密钥
IssuerSigningKey = (SecurityKey) new SymmetricSecurityKey(Encoding.ASCII.GetBytes(secretKey)),
// 验证签名(必须开启)
ValidateIssuerSigningKey = true,
// 根据你的 JWT 配置开启/关闭
ValidateIssuer = false, // 是否验证签发者
ValidateAudience = false, // 是否验证受众
ValidateLifetime = false // 是否验证过期时间(默认开启)
};
var result = await ParseWithValidationAsync(jwtToken, validationParams);
return result.IsValid ? result.SecurityToken as JwtSecurityToken : null;
}
public static async Task< object> GetJwtData(string jwtToken, string secretKey,string key)
{
var token = await ParseWithSecretKeyAsync(jwtToken,secretKey);
var data = token.Payload;
if (data.TryGetValue(key, out object result))
{
return result;
}
return null;
}
}

View File

@@ -0,0 +1,25 @@
namespace Application.Web;
public class ComHelper
{
public static string GetClientUserIp(HttpContext context)
{
var ip = context.Request.Headers["X-Forwarded-For"].FirstOrDefault();
if (string.IsNullOrEmpty(ip))
{
ip = context.Connection.RemoteIpAddress.ToString();
ip = ip.Replace("::ffff:", "");
}
if (ip.Contains(","))
{
ip = ip.Split(',')[0];
}
//var ip = context.Request.Cookies["kxUserIp"];
//if (string.IsNullOrEmpty(ip))
//{
// ip = "0.0.0.0";
//}
return ip;
}
}

View File

@@ -18,12 +18,20 @@
return token.Claims["userId"];
}
}
public static string sid
public static string accId
{
get
{
var token = App.HttpContext.GetTokenInfo();
return token.Claims["token"];
return token.Claims["accId"];
}
}
public static int areaId
{
get
{
var token = App.HttpContext.GetTokenInfo();
return Convert.ToInt32(token.Claims["areaId"]) ;
}
}
}

View File

@@ -154,6 +154,11 @@ namespace Application.Web.Controllers.Login
return PoAction.Message("当前区繁忙,无法进入!");
}
if (areaInfo.opTime > DateTime.Now)
{
return PoAction.Message("暂未开放本区服!");
}
//判断是否已经注册
var userData = await _userService.GetUserDataByAccId(accInfo.accId);
if (userData.Any(it => it.areaId == area))
@@ -170,7 +175,7 @@ namespace Application.Web.Controllers.Login
Dictionary<string, object> loadData = new Dictionary<string, object>();
loadData.Add("userId", userInfo.userId);
loadData.Add("accId", userInfo.accId);
loadData.Add("areaId", userInfo.areaId);
string Key = App.Configuration["JwtTokenOptions:SecurityKey"].ToString();
string Issuer = App.Configuration["JwtTokenOptions:Issuer"].ToString();
string Audience = App.Configuration["JwtTokenOptions:Audience"].ToString();
@@ -222,7 +227,7 @@ namespace Application.Web.Controllers.Login
Dictionary<string, object> loadData = new Dictionary<string, object>();
loadData.Add("userId", userInfo.userId);
loadData.Add("accId", userInfo.accId);
loadData.Add("areaId", userInfo.areaId);
string Key = App.Configuration["JwtTokenOptions:SecurityKey"].ToString();
string Issuer = App.Configuration["JwtTokenOptions:Issuer"].ToString();
string Audience = App.Configuration["JwtTokenOptions:Audience"].ToString();
@@ -238,16 +243,18 @@ namespace Application.Web.Controllers.Login
{
return PoAction.Message("刷新失败");
}
string Key = App.Configuration["JwtTokenOptions:SecurityKey"].ToString();
string Issuer = App.Configuration["JwtTokenOptions:Issuer"].ToString();
string Audience = App.Configuration["JwtTokenOptions:Audience"].ToString();
var data = JwtHelper.GetTokenPload(parms.token,Key);
string accId = string.Empty;
if (data.TryGetValue("accId", out object _accId))
var tokenData = await JwtTool.GetJwtData(parms.token, Key, "accId");
if (tokenData != null)
{
accId = _accId.ToString();
accId = tokenData.ToString();
}
var userInfo = await _userService.GetUserInfoByToken(parms.refToken);
if (userInfo == null)
{
@@ -258,12 +265,14 @@ namespace Application.Web.Controllers.Login
{
return PoAction.Message("刷新失败,数据信息不合法!");
}
Dictionary<string, object> loadData = new Dictionary<string, object>();
loadData.Add("userId", userInfo.userId);
loadData.Add("accId", userInfo.accId);
loadData.Add("areaId", userInfo.areaId);
string token = JwtHelper.CreateToken(Key, Issuer, Audience, loadData, TokenConfig.TokenTime);
return PoAction.Ok(new
{ token = token, refToken = userInfo.token, userId = userInfo.userId });
{ token = token, refToken = userInfo.token, userId = userInfo.userId });
}
/// <summary>
@@ -284,6 +293,7 @@ namespace Application.Web.Controllers.Login
{
return PoAction.Message("昵称需要1-12字符之间哦!");
}
string sex = parms.sex == 0 ? "女" : "男";
string userId = StateHelper.userId;
var userInfo = await _userService.GetUserInfoByUserId(userId);

View File

@@ -0,0 +1,61 @@
using Microsoft.AspNetCore.Mvc;
namespace Application.Web.Controllers.Map;
/// <summary>
/// 地图接口
/// </summary>
[ApiExplorerSettings(GroupName = "Map")]
[Route("Map/[controller]/[action]")]
[ApiController]
[Authorize]
public class MapController : ControllerBase
{
private readonly IUnitUserService _userService;
private readonly IGameMapService _mapService;
public MapController(IUnitUserService userService, IGameMapService mapService)
{
_userService = userService;
_mapService = mapService;
}
/// <summary>
/// 获取地图主页信息
/// </summary>
/// <param name="map"></param>
/// <returns></returns>
[HttpGet]
public async Task<IPoAction> GetMapData(string? map)
{
string userId = StateHelper.userId;
var onMap = await _mapService.GetUserOnMap(userId);
game_city_map mapInfo = new game_city_map();
if (string.IsNullOrEmpty(map))
{
mapInfo = await _mapService.GetMapInfo(onMap.mapId);
}
else
{
mapInfo = await _mapService.GetMapInfo(map);
}
//NPC信息
var npcData = await _mapService.GetMapNpc(mapInfo.mapId);
npcData = npcData.FindAll(it => GameTool.AreaVerify(StateHelper.areaId,it.areaId));
//城市信息
var cityInfo = await _mapService.GetCityInfo((int)mapInfo.cityId);
#region 线
string ip = ComHelper.GetClientUserIp(HttpContext);
await _mapService.UpdateUserOnMap(userId, ip, mapInfo.mapId);
#endregion
object ret = new { mapInfo, cityInfo, npcData };
return PoAction.Ok(ret);
}
}

View File

@@ -28,6 +28,12 @@ groups.Add("User", new OpenApiInfo
Version = "v1",
Description = "航海时代用户相关接口。",
});
groups.Add("Map", new OpenApiInfo
{
Title = "用户地图文档",
Version = "v1",
Description = "航海时代用户地图相关接口。",
});
builder.Services.InjectJwt(builder.Configuration, new OpenApiInfo
{
@@ -94,7 +100,8 @@ if (app.Environment.IsDevelopment())
#region swagger配置
app.UseJwtSwagger("swagger", "航海时代接口文档",new List<JwtGroupConfig> {
new JwtGroupConfig(){ groupId="Login", groupName="登录接口文档"},
new JwtGroupConfig(){ groupId="User", groupName="用户接口文档"}
new JwtGroupConfig(){ groupId="User", groupName="用户接口文档"},
new JwtGroupConfig(){ groupId="Map", groupName="用户地图文档"}
});
#endregion