From e396e6695956603d374ee92c17ef4c928f2d6b71 Mon Sep 17 00:00:00 2001 From: Seany <17074267@qq.com> Date: Wed, 24 Dec 2025 12:15:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=9C=B0=E5=8C=BA=E5=AE=9E?= =?UTF-8?q?=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/Settings/CountryEdit.razor | 134 ++++++++- .../Pages/Settings/CountryList.razor | 264 ++++++++++++++++- .../Pages/Settings/StateProvinceEdit.razor | 137 +++++++++ .../Pages/Settings/StateProvinceList.razor | 267 ++++++++++++++++++ .../Extensions/DbMigrateExtension.cs | 177 +++++++++++- Atomx.Common/Configuration/GeneralConfig.cs | 17 +- Atomx.Common/Entities/Area.cs | 29 +- Atomx.Common/Entities/Channel.cs | 2 +- Atomx.Common/Entities/Country.cs | 64 +++++ .../Entities/CurrencyChannelRelation.cs | 2 +- Atomx.Common/Entities/LocalizedProperty.cs | 2 +- Atomx.Common/Entities/Post.cs | 8 + Atomx.Common/Entities/StateProvince.cs | 53 ++++ Atomx.Data/DataContext.cs | 22 +- ...gner.cs => 20251224030208_0.1.Designer.cs} | 97 ++++++- ...223083953_0.1.cs => 20251224030208_0.1.cs} | 54 +++- .../Migrations/DataContextModelSnapshot.cs | 95 ++++++- 17 files changed, 1349 insertions(+), 75 deletions(-) create mode 100644 Atomx.Admin/Atomx.Admin.Client/Pages/Settings/StateProvinceEdit.razor create mode 100644 Atomx.Admin/Atomx.Admin.Client/Pages/Settings/StateProvinceList.razor create mode 100644 Atomx.Common/Entities/Country.cs create mode 100644 Atomx.Common/Entities/StateProvince.cs rename Atomx.Data/Migrations/{20251223083953_0.1.Designer.cs => 20251224030208_0.1.Designer.cs} (95%) rename Atomx.Data/Migrations/{20251223083953_0.1.cs => 20251224030208_0.1.cs} (95%) diff --git a/Atomx.Admin/Atomx.Admin.Client/Pages/Settings/CountryEdit.razor b/Atomx.Admin/Atomx.Admin.Client/Pages/Settings/CountryEdit.razor index 4668b07..0582bd9 100644 --- a/Atomx.Admin/Atomx.Admin.Client/Pages/Settings/CountryEdit.razor +++ b/Atomx.Admin/Atomx.Admin.Client/Pages/Settings/CountryEdit.razor @@ -1,5 +1,137 @@ -

CountryEdit

+@page "/country/create" +@page "/country/edit/{id:long}" +@page "/{locale}/country/create" +@page "/{locale}/country/edit/{id:long}" +@inject ILogger Logger +@attribute [Authorize] + + + + + 管理后台 + 系统配置 + 国家管理 + + + + + + +
+ + + + + + + + + + + + + @foreach (var item in LanguageCultures) + { + + } + + + + + + + + + + + 启用 + + + + +
+
+
+
+
@code { + [Parameter] + public string Locale { get; set; } = string.Empty; + + [Parameter] + public long Id { get; set; } + + [SupplyParameterFromForm] + CurrencyModel model { get; set; } = new(); + Form editform = null!; + Dictionary LanguageCultures = LanguageCulture.Descriptions.ToDictionary(); + bool pageLoading = false; + bool saving = false; + + protected override void OnInitialized() + { + base.OnInitialized(); + } + + protected override void OnParametersSet() + { + if (Id > 0) + { + LoadData(); + } + base.OnParametersSet(); + } + + async void LoadData() + { + pageLoading = true; + var url = $"/api/currency/{Id}"; + var apiResult = await HttpService.Get>(url); + if (apiResult.Success) + { + if (apiResult.Data == null) + { + Navigation.NavigateTo($"/currency/create"); + } + else + { + model = apiResult.Data.Adapt(); + } + } + else + { + Navigation.NavigateTo($"/currency/create"); + } + + pageLoading = false; + StateHasChanged(); + } + + async void OnFormFinishAsync() + { + if (editform.Validate()) + { + saving = true; + var url = $"api/currency/save"; + var result = new ApiResult(); + result = await HttpService.Post>(url, model); + + + if (result.Code == (int)ResultCode.Success) + { + saving = false; + await ModalService.InfoAsync(new ConfirmOptions() { Title = "提示", Content = "数据提交成功!" }); + Navigation.NavigateTo($"/currency/list"); + } + else + { + saving = false; + await ModalService.ErrorAsync(new ConfirmOptions() { Title = "服务异常", Content = result.Message }); + } + } + } } diff --git a/Atomx.Admin/Atomx.Admin.Client/Pages/Settings/CountryList.razor b/Atomx.Admin/Atomx.Admin.Client/Pages/Settings/CountryList.razor index abc05a2..0fca3ce 100644 --- a/Atomx.Admin/Atomx.Admin.Client/Pages/Settings/CountryList.razor +++ b/Atomx.Admin/Atomx.Admin.Client/Pages/Settings/CountryList.razor @@ -1,4 +1,266 @@ -

CountryList

+@page "/country/list" +@page "/{locale}/country/list" +@inject ILogger Logger +@attribute [Authorize] + + + + + + + Home + 系统配置 + 货币管理 + + + + + +
+ + + + + + + @if (searchExpand) + { + + + + + + + + + + + + + + + + + + } + + + + +
+
+ + +
+ +
+
+ + + + + + + + @if (context.PrimaryCurrency) + { + + } + else + { + + } + + + @if (context.Enabled) + { + 已激活 + } + else + { + 未激活 + } + + + + + + 编辑 + + @* + + 删除 + + *@ + + +
+
+ + @if (PagingList.Count > 0) + { + + } + +
+
+
+
+
+ +@code { + [Parameter] + public string Locale { get; set; } = string.Empty; + + [SupplyParameterFromQuery] + int? Page { get; set; } + + [SupplyParameterFromQuery(Name = "size")] + int? PageSize { get; set; } + + bool pageLoading = false; + bool searchExpand = false; + + Form searchForm = new(); + CurrencySearchModel search = new(); + + PagingList PagingList = new() { Size = 20 }; + + + protected override async Task OnInitializedAsync() + { + await base.OnInitializedAsync(); + } + + protected override async Task OnParametersSetAsync() + { + loadQueryString(); + await LoadListAsync(); + await base.OnParametersSetAsync(); + } + + void loadQueryString() + { + var uri = new Uri(Navigation.Uri); + var query = uri.Query; + search.Name = query.GetQueryString("Name"); + search.Status = query.GetQueryString("Status"); + + var data = query.GetQueryString("RangeTime"); + if (!string.IsNullOrEmpty(data)) + { + var rangetime = data.Split("-"); + if (rangetime != null && rangetime.Length > 0) + { + searchExpand = true; + search.RangeTime[0] = rangetime[0].NumberToDateTime(); + search.RangeTime[1] = rangetime[1].NumberToDateTime(); + StateHasChanged(); + } + } + + } + + async Task LoadListAsync() + { + try + { + pageLoading = true; + var url = "/api/currency/search"; + var apiResult = await HttpService.GetPagingList(url, search, Page.GetValueOrDefault(1), PageSize.GetValueOrDefault(20)); + if (apiResult.Success) + { + if (apiResult.Data != null) + { + PagingList = apiResult.Data; + } + } + else if (apiResult.Code == 403) + { + ModalService.Error(new ConfirmOptions() { Title = "权限不足", Content = apiResult.Message }); + } + + StateHasChanged(); + } + finally + { + pageLoading = false; + } + } + + void OnSearchReset() + { + search = new CurrencySearchModel(); + searchForm?.Reset(); + } + + private void OnSearch(int page) + { + var queryString = search.BuildQueryString(); + if (string.IsNullOrEmpty(queryString)) + { + if (page > 1) + { + Navigation.NavigateTo($"/currency/list?page={page}"); + } + else + { + Navigation.NavigateTo($"/currency/list"); + } + } + else + { + if (page > 1) + { + Navigation.NavigateTo($"/currency/list?page={page}&{queryString}"); + } + else + { + Navigation.NavigateTo($"/currency/list?{queryString}"); + } + } + } + + void OnSearchFinish() + { + Page = Page.GetValueOrDefault(1) - 1; + + OnSearch(Page.Value); + } + + private void OnPageChanged(PaginationEventArgs args) + { + OnSearch(args.Page); + } + + void HandleAddNew() + { + Navigation.NavigateTo($"/currency/create"); + } + + + void HandleEdit(CurrencyModel model) + { + Navigation.NavigateTo($"/currency/edit/{model.Id}"); + } + +} @code { diff --git a/Atomx.Admin/Atomx.Admin.Client/Pages/Settings/StateProvinceEdit.razor b/Atomx.Admin/Atomx.Admin.Client/Pages/Settings/StateProvinceEdit.razor new file mode 100644 index 0000000..4521971 --- /dev/null +++ b/Atomx.Admin/Atomx.Admin.Client/Pages/Settings/StateProvinceEdit.razor @@ -0,0 +1,137 @@ +@page "/stateprovince/create" +@page "/stateprovince/edit/{id:long}" +@page "/{locale}/stateprovince/create" +@page "/{locale}/stateprovince/edit/{id:long}" + +@inject ILogger Logger +@attribute [Authorize] + + + + + 管理后台 + 系统配置 + 国家管理 + + + + + + +
+ + + + + + + + + + + + + @foreach (var item in LanguageCultures) + { + + } + + + + + + + + + + + 启用 + + + + +
+
+
+
+
+@code { + [Parameter] + public string Locale { get; set; } = string.Empty; + + [Parameter] + public long Id { get; set; } + + [SupplyParameterFromForm] + CurrencyModel model { get; set; } = new(); + Form editform = null!; + Dictionary LanguageCultures = LanguageCulture.Descriptions.ToDictionary(); + bool pageLoading = false; + bool saving = false; + + protected override void OnInitialized() + { + base.OnInitialized(); + } + + protected override void OnParametersSet() + { + if (Id > 0) + { + LoadData(); + } + base.OnParametersSet(); + } + + async void LoadData() + { + pageLoading = true; + var url = $"/api/currency/{Id}"; + var apiResult = await HttpService.Get>(url); + if (apiResult.Success) + { + if (apiResult.Data == null) + { + Navigation.NavigateTo($"/currency/create"); + } + else + { + model = apiResult.Data.Adapt(); + } + } + else + { + Navigation.NavigateTo($"/currency/create"); + } + + pageLoading = false; + StateHasChanged(); + } + + async void OnFormFinishAsync() + { + if (editform.Validate()) + { + saving = true; + var url = $"api/currency/save"; + var result = new ApiResult(); + result = await HttpService.Post>(url, model); + + + if (result.Code == (int)ResultCode.Success) + { + saving = false; + await ModalService.InfoAsync(new ConfirmOptions() { Title = "提示", Content = "数据提交成功!" }); + Navigation.NavigateTo($"/currency/list"); + } + else + { + saving = false; + await ModalService.ErrorAsync(new ConfirmOptions() { Title = "服务异常", Content = result.Message }); + } + } + } + +} diff --git a/Atomx.Admin/Atomx.Admin.Client/Pages/Settings/StateProvinceList.razor b/Atomx.Admin/Atomx.Admin.Client/Pages/Settings/StateProvinceList.razor new file mode 100644 index 0000000..ccbac73 --- /dev/null +++ b/Atomx.Admin/Atomx.Admin.Client/Pages/Settings/StateProvinceList.razor @@ -0,0 +1,267 @@ +@page "/stateprovince/list" +@page "/{locale}/stateprovince/list" +@inject ILogger Logger +@attribute [Authorize] + + + + + + + Home + 系统配置 + 州省管理 + + + + + +
+ + + + + + + @if (searchExpand) + { + + + + + + + + + + + + + + + + + + } + + + + +
+
+ + +
+ +
+
+ + + + + + + + @if (context.PrimaryCurrency) + { + + } + else + { + + } + + + @if (context.Enabled) + { + 已激活 + } + else + { + 未激活 + } + + + + + + 编辑 + + @* + + 删除 + + *@ + + +
+
+ + @if (PagingList.Count > 0) + { + + } + +
+
+
+
+
+ +@code { + [Parameter] + public string Locale { get; set; } = string.Empty; + + [SupplyParameterFromQuery] + int? Page { get; set; } + + [SupplyParameterFromQuery(Name = "size")] + int? PageSize { get; set; } + + bool pageLoading = false; + bool searchExpand = false; + + Form searchForm = new(); + CurrencySearchModel search = new(); + + PagingList PagingList = new() { Size = 20 }; + + + protected override async Task OnInitializedAsync() + { + await base.OnInitializedAsync(); + } + + protected override async Task OnParametersSetAsync() + { + loadQueryString(); + await LoadListAsync(); + await base.OnParametersSetAsync(); + } + + void loadQueryString() + { + var uri = new Uri(Navigation.Uri); + var query = uri.Query; + search.Name = query.GetQueryString("Name"); + search.Status = query.GetQueryString("Status"); + + var data = query.GetQueryString("RangeTime"); + if (!string.IsNullOrEmpty(data)) + { + var rangetime = data.Split("-"); + if (rangetime != null && rangetime.Length > 0) + { + searchExpand = true; + search.RangeTime[0] = rangetime[0].NumberToDateTime(); + search.RangeTime[1] = rangetime[1].NumberToDateTime(); + StateHasChanged(); + } + } + + } + + async Task LoadListAsync() + { + try + { + pageLoading = true; + var url = "/api/currency/search"; + var apiResult = await HttpService.GetPagingList(url, search, Page.GetValueOrDefault(1), PageSize.GetValueOrDefault(20)); + if (apiResult.Success) + { + if (apiResult.Data != null) + { + PagingList = apiResult.Data; + } + } + else if (apiResult.Code == 403) + { + ModalService.Error(new ConfirmOptions() { Title = "权限不足", Content = apiResult.Message }); + } + + StateHasChanged(); + } + finally + { + pageLoading = false; + } + } + + void OnSearchReset() + { + search = new CurrencySearchModel(); + searchForm?.Reset(); + } + + private void OnSearch(int page) + { + var queryString = search.BuildQueryString(); + if (string.IsNullOrEmpty(queryString)) + { + if (page > 1) + { + Navigation.NavigateTo($"/currency/list?page={page}"); + } + else + { + Navigation.NavigateTo($"/currency/list"); + } + } + else + { + if (page > 1) + { + Navigation.NavigateTo($"/currency/list?page={page}&{queryString}"); + } + else + { + Navigation.NavigateTo($"/currency/list?{queryString}"); + } + } + } + + void OnSearchFinish() + { + Page = Page.GetValueOrDefault(1) - 1; + + OnSearch(Page.Value); + } + + private void OnPageChanged(PaginationEventArgs args) + { + OnSearch(args.Page); + } + + void HandleAddNew() + { + Navigation.NavigateTo($"/currency/create"); + } + + + void HandleEdit(CurrencyModel model) + { + Navigation.NavigateTo($"/currency/edit/{model.Id}"); + } + +} + +@code { + +} diff --git a/Atomx.Admin/Atomx.Admin/Extensions/DbMigrateExtension.cs b/Atomx.Admin/Atomx.Admin/Extensions/DbMigrateExtension.cs index c7d18b4..b06d11b 100644 --- a/Atomx.Admin/Atomx.Admin/Extensions/DbMigrateExtension.cs +++ b/Atomx.Admin/Atomx.Admin/Extensions/DbMigrateExtension.cs @@ -56,15 +56,174 @@ namespace Atomx.Admin.Extensions if (!db.Languages.Any()) { - Language language = new Language(); - language.Culture = "zh-cn"; - language.CreateTime = DateTime.UtcNow; - language.UpdateTime = DateTime.UtcNow; - language.Name = "中文"; - language.DisplayOrder = 0; - language.Enabled = true; - language.Title = "中文"; - db.Languages.Add(language); + db.Languages.Add(new() + { + Culture = "en-US", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "English", + DisplayOrder = 0, + Enabled = true, + Title = "英语" + }); + + db.Languages.Add(new() + { + Culture = "zh-CN", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "简体中文", + DisplayOrder = 0, + Enabled = true, + Title = "简体中文" + }); + + db.Languages.Add(new() + { + Culture = "zh-TW", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "繁体中文", + DisplayOrder = 0, + Enabled = true, + Title = "繁体中文" + }); + + db.Languages.Add(new() + { + Culture = "ja-JP", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "日本語", + DisplayOrder = 0, + Enabled = true, + Title = "日语" + }); + db.Languages.Add(new() + { + Culture = "ko-KR", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "한국어", + DisplayOrder = 0, + Enabled = true, + Title = "朝鲜语/韩语" + }); + db.Languages.Add(new() + { + Culture = "ms-MY", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "Bahasa Melayu", + DisplayOrder = 0, + Enabled = true, + Title = "马来语" + }); + db.Languages.Add(new() + { + Culture = "es-ES", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "Español", + DisplayOrder = 0, + Enabled = true, + Title = "西班牙语" + }); + db.Languages.Add(new() + { + Culture = "pt-PT", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "Português", + DisplayOrder = 0, + Enabled = true, + Title = "葡萄牙语" + }); + db.Languages.Add(new() + { + Culture = "fr-FR", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "Français", + DisplayOrder = 0, + Enabled = true, + Title = "法语" + }); + db.Languages.Add(new() + { + Culture = "ar-SA", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "العربية", + DisplayOrder = 0, + Enabled = true, + Title = "阿拉伯语" + }); + db.Languages.Add(new() + { + Culture = "hi-IN", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "हिन्दी", + DisplayOrder = 0, + Enabled = true, + Title = "印度语 (印地语)" + }); + db.Languages.Add(new() + { + Culture = "id-ID", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "Bahasa Indonesia", + DisplayOrder = 0, + Enabled = true, + Title = "印尼语" + }); + db.Languages.Add(new() + { + Culture = "vi-VN", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "Tiếng Việt", + DisplayOrder = 0, + Enabled = true, + Title = "越南语" + }); + db.Languages.Add(new() + { + Culture = "ru-RU", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "Русский", + DisplayOrder = 0, + Enabled = true, + Title = "俄语" + }); + db.Languages.Add(new() + { + Culture = "de-DE", + CreateTime = DateTime.UtcNow, + UpdateTime = DateTime.UtcNow, + Name = "Deutsch", + DisplayOrder = 0, + Enabled = true, + Title = "德语" + }); + } + if (!db.Currencies.Any()) + { + db.Currencies.Add(new Currency() { Name = "美元", CreateTime = DateTime.UtcNow, CurrencyCode = "USD", CustomFormatting = string.Empty, DisplayLocale = string.Empty, DisplayOrder = 0, Enabled = true, EnableDisplay = false, EnablePay = false, Rate = 1, SiteId = 0, Symbolic = "$‌", Title = "美元" }); + db.Currencies.Add(new Currency() { Name = "人民币", CreateTime = DateTime.UtcNow, CurrencyCode = "CNY", CustomFormatting = string.Empty, DisplayLocale = string.Empty, DisplayOrder = 1, Enabled = true, EnableDisplay = false, EnablePay = false, Rate = 6.43M, SiteId = 0, Symbolic = "¥‌", Title = "人民币" }); + db.Currencies.Add(new Currency() { Name = "欧元", CreateTime = DateTime.UtcNow, CurrencyCode = "EUR", CustomFormatting = string.Empty, DisplayLocale = string.Empty, DisplayOrder = 2, Enabled = true, EnableDisplay = false, EnablePay = false, Rate = 0.86M, SiteId = 0, Symbolic = "€", Title = "欧元" }); + db.Currencies.Add(new Currency() { Name = "英镑", CreateTime = DateTime.UtcNow, CurrencyCode = "GBP", CustomFormatting = string.Empty, DisplayLocale = string.Empty, DisplayOrder = 3, Enabled = true, EnableDisplay = false, EnablePay = false, Rate = 0.75M, SiteId = 0, Symbolic = "£‌", Title = "英镑" }); + db.Currencies.Add(new Currency() { Name = "澳元", CreateTime = DateTime.UtcNow, CurrencyCode = "AUD", CustomFormatting = string.Empty, DisplayLocale = string.Empty, DisplayOrder = 4, Enabled = true, EnableDisplay = false, EnablePay = false, Rate = 1.34M, SiteId = 0, Symbolic = "A$‌", Title = "澳元" }); + db.Currencies.Add(new Currency() { Name = "加拿大元", CreateTime = DateTime.UtcNow, CurrencyCode = "CAD", CustomFormatting = string.Empty, DisplayLocale = string.Empty, DisplayOrder = 5, Enabled = true, EnableDisplay = false, EnablePay = false, Rate = 1.32M, SiteId = 0, Symbolic = "C$‌", Title = "加拿大元" }); + db.Currencies.Add(new Currency() { Name = "港币", CreateTime = DateTime.UtcNow, CurrencyCode = "HKD", CustomFormatting = string.Empty, DisplayLocale = string.Empty, DisplayOrder = 6, Enabled = true, EnableDisplay = false, EnablePay = false, Rate = 7.84M, SiteId = 0, Symbolic = "HK$", Title = "港币" }); + db.Currencies.Add(new Currency() { Name = "日元", CreateTime = DateTime.UtcNow, CurrencyCode = "JPY", CustomFormatting = string.Empty, DisplayLocale = string.Empty, DisplayOrder = 7, Enabled = true, EnableDisplay = false, EnablePay = false, Rate = 110.45M, SiteId = 0, Symbolic = "¥‌", Title = "日元" }); + db.Currencies.Add(new Currency() { Name = "俄罗斯卢布", CreateTime = DateTime.UtcNow, CurrencyCode = "RUB", CustomFormatting = string.Empty, DisplayLocale = string.Empty, DisplayOrder = 8, Enabled = true, EnableDisplay = false, EnablePay = false, Rate = 63.25M, SiteId = 0, Symbolic = "₽‌", Title = "俄罗斯卢布" }); + db.Currencies.Add(new Currency() { Name = "瑞典克朗", CreateTime = DateTime.UtcNow, CurrencyCode = "SEK", CustomFormatting = string.Empty, DisplayLocale = string.Empty, DisplayOrder = 9, Enabled = true, EnableDisplay = false, EnablePay = false, Rate = 8.8M, SiteId = 0, Symbolic = "kr‌", Title = "瑞典克朗" }); + db.Currencies.Add(new Currency() { Name = "印度卢比", CreateTime = DateTime.UtcNow, CurrencyCode = "INR", CustomFormatting = string.Empty, DisplayLocale = string.Empty, DisplayOrder = 10, Enabled = true, EnableDisplay = false, EnablePay = false, Rate = 68.03M, SiteId = 0, Symbolic = "₹‌", Title = "印度卢比" }); + } if (!db.Permissions.Any()) diff --git a/Atomx.Common/Configuration/GeneralConfig.cs b/Atomx.Common/Configuration/GeneralConfig.cs index b99d6ad..8f93173 100644 --- a/Atomx.Common/Configuration/GeneralConfig.cs +++ b/Atomx.Common/Configuration/GeneralConfig.cs @@ -51,10 +51,23 @@ public int LoginErrorLockDuration { get; set; } = 30; /// - /// 是否多个法定货币钱包 + /// facebook页面地址 /// - public bool MultipleLegalTenderWallets { get; set; } = false; + public string FacebookUrl { get; set; } = string.Empty; + /// + /// 推特页面地址 + /// + public string TwitterUrl { get; set; } = string.Empty; + /// + /// YouTube页面地址 + /// + public string YouTubeUrl { get; set; } = string.Empty; + + /// + /// Instagram页面地址 + /// + public string InstagramUrl { get; set; } = string.Empty; } } diff --git a/Atomx.Common/Entities/Area.cs b/Atomx.Common/Entities/Area.cs index 9879c46..3a87fcc 100644 --- a/Atomx.Common/Entities/Area.cs +++ b/Atomx.Common/Entities/Area.cs @@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema; namespace Atomx.Common.Entities { /// - /// 地区(国家、省、市、区) + /// 地区(市、区) /// [Table("Areas")] public class Area @@ -16,6 +16,16 @@ namespace Atomx.Common.Entities [Key] public long Id { get; set; } + /// + /// 国家ID + /// + public long CountryId { get; set; } + + /// + /// 州省ID + /// + public long StateProvinceId { get; set; } + /// /// 上级ID /// @@ -34,23 +44,6 @@ namespace Atomx.Common.Entities [Column(TypeName = "varchar(1)")] public string Initial { get; set; } = string.Empty; - /// - /// 双字母代码 - /// - [Column(TypeName = "varchar(2)")] - public string TwoLetterISOCode { get; set; } = string.Empty; - - /// - /// 三字母代码 - /// - [Column(TypeName = "varchar(3)")] - public string ThreeLetterISOCode { get; set; } = string.Empty; - - /// - /// 数字代码 - /// - public int NumericISOCode { get; set; } - /// /// 是否允许配送 /// diff --git a/Atomx.Common/Entities/Channel.cs b/Atomx.Common/Entities/Channel.cs index 49459b1..2d91e56 100644 --- a/Atomx.Common/Entities/Channel.cs +++ b/Atomx.Common/Entities/Channel.cs @@ -9,7 +9,7 @@ namespace Atomx.Common.Entities /// /// 数据ID /// - [DatabaseGenerated(DatabaseGeneratedOption.None)] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] [Key] public int Id { get; set; } diff --git a/Atomx.Common/Entities/Country.cs b/Atomx.Common/Entities/Country.cs new file mode 100644 index 0000000..4af5aae --- /dev/null +++ b/Atomx.Common/Entities/Country.cs @@ -0,0 +1,64 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Atomx.Common.Entities +{ + /// + /// 国家数据 + /// + [Table("Countries")] + public class Country + { + /// + /// 数据ID + /// + [DatabaseGenerated(DatabaseGeneratedOption.None)] + [Key] + public long Id { get; set; } + + /// + /// 地区名称 + /// + + [Column(TypeName = "varchar(256)")] + public string Name { get; set; } = string.Empty; + + /// + /// 首字母 + /// + [Column(TypeName = "varchar(1)")] + public string Initial { get; set; } = string.Empty; + + /// + /// 双字母代码 + /// + [Column(TypeName = "varchar(2)")] + public string TwoLetterISOCode { get; set; } = string.Empty; + + /// + /// 三字母代码 + /// + [Column(TypeName = "varchar(3)")] + public string ThreeLetterISOCode { get; set; } = string.Empty; + + /// + /// 数字代码 + /// + public int NumericISOCode { get; set; } + + /// + /// 是否允许配送 + /// + public bool AllowShipping { get; set; } + + /// + /// 是否启用 + /// + public bool Enabled { get; set; } + + /// + /// 显示排序 + /// + public int DisplayOrder { get; set; } + } +} diff --git a/Atomx.Common/Entities/CurrencyChannelRelation.cs b/Atomx.Common/Entities/CurrencyChannelRelation.cs index ff91baa..9e59839 100644 --- a/Atomx.Common/Entities/CurrencyChannelRelation.cs +++ b/Atomx.Common/Entities/CurrencyChannelRelation.cs @@ -26,7 +26,7 @@ namespace Atomx.Common.Entities /// /// 支付通道ID /// - public int PayChannelId { get; set; } + public int ChannelId { get; set; } /// /// 每天可用开始时间 diff --git a/Atomx.Common/Entities/LocalizedProperty.cs b/Atomx.Common/Entities/LocalizedProperty.cs index bdd0a53..2fbd321 100644 --- a/Atomx.Common/Entities/LocalizedProperty.cs +++ b/Atomx.Common/Entities/LocalizedProperty.cs @@ -19,7 +19,7 @@ namespace Atomx.Common.Entities /// /// 语言编码 /// - public int LanguageNumber { get; set; } + public int LanguageId { get; set; } /// /// 数据类型 diff --git a/Atomx.Common/Entities/Post.cs b/Atomx.Common/Entities/Post.cs index 2de9109..eb2cfc3 100644 --- a/Atomx.Common/Entities/Post.cs +++ b/Atomx.Common/Entities/Post.cs @@ -13,8 +13,16 @@ namespace Atomx.Common.Entities [Key] public long Id { get; set; } + /// + /// 内容类型 + /// public int Type { get; set; } + /// + /// 语言编码 + /// + public int LanguageId { get; set; } + /// /// 作者ID /// diff --git a/Atomx.Common/Entities/StateProvince.cs b/Atomx.Common/Entities/StateProvince.cs new file mode 100644 index 0000000..ab0cb24 --- /dev/null +++ b/Atomx.Common/Entities/StateProvince.cs @@ -0,0 +1,53 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Atomx.Common.Entities +{ + /// + /// 州省 + /// + [Table("StateProvinces")] + public class StateProvince + { + /// + /// 数据ID + /// + [DatabaseGenerated(DatabaseGeneratedOption.None)] + [Key] + public long Id { get; set; } + + /// + /// 地区名称 + /// + + [Column(TypeName = "varchar(256)")] + public string Name { get; set; } = string.Empty; + + /// + /// 国家ID + /// + public long CountryId { get; set; } + + /// + /// 首字母 + /// + [Column(TypeName = "varchar(1)")] + public string Initial { get; set; } = string.Empty; + + /// + /// 缩写 + /// + [Column(TypeName = "varchar(32)")] + public string Abbreviation { get; set; } = string.Empty; + + /// + /// 是否启用 + /// + public bool Enabled { get; set; } + + /// + /// 显示排序 + /// + public int DisplayOrder { get; set; } + } +} diff --git a/Atomx.Data/DataContext.cs b/Atomx.Data/DataContext.cs index b00c62c..dca7924 100644 --- a/Atomx.Data/DataContext.cs +++ b/Atomx.Data/DataContext.cs @@ -23,11 +23,11 @@ namespace Atomx.Data protected override void OnModelCreating(ModelBuilder builder) { - base.OnModelCreating(builder); - builder.Entity(entity => - { - entity.Property(e => e.Id).ValueGeneratedOnAdd(); - }); + //base.OnModelCreating(builder); + //builder.Entity(entity => + //{ + // entity.Property(e => e.Id).ValueGeneratedOnAdd(); + //}); } /// @@ -46,7 +46,7 @@ namespace Atomx.Data public DbSet AppVersions { get; set; } /// - /// 国家省市地区 + /// 市区数据 /// public DbSet Areas { get; set; } @@ -60,6 +60,11 @@ namespace Atomx.Data /// public DbSet Channels { get; set; } + /// + /// 国家数据 + /// + public DbSet Countries { get; set; } + /// /// 货币信息 /// @@ -136,6 +141,11 @@ namespace Atomx.Data /// public DbSet SpecificationAttributeOptions { get; set; } + /// + /// 州省份数据 + /// + public DbSet StateProvinces { get; set; } + /// /// 刷新Tokens /// diff --git a/Atomx.Data/Migrations/20251223083953_0.1.Designer.cs b/Atomx.Data/Migrations/20251224030208_0.1.Designer.cs similarity index 95% rename from Atomx.Data/Migrations/20251223083953_0.1.Designer.cs rename to Atomx.Data/Migrations/20251224030208_0.1.Designer.cs index ffa1a5e..2d5995a 100644 --- a/Atomx.Data/Migrations/20251223083953_0.1.Designer.cs +++ b/Atomx.Data/Migrations/20251224030208_0.1.Designer.cs @@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace Atomx.Data.Migrations { [DbContext(typeof(DataContext))] - [Migration("20251223083953_0.1")] + [Migration("20251224030208_0.1")] partial class _01 { /// @@ -242,6 +242,9 @@ namespace Atomx.Data.Migrations b.Property("AllowShipping") .HasColumnType("boolean"); + b.Property("CountryId") + .HasColumnType("bigint"); + b.Property("DisplayOrder") .HasColumnType("integer"); @@ -256,19 +259,11 @@ namespace Atomx.Data.Migrations .IsRequired() .HasColumnType("varchar(256)"); - b.Property("NumericISOCode") - .HasColumnType("integer"); - b.Property("ParentId") .HasColumnType("bigint"); - b.Property("ThreeLetterISOCode") - .IsRequired() - .HasColumnType("varchar(3)"); - - b.Property("TwoLetterISOCode") - .IsRequired() - .HasColumnType("varchar(2)"); + b.Property("StateProvinceId") + .HasColumnType("bigint"); b.HasKey("Id"); @@ -350,8 +345,11 @@ namespace Atomx.Data.Migrations modelBuilder.Entity("Atomx.Common.Entities.Channel", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("integer"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Config") .IsRequired() .HasColumnType("text"); @@ -394,6 +392,44 @@ namespace Atomx.Data.Migrations b.ToTable("Channels"); }); + modelBuilder.Entity("Atomx.Common.Entities.Country", b => + { + b.Property("Id") + .HasColumnType("bigint"); + + b.Property("AllowShipping") + .HasColumnType("boolean"); + + b.Property("DisplayOrder") + .HasColumnType("integer"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("Initial") + .IsRequired() + .HasColumnType("varchar(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(256)"); + + b.Property("NumericISOCode") + .HasColumnType("integer"); + + b.Property("ThreeLetterISOCode") + .IsRequired() + .HasColumnType("varchar(3)"); + + b.Property("TwoLetterISOCode") + .IsRequired() + .HasColumnType("varchar(2)"); + + b.HasKey("Id"); + + b.ToTable("Countries"); + }); + modelBuilder.Entity("Atomx.Common.Entities.Currency", b => { b.Property("Id") @@ -460,6 +496,9 @@ namespace Atomx.Data.Migrations b.Property("Id") .HasColumnType("bigint"); + b.Property("ChannelId") + .HasColumnType("integer"); + b.Property("CreateTime") .HasColumnType("timestamptz"); @@ -473,9 +512,6 @@ namespace Atomx.Data.Migrations .IsRequired() .HasColumnType("text"); - b.Property("PayChannelId") - .HasColumnType("integer"); - b.Property("Rate") .HasColumnType("numeric"); @@ -581,7 +617,7 @@ namespace Atomx.Data.Migrations .IsRequired() .HasColumnType("varchar(256)"); - b.Property("LanguageNumber") + b.Property("LanguageId") .HasColumnType("integer"); b.Property("Type") @@ -1339,6 +1375,37 @@ namespace Atomx.Data.Migrations b.ToTable("SpecificationAttributeOptions"); }); + modelBuilder.Entity("Atomx.Common.Entities.StateProvince", b => + { + b.Property("Id") + .HasColumnType("bigint"); + + b.Property("Abbreviation") + .IsRequired() + .HasColumnType("varchar(32)"); + + b.Property("CountryId") + .HasColumnType("bigint"); + + b.Property("DisplayOrder") + .HasColumnType("integer"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("Initial") + .IsRequired() + .HasColumnType("varchar(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.ToTable("StateProvinces"); + }); + modelBuilder.Entity("Atomx.Common.Entities.Tag", b => { b.Property("Id") diff --git a/Atomx.Data/Migrations/20251223083953_0.1.cs b/Atomx.Data/Migrations/20251224030208_0.1.cs similarity index 95% rename from Atomx.Data/Migrations/20251223083953_0.1.cs rename to Atomx.Data/Migrations/20251224030208_0.1.cs index 5f860ac..8a18f0e 100644 --- a/Atomx.Data/Migrations/20251223083953_0.1.cs +++ b/Atomx.Data/Migrations/20251224030208_0.1.cs @@ -101,12 +101,11 @@ namespace Atomx.Data.Migrations columns: table => new { Id = table.Column(type: "bigint", nullable: false), + CountryId = table.Column(type: "bigint", nullable: false), + StateProvinceId = table.Column(type: "bigint", nullable: false), ParentId = table.Column(type: "bigint", nullable: false), Name = table.Column(type: "varchar(256)", nullable: false), Initial = table.Column(type: "varchar(1)", nullable: false), - TwoLetterISOCode = table.Column(type: "varchar(2)", nullable: false), - ThreeLetterISOCode = table.Column(type: "varchar(3)", nullable: false), - NumericISOCode = table.Column(type: "integer", nullable: false), AllowShipping = table.Column(type: "boolean", nullable: false), Enabled = table.Column(type: "boolean", nullable: false), DisplayOrder = table.Column(type: "integer", nullable: false) @@ -149,7 +148,8 @@ namespace Atomx.Data.Migrations name: "Channels", columns: table => new { - Id = table.Column(type: "integer", nullable: false), + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), SiteId = table.Column(type: "integer", nullable: false), Type = table.Column(type: "integer", nullable: false), Network = table.Column(type: "integer", nullable: false), @@ -167,6 +167,25 @@ namespace Atomx.Data.Migrations table.PrimaryKey("PK_Channels", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Countries", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "varchar(256)", nullable: false), + Initial = table.Column(type: "varchar(1)", nullable: false), + TwoLetterISOCode = table.Column(type: "varchar(2)", nullable: false), + ThreeLetterISOCode = table.Column(type: "varchar(3)", nullable: false), + NumericISOCode = table.Column(type: "integer", nullable: false), + AllowShipping = table.Column(type: "boolean", nullable: false), + Enabled = table.Column(type: "boolean", nullable: false), + DisplayOrder = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Countries", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Currencies", columns: table => new @@ -200,7 +219,7 @@ namespace Atomx.Data.Migrations Id = table.Column(type: "bigint", nullable: false), Title = table.Column(type: "text", nullable: false), CurrencyId = table.Column(type: "integer", nullable: false), - PayChannelId = table.Column(type: "integer", nullable: false), + ChannelId = table.Column(type: "integer", nullable: false), StartTime = table.Column(type: "integer", nullable: false), EndTime = table.Column(type: "integer", nullable: false), TimeZone = table.Column(type: "integer", nullable: false), @@ -256,7 +275,7 @@ namespace Atomx.Data.Migrations columns: table => new { Id = table.Column(type: "bigint", nullable: false), - LanguageNumber = table.Column(type: "integer", nullable: false), + LanguageId = table.Column(type: "integer", nullable: false), Type = table.Column(type: "integer", nullable: false), EntityId = table.Column(type: "bigint", nullable: false), Key = table.Column(type: "varchar(256)", nullable: false), @@ -633,6 +652,23 @@ namespace Atomx.Data.Migrations table.PrimaryKey("PK_SpecificationAttributes", x => x.Id); }); + migrationBuilder.CreateTable( + name: "StateProvinces", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "varchar(256)", nullable: false), + CountryId = table.Column(type: "bigint", nullable: false), + Initial = table.Column(type: "varchar(1)", nullable: false), + Abbreviation = table.Column(type: "varchar(32)", nullable: false), + Enabled = table.Column(type: "boolean", nullable: false), + DisplayOrder = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StateProvinces", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Tags", columns: table => new @@ -718,6 +754,9 @@ namespace Atomx.Data.Migrations migrationBuilder.DropTable( name: "Channels"); + migrationBuilder.DropTable( + name: "Countries"); + migrationBuilder.DropTable( name: "Currencies"); @@ -784,6 +823,9 @@ namespace Atomx.Data.Migrations migrationBuilder.DropTable( name: "SpecificationAttributes"); + migrationBuilder.DropTable( + name: "StateProvinces"); + migrationBuilder.DropTable( name: "Tags"); diff --git a/Atomx.Data/Migrations/DataContextModelSnapshot.cs b/Atomx.Data/Migrations/DataContextModelSnapshot.cs index 9906456..0e4e112 100644 --- a/Atomx.Data/Migrations/DataContextModelSnapshot.cs +++ b/Atomx.Data/Migrations/DataContextModelSnapshot.cs @@ -239,6 +239,9 @@ namespace Atomx.Data.Migrations b.Property("AllowShipping") .HasColumnType("boolean"); + b.Property("CountryId") + .HasColumnType("bigint"); + b.Property("DisplayOrder") .HasColumnType("integer"); @@ -253,19 +256,11 @@ namespace Atomx.Data.Migrations .IsRequired() .HasColumnType("varchar(256)"); - b.Property("NumericISOCode") - .HasColumnType("integer"); - b.Property("ParentId") .HasColumnType("bigint"); - b.Property("ThreeLetterISOCode") - .IsRequired() - .HasColumnType("varchar(3)"); - - b.Property("TwoLetterISOCode") - .IsRequired() - .HasColumnType("varchar(2)"); + b.Property("StateProvinceId") + .HasColumnType("bigint"); b.HasKey("Id"); @@ -347,8 +342,11 @@ namespace Atomx.Data.Migrations modelBuilder.Entity("Atomx.Common.Entities.Channel", b => { b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("integer"); + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("Config") .IsRequired() .HasColumnType("text"); @@ -391,6 +389,44 @@ namespace Atomx.Data.Migrations b.ToTable("Channels"); }); + modelBuilder.Entity("Atomx.Common.Entities.Country", b => + { + b.Property("Id") + .HasColumnType("bigint"); + + b.Property("AllowShipping") + .HasColumnType("boolean"); + + b.Property("DisplayOrder") + .HasColumnType("integer"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("Initial") + .IsRequired() + .HasColumnType("varchar(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(256)"); + + b.Property("NumericISOCode") + .HasColumnType("integer"); + + b.Property("ThreeLetterISOCode") + .IsRequired() + .HasColumnType("varchar(3)"); + + b.Property("TwoLetterISOCode") + .IsRequired() + .HasColumnType("varchar(2)"); + + b.HasKey("Id"); + + b.ToTable("Countries"); + }); + modelBuilder.Entity("Atomx.Common.Entities.Currency", b => { b.Property("Id") @@ -457,6 +493,9 @@ namespace Atomx.Data.Migrations b.Property("Id") .HasColumnType("bigint"); + b.Property("ChannelId") + .HasColumnType("integer"); + b.Property("CreateTime") .HasColumnType("timestamptz"); @@ -470,9 +509,6 @@ namespace Atomx.Data.Migrations .IsRequired() .HasColumnType("text"); - b.Property("PayChannelId") - .HasColumnType("integer"); - b.Property("Rate") .HasColumnType("numeric"); @@ -578,7 +614,7 @@ namespace Atomx.Data.Migrations .IsRequired() .HasColumnType("varchar(256)"); - b.Property("LanguageNumber") + b.Property("LanguageId") .HasColumnType("integer"); b.Property("Type") @@ -1336,6 +1372,37 @@ namespace Atomx.Data.Migrations b.ToTable("SpecificationAttributeOptions"); }); + modelBuilder.Entity("Atomx.Common.Entities.StateProvince", b => + { + b.Property("Id") + .HasColumnType("bigint"); + + b.Property("Abbreviation") + .IsRequired() + .HasColumnType("varchar(32)"); + + b.Property("CountryId") + .HasColumnType("bigint"); + + b.Property("DisplayOrder") + .HasColumnType("integer"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("Initial") + .IsRequired() + .HasColumnType("varchar(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.ToTable("StateProvinces"); + }); + modelBuilder.Entity("Atomx.Common.Entities.Tag", b => { b.Property("Id")