Compare commits
38 Commits
eb196a25be
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
590f7c5290 | ||
|
|
dbace8a8b2 | ||
|
|
05e340801f | ||
|
|
88ff77df2b | ||
|
|
7d263d2b96 | ||
|
|
0016ef7e83 | ||
|
|
784bc66ef6 | ||
|
|
2c85872abd | ||
|
|
24c784e6a4 | ||
|
|
2037d1e577 | ||
|
|
571877970b | ||
|
|
974421ce9b | ||
|
|
78759387f7 | ||
| 52ad7e79ec | |||
|
|
ed38058f91 | ||
|
|
873316157b | ||
| b842406560 | |||
| ea1cfc4a37 | |||
|
|
29b76bab65 | ||
| 2996fa712c | |||
|
|
2ef5b079c9 | ||
|
|
8183bb0cf0 | ||
|
|
cc9d697f9c | ||
| 80cbdbb0f9 | |||
| eff2040baa | |||
|
|
dccf21527f | ||
|
|
efe62d2ab4 | ||
| 1f14f11298 | |||
|
|
cef2f9c974 | ||
|
|
fe682cd6f3 | ||
|
|
cf6eddc431 | ||
|
|
4facfd980c | ||
|
|
e074c980c3 | ||
|
|
d636e98022 | ||
| 21a9d57d0a | |||
|
|
2c437fe553 | ||
|
|
7ee960cfc7 | ||
|
|
3617d497b6 |
@@ -1,3 +1,8 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIRedisCache_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F55e5569a0f314a0db6a665eafad446dd6800_003F9e_003F88bbb06d_003FIRedisCache_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></wpf:ResourceDictionary>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AJwtExtensions_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6b089d08a87d4ddd82371ae63e754ba05000_003F26_003Fd6433acb_003FJwtExtensions_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AJwtHelper_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6b089d08a87d4ddd82371ae63e754ba05000_003Fe2_003F86047f24_003FJwtHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<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_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_003AString_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F51505665371d472f8bdbc333fa4d888cf49938_003Fdf_003F23ca03dd_003FString_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATokenValidationParameters_002Ecs_002Fl_003AC_0021_003FUsers_003F29055_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffbb48859ccd84b0d884ab212a4cf9fdb5f820_003F55_003F417754e1_003FTokenValidationParameters_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
|
||||
69
Service/Application.Domain.Entity/game/game/game_chat.cs
Normal file
69
Service/Application.Domain.Entity/game/game/game_chat.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace Application.Domain.Entity
|
||||
{
|
||||
[Tenant("Kg.SeaTime.Game")]
|
||||
public class game_chat
|
||||
{
|
||||
/// <summary>
|
||||
/// chatId
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, Length = 50)]
|
||||
public string chatId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// code
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// areaId
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? areaId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// userId
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? userId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// par
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? par { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// sign
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 255, IsNullable = true)]
|
||||
public string? sign { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// addTime
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public DateTime? addTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// sort
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public long? sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// delTime
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public long? delTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// state
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? state { get; set; }
|
||||
}
|
||||
}
|
||||
75
Service/Application.Domain.Entity/game/user/game_account.cs
Normal file
75
Service/Application.Domain.Entity/game/user/game_account.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace Application.Domain.Entity
|
||||
{
|
||||
[Tenant("Kg.SeaTime.Game")]
|
||||
public class game_account
|
||||
{
|
||||
/// <summary>
|
||||
/// accId
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, Length = 50)]
|
||||
public string accId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// userName
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 20, IsNullable = true)]
|
||||
public string? userName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// nick
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 30, IsNullable = true)]
|
||||
public string? nick { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// pwd
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 255, IsNullable = true)]
|
||||
public string? pwd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// npwd
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 255, IsNullable = true)]
|
||||
public string? npwd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// status
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// remCode
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 255, IsNullable = true)]
|
||||
public string? remCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// remAccId
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? remAccId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// token
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? token { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// addTime
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public DateTime? addTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// openId
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? openId { get; set; }
|
||||
}
|
||||
}
|
||||
87
Service/Application.Domain.Entity/game/user/unit_user.cs
Normal file
87
Service/Application.Domain.Entity/game/user/unit_user.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace Application.Domain.Entity
|
||||
{
|
||||
[Tenant("Kg.SeaTime.Game")]
|
||||
public class unit_user
|
||||
{
|
||||
/// <summary>
|
||||
/// userId
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, Length = 50)]
|
||||
public string userId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 账号ID
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? accId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 区服
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? areaId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// userNo
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 12, IsNullable = false)]
|
||||
public string userNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public string? nick { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 头像
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 255, IsNullable = true)]
|
||||
public string? headImg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? sex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 简介
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? sign { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 注册状态
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? regOk { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// token
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? token { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否系统账号
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? isSystem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public DateTime? addTime { get; set; }
|
||||
}
|
||||
}
|
||||
39
Service/Application.Domain.Entity/game/user/unit_user_acc.cs
Normal file
39
Service/Application.Domain.Entity/game/user/unit_user_acc.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
267
Service/Application.Domain.Entity/game/user/unit_user_equ.cs
Normal file
267
Service/Application.Domain.Entity/game/user/unit_user_equ.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
27
Service/Application.Domain.Entity/game/user/unit_user_exp.cs
Normal file
27
Service/Application.Domain.Entity/game/user/unit_user_exp.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace Application.Domain.Entity
|
||||
{
|
||||
[Tenant("Kg.SeaTime.Game")]
|
||||
public class unit_user_ship
|
||||
{
|
||||
/// <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>
|
||||
/// goodsId
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? goodsId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// name
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// speed
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? speed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// weight
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? weight { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
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; }
|
||||
|
||||
/// <summary>
|
||||
/// 船只当前负重
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? shipOnWeight { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace Application.Domain.Entity;
|
||||
|
||||
[SplitTable(SplitType.Day)]
|
||||
[SugarTable("unit_user_goods_log_{year}{month}{day}")]
|
||||
[Tenant("Kg.SeaTime.Log")]
|
||||
public class unit_user_goods_log
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true)] public string logId { get; set; }
|
||||
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? userId { get; set; }
|
||||
|
||||
public int? goodsId { get; set; }
|
||||
|
||||
[SugarColumn(Length = 50, IsNullable = true)]
|
||||
public string? code { get; set; }
|
||||
|
||||
public int? count { get; set; }
|
||||
|
||||
[SugarColumn(Length = 255, IsNullable = true)]
|
||||
public string? remark { get; set; }
|
||||
|
||||
public DateTime? addTime { get; set; }
|
||||
}
|
||||
8
Service/Application.Domain.Entity/model/MapNear.cs
Normal file
8
Service/Application.Domain.Entity/model/MapNear.cs
Normal 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; }
|
||||
}
|
||||
11
Service/Application.Domain.Entity/model/UserModel.cs
Normal file
11
Service/Application.Domain.Entity/model/UserModel.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Application.Domain.Entity;
|
||||
|
||||
public class UserModel
|
||||
{
|
||||
public string userNo { get; set; }
|
||||
public string nick { get; set; }
|
||||
public string sex { get; set; }
|
||||
public string headImg { get; set; }
|
||||
public int area { get; set; }
|
||||
public string icon { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using SqlSugar;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace Application.Domain.Entity
|
||||
69
Service/Application.Domain.Entity/resource/game/game_city.cs
Normal file
69
Service/Application.Domain.Entity/resource/game/game_city.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
117
Service/Application.Domain.Entity/resource/game/game_city_map.cs
Normal file
117
Service/Application.Domain.Entity/resource/game/game_city_map.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using SqlSugar;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace Application.Domain.Entity
|
||||
8
Service/Application.Domain.Entity/view/GameChatView.cs
Normal file
8
Service/Application.Domain.Entity/view/GameChatView.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Application.Domain.Entity;
|
||||
|
||||
public class GameChatView
|
||||
{
|
||||
public game_chat chat { get; set; }
|
||||
public UserModel user { get; set; }
|
||||
|
||||
}
|
||||
7
Service/Application.Domain/Cache/UserCache.cs
Normal file
7
Service/Application.Domain/Cache/UserCache.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public class UserCache
|
||||
{
|
||||
public static string BaseCacheKey = "BaseUserCache:{0}";
|
||||
public static string BaseCacheKeys = "BaseUserCache:{0}:{1}";
|
||||
}
|
||||
9
Service/Application.Domain/Config/GameConfig.cs
Normal file
9
Service/Application.Domain/Config/GameConfig.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public static class GameConfig
|
||||
{
|
||||
public const int OnLineTime = 30;//在线延迟时间(分钟)
|
||||
public const int SendChatGoodsBase = 10014;//小海螺
|
||||
public const int SendChatGoodsArea = 10001;//大海螺
|
||||
public const int SendChatGoodsService = 10002;//金海螺
|
||||
}
|
||||
14
Service/Application.Domain/Enum/GameChatEnum.cs
Normal file
14
Service/Application.Domain/Enum/GameChatEnum.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public static class GameChatEnum
|
||||
{
|
||||
public enum Code
|
||||
{
|
||||
Public,//公共
|
||||
Group,//帮派
|
||||
Team,//队伍
|
||||
Region,//全区
|
||||
Dress,//全服
|
||||
System//系统
|
||||
}
|
||||
}
|
||||
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 static class GameEnum
|
||||
{
|
||||
public enum LogCode
|
||||
{
|
||||
减少,
|
||||
增加
|
||||
}
|
||||
}
|
||||
11
Service/Application.Domain/Enum/GoodsEnum.cs
Normal file
11
Service/Application.Domain/Enum/GoodsEnum.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public static class GoodsEnum
|
||||
{
|
||||
public enum Code
|
||||
{
|
||||
Drug,//药品
|
||||
Prop,//物品
|
||||
Cargo,//货物
|
||||
}
|
||||
}
|
||||
@@ -2,3 +2,5 @@
|
||||
global using SqlSugar;
|
||||
global using Application.Domain.Entity;
|
||||
global using Photon.Core.Redis;
|
||||
global using Photon.Core.Assist;
|
||||
global using Application.Service.Pub;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public interface IGameChatService
|
||||
{
|
||||
Task<List<GameChatView>> GetChatTop(int areaId, int top, string teamId, string groupId);
|
||||
|
||||
Task<List<GameChatView>> GetChatData(int type, int areaId, string teamId, string groupId, int page, int limit,
|
||||
RefAsync<int> total);
|
||||
|
||||
Task<bool> SendChat(string userId, int areaId, string code, string sign, string par = "");
|
||||
Task<bool> DeleteChat(string chatId);
|
||||
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public interface IGameMapService
|
||||
{
|
||||
#region 城市地图数据
|
||||
|
||||
Task<game_city> GetCityInfo(int cityId);
|
||||
Task<game_city_map> GetMapInfo(string mapId);
|
||||
Task<List<game_city_map>> GetMapCity(int cityId);
|
||||
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
|
||||
|
||||
#region 其他相关
|
||||
|
||||
Task<List<UserModel>> GetMapUser(string mapId, int area, int showArea, List<string> noUser, int take);
|
||||
|
||||
Task<List<UserModel>> GetMapUser(string mapId, int area, int showArea, List<string> noUser, int page,
|
||||
int limit, RefAsync<int> total);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -4,4 +4,5 @@ public interface INoticeService
|
||||
{
|
||||
Task<List<game_notice>> GetNoticeDataByTake(int take);
|
||||
Task<List<game_notice>> GetNoticeData(int page, int limit, RefAsync<int> total);
|
||||
Task<game_notice> GetNoticeInfo(string id);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public interface IGameAccountService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据OpenId获取账号信息
|
||||
/// </summary>
|
||||
/// <param name="openId"></param>
|
||||
/// <returns></returns>
|
||||
Task<game_account> GetAccInfoByOpenId(string openId);
|
||||
/// <summary>
|
||||
/// 根据AccId获取账号信息
|
||||
/// </summary>
|
||||
/// <param name="accId"></param>
|
||||
/// <returns></returns>
|
||||
Task<game_account> GetAccInfoByAccId(string accId);
|
||||
|
||||
Task<game_account> GetAccInfoByToken(string token);
|
||||
/// <summary>
|
||||
/// 注册账号
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="nick"></param>
|
||||
/// <param name="pwd"></param>
|
||||
/// <param name="remAccId"></param>
|
||||
/// <param name="openId"></param>
|
||||
/// <returns></returns>
|
||||
Task<game_account> Regist(string userName, string nick, string pwd, string remAccId = "",
|
||||
string openId = "");
|
||||
|
||||
Task<bool> UpdateAccountToken(string accId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public interface IUnitUserService
|
||||
{
|
||||
#region 用户信息
|
||||
|
||||
Task<List<unit_user>> GetUserDataByAccId(string accId);
|
||||
Task<unit_user> GetUserInfoByUserId(string userId);
|
||||
Task<unit_user> GetUserInfoByUserNo(string userNo);
|
||||
Task<unit_user> GetUserInfoByToken(string token);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 用户注册
|
||||
|
||||
/// <summary>
|
||||
/// 注册游戏角色
|
||||
/// </summary>
|
||||
/// <param name="areaId"></param>
|
||||
/// <param name="accId"></param>
|
||||
/// <returns></returns>
|
||||
Task<unit_user> Register(int areaId, string accId);
|
||||
|
||||
Task<bool> RegisterUserInfo(string userId, string nick, string sex);
|
||||
|
||||
#endregion
|
||||
|
||||
#region 其他
|
||||
|
||||
Task<int> GetOnlineCount();
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public interface IUnitUserWeight
|
||||
{
|
||||
Task<unit_user_weight> GetUserWeightInfo(string userId);
|
||||
Task<bool> UpdateUserWeight(string userId, int op, int weight);
|
||||
Task<bool> UpdateUserMaxWeight(string userId, int op, int weight);
|
||||
Task<bool> AddUserWeightLog(string userId, int goodsId, string goodsName, int weight, int count);
|
||||
Task<bool> CheakUserWeight(string userId, int useWeight);
|
||||
|
||||
#region 船只相关
|
||||
|
||||
Task<List<unit_user_ship>> GetUserShip(string userId);
|
||||
Task<int> GetUserShipMaxWeight(string userId);
|
||||
Task<bool> UpdateUserShipOnWeight(string userId, int op, int weight);
|
||||
Task<bool> CheakUserShipWeight(string userId, int useWeight);
|
||||
Task<bool> DeleteUserShip(string usId, string userId);
|
||||
Task<bool> AddUserShip(string userId, string name, int goodsId, int speed, int weight);
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public class GameChatService : IGameChatService, ITransient
|
||||
{
|
||||
private readonly ISqlSugarClient _dbClient;
|
||||
private readonly IRedisCache _redisClient;
|
||||
|
||||
public GameChatService(ISqlSugarClient dbClient, IRedisCache redisClient)
|
||||
{
|
||||
_dbClient = dbClient;
|
||||
_redisClient = redisClient;
|
||||
}
|
||||
|
||||
public async Task<List<GameChatView>> GetChatTop(int areaId, int top, string teamId, string groupId)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_chat>();
|
||||
List<string> allCode = new List<string>() { "Public", "Region", "System" };
|
||||
var data = await db.Queryable<game_chat>().Where(it => it.state == 1 &&
|
||||
(
|
||||
(allCode.Contains(it.code) && it.areaId == areaId) ||
|
||||
(it.code == "Group" && it.par == groupId) ||
|
||||
(it.code == "Team" && it.par == teamId) ||
|
||||
(it.code == "Dress")
|
||||
)
|
||||
).Take(top).OrderByDescending(it => it.sort).ToListAsync();
|
||||
|
||||
var result = new List<GameChatView>();
|
||||
foreach (var item in data)
|
||||
{
|
||||
var userModel = await UserModelTool.GetUserView(item.userId, true);
|
||||
result.Add(new GameChatView() { chat = item, user = userModel });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<List<GameChatView>> GetChatData(int type, int areaId, string teamId, string groupId, int page,
|
||||
int limit,
|
||||
RefAsync<int> total)
|
||||
{
|
||||
List<game_chat> data = new List<game_chat>();
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_chat>();
|
||||
if (type == 0)
|
||||
{
|
||||
List<string> allCode = new List<string>() { "Public", "Region", "System" };
|
||||
data = await db.Queryable<game_chat>().Where(it => it.state == 1 &&
|
||||
(
|
||||
(allCode.Contains(it.code) && it.areaId == areaId) ||
|
||||
(it.code == "Group" && it.par == groupId) ||
|
||||
(it.code == "Team" && it.par == teamId) ||
|
||||
(it.code == "Dress")
|
||||
)
|
||||
).OrderByDescending(it => it.sort).ToPageListAsync(page, limit, total);
|
||||
}
|
||||
else if (type == 1) //队伍
|
||||
{
|
||||
data = await db.Queryable<game_chat>().Where(it => it.state == 1 && it.code == "Team" && it.par == teamId
|
||||
).OrderByDescending(it => it.sort).ToPageListAsync(page, limit, total);
|
||||
}
|
||||
else if (type == 2) //帮派
|
||||
{
|
||||
data = await db.Queryable<game_chat>().Where(it => it.state == 1 && it.code == "Group" && it.par == groupId
|
||||
).OrderByDescending(it => it.sort).ToPageListAsync(page, limit, total);
|
||||
}
|
||||
else if (type == 3) //全区
|
||||
{
|
||||
data = await db.Queryable<game_chat>()
|
||||
.Where(it => it.state == 1 && it.code == "Region" && it.areaId == areaId
|
||||
).OrderByDescending(it => it.sort).ToPageListAsync(page, limit, total);
|
||||
}
|
||||
else if (type == 4) //全服
|
||||
{
|
||||
data = await db.Queryable<game_chat>().Where(it => it.state == 1 && it.code == "Dress"
|
||||
).OrderByDescending(it => it.sort).ToPageListAsync(page, limit, total);
|
||||
}
|
||||
else if (type == 5) //系统
|
||||
{
|
||||
data = await db.Queryable<game_chat>()
|
||||
.Where(it => it.state == 1 && it.code == "System" && it.areaId == areaId
|
||||
).OrderByDescending(it => it.sort).ToPageListAsync(page, limit, total);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = new List<game_chat>();
|
||||
}
|
||||
var result = new List<GameChatView>();
|
||||
foreach (var item in data)
|
||||
{
|
||||
var userModel = await UserModelTool.GetUserView(item.userId, true);
|
||||
result.Add(new GameChatView() { chat = item, user = userModel });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加聊天
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="areaId"></param>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="sign"></param>
|
||||
/// <param name="par"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> SendChat(string userId, int areaId, string code, string sign, string par = "")
|
||||
{
|
||||
game_chat chat = new game_chat();
|
||||
chat.chatId = StringAssist.NewGuid;
|
||||
chat.userId = userId;
|
||||
chat.areaId = areaId;
|
||||
chat.code = code;
|
||||
chat.par = par;
|
||||
chat.sign = sign;
|
||||
chat.state = 1;
|
||||
chat.addTime = DateTime.Now;
|
||||
chat.sort = TimeExtend.GetTimeStampSeconds;
|
||||
chat.delTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddDays(3));
|
||||
switch (code)
|
||||
{
|
||||
case "Region":
|
||||
chat.sort += 300; //五分钟
|
||||
break;
|
||||
|
||||
case "Dress":
|
||||
chat.sort += 600; //10分钟
|
||||
break;
|
||||
case "System":
|
||||
chat.delTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddHours(6));
|
||||
break;
|
||||
case "Group":
|
||||
chat.delTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddHours(6));
|
||||
break;
|
||||
case "Team":
|
||||
chat.delTime = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddHours(6));
|
||||
break;
|
||||
}
|
||||
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_chat>();
|
||||
return await db.Insertable(chat).ExecuteCommandAsync() > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除聊天
|
||||
/// </summary>
|
||||
/// <param name="chatId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> DeleteChat(string chatId)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_chat>();
|
||||
return await db.Updateable<game_chat>().SetColumns(it => it.state == 0).Where(it => it.chatId == chatId)
|
||||
.ExecuteCommandAsync() > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGameEquService, ITransient
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
using System.Reflection.Metadata;
|
||||
|
||||
namespace Application.Domain;
|
||||
|
||||
public class GameGoodsService(ISqlSugarClient DbClient, IRedisCache redis) : IGameGoodsService, 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)
|
||||
{
|
||||
//更新负重
|
||||
int weightCount = Convert.ToInt32(UserGoods.weight) * count;
|
||||
if (weightCount > 0)
|
||||
{
|
||||
var weightService = App.GetService<IUnitUserWeight>();
|
||||
if (UserGoods.code == nameof(GoodsEnum.Code.Cargo))//跑商物品处理
|
||||
{
|
||||
await weightService.UpdateUserShipOnWeight(userId, op, weightCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
await weightService.UpdateUserWeight(userId, op, weightCount);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public class GameMapService(ISqlSugarClient DbClient, IRedisCache redis) : IGameMapService, ITransient
|
||||
{
|
||||
#region 城市地图数据
|
||||
|
||||
public async Task<game_city> GetCityInfo(int cityId)
|
||||
{
|
||||
string key = string.Format(BaseCache.BaseCacheKeys, "MapCityData", "CityData");
|
||||
var data = await redis.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 redis.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 redis.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 redis.AddHashAsync(key, mapId, 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)
|
||||
{
|
||||
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 redis.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 redis.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 redis.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 redis.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 redis.HExistsHashAsync(key, userId))
|
||||
{
|
||||
return await redis.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 redis.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 redis.AddHashAsync(key, userId, onLine))
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_online>();
|
||||
await db.Updateable<unit_user_online>(onLine).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 其他相关
|
||||
|
||||
private async Task<List<UserModel>> GetMapUser(string mapId, int area, int showArea, List<string> noUser)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_online>();
|
||||
long time = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddMinutes(0 - GameConfig.OnLineTime));
|
||||
var data = await db.Queryable<unit_user_online>().Where(it => it.upTime > time && it.mapId == mapId)
|
||||
.WhereIF(noUser.Count > 0, it => !noUser.Contains(it.userId))
|
||||
.OrderByDescending(it=>it.upTime)
|
||||
.ToListAsync();
|
||||
|
||||
List<UserModel> result = new List<UserModel>();
|
||||
data.ForEach(async it =>
|
||||
{
|
||||
var temp = await UserModelTool.GetUserView(it.userId);
|
||||
bool isAdd = showArea == 1 && area != temp.area ? false : true;
|
||||
if (isAdd)
|
||||
{
|
||||
result.Add(temp);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<List<UserModel>> GetMapUser(string mapId, int area, int showArea, List<string> noUser, int take)
|
||||
{
|
||||
var data = await GetMapUser(mapId, area, showArea, noUser);
|
||||
return data.Take(take).ToList();
|
||||
}
|
||||
|
||||
public async Task<List<UserModel>> GetMapUser(string mapId, int area, int showArea, List<string> noUser, int page,
|
||||
int limit, RefAsync<int> total)
|
||||
{
|
||||
var data = await GetMapUser(mapId, area, showArea, noUser);
|
||||
total = data.Count;
|
||||
return data.Skip((page - 1) * limit) // 跳过前面的页
|
||||
.Take(limit) // 取当前页
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -20,6 +20,12 @@ public class NoticeService:INoticeService,ITransient
|
||||
public async Task<List<game_notice>> GetNoticeData(int page, int limit, RefAsync<int> total)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
||||
return await db.Queryable<game_notice>().ToPageListAsync(page, limit, total);
|
||||
return await db.Queryable<game_notice>().OrderByDescending(it=>it.addTime).ToPageListAsync(page, limit, total);
|
||||
}
|
||||
|
||||
public async Task<game_notice> GetNoticeInfo(string id)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
||||
return await db.Queryable<game_notice>().Where(it => it.noticeId == id).SingleAsync();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
using Photon.Core.Assist;
|
||||
|
||||
namespace Application.Domain;
|
||||
|
||||
public class GameAccountService : IGameAccountService, ITransient
|
||||
{
|
||||
private readonly ISqlSugarClient _dbClient;
|
||||
private readonly IRedisCache _redisClient;
|
||||
|
||||
public GameAccountService(ISqlSugarClient dbClient, IRedisCache redisClient)
|
||||
{
|
||||
_dbClient = dbClient;
|
||||
_redisClient = redisClient;
|
||||
}
|
||||
|
||||
|
||||
public async Task<game_account> GetAccInfoByOpenId(string openId)
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "UserAccountData", "OpenId");
|
||||
if (await _redisClient.HExistsHashAsync(key, openId))
|
||||
{
|
||||
return await _redisClient.GetHashAsync<game_account>(key, openId);
|
||||
}
|
||||
else
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_account>();
|
||||
var data = await db.Queryable<game_account>().Where(it => it.openId == openId).FirstAsync();
|
||||
if (data != null)
|
||||
{
|
||||
await _redisClient.AddHashAsync(key, openId, data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<game_account> GetAccInfoByAccId(string accId)
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "UserAccountData", "AccId");
|
||||
if (await _redisClient.HExistsHashAsync(key, accId))
|
||||
{
|
||||
return await _redisClient.GetHashAsync<game_account>(key, accId);
|
||||
}
|
||||
else
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_account>();
|
||||
var data = await db.Queryable<game_account>().Where(it => it.accId == accId).FirstAsync();
|
||||
if (data != null)
|
||||
{
|
||||
await _redisClient.AddHashAsync(key, accId, data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<game_account> GetAccInfoByToken(string token)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_account>();
|
||||
var data = await db.Queryable<game_account>().Where(it => it.token == token).FirstAsync();
|
||||
return data;
|
||||
}
|
||||
|
||||
private async Task ClearCache(string clearId)
|
||||
{
|
||||
string openId = string.Empty;
|
||||
string accId = string.Empty;
|
||||
var accInfo = await GetAccInfoByAccId(clearId);
|
||||
if (accInfo != null)
|
||||
{
|
||||
accId = accInfo.accId;
|
||||
openId = accInfo.openId;
|
||||
}
|
||||
else
|
||||
{
|
||||
accInfo = await GetAccInfoByOpenId(clearId);
|
||||
if (accInfo != null)
|
||||
{
|
||||
accId = accInfo.accId;
|
||||
openId = accInfo.openId;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(openId))
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "UserAccountData", "OpenId");
|
||||
await _redisClient.DelHashAsync(key, openId);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(accId))
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "UserAccountData", "AccId");
|
||||
await _redisClient.DelHashAsync(key, accId);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<game_account> Regist(string userName, string nick, string pwd, string remAccId = "",
|
||||
string openId = "")
|
||||
{
|
||||
game_account result = new game_account();
|
||||
try
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_account>();
|
||||
await _dbClient.AsTenant().BeginTranAsync();
|
||||
string accId = StringAssist.NewGuid;
|
||||
result.accId = accId;
|
||||
result.userName = userName;
|
||||
result.nick = nick;
|
||||
string sid = await CreateToken();
|
||||
result.token = sid;
|
||||
result.npwd = pwd;
|
||||
result.remAccId = remAccId;
|
||||
result.remCode = StringAssist.RandomString(6);
|
||||
result.pwd = EncryptAssist.Md5Encryption(pwd);
|
||||
result.status = 1;
|
||||
result.addTime = DateTime.Now;
|
||||
result.openId = openId;
|
||||
bool isok = await db.Insertable(result).ExecuteCommandAsync() > 0;
|
||||
if (isok)
|
||||
{
|
||||
await ClearCache(openId);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
|
||||
await _dbClient.AsTenant().CommitTranAsync();
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = null;
|
||||
await _dbClient.AsTenant().RollbackTranAsync();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task<string> CreateToken()
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_account>();
|
||||
string token = string.Empty;
|
||||
bool ok = true;
|
||||
while (ok)
|
||||
{
|
||||
token = string.Format("{0}", StringAssist.RandomString(32));
|
||||
if (await db.Queryable<game_account>().Where(it => it.token == token).AnyAsync() == false)
|
||||
{
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateAccountToken(string accId)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_account>();
|
||||
string token = await CreateToken();
|
||||
bool result = await db.Updateable<game_account>().SetColumns(it => it.token == token)
|
||||
.Where(it => it.accId == accId).ExecuteCommandAsync() > 0;
|
||||
if (result)
|
||||
{
|
||||
await ClearCache(accId);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
using Photon.Core.Assist;
|
||||
|
||||
namespace Application.Domain;
|
||||
|
||||
public class UnitUserService : IUnitUserService, ITransient
|
||||
{
|
||||
private readonly ISqlSugarClient _dbClient;
|
||||
private readonly IRedisCache _redisClient;
|
||||
|
||||
public UnitUserService(ISqlSugarClient dbClient, IRedisCache redisClient)
|
||||
{
|
||||
_dbClient = dbClient;
|
||||
_redisClient = redisClient;
|
||||
}
|
||||
|
||||
#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");
|
||||
var data = await _redisClient.GetHashAsync<unit_user>(key, userId);
|
||||
if (data == null)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<unit_user>();
|
||||
data = await db.Queryable<unit_user>().Where(it => it.userId == userId).SingleAsync();
|
||||
if (data != null)
|
||||
{
|
||||
await _redisClient.AddHashAsync(key, userId, data);
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<unit_user> GetUserInfoByUserNo(string userNo)
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "UserInfo", "UserNo");
|
||||
var data = await _redisClient.GetHashAsync<unit_user>(key, userNo);
|
||||
if (data == null)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<unit_user>();
|
||||
data = await db.Queryable<unit_user>().Where(it => it.userNo == userNo).SingleAsync();
|
||||
if (data != null)
|
||||
{
|
||||
await _redisClient.AddHashAsync(key, userNo, data);
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<unit_user> GetUserInfoByToken(string token)
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "UserInfo", "token");
|
||||
var data = await _redisClient.GetHashAsync<unit_user>(key, token);
|
||||
if (data == null)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<unit_user>();
|
||||
data = await db.Queryable<unit_user>().Where(it => it.token == token).SingleAsync();
|
||||
if (data != null)
|
||||
{
|
||||
await _redisClient.AddHashAsync(key, token, data);
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private async Task ClearUserInfo(int type, string id)
|
||||
{
|
||||
unit_user result = new unit_user();
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
result = await GetUserInfoByUserId(id);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
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);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 用户注册
|
||||
|
||||
public async Task<unit_user> Register(int areaId, string accId)
|
||||
{
|
||||
unit_user result = new unit_user();
|
||||
try
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<unit_user>();
|
||||
await _dbClient.AsTenant().BeginTranAsync();
|
||||
string userId = StringAssist.NewGuid;
|
||||
result.userId = userId;
|
||||
result.areaId = areaId;
|
||||
result.accId = accId;
|
||||
result.nick = "四海虾米";
|
||||
result.headImg = "";
|
||||
int no = await GetUserNo();
|
||||
result.userNo = no.ToString();
|
||||
string token = await GetToken();
|
||||
result.token = token;
|
||||
result.sign = "这个小家伙儿很懒,什么也没留下.";
|
||||
result.status = 1;
|
||||
result.regOk = 0;
|
||||
result.isSystem = 0;
|
||||
result.addTime = DateTime.Now;
|
||||
bool isok = db.Insertable(result).ExecuteCommand() > 0;
|
||||
if (!isok)
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
|
||||
await _dbClient.AsTenant().CommitTranAsync();
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = null;
|
||||
await _dbClient.AsTenant().RollbackTranAsync();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<bool> RegisterUserInfo(string userId, string nick, string sex)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<unit_user>();
|
||||
bool result = await db.Updateable<unit_user>().SetColumns(it => it.nick == nick)
|
||||
.SetColumns(it => it.sex == sex)
|
||||
.SetColumns(it => it.regOk == 1)
|
||||
.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);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task<int> GetUserNo()
|
||||
{
|
||||
int No = 0;
|
||||
bool ok = true;
|
||||
while (ok)
|
||||
{
|
||||
No = RandomAssist.GetFormatedNumeric(11012585, 97521695);
|
||||
if (await GetUserInfoByUserNo(No.ToString()) == null)
|
||||
{
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
return No;
|
||||
}
|
||||
|
||||
private async Task<string> GetToken()
|
||||
{
|
||||
string token = string.Empty;
|
||||
bool ok = true;
|
||||
while (ok)
|
||||
{
|
||||
token = StringAssist.RandomString(32);
|
||||
if (await GetUserInfoByToken(token) == null)
|
||||
{
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 其他
|
||||
|
||||
public async Task<int> GetOnlineCount()
|
||||
{
|
||||
long time = TimeExtend.GetTimeStampBySeconds(DateTime.Now.AddMinutes(0-GameConfig.OnLineTime));
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<unit_user_online>();
|
||||
return await db.Queryable<unit_user_online>().Where(it => it.upTime > time).CountAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public class UnitUserWeight(ISqlSugarClient DbClient, IRedisCache redis) : IUnitUserWeight, ITransient
|
||||
{
|
||||
public async Task<unit_user_weight> GetUserWeightInfo(string userId)
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "WeightData", "Weight");
|
||||
var data = await redis.GetHashAsync<unit_user_weight>(key, userId);
|
||||
if (data == null)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_weight>();
|
||||
data = await db.Queryable<unit_user_weight>().Where(it => it.userId == userId).SingleAsync();
|
||||
await redis.AddHashAsync(key, userId, data);
|
||||
}
|
||||
|
||||
data.maxWeight = await GetUserMaxWeight(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
private async Task<int> GetUserMaxWeight(unit_user_weight data)
|
||||
{
|
||||
int result = (int)data.maxWeight;
|
||||
//其他属性加层
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task ClearUserWeightInfo(string userId)
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "WeightData", "Weight");
|
||||
await redis.DelHashAsync(key, userId);
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateUserWeight(string userId, int op, int weight)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_weight>();
|
||||
bool result = await db.Updateable<unit_user_weight>()
|
||||
.SetColumnsIF(op == 0, it => it.onWeight == it.onWeight - weight)
|
||||
.SetColumnsIF(op == 1, it => it.onWeight == it.onWeight + weight)
|
||||
.SetColumnsIF(op == 2, it => it.onWeight == weight)
|
||||
.Where(it => it.userId == userId).ExecuteCommandAsync() > 0;
|
||||
if (result)
|
||||
{
|
||||
await ClearUserWeightInfo(userId);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateUserMaxWeight(string userId, int op, int weight)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_weight>();
|
||||
bool result = await db.Updateable<unit_user_weight>()
|
||||
.SetColumnsIF(op == 0, it => it.maxWeight == it.maxWeight - weight)
|
||||
.SetColumnsIF(op == 1, it => it.maxWeight == it.maxWeight + weight)
|
||||
.Where(it => it.userId == userId).ExecuteCommandAsync() > 0;
|
||||
if (result)
|
||||
{
|
||||
await ClearUserWeightInfo(userId);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<bool> AddUserWeightLog(string userId, int goodsId, string goodsName, int weight, int count)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_weight_log>();
|
||||
unit_user_weight_log log = new unit_user_weight_log();
|
||||
log.logId = StringAssist.NewGuid;
|
||||
log.userId = userId;
|
||||
log.goodsId = goodsId;
|
||||
log.goodsName = goodsName;
|
||||
log.weight = weight;
|
||||
log.count = count;
|
||||
log.sum = weight * count;
|
||||
log.addTime = DateTime.Now;
|
||||
return await db.Insertable(log).ExecuteCommandAsync() > 0;
|
||||
}
|
||||
|
||||
public async Task<bool> CheakUserWeight(string userId, int useWeight)
|
||||
{
|
||||
bool result = false;
|
||||
var weightInfo = await GetUserWeightInfo(userId);
|
||||
if (weightInfo != null)
|
||||
{
|
||||
result = (useWeight + weightInfo.onWeight) <= weightInfo.maxWeight;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#region 船只相关
|
||||
|
||||
public async Task<List<unit_user_ship>> GetUserShip(string userId)
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "WeightData", "Ship");
|
||||
var data = await redis.GetHashAsync<List<unit_user_ship>>(key, userId);
|
||||
if (data == null)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_ship>();
|
||||
data = await db.Queryable<unit_user_ship>().Where(it => it.userId == userId).ToListAsync();
|
||||
await redis.AddHashAsync(key, userId, data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
public async Task<int> GetUserShipMaxWeight(string userId)
|
||||
{
|
||||
var data = await GetUserShip(userId);
|
||||
return data.Sum(it => (int)it.weight);
|
||||
}
|
||||
private async Task ClearUserShipData(string userId)
|
||||
{
|
||||
string key = string.Format(UserCache.BaseCacheKeys, "WeightData", "Ship");
|
||||
await redis.DelHashAsync(key, userId);
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateUserShipOnWeight(string userId, int op, int weight)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_weight>();
|
||||
bool result = await db.Updateable<unit_user_weight>()
|
||||
.SetColumnsIF(op == 0, it => it.shipOnWeight == it.shipOnWeight - weight)
|
||||
.SetColumnsIF(op == 1, it => it.shipOnWeight == it.shipOnWeight + weight)
|
||||
.Where(it => it.userId == userId).ExecuteCommandAsync() > 0;
|
||||
if (result)
|
||||
{
|
||||
await ClearUserWeightInfo(userId);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<bool> CheakUserShipWeight(string userId, int useWeight)
|
||||
{
|
||||
bool result = false;
|
||||
var weightInfo = await GetUserWeightInfo(userId);
|
||||
var maxShipWeight = await GetUserShipMaxWeight(userId);
|
||||
if (weightInfo != null)
|
||||
{
|
||||
result = (useWeight + weightInfo.onWeight) <= maxShipWeight;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<bool> DeleteUserShip(string usId,string userId)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_ship>();
|
||||
bool result = await db.Deleteable<unit_user_ship>().Where(it => it.usId == usId).ExecuteCommandAsync() > 0;
|
||||
if (result)
|
||||
{
|
||||
await ClearUserShipData(userId);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<bool> AddUserShip(string userId,string name,int goodsId,int speed,int weight)
|
||||
{
|
||||
unit_user_ship ship = new unit_user_ship();
|
||||
ship.usId = StringAssist.NewGuid;
|
||||
ship.userId = userId;
|
||||
ship.goodsId = goodsId;
|
||||
ship.name = name;
|
||||
ship.speed = speed;
|
||||
ship.weight = weight;
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_ship>();
|
||||
bool result = await db.Insertable(ship).ExecuteCommandAsync() > 0;
|
||||
if (result)
|
||||
{
|
||||
await ClearUserShipData(userId);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
41
Service/Application.Domain/Tool/Base/GameTool.cs
Normal file
41
Service/Application.Domain/Tool/Base/GameTool.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
32
Service/Application.Domain/Tool/ModelTool/UserModelTool.cs
Normal file
32
Service/Application.Domain/Tool/ModelTool/UserModelTool.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public class UserModelTool
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取用户模型
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="addIcon"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<UserModel> GetUserView(string userId,bool addIcon=false)
|
||||
{
|
||||
UserModel result = new UserModel();
|
||||
var userService = App.GetService<IUnitUserService>();
|
||||
var userInfo = await userService.GetUserInfoByUserId(userId);
|
||||
if (userInfo != null)
|
||||
{
|
||||
result.userNo = userInfo.userNo;
|
||||
result.nick = userInfo.nick;
|
||||
result.sex = userInfo.sex;
|
||||
result.headImg = userInfo.headImg;
|
||||
result.area = (int)userInfo.areaId;
|
||||
result.icon = "";
|
||||
if (addIcon)//获取图标信息
|
||||
{
|
||||
result.icon = "";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
24
Service/Application.Service.Pub/Extends/TimeExtend.cs
Normal file
24
Service/Application.Service.Pub/Extends/TimeExtend.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace Application.Service.Pub;
|
||||
|
||||
public class TimeExtend
|
||||
{
|
||||
public static long GetTimeStampSeconds
|
||||
{
|
||||
get => Convert.ToInt64((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
|
||||
}
|
||||
|
||||
public static long GetTimeStampMilliseconds
|
||||
{
|
||||
get => Convert.ToInt64((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalMilliseconds);
|
||||
}
|
||||
|
||||
public static long GetTimeStampBySeconds(DateTime time)
|
||||
{
|
||||
return Convert.ToInt64((time - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
|
||||
}
|
||||
|
||||
public static long GetTimeStampByMilliseconds(DateTime time)
|
||||
{
|
||||
return Convert.ToInt64((time - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalMilliseconds);
|
||||
}
|
||||
}
|
||||
55
Service/Application.Service.Pub/Jwt/JwtTool.cs
Normal file
55
Service/Application.Service.Pub/Jwt/JwtTool.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
22
Service/Application.Web/Common/AutoLogin.cs
Normal file
22
Service/Application.Web/Common/AutoLogin.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Application.Web;
|
||||
|
||||
public class AutoLogin
|
||||
{
|
||||
public async Task<TwResult> TwLogin(string code)
|
||||
{
|
||||
using HttpClient client = new HttpClient();
|
||||
// 发送 GET 请求
|
||||
string url = $"https://m.twbar.cn/api/AppAuto/GetOpenInfo?code={code}";
|
||||
string responseText = await client.GetStringAsync(url);
|
||||
return JsonConvert.DeserializeObject<TwResult>(responseText);
|
||||
}
|
||||
}
|
||||
|
||||
public class TwResult
|
||||
{
|
||||
public string msg { get; set; } = "";
|
||||
public int code { get; set; }
|
||||
public object data { get; set; }
|
||||
}
|
||||
25
Service/Application.Web/Common/ComHelper.cs
Normal file
25
Service/Application.Web/Common/ComHelper.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
21
Service/Application.Web/Common/DateTimeJsonConverter.cs
Normal file
21
Service/Application.Web/Common/DateTimeJsonConverter.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Application.Web;
|
||||
|
||||
public class DateTimeJsonConverter: JsonConverter<DateTime>
|
||||
{
|
||||
public override DateTime Read(
|
||||
ref Utf8JsonReader reader,
|
||||
Type typeToConvert,
|
||||
JsonSerializerOptions options)
|
||||
{
|
||||
return DateTime.ParseExact(reader.GetString(), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options)
|
||||
{
|
||||
writer.WriteStringValue(value.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
@@ -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"]) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
7
Service/Application.Web/Config/TokenConfig.cs
Normal file
7
Service/Application.Web/Config/TokenConfig.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Application.Web;
|
||||
|
||||
public class TokenConfig
|
||||
{
|
||||
public const int TokenTime = 5;//分钟
|
||||
|
||||
}
|
||||
137
Service/Application.Web/Controllers/Chat/ChatController.cs
Normal file
137
Service/Application.Web/Controllers/Chat/ChatController.cs
Normal file
@@ -0,0 +1,137 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Application.Web.Controllers.Chat;
|
||||
|
||||
/// <summary>
|
||||
/// 公聊接口
|
||||
/// </summary>
|
||||
[Route("Chat/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class ChatController : ControllerBase
|
||||
{
|
||||
private readonly IGameChatService _chatService;
|
||||
private readonly IGameGoodsService _goodsService;
|
||||
public ChatController(IGameChatService chatService,IGameGoodsService goodsService)
|
||||
{
|
||||
_chatService = chatService;
|
||||
_goodsService = goodsService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取公聊信息
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="page"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> GetChatData(int type, int page)
|
||||
{
|
||||
string userId = StateHelper.userId;
|
||||
int areaId = StateHelper.areaId;
|
||||
string teamId = "";
|
||||
string groupId = "";
|
||||
RefAsync<int> Total = 0;
|
||||
var data = await _chatService.GetChatData(type, areaId, teamId, groupId, page, 10, Total);
|
||||
//物品数量
|
||||
int sendGoodsCount = 0;
|
||||
string sendGoodsName = "";
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
sendGoodsCount = await _goodsService.GetUserGoodsCount(userId,GameConfig.SendChatGoodsBase);
|
||||
sendGoodsName = "小海螺";
|
||||
break;
|
||||
case 3:
|
||||
sendGoodsCount = await _goodsService.GetUserGoodsCount(userId,GameConfig.SendChatGoodsArea);
|
||||
sendGoodsName = "大海螺";
|
||||
break;
|
||||
case 4:
|
||||
sendGoodsCount = await _goodsService.GetUserGoodsCount(userId,GameConfig.SendChatGoodsService);
|
||||
sendGoodsName = "金海螺";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return PoAction.Ok(new { data, total = Total.Value ,sendGoodsCount,sendGoodsName});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发言
|
||||
/// </summary>
|
||||
/// <param name="pars"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IPoAction> SendChat([FromBody] SendChatParms pars)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pars.sign))
|
||||
{
|
||||
return PoAction.Message("发言内容不能为空!");
|
||||
}
|
||||
|
||||
string userId = StateHelper.userId;
|
||||
int areaId = StateHelper.areaId;
|
||||
string par = string.Empty;
|
||||
string code = GameChatEnum.Code.Public.ToString();
|
||||
int goodsId = 0;
|
||||
bool isSend = false;
|
||||
switch (pars.type)
|
||||
{
|
||||
case 0:
|
||||
isSend = true;
|
||||
code =nameof(GameChatEnum.Code.Public);
|
||||
goodsId = GameConfig.SendChatGoodsBase;
|
||||
break;
|
||||
case 1:
|
||||
isSend = true;
|
||||
code = nameof(GameChatEnum.Code.Team);
|
||||
par = "";
|
||||
break;
|
||||
case 2:
|
||||
isSend = true;
|
||||
code = nameof(GameChatEnum.Code.Group);
|
||||
par="";
|
||||
break;
|
||||
case 3:
|
||||
isSend = true;
|
||||
goodsId = GameConfig.SendChatGoodsArea;
|
||||
code = nameof(GameChatEnum.Code.Region);
|
||||
break;
|
||||
case 4:
|
||||
isSend = true;
|
||||
goodsId = GameConfig.SendChatGoodsService;
|
||||
code = nameof(GameChatEnum.Code.Dress);
|
||||
break;
|
||||
|
||||
}
|
||||
if (isSend == false)
|
||||
{
|
||||
return PoAction.Message("无法发言!");
|
||||
}
|
||||
|
||||
if (goodsId != 0)
|
||||
{
|
||||
var myCount = await _goodsService.GetUserGoodsCount(userId, goodsId);
|
||||
if (myCount < 1)
|
||||
{
|
||||
return PoAction.Message("暂无发言道具,去商城购买海螺才可以发言哦!");
|
||||
}
|
||||
}
|
||||
|
||||
string sign = StringAssist.NoHTML(pars.sign);
|
||||
bool result = await _chatService.SendChat(userId, areaId, code, sign, par);
|
||||
if (result)
|
||||
{
|
||||
if (goodsId != 0)//扣除道具
|
||||
{
|
||||
await _goodsService.UpdateUserGoods(userId, 0, goodsId, 1, "发言");
|
||||
}
|
||||
|
||||
return PoAction.Ok(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return PoAction.Message("发送失败,请稍后尝试!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Application.Web.Controllers.Login
|
||||
{
|
||||
@@ -12,11 +13,18 @@ namespace Application.Web.Controllers.Login
|
||||
[ApiController]
|
||||
public class LoginController : ControllerBase
|
||||
{
|
||||
private readonly IHubContext<ChatHub> _hubContext;
|
||||
public LoginController(IHubContext<ChatHub> hubContext)
|
||||
private readonly IGameAccountService _accountService;
|
||||
private readonly IAreaService _areaService;
|
||||
private readonly IUnitUserService _userService;
|
||||
|
||||
public LoginController(IGameAccountService accountService, IAreaService areaService,
|
||||
IUnitUserService userService)
|
||||
{
|
||||
_hubContext = hubContext;
|
||||
_accountService = accountService;
|
||||
_areaService = areaService;
|
||||
_userService = userService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录接口
|
||||
/// </summary>
|
||||
@@ -25,23 +33,283 @@ namespace Application.Web.Controllers.Login
|
||||
[HttpPost]
|
||||
public async Task<IPoAction> Login([FromBody] LoginParms parms)
|
||||
{
|
||||
HttpContext.Request.QueryString
|
||||
return PoAction.Ok(parms.code);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试接口
|
||||
/// 探玩自动登录
|
||||
/// </summary>
|
||||
/// <param name="name">测试名</param>
|
||||
/// <param name="ttt">测试2</param>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> Test(string name,string ttt)
|
||||
public async Task<IPoAction> TwLogin(string code)
|
||||
{
|
||||
await _hubContext.Clients.All.SendAsync("ReceiveMessage", "系统");
|
||||
|
||||
return PoAction.Ok(name);
|
||||
|
||||
if (string.IsNullOrEmpty(code))
|
||||
{
|
||||
return PoAction.Message("code值错误!");
|
||||
}
|
||||
|
||||
AutoLogin login = new AutoLogin();
|
||||
var loginInfo = await login.TwLogin(code);
|
||||
if (loginInfo.code == 0)
|
||||
{
|
||||
dynamic twInfo = JsonConvert.DeserializeObject<dynamic>(loginInfo.data.ToString());
|
||||
string openId = twInfo.openid;
|
||||
string nick = "探玩玩家";
|
||||
var accInfo = await _accountService.GetAccInfoByOpenId(openId);
|
||||
if (accInfo == null)
|
||||
{
|
||||
var userData = await _accountService.Regist("", nick, "", "", openId);
|
||||
if (userData == null)
|
||||
{
|
||||
return PoAction.Message("登录失败,请联系客服!");
|
||||
}
|
||||
else
|
||||
{
|
||||
object ret = new { token = userData.token };
|
||||
return PoAction.Ok(ret);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (accInfo.status != 1)
|
||||
{
|
||||
return PoAction.Message("账号被冻结!");
|
||||
}
|
||||
else
|
||||
{
|
||||
object ret = new { token = accInfo.token };
|
||||
return PoAction.Ok(ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return PoAction.Message(loginInfo.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 退出登录
|
||||
/// </summary>
|
||||
/// <param name="sid"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> LoginOut(string? sid)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sid))
|
||||
{
|
||||
return PoAction.Message("身份信息不存在!");
|
||||
}
|
||||
|
||||
var accInfo = await _accountService.GetAccInfoByToken(sid);
|
||||
if (accInfo == null)
|
||||
{
|
||||
return PoAction.Message("身份信息不存在!");
|
||||
}
|
||||
|
||||
if (await _accountService.UpdateAccountToken(accInfo.accId))
|
||||
{
|
||||
return PoAction.Ok(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return PoAction.Message("退出失败,请稍后尝试!");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册基础账号信息
|
||||
/// </summary>
|
||||
/// <param name="sid"></param>
|
||||
/// <param name="area"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> Register(string sid, int area)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sid))
|
||||
{
|
||||
return PoAction.Message("未登录账号!");
|
||||
}
|
||||
|
||||
var accInfo = await _accountService.GetAccInfoByToken(sid);
|
||||
if (accInfo == null)
|
||||
{
|
||||
return PoAction.Message("未登录账号!");
|
||||
}
|
||||
|
||||
if (accInfo.status != 1)
|
||||
{
|
||||
return PoAction.Message("账号已冻结!");
|
||||
}
|
||||
|
||||
var areaInfo = await _areaService.GetAreaInfo(area);
|
||||
if (areaInfo == null)
|
||||
{
|
||||
return PoAction.Message("区服不存在!");
|
||||
}
|
||||
|
||||
if (areaInfo.status != 1)
|
||||
{
|
||||
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))
|
||||
{
|
||||
return PoAction.Message("该区已存在角色!");
|
||||
}
|
||||
|
||||
var userInfo = await _userService.Register(areaInfo.areaId, accInfo.accId);
|
||||
if (userInfo == null)
|
||||
{
|
||||
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 Key = App.Configuration["JwtTokenOptions:SecurityKey"].ToString();
|
||||
string Issuer = App.Configuration["JwtTokenOptions:Issuer"].ToString();
|
||||
string Audience = App.Configuration["JwtTokenOptions:Audience"].ToString();
|
||||
string token = JwtHelper.CreateToken(Key, Issuer, Audience, loadData, TokenConfig.TokenTime);
|
||||
return PoAction.Ok(new { token = token, refToken = userInfo.token, userId = userInfo.userId });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录到游戏
|
||||
/// </summary>
|
||||
/// <param name="sid"></param>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> LoginGame(string sid, string user)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sid))
|
||||
{
|
||||
return PoAction.Message("未登录账号!");
|
||||
}
|
||||
|
||||
var accInfo = await _accountService.GetAccInfoByToken(sid);
|
||||
if (accInfo == null)
|
||||
{
|
||||
return PoAction.Message("未登录账号!");
|
||||
}
|
||||
|
||||
if (accInfo.status != 1)
|
||||
{
|
||||
return PoAction.Message("账号已冻结!");
|
||||
}
|
||||
|
||||
var userInfo = await _userService.GetUserInfoByUserId(user);
|
||||
if (userInfo == null)
|
||||
{
|
||||
return PoAction.Message("角色不存在!");
|
||||
}
|
||||
|
||||
if (userInfo.accId != accInfo.accId)
|
||||
{
|
||||
return PoAction.Message("角色不存在!");
|
||||
}
|
||||
|
||||
if (userInfo.status == 0)
|
||||
{
|
||||
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 Key = App.Configuration["JwtTokenOptions:SecurityKey"].ToString();
|
||||
string Issuer = App.Configuration["JwtTokenOptions:Issuer"].ToString();
|
||||
string Audience = App.Configuration["JwtTokenOptions:Audience"].ToString();
|
||||
string token = JwtHelper.CreateToken(Key, Issuer, Audience, loadData, TokenConfig.TokenTime);
|
||||
return PoAction.Ok(new
|
||||
{ regOk = userInfo.regOk, token = token, refToken = userInfo.token, userId = userInfo.userId });
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IPoAction> RefreshToken([FromBody] RefreshTokenParms parms)
|
||||
{
|
||||
if (string.IsNullOrEmpty(parms.token) || string.IsNullOrEmpty(parms.refToken))
|
||||
{
|
||||
return PoAction.Message("刷新失败");
|
||||
}
|
||||
|
||||
string Key = App.Configuration["JwtTokenOptions:SecurityKey"].ToString();
|
||||
string Issuer = App.Configuration["JwtTokenOptions:Issuer"].ToString();
|
||||
string Audience = App.Configuration["JwtTokenOptions:Audience"].ToString();
|
||||
|
||||
string accId = string.Empty;
|
||||
var tokenData = await JwtTool.GetJwtData(parms.token, Key, "accId");
|
||||
if (tokenData != null)
|
||||
{
|
||||
accId = tokenData.ToString();
|
||||
}
|
||||
|
||||
var userInfo = await _userService.GetUserInfoByToken(parms.refToken);
|
||||
if (userInfo == null)
|
||||
{
|
||||
return PoAction.Message("刷新失败,用户不存在!");
|
||||
}
|
||||
|
||||
if (userInfo.accId != accId)
|
||||
{
|
||||
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 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册角色信息
|
||||
/// </summary>
|
||||
/// <param name="parms"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public async Task<IPoAction> RegisterInfo([FromBody] RegisterInfoParms parms)
|
||||
{
|
||||
if (string.IsNullOrEmpty(parms.nick))
|
||||
{
|
||||
return PoAction.Message("昵称不能为空!");
|
||||
}
|
||||
|
||||
if (!RegExpAssist.RegStringLeght(parms.nick, 1, 12))
|
||||
{
|
||||
return PoAction.Message("昵称需要1-12字符之间哦!");
|
||||
}
|
||||
|
||||
string sex = parms.sex == 0 ? "女" : "男";
|
||||
string userId = StateHelper.userId;
|
||||
var userInfo = await _userService.GetUserInfoByUserId(userId);
|
||||
if (userInfo.regOk == 1)
|
||||
{
|
||||
return PoAction.Ok(true);
|
||||
}
|
||||
|
||||
if (await _userService.RegisterUserInfo(userId, parms.nick, sex))
|
||||
{
|
||||
return PoAction.Ok(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return PoAction.Message("注册失败,请稍后尝试!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
98
Service/Application.Web/Controllers/Map/MapController.cs
Normal file
98
Service/Application.Web/Controllers/Map/MapController.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
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;
|
||||
private readonly IGameChatService _chatService;
|
||||
|
||||
public MapController(IUnitUserService userService, IGameMapService mapService, IGameChatService chatService)
|
||||
{
|
||||
_userService = userService;
|
||||
_mapService = mapService;
|
||||
_chatService = chatService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取地图主页信息
|
||||
/// </summary>
|
||||
/// <param name="map"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> GetMapData(string? map)
|
||||
{
|
||||
string userId = StateHelper.userId;
|
||||
int area = StateHelper.areaId;
|
||||
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);
|
||||
}
|
||||
|
||||
//公聊信息
|
||||
string teamId = "";
|
||||
string groupId = "";
|
||||
var chatData = await _chatService.GetChatTop(area, 2, teamId, groupId);
|
||||
|
||||
|
||||
var npcData = await _mapService.GetMapNpc(mapInfo.mapId); //NPC信息
|
||||
npcData = npcData.FindAll(it => GameTool.AreaVerify(StateHelper.areaId, it.areaId));
|
||||
var nearUser =
|
||||
await _mapService.GetMapUser(mapInfo.mapId, area, (int)mapInfo.lookArea, new List<string> { userId },
|
||||
3); //获取附近的人
|
||||
|
||||
var cityInfo = await _mapService.GetCityInfo((int)mapInfo.cityId); //城市信息
|
||||
var cityShow = await _mapService.GetMapCity(cityInfo.cityId); //城内地图
|
||||
|
||||
#region 更新在线
|
||||
|
||||
string ip = ComHelper.GetClientUserIp(HttpContext);
|
||||
await _mapService.UpdateUserOnMap(userId, ip, mapInfo.mapId);
|
||||
|
||||
#endregion
|
||||
|
||||
object ret = new { mapInfo, cityInfo, npcData, chatData, cityShow, nearUser };
|
||||
|
||||
return PoAction.Ok(ret);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取地图在线玩家
|
||||
/// </summary>
|
||||
/// <param name="map"></param>
|
||||
/// <param name="page"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> GetMapUser(int page)
|
||||
{
|
||||
RefAsync<int> Total = 0;
|
||||
string userId = StateHelper.userId;
|
||||
int areaId = StateHelper.areaId;
|
||||
var onMap = await _mapService.GetUserOnMap(userId);
|
||||
|
||||
var mapInfo = await _mapService.GetMapInfo(onMap.mapId);
|
||||
if (mapInfo == null)
|
||||
{
|
||||
return PoAction.Message("地图不存在!");
|
||||
}
|
||||
|
||||
var data = await _mapService.GetMapUser(onMap.mapId, areaId, (int)mapInfo.lookArea, new List<string> { userId }, page,
|
||||
10, Total);
|
||||
|
||||
return PoAction.Ok(new { data, total = Total.Value});
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Application.Web.Controllers.Pub
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 公共接口
|
||||
/// </summary>
|
||||
@@ -12,20 +11,101 @@ namespace Application.Web.Controllers.Pub
|
||||
public class PubController : ControllerBase
|
||||
{
|
||||
private readonly IAreaService _areaService;
|
||||
public PubController(IAreaService areaService)
|
||||
private readonly INoticeService _noticeService;
|
||||
private readonly IGameAccountService _accountService;
|
||||
private readonly IUnitUserService _userService;
|
||||
|
||||
public PubController(IAreaService areaService, INoticeService noticeService, IGameAccountService accountService,IUnitUserService userService)
|
||||
{
|
||||
_areaService = areaService;
|
||||
_noticeService = noticeService;
|
||||
_accountService = accountService;
|
||||
_userService = userService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取首页信息
|
||||
/// </summary>
|
||||
/// <param name="sid"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> GetMain()
|
||||
public async Task<IPoAction> GetMain(string? sid)
|
||||
{
|
||||
bool isOnline = false;
|
||||
game_account account = new game_account();
|
||||
List<unit_user> userData = new List<unit_user>();
|
||||
if (!string.IsNullOrEmpty(sid))
|
||||
{
|
||||
account = await _accountService.GetAccInfoByToken(sid);
|
||||
if (account != null)
|
||||
{
|
||||
isOnline = true;
|
||||
userData = await _userService.GetUserDataByAccId(account.accId);
|
||||
}
|
||||
}
|
||||
|
||||
var areaData = await _areaService.GetAreaData();
|
||||
return PoAction.Ok(new{area=areaData});
|
||||
foreach (var _user in userData)
|
||||
{
|
||||
areaData.RemoveAll(it => it.areaId == _user.areaId);
|
||||
}
|
||||
|
||||
var notice = await _noticeService.GetNoticeDataByTake(5);
|
||||
|
||||
int OnCount = await _userService.GetOnlineCount();
|
||||
return PoAction.Ok(new { area = areaData, notice, isOnline, onCount = OnCount, account,userData });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取公告列表
|
||||
/// </summary>
|
||||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> GetNoticeData(int page, int limit)
|
||||
{
|
||||
RefAsync<int> total = 0;
|
||||
var data = await _noticeService.GetNoticeData(page, limit, total);
|
||||
return PoAction.Ok(new { data, total = total.Value });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取公告详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> GetNoticeInfo(string id)
|
||||
{
|
||||
var data = await _noticeService.GetNoticeInfo(id);
|
||||
if (data == null)
|
||||
{
|
||||
return PoAction.Message("公告不存在!");
|
||||
}
|
||||
data.sign = data.sign.Replace("[Br]", "<br />");
|
||||
return PoAction.Ok(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户游戏角色
|
||||
/// </summary>
|
||||
/// <param name="sid"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> GetMyGame(string? sid)
|
||||
{
|
||||
List<unit_user> userData = new List<unit_user>();
|
||||
if (!string.IsNullOrEmpty(sid))
|
||||
{
|
||||
var account = await _accountService.GetAccInfoByToken(sid);
|
||||
if (account != null)
|
||||
{
|
||||
userData = await _userService.GetUserDataByAccId(account.accId);
|
||||
}
|
||||
}
|
||||
return PoAction.Ok(userData);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
38
Service/Application.Web/Controllers/User/BagController.cs
Normal file
38
Service/Application.Web/Controllers/User/BagController.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
namespace Application.Web.Controllers.User;
|
||||
|
||||
/// <summary>
|
||||
/// 用户背包信息
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "User")]
|
||||
[Route("User/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class BagController : ControllerBase
|
||||
{
|
||||
private readonly IUnitUserWeight _weightService;
|
||||
|
||||
public BagController(IUnitUserWeight weightService)
|
||||
{
|
||||
_weightService = weightService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取背包信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> GetUserBagData()
|
||||
{
|
||||
string userId = StateHelper.userId;
|
||||
int onWeight = 0;
|
||||
int maxWeight = 0;
|
||||
int gold = 0;
|
||||
int cowry = 0;
|
||||
long copper = 0;
|
||||
var userWeight = await _weightService.GetUserWeightInfo(userId);
|
||||
onWeight = (int)userWeight.onWeight;
|
||||
maxWeight = (int)userWeight.maxWeight;
|
||||
|
||||
return PoAction.Ok(new { onWeight, maxWeight,cowry, gold, copper });
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ global using Photon.Core.Services;
|
||||
global using Photon.Core.SqlSugar;
|
||||
global using Photon.Core.Assist;
|
||||
global using Photon.Core.Timer;
|
||||
global using SqlSugar;
|
||||
|
||||
global using Application.Service.Pub;
|
||||
global using Application.Domain;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Application.Web;
|
||||
|
||||
public class SendChatParms
|
||||
{
|
||||
public int type { get; set; }
|
||||
public string sign { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Application.Web;
|
||||
|
||||
public class RefreshTokenParms
|
||||
{
|
||||
public string refToken { get; set; }
|
||||
public string token { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Application.Web;
|
||||
|
||||
public class RegisterInfoParms
|
||||
{
|
||||
public string nick { get; set; } = string.Empty;
|
||||
public int sex { get; set; }
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
@@ -53,8 +59,13 @@ builder.Services.InjectTimer(services =>
|
||||
builder.Logging.InjectLog();
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers().AddJsonOptions(option =>
|
||||
{
|
||||
option.JsonSerializerOptions.Converters.Add(new DateTimeJsonConverter());
|
||||
option.JsonSerializerOptions.ReferenceHandler = System.Text.Json.Serialization.ReferenceHandler.IgnoreCycles;
|
||||
option.JsonSerializerOptions.MaxDepth =int.MaxValue;
|
||||
});
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||
|
||||
#region 配置跨域处理,允许所有来源
|
||||
@@ -89,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
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||
export default defineNuxtConfig({
|
||||
srcDir: 'src/',
|
||||
|
||||
components: {
|
||||
dirs: [
|
||||
// 自动递归 components 下所有子文件夹
|
||||
{ path: '~/components', pathPrefix: false }
|
||||
]
|
||||
},
|
||||
future: {
|
||||
compatibilityVersion: 4
|
||||
compatibilityVersion: 4,
|
||||
},
|
||||
|
||||
devtools: { enabled: true },
|
||||
@@ -14,30 +19,20 @@ export default defineNuxtConfig({
|
||||
port: 5068,
|
||||
},
|
||||
|
||||
modules: [
|
||||
'@pinia/nuxt',
|
||||
'@vant/nuxt',
|
||||
'pinia-plugin-persistedstate/nuxt'
|
||||
],
|
||||
modules: ['@pinia/nuxt', '@vant/nuxt', 'pinia-plugin-persistedstate/nuxt'],
|
||||
|
||||
// 自动导入配置 - 使用完整路径
|
||||
imports: {
|
||||
dirs: [
|
||||
'stores',
|
||||
'composables',
|
||||
'extends',
|
||||
'services/**',
|
||||
"model/**"
|
||||
]
|
||||
dirs: ['stores', 'composables', 'extends', 'services/**', 'model/**'],
|
||||
},
|
||||
|
||||
pinia: {
|
||||
storesDirs: ['./src/stores/**']
|
||||
storesDirs: ['./src/stores/**'],
|
||||
},
|
||||
|
||||
typescript: {
|
||||
strict: true,
|
||||
shim: false
|
||||
shim: false,
|
||||
},
|
||||
|
||||
app: {
|
||||
@@ -47,12 +42,16 @@ export default defineNuxtConfig({
|
||||
{ charset: 'utf-8' },
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
||||
{ name: 'keywords', content: '航海时代2|纵横四海|雄霸四海' },
|
||||
{ name: 'description', content: '航海时代是2022年推出的一款以航海为背景的wap文字游戏,让玩家穿越到15世纪的大航海时代,了解各地不同的风土人情;淋漓尽致的演绎航海时代的血雨腥风。' }
|
||||
]
|
||||
}
|
||||
{
|
||||
name: 'description',
|
||||
content:
|
||||
'航海时代是2022年推出的一款以航海为背景的wap文字游戏,让玩家穿越到15世纪的大航海时代,了解各地不同的风土人情;淋漓尽致的演绎航海时代的血雨腥风。',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
css: ['~/assets/css/style.css'],
|
||||
|
||||
compatibilityDate: '2024-04-03'
|
||||
compatibilityDate: '2024-04-03',
|
||||
})
|
||||
|
||||
BIN
Web/public/css/images/btn_b_gold.gif
Normal file
BIN
Web/public/css/images/btn_b_gold.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 346 B |
BIN
Web/public/images/loading.gif
Normal file
BIN
Web/public/images/loading.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 MiB |
BIN
Web/public/images/loading2.gif
Normal file
BIN
Web/public/images/loading2.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 MiB |
BIN
Web/public/images/loading3.gif
Normal file
BIN
Web/public/images/loading3.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1009 KiB |
BIN
Web/public/images/loading4.gif
Normal file
BIN
Web/public/images/loading4.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 519 KiB |
BIN
Web/public/images/logo.png
Normal file
BIN
Web/public/images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
@@ -3,18 +3,22 @@
|
||||
<NuxtLayout>
|
||||
<NuxtPage />
|
||||
</NuxtLayout>
|
||||
<PageLoading />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
// 项目根入口文件
|
||||
// Nuxt4会自动注入,无需手动配置
|
||||
// 全局样式已移至 src/assets/css/style.css 并在 nuxt.config.ts 中全局引用
|
||||
|
||||
// 可以在这里进行全局初始化
|
||||
const appStore = useAppStore()
|
||||
import { Loading } from 'vant'
|
||||
const userStore = useUserStore();
|
||||
const { on, emit } = useEventBus()
|
||||
|
||||
//连接signlar
|
||||
const ConnectSignlar = (clientId: string) => {
|
||||
console.log(`客户端:${clientId}`);
|
||||
}
|
||||
|
||||
|
||||
// 初始化应用配置
|
||||
onMounted(() => {
|
||||
// 初始化屏幕尺寸
|
||||
@@ -34,10 +38,24 @@ onMounted(() => {
|
||||
appStore.setOnlineStatus(false)
|
||||
})
|
||||
}
|
||||
if (userStore.getUserId != '') {
|
||||
ConnectSignlar(userStore.getUserId);
|
||||
}
|
||||
|
||||
|
||||
//监听启动连接signlaR
|
||||
on<any>('connect', (payload) => {
|
||||
ConnectSignlar(payload);
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* 页面级样式可以在这里定义 */
|
||||
/* 全局样式已移至 src/assets/css/style.css */
|
||||
|
||||
:root{
|
||||
--van-base-font: initial !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,4 +1,13 @@
|
||||
body, div, p, a, table, textarea, form, img, ul, li {
|
||||
body,
|
||||
div,
|
||||
p,
|
||||
a,
|
||||
table,
|
||||
textarea,
|
||||
form,
|
||||
img,
|
||||
ul,
|
||||
li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
@@ -10,18 +19,7 @@ body {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.game_nav {
|
||||
background: #302828;
|
||||
color: white;
|
||||
font-size: 15px;
|
||||
padding: 2px 0px 2px 3px;
|
||||
color: white;
|
||||
font-style: italic;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.main {
|
||||
}
|
||||
.main {}
|
||||
|
||||
div {
|
||||
margin: 5px 2px;
|
||||
@@ -34,48 +32,31 @@ div {
|
||||
|
||||
div img {
|
||||
max-width: 100%;
|
||||
width: exPRession(document.body.clientWidth>250?"250px":"auto");
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.logo {
|
||||
max-height: 120px;
|
||||
}
|
||||
|
||||
.step-logo {
|
||||
max-height: 120px;
|
||||
}
|
||||
.head {}
|
||||
|
||||
.head {
|
||||
}
|
||||
.title {}
|
||||
|
||||
.title {
|
||||
}
|
||||
.content {}
|
||||
|
||||
.content {
|
||||
}
|
||||
|
||||
.item {
|
||||
}
|
||||
.item {}
|
||||
|
||||
.border {
|
||||
border-bottom: 1px dashed #9f8d8d;
|
||||
}
|
||||
|
||||
.tips {
|
||||
}
|
||||
|
||||
.menu {
|
||||
}
|
||||
|
||||
.clear {
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
.foot {
|
||||
}
|
||||
.foot {}
|
||||
|
||||
body a {
|
||||
a {
|
||||
color: #1e5494;
|
||||
margin: 0 5px;
|
||||
text-decoration: underline;
|
||||
@@ -87,7 +68,9 @@ body a {
|
||||
margin: 3px 4px 3px 4px;
|
||||
}
|
||||
|
||||
a:hover, a:active, a:focus {
|
||||
a:hover,
|
||||
a:active,
|
||||
a:focus {
|
||||
color: #FFFFFF;
|
||||
background: #1e5494;
|
||||
}
|
||||
@@ -108,27 +91,13 @@ body a {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.page-msg {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.common {
|
||||
}
|
||||
.common {}
|
||||
|
||||
.common img {
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.PageTips {
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.algin-center {
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.input {
|
||||
line-height: 30px;
|
||||
}
|
||||
@@ -146,6 +115,47 @@ body a {
|
||||
box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%);
|
||||
transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
|
||||
}
|
||||
.ipt-btn-gray-m {
|
||||
width: 60px;
|
||||
height: 20px;
|
||||
border: none;
|
||||
}
|
||||
.serch{
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
.search-ipt{
|
||||
width: 80px;
|
||||
font-size: 11px;
|
||||
padding: 0 ;
|
||||
}
|
||||
|
||||
.ipt-btn{
|
||||
width: 61px;
|
||||
height: 21px;
|
||||
font-size: 13px;
|
||||
border: none;
|
||||
margin-top: 5px;
|
||||
background: url(/css/images/btn_b_gold.gif) no-repeat;
|
||||
color: #af4c00;
|
||||
}
|
||||
|
||||
.chat {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.chat img {
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.em {
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
}
|
||||
.badge {
|
||||
max-height: 25px;
|
||||
max-width: 25px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: inline-block;
|
||||
@@ -184,450 +194,3 @@ body a {
|
||||
background: 0 0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.chat {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.chat img {
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.em {
|
||||
height: 22px;
|
||||
width: 22px;
|
||||
}
|
||||
|
||||
.ftbtn {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.equImg-min {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
.user-head {
|
||||
max-height: 25px;
|
||||
max-width: 25px;
|
||||
}
|
||||
/******装备样式******/
|
||||
.equImg {
|
||||
max-width: 130px;
|
||||
max-height: 230px;
|
||||
}
|
||||
|
||||
.tq {
|
||||
background-image: url('/images/site/equ/tq.png');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.ty {
|
||||
background-image: url('/images/site/equ/ty.png');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.ms {
|
||||
background-image: url('/images/site/equ/ms.png');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.zx {
|
||||
background-image: url('/images/site/equ/zx.png');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.sy {
|
||||
background-image: url('/images/site/equ/sy.png');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.gw {
|
||||
background-image: url('/images/site/equ/gw.png');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.ly {
|
||||
background-image: url('/images/site/equ/ly.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.hm {
|
||||
background-image: url('/images/site/equ/hm.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.j_r {
|
||||
background-image: url('/images/site/equ/r.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.j_l {
|
||||
background-image: url('/images/site/equ/l.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background-size: 15px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
/**********End*******/
|
||||
/***副本***/
|
||||
.dup {
|
||||
background-image: url('/images/site/dup/dup.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
}
|
||||
/***任务***/
|
||||
.task-ret {
|
||||
background-image: url('/images/site/tr.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
}
|
||||
|
||||
.task-get {
|
||||
background-image: url('/images/site/tg.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
}
|
||||
/*九宫图片*/
|
||||
.gray {
|
||||
-webkit-filter: grayscale(100%);
|
||||
-moz-filter: grayscale(100%);
|
||||
-ms-filter: grayscale(100%);
|
||||
-o-filter: grayscale(100%);
|
||||
filter: grayscale(100%);
|
||||
filter: gray;
|
||||
}
|
||||
|
||||
/*九宫样式*/
|
||||
.wrapper {
|
||||
display: grid;
|
||||
grid-template-columns: 51px 51px 51px;
|
||||
grid-template-rows: 51px 51px 51px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.list {
|
||||
background: #eee;
|
||||
margin-right: 1px;
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
|
||||
.list img {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
/********其他*******/
|
||||
.mounthImg {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
/***广播***/
|
||||
.broad {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.broad-gift {
|
||||
background-image: url('/images/site/broad/gift.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.broad-system {
|
||||
background-image: url('/images/site/broad/system.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.broad-award {
|
||||
background-image: url('/images/site/broad/award.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.broad-remind {
|
||||
background-image: url('/images/site/broad/remind.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.broad-promote {
|
||||
background-image: url('/images/site/broad/promote.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.broad-hot1 {
|
||||
background-image: url('/images/site/broad/hot1.gif');
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-size: 18px; /*设置图片大小*/
|
||||
margin-right: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
/****礼物***/
|
||||
.gift {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.attire {
|
||||
height: 200px;
|
||||
width: 125px;
|
||||
}
|
||||
|
||||
/****限时活动****/
|
||||
.act_item {
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid #9f8d8d;
|
||||
border-radius: 16px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.act_menu a {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.act_content {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.act_header {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.m_act_head {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.m_act_head {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.m_act_item {
|
||||
border-bottom: 1px dashed #9f8d8d;
|
||||
}
|
||||
|
||||
.m_act_title {
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.m_act_con {
|
||||
font-size: 15px;
|
||||
padding: 3px;
|
||||
text-indent: 2em;
|
||||
}
|
||||
|
||||
.m_act_con a {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.badge {
|
||||
max-height: 25px;
|
||||
max-width: 25px;
|
||||
}
|
||||
|
||||
.maxname {
|
||||
max-height: 150px;
|
||||
max-width: 250px;
|
||||
}
|
||||
|
||||
/* ========== 自定义通知队列 ========== */
|
||||
#custom-notify-container {
|
||||
position: fixed;
|
||||
top: 10px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.custom-notify-item {
|
||||
box-sizing: border-box;
|
||||
max-width: 90%;
|
||||
padding: 8px 16px;
|
||||
margin-bottom: 8px;
|
||||
border-radius: 8px;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
text-align: center;
|
||||
word-wrap: break-word;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
||||
pointer-events: auto;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transform: translateY(-20px);
|
||||
animation: notify-slide-in 300ms ease-out forwards;
|
||||
}
|
||||
|
||||
.custom-notify-item.leaving {
|
||||
animation: notify-fade-out 200ms ease-in forwards;
|
||||
}
|
||||
|
||||
@keyframes notify-slide-in {
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes notify-fade-out {
|
||||
to {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
}
|
||||
|
||||
/* ========== 顶部通告栏 ========== */
|
||||
.custom-notice-bar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 16px;
|
||||
box-sizing: border-box;
|
||||
z-index: 9998;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.custom-notice-bar .notice-icon {
|
||||
flex-shrink: 0;
|
||||
margin-right: 8px;
|
||||
font-size: 16px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.custom-notice-bar .notice-wrap {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 40px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.custom-notice-bar .notice-text {
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
padding-right: 50px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.custom-notice-bar .notice-wrap.scrolling {
|
||||
animation: notice-scroll var(--scroll-duration, 10s) linear infinite;
|
||||
}
|
||||
|
||||
@keyframes notice-scroll {
|
||||
0% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
100% {
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.custom-notice-bar .notice-close {
|
||||
flex-shrink: 0;
|
||||
margin-left: 8px;
|
||||
font-size: 18px;
|
||||
cursor: pointer;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
line-height: 1;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<router-link :to="url" :class="_class" >
|
||||
<router-link :to="href" :class="_class">
|
||||
<slot></slot>
|
||||
</router-link>
|
||||
</template>
|
||||
@@ -7,7 +7,7 @@
|
||||
// 1. 定义接收父组件传来的参数 props
|
||||
const props = defineProps({
|
||||
// 字段名、类型、默认值
|
||||
url: String,
|
||||
href: String,
|
||||
_class: String,
|
||||
})
|
||||
</script>
|
||||
31
Web/src/components/Base/Abutton.vue
Normal file
31
Web/src/components/Base/Abutton.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<button class="kx-link-button" @click="handleClick">
|
||||
<slot></slot>
|
||||
</button>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
|
||||
const emit = defineEmits(['click'])
|
||||
// 定义 click 事件
|
||||
const handleClick = (): any => {
|
||||
emit('click')
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
.kx-link-button {
|
||||
/* text-decoration: underline; */
|
||||
color: #1e5494;
|
||||
font-size: 18px;
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
border: none;
|
||||
}
|
||||
.kx-link-button:hover{
|
||||
color: #FFFFFF;
|
||||
background: #1e5494;
|
||||
}
|
||||
|
||||
</style>
|
||||
26
Web/src/components/Base/Acheak.vue
Normal file
26
Web/src/components/Base/Acheak.vue
Normal file
@@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<Abutton @click="handleClick" v-if="onValue != onCheak">
|
||||
<slot></slot>
|
||||
</Abutton>
|
||||
|
||||
<span v-if="onValue == onCheak">
|
||||
<slot></slot>
|
||||
</span>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// 1. 定义接收父组件传来的参数 props
|
||||
const props = defineProps({
|
||||
// 字段名、类型、默认值
|
||||
href: String,
|
||||
onValue: String,
|
||||
onCheak: String
|
||||
|
||||
})
|
||||
|
||||
const emit = defineEmits(['click'])
|
||||
// 定义 click 事件
|
||||
const handleClick = (): any => {
|
||||
emit('click')
|
||||
}
|
||||
|
||||
</script>
|
||||
88
Web/src/components/Base/PageLoading.vue
Normal file
88
Web/src/components/Base/PageLoading.vue
Normal file
@@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<Transition name="page-loading-fade">
|
||||
<div v-if="appStore.isLoading" class="page-loading" role="status" aria-live="polite" aria-busy="true">
|
||||
<div class="gif">
|
||||
<!-- <van-image round width="6rem" height="8rem" src="/images/logo.png" /> -->
|
||||
<div style="width: 200px; height: 200px;">
|
||||
<img src="/images/loading4.gif" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const appStore = useAppStore()
|
||||
const defaultImage = '/images/page-loading-cover.png'
|
||||
const fallbackImage = '/images/logo.png'
|
||||
const loadingImage = ref(defaultImage)
|
||||
|
||||
const handleImageError = (): void => {
|
||||
if (loadingImage.value !== fallbackImage) {
|
||||
loadingImage.value = fallbackImage
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-loading {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
|
||||
.gif {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.page-loading__panel {
|
||||
width: min(100%, 280px);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.page-loading__image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
aspect-ratio: 1 / 1;
|
||||
object-fit: cover;
|
||||
border-radius: 18px;
|
||||
box-shadow: 0 16px 48px rgba(12, 40, 74, 0.18);
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.page-loading__title {
|
||||
color: #103b63;
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.page-loading__text {
|
||||
color: #4f6476;
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
.page-loading-fade-enter-active,
|
||||
.page-loading-fade-leave-active {
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.page-loading-fade-enter-from,
|
||||
.page-loading-fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
151
Web/src/components/Base/Pagination.vue
Normal file
151
Web/src/components/Base/Pagination.vue
Normal file
@@ -0,0 +1,151 @@
|
||||
<template>
|
||||
<div class="pagination" v-if="totalPages > 1">
|
||||
<!-- 第一行:导航按钮 -->
|
||||
<div class="pagination-nav">
|
||||
<span v-if="currentPage > 1" @click="changePage('first')">首页</span>
|
||||
<span v-if="currentPage > 1"> . </span>
|
||||
<span v-if="currentPage > 1" @click="changePage('prev')">上一页</span>
|
||||
<span v-if="currentPage > 1 && currentPage < totalPages"> . </span>
|
||||
<span v-if="currentPage < totalPages" @click="changePage('next')">下一页</span>
|
||||
<span v-if="currentPage < totalPages"> . </span>
|
||||
<span v-if="currentPage < totalPages" @click="changePage('last')">尾页</span>
|
||||
</div>
|
||||
<!-- 第二行:页码信息与跳转 -->
|
||||
<div class="pagination-info" style="margin-top: 0px;">
|
||||
<span>第{{ currentPage }}/{{ totalPages }}页</span>
|
||||
<input v-model.number="goPage" type="number" min="1" :max="totalPages" class="page-input"
|
||||
@keyup.enter="changePage('input')" />
|
||||
<button @click="changePage('input')" style="padding: 0px 10px; font-size: 15px; ">跳转</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// 定义Props
|
||||
interface Props {
|
||||
currentPage: number; // 当前页
|
||||
limit: number; // 每页条数
|
||||
total: number; // 总条数
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
currentPage: 1,
|
||||
limit: 10,
|
||||
total: 0,
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
pageChange: [page: number]
|
||||
}>()
|
||||
|
||||
// 响应式存储当前页(不直接修改props)
|
||||
const currentPage = ref(props.currentPage)
|
||||
// 跳转输入框绑定值
|
||||
const goPage = ref(props.currentPage)
|
||||
|
||||
// 计算属性:自动计算总页数(核心修复)
|
||||
const totalPages = computed(() => {
|
||||
const { total, limit } = props
|
||||
if (total <= 0 || limit <= 0) return 1
|
||||
return Math.ceil(total / limit)
|
||||
})
|
||||
|
||||
// 监听父组件传入的页码变化,同步内部值
|
||||
watch(
|
||||
() => props.currentPage,
|
||||
(val) => {
|
||||
currentPage.value = val
|
||||
goPage.value = val
|
||||
}
|
||||
)
|
||||
|
||||
//回到顶部
|
||||
const scrollToTop = () => {
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth' // 平滑动画,去掉就是瞬间置顶
|
||||
})
|
||||
}
|
||||
|
||||
// 分页切换方法
|
||||
const changePage = (type: 'first' | 'prev' | 'next' | 'last' | 'input') => {
|
||||
const pages = totalPages.value
|
||||
|
||||
if (type === 'input') {
|
||||
// 输入跳转:边界校验
|
||||
let page = goPage.value
|
||||
page = Math.max(1, Math.min(page, pages))
|
||||
currentPage.value = page
|
||||
} else {
|
||||
// 按钮跳转
|
||||
switch (type) {
|
||||
case 'first':
|
||||
currentPage.value = 1
|
||||
break
|
||||
case 'prev':
|
||||
currentPage.value = Math.max(1, currentPage.value - 1)
|
||||
break
|
||||
case 'next':
|
||||
currentPage.value = Math.min(pages, currentPage.value + 1)
|
||||
break
|
||||
case 'last':
|
||||
currentPage.value = pages
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 更新输入框显示
|
||||
goPage.value = currentPage.value
|
||||
// 向父组件抛出最新页码
|
||||
emit('pageChange', currentPage.value)
|
||||
scrollToTop();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.pagination {
|
||||
text-align: left;
|
||||
font-size: 18px;
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
.pagination-nav {}
|
||||
|
||||
.pagination-nav span {
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
color: #1e5494;
|
||||
}
|
||||
|
||||
.pagination-nav span.disabled {
|
||||
color: #999;
|
||||
cursor: not-allowed;
|
||||
pointer-events: none;
|
||||
/* 禁用点击 */
|
||||
}
|
||||
|
||||
.pagination-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.page-input {
|
||||
width: 46px;
|
||||
font-size: 14px;
|
||||
padding: 0px 6px;
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.pagination-info button {
|
||||
padding: 4px 10px;
|
||||
cursor: pointer;
|
||||
border: 1px solid #1e5494;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
color: #1e5494;
|
||||
}
|
||||
</style>
|
||||
51
Web/src/components/Business/GameChat.vue
Normal file
51
Web/src/components/Business/GameChat.vue
Normal file
@@ -0,0 +1,51 @@
|
||||
<template>
|
||||
<div class="chat">
|
||||
<div class="item" v-for="(item, index) in data" :key="index">
|
||||
<span>[{{ GetChatType(item.chat.code) }}]</span>
|
||||
<span>
|
||||
<GameUser :data="item.user" :show-icon="1"></GameUser>:
|
||||
<span>
|
||||
{{ item.chat.sign }}
|
||||
</span>
|
||||
<span v-if="showTime == 1">
|
||||
({{ TimeExtend.StrToFormat(item.chat.addTime, "dd日HH:mm") }})
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
const props = defineProps({
|
||||
// 字段名、类型、默认值
|
||||
data: Array<any>,
|
||||
showTime: Number,
|
||||
page: Number,
|
||||
limit: Number
|
||||
})
|
||||
|
||||
const GetChatType = (type: string) => {
|
||||
let result = "";
|
||||
switch (type) {
|
||||
case "Public":
|
||||
result = "公共";
|
||||
break;
|
||||
case "Team":
|
||||
result = "队伍";
|
||||
break;
|
||||
case "Group":
|
||||
result = "帮派";
|
||||
break;
|
||||
case "Region":
|
||||
result = "全区";
|
||||
break;
|
||||
case "Dress":
|
||||
result = "全服";
|
||||
break;
|
||||
case "System":
|
||||
result = "系统";
|
||||
break;
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
</script>
|
||||
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>
|
||||
10
Web/src/components/Business/GameUser.vue
Normal file
10
Web/src/components/Business/GameUser.vue
Normal file
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<Abar href="">{{data.nick}}</Abar>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
const props = defineProps({
|
||||
// 字段名、类型、默认值
|
||||
data: null,
|
||||
showIcon: Number
|
||||
})
|
||||
</script>
|
||||
23
Web/src/components/Page/Footer.vue
Normal file
23
Web/src/components/Page/Footer.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<div class="clear"></div>
|
||||
<div class="foot">
|
||||
<div class="common">
|
||||
<Abar href="/">首页</Abar>-
|
||||
<Abar href="/">挂机</Abar>-
|
||||
<a target="_blank" href="https://work.weixin.qq.com/kfid/kfc86bc348120aea3e7">反馈</a>
|
||||
</div>
|
||||
|
||||
<div class="timeService">
|
||||
小G报时({{ timeTips }})
|
||||
</div>
|
||||
<p style="font-weight:bold;font-size:14px">官方QQ群:931835791</p>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
const timeTips = ref(TimeExtend.Now("HH:mm"));
|
||||
onMounted(() => {
|
||||
setInterval(() => {
|
||||
timeTips.value = TimeExtend.Now("HH:mm");
|
||||
}, 1000)
|
||||
})
|
||||
</script>
|
||||
17
Web/src/components/Page/MapMenu.vue
Normal file
17
Web/src/components/Page/MapMenu.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<div class="common">
|
||||
<Abar href="/">状态</Abar>.
|
||||
<Abar href="/bag">物品</Abar>.
|
||||
<Abar href="/chat">聊天</Abar>
|
||||
</div>
|
||||
<div class="common">
|
||||
<Abar href="/">好友</Abar>.
|
||||
<Abar href="/">宠物</Abar>.
|
||||
<Abar href="/">队伍</Abar>
|
||||
</div>
|
||||
<div class="common">
|
||||
<Abar href="/">商城</Abar>.
|
||||
<Abar href="/">活动</Abar>.
|
||||
<Abar href="/">排行</Abar>
|
||||
</div>
|
||||
</template>
|
||||
@@ -11,7 +11,12 @@ export type HandledRedirectError = {
|
||||
|
||||
export class ApiService {
|
||||
private static initialized = false;
|
||||
private static isRefreshing = false;
|
||||
private static refreshWaiters: Array<(success: boolean) => void> = [];
|
||||
|
||||
private static get userStore() {
|
||||
return useUserStore()
|
||||
}
|
||||
private static request = new RequestExtend({
|
||||
baseURL: BaseConfig.BaseUrl,
|
||||
timeout: 60000
|
||||
@@ -26,13 +31,56 @@ export class ApiService {
|
||||
}
|
||||
|
||||
private static redirectToLogin() {
|
||||
if (typeof localStorage !== "undefined") {
|
||||
localStorage.removeItem("token");
|
||||
localStorage.removeItem("userInfo");
|
||||
window.location.href = "/";
|
||||
}
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
PageExtend.Redirect("/home");
|
||||
private static waitForRefresh(): Promise<boolean> {
|
||||
return new Promise(resolve => {
|
||||
this.refreshWaiters.push(resolve);
|
||||
});
|
||||
}
|
||||
|
||||
private static notifyWaiters(success: boolean): void {
|
||||
this.refreshWaiters.forEach(resolve => resolve(success));
|
||||
this.refreshWaiters = [];
|
||||
}
|
||||
|
||||
// 刷新 token,支持并发排队:多个请求同时 401 时只发一次刷新请求
|
||||
private static async doRefreshToken(): Promise<boolean> {
|
||||
if (this.isRefreshing) {
|
||||
return this.waitForRefresh();
|
||||
}
|
||||
|
||||
this.isRefreshing = true;
|
||||
try {
|
||||
const refToken = this.userStore.getRefToken;
|
||||
const token = this.userStore.getToken
|
||||
if (!refToken) {
|
||||
this.notifyWaiters(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
const result = await this.request.post<IResultData<{ token: string; refToken: string; userId: string }>>(
|
||||
"/Login/RefreshToken",
|
||||
{ refToken, token }
|
||||
);
|
||||
if (result.code === 0 && result.data) {
|
||||
this.userStore.setToken(
|
||||
result.data.userId,
|
||||
result.data.token,
|
||||
result.data.refToken ?? this.userStore.refToken
|
||||
);
|
||||
this.notifyWaiters(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
this.notifyWaiters(false);
|
||||
return false;
|
||||
} catch {
|
||||
this.notifyWaiters(false);
|
||||
return false;
|
||||
} finally {
|
||||
this.isRefreshing = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +91,7 @@ export class ApiService {
|
||||
|
||||
RequestExtend.addRequestInterceptor({
|
||||
onFulfilled: (config) => {
|
||||
const token = typeof localStorage !== "undefined" ? localStorage.getItem("token") : "";
|
||||
const token = this.userStore.token;
|
||||
|
||||
if (token) {
|
||||
config.headers = {
|
||||
@@ -63,19 +111,18 @@ export class ApiService {
|
||||
return response;
|
||||
}
|
||||
const result = response.data;
|
||||
if (result.code === 401) {
|
||||
console.log(result.data);
|
||||
} else if (result.code === 40101) {
|
||||
this.redirectToLogin();
|
||||
if (result.code === 500) {
|
||||
throw {
|
||||
handled: true,
|
||||
redirectTo: "/login/login",
|
||||
message: result.msg || "登录已失效"
|
||||
redirectTo: "/",
|
||||
message: result.msg || "服务器内部错误"
|
||||
} satisfies HandledRedirectError;
|
||||
} else if (result.code === 500) {
|
||||
// 跳转错误页面
|
||||
} else if (result.code === 404) {
|
||||
// 跳转不存在页面
|
||||
throw {
|
||||
handled: true,
|
||||
redirectTo: "/",
|
||||
message: result.msg || "资源不存在"
|
||||
} satisfies HandledRedirectError;
|
||||
}
|
||||
|
||||
return response;
|
||||
@@ -92,26 +139,57 @@ export class ApiService {
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
private static executeRequest<T>(
|
||||
method: HttpMethod,
|
||||
url: string,
|
||||
params: RequestParams
|
||||
): Promise<IResultData<T>> {
|
||||
switch (method) {
|
||||
case "get":
|
||||
return this.request.get<IResultData<T>>(url, { params });
|
||||
case "post":
|
||||
return this.request.post<IResultData<T>>(url, params);
|
||||
case "put":
|
||||
return this.request.put<IResultData<T>>(url, params);
|
||||
case "delete":
|
||||
return this.request.delete<IResultData<T>>(url, { params });
|
||||
case "patch":
|
||||
return this.request.patch<IResultData<T>>(url, params);
|
||||
default:
|
||||
throw new Error(`不支持的请求方法: ${method}`);
|
||||
}
|
||||
}
|
||||
|
||||
private static async requestWithRetry<T>(
|
||||
method: HttpMethod,
|
||||
url: string,
|
||||
params: RequestParams,
|
||||
isRetry: boolean
|
||||
): Promise<IResultData<T>> {
|
||||
const result = await this.executeRequest<T>(method, url, params);
|
||||
|
||||
if (result.code === 401 && !isRetry) {
|
||||
const refreshed = await this.doRefreshToken();
|
||||
if (refreshed) {
|
||||
return this.requestWithRetry<T>(method, url, params, true);
|
||||
}
|
||||
this.redirectToLogin();
|
||||
throw {
|
||||
handled: true,
|
||||
redirectTo: "/",
|
||||
message: "登录已失效,请重新登录"
|
||||
} satisfies HandledRedirectError;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Request<T = any>(
|
||||
method: HttpMethod,
|
||||
url: string,
|
||||
params: RequestParams = {}
|
||||
): Promise<IResultData<T>> {
|
||||
this.ensureInitialized();
|
||||
|
||||
switch (method) {
|
||||
case "get":
|
||||
return await this.request.get<IResultData<T>>(url, { params });
|
||||
case "post":
|
||||
return await this.request.post<IResultData<T>>(url, params);
|
||||
case "put":
|
||||
return await this.request.put<IResultData<T>>(url, params);
|
||||
case "delete":
|
||||
return await this.request.delete<IResultData<T>>(url, { params });
|
||||
case "patch":
|
||||
return await this.request.patch<IResultData<T>>(url, params);
|
||||
default:
|
||||
throw new Error(`不支持的请求方法: ${method}`);
|
||||
}
|
||||
return this.requestWithRetry<T>(method, url, params, false);
|
||||
}
|
||||
}
|
||||
|
||||
38
Web/src/composables/StateHelper.ts
Normal file
38
Web/src/composables/StateHelper.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
export class StateHelper {
|
||||
|
||||
private static get userStore() {
|
||||
return useUserStore()
|
||||
}
|
||||
static get Sid() {
|
||||
const userStoret = useUserStore();
|
||||
return userStoret.sid;
|
||||
}
|
||||
static get Token() {
|
||||
return this.userStore.token;
|
||||
}
|
||||
static get refToken() {
|
||||
return this.userStore.refToken;
|
||||
}
|
||||
static get userId() {
|
||||
return this.userStore.userId;
|
||||
}
|
||||
static SetToken(userId: string, token: string, refToken: string) {
|
||||
this.userStore.setToken(userId, token, refToken);
|
||||
}
|
||||
|
||||
static SetSid(sid: string) {
|
||||
this.userStore.setSid(sid);
|
||||
}
|
||||
|
||||
static OffOnline() {
|
||||
this.userStore.offOnline();
|
||||
}
|
||||
static get IsAccLogin() {
|
||||
return this.userStore.isLoginAccount;
|
||||
}
|
||||
|
||||
static get IsLogin() {
|
||||
return this.userStore.isLogin;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,5 +15,7 @@ export const layout = {
|
||||
empty: 'empty'
|
||||
} as const
|
||||
|
||||
// 类型定义
|
||||
export type LayoutValue = typeof layout.default | typeof layout.empty
|
||||
// 定义布局常量
|
||||
export const middleware = {
|
||||
loading: 'page-loading'
|
||||
} as const
|
||||
14
Web/src/composables/usePageLoading.ts
Normal file
14
Web/src/composables/usePageLoading.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export class PageLoading{
|
||||
|
||||
private static get PageLoading() {
|
||||
return useAppStore()
|
||||
}
|
||||
public static Loading(): void {
|
||||
this.PageLoading.startLoading("加载中...");
|
||||
}
|
||||
public static Close(): void {
|
||||
|
||||
this.PageLoading.endLoading();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,23 +3,47 @@
|
||||
*/
|
||||
export class MessageExtend {
|
||||
// 消息通知
|
||||
static Notify(type: 'primary' | 'success' | 'danger' | 'warning', message: any) {
|
||||
showNotify({ type, message })
|
||||
static Notify(message: any, type?: 'primary' | 'success' | 'danger' | 'warning') {
|
||||
showNotify({
|
||||
type: type,
|
||||
message: message,
|
||||
duration: 1500,
|
||||
});
|
||||
}
|
||||
|
||||
static LoadingToast(message?: string) {
|
||||
showLoadingToast({
|
||||
message: message || '加载中',
|
||||
forbidClick: true,
|
||||
loadingType: 'spinner',
|
||||
duration: 0
|
||||
});
|
||||
}
|
||||
|
||||
static LoadingClose() {
|
||||
closeToast();
|
||||
}
|
||||
|
||||
// 提示弹窗
|
||||
static Dialog(
|
||||
title: string,
|
||||
message: string,
|
||||
theme: 'round-button' | 'default',
|
||||
onConfirm?: () => void,
|
||||
onCancel?: () => void,
|
||||
confirmButtonText: string = '确认',
|
||||
) {
|
||||
static ShowDialog(title: string, message: string) {
|
||||
showDialog({ title: title, message: message })
|
||||
}
|
||||
|
||||
static ShowDialogEvent(title: string, message: string, onConfirm?: () => void, confirmButtonText?: string) {
|
||||
showDialog({
|
||||
title: title,
|
||||
message: message,
|
||||
confirmButtonText: confirmButtonText || '确认'
|
||||
}).then(() => {
|
||||
onConfirm?.()
|
||||
});
|
||||
}
|
||||
|
||||
// 确认提示弹窗
|
||||
static ShowConfirmDialog(title: string, message: string, onConfirm?: () => void, onCancel?: () => void, confirmButtonText?: string) {
|
||||
showConfirmDialog({
|
||||
title: title,
|
||||
message: message,
|
||||
theme: theme || 'default',
|
||||
confirmButtonText: confirmButtonText || '确认',
|
||||
})
|
||||
.then(() => {
|
||||
@@ -30,8 +54,32 @@ export class MessageExtend {
|
||||
})
|
||||
}
|
||||
|
||||
// 异步提示弹窗
|
||||
static ShowConfirmDialogAsyc(title: string, message: string, onConfirm?: () => Promise<boolean>): Promise<boolean> {
|
||||
return new Promise((resolve) => {
|
||||
showConfirmDialog({
|
||||
title,
|
||||
message,
|
||||
beforeClose: async (action) => {
|
||||
if (action === 'confirm' && onConfirm) {
|
||||
const result = await onConfirm()
|
||||
if (result) {
|
||||
resolve(true)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
resolve(action === 'confirm')
|
||||
return true
|
||||
},
|
||||
}).catch(() => {
|
||||
resolve(false) // 捕获取消操作,返回 false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 成功失败默认提示
|
||||
static ShowToast(type: 'success' | 'fail' | 'default', text: any) {
|
||||
static ShowToast(text: any, type?: 'success' | 'fail' | 'default') {
|
||||
if (type == 'success') {
|
||||
showSuccessToast(text)
|
||||
} else if (type == 'fail') {
|
||||
@@ -50,7 +98,7 @@ export class MessageExtend {
|
||||
}
|
||||
|
||||
// 多条消息通知(堆叠展示)
|
||||
static NotifyList(type: 'primary' | 'success' | 'danger' | 'warning', messages: string[], duration: number = 3000) {
|
||||
static NotifyList(messages: string[], type: 'primary' | 'success' | 'danger' | 'warning', duration: number = 3000) {
|
||||
if (typeof window === 'undefined') return
|
||||
if (!messages || messages.length === 0) return
|
||||
|
||||
|
||||
@@ -8,4 +8,11 @@ export class PageExtend {
|
||||
const value = route.query[params]
|
||||
return value ? String(value) : ''
|
||||
}
|
||||
|
||||
// 回到顶部函数 默认平滑滚动到顶部
|
||||
public static ScrollToTop(behavior: ScrollBehavior = 'smooth') {
|
||||
if (typeof window !== 'undefined') {
|
||||
window.scrollTo({ top: 0, behavior })
|
||||
}
|
||||
}
|
||||
}
|
||||
99
Web/src/extends/TimeExtend.ts
Normal file
99
Web/src/extends/TimeExtend.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
export class TimeExtend {
|
||||
/**
|
||||
* 格式化日期
|
||||
* @param date 日期对象/时间戳/日期字符串
|
||||
* @param format 格式化模板
|
||||
* 示例:yyyy-MM-dd、yyyy-MM-dd HH:mm:ss、HH:mm:ss、yyyy年MM月dd日
|
||||
*/
|
||||
public static Format(date: Date | string | number, format = 'yyyy-MM-dd HH:mm:ss'): string {
|
||||
let targetDate: Date
|
||||
if (typeof date === 'number') {
|
||||
targetDate = date.toString().length === 10 ? new Date(date * 1000) : new Date(date)
|
||||
} else {
|
||||
targetDate = new Date(date)
|
||||
}
|
||||
|
||||
if (isNaN(targetDate.getTime())) return ''
|
||||
|
||||
const year = targetDate.getFullYear()
|
||||
const month = targetDate.getMonth() + 1
|
||||
const day = targetDate.getDate()
|
||||
const hours = targetDate.getHours()
|
||||
const minutes = targetDate.getMinutes()
|
||||
const seconds = targetDate.getSeconds()
|
||||
|
||||
const pad = (num: number) => num.toString().padStart(2, '0')
|
||||
|
||||
return format
|
||||
.replace('yyyy', String(year))
|
||||
.replace('MM', pad(month))
|
||||
.replace('dd', pad(day))
|
||||
.replace('HH', pad(hours))
|
||||
.replace('hh', pad(hours > 12 ? hours - 12 : hours))
|
||||
.replace('mm', pad(minutes))
|
||||
.replace('ss', pad(seconds))
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间格式化字符串
|
||||
* @param format 格式
|
||||
*/
|
||||
public static Now(format = 'yyyy-MM-dd HH:mm:ss'): string {
|
||||
return this.Format(new Date(), format)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前毫秒时间戳
|
||||
*/
|
||||
public static GetTimeStamp(): number {
|
||||
return Date.now()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前秒级时间戳
|
||||
*/
|
||||
public static GetSecondStamp(): number {
|
||||
return Math.floor(Date.now() / 1000)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前日期 yyyy-MM-dd
|
||||
*/
|
||||
public static GetDateStr(): string {
|
||||
return this.Now('yyyy-MM-dd')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时分秒 HH:mm:ss
|
||||
*/
|
||||
public static GetTimeStr(): string {
|
||||
return this.Now('HH:mm:ss')
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间字符串 转换为 指定格式字符串
|
||||
* 场景:把 "2025-01-01 12:30:45" 转成 "2025年01月01日" / "01-01 12:30" 等
|
||||
* @param timeStr 时间字符串(如 2025-01-01、2025/01/01 12:30、2025-01-01 12:30:45)
|
||||
* @param format 目标格式
|
||||
*/
|
||||
public static StrToFormat(timeStr: string, format = 'yyyy-MM-dd HH:mm:ss'): string {
|
||||
return this.Format(timeStr, format);
|
||||
}
|
||||
/**
|
||||
* 时间字符串 转 日期对象
|
||||
* @param timeStr 时间字符串
|
||||
*/
|
||||
public static StrToDate(timeStr: string): Date | null {
|
||||
const date = new Date(timeStr);
|
||||
return isNaN(date.getTime()) ? null : date;
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间字符串 转 秒级时间戳
|
||||
* @param timeStr 时间字符串
|
||||
*/
|
||||
public static StrToSecondStamp(timeStr: string): number | null {
|
||||
const date = this.StrToDate(timeStr);
|
||||
return date ? Math.floor(date.getTime() / 1000) : null;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,22 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<slot />
|
||||
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="content ">
|
||||
<button class="btn btn-ret" @click="GoBack">返回</button><br />
|
||||
<Abar href="/map">返回游戏</Abar>
|
||||
</div>
|
||||
<Footer></Footer>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const router = useRouter()
|
||||
//返回
|
||||
const GoBack = (): void => {
|
||||
router.back();
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
<style scoped></style>
|
||||
3
Web/src/middleware/page-loading.ts
Normal file
3
Web/src/middleware/page-loading.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default defineNuxtRouteMiddleware(() => {
|
||||
PageLoading.Loading()
|
||||
})
|
||||
64
Web/src/pages/area/my.vue
Normal file
64
Web/src/pages/area/my.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
|
||||
<div class="common">
|
||||
<div class="title">
|
||||
=====☆我的区服☆=====
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="item" v-for="(item, index) in userData" :key="index">
|
||||
✧<Abutton @click="loginGame(item.userId)" >【{{ item.areaId }}区】{{ item.nick }}({{ (item.sex == null || item.sex == '') ?
|
||||
"未知" : item.sex }})</Abutton>
|
||||
</div>
|
||||
<span v-if="userData.length == 0">暂无角色.</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Abar href="/">返回游戏首页</Abar>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
definePageMeta({
|
||||
layout: layout.empty,
|
||||
middleware: 'page-loading'
|
||||
})
|
||||
let userData = ref<Array<any>>([]);
|
||||
|
||||
const BindData = async (): Promise<void> => {
|
||||
var result = await PubService.GetMyGame(StateHelper.Sid);
|
||||
if (result.code == 0) {
|
||||
userData.value = result.data;
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialogEvent("提示", result.msg, () => {
|
||||
PageExtend.Redirect("/");
|
||||
}, "我知道了");
|
||||
}
|
||||
};
|
||||
|
||||
const loginGame = async (gameId: string): Promise<void> => {
|
||||
let result = await LoginService.LoginGame(StateHelper.Sid, gameId);
|
||||
if (result.code == 0) {
|
||||
StateHelper.SetToken(result.data.userId, result.data.token, result.data.refToken);
|
||||
if (result.data.regOk == 0) {
|
||||
PageExtend.Redirect("/login/register");
|
||||
}
|
||||
else {
|
||||
PageExtend.Redirect("/map");
|
||||
}
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialog("登录游戏", result.msg);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await BindData();
|
||||
}
|
||||
finally {
|
||||
PageLoading.Close();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user