调整地区实体
This commit is contained in:
@@ -1,5 +1,137 @@
|
||||
<h3>CountryEdit</h3>
|
||||
@page "/country/create"
|
||||
@page "/country/edit/{id:long}"
|
||||
@page "/{locale}/country/create"
|
||||
@page "/{locale}/country/edit/{id:long}"
|
||||
|
||||
@inject ILogger<CountryEdit> Logger
|
||||
@attribute [Authorize]
|
||||
|
||||
<PageContainer Title="@(Id > 0 ? "编辑国家信息" : "新增国家信息")">
|
||||
<Breadcrumb>
|
||||
<Breadcrumb>
|
||||
<BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
|
||||
<BreadcrumbItem Href="/admin/list">系统配置</BreadcrumbItem>
|
||||
<BreadcrumbItem Href="/country/list">国家管理</BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
</Breadcrumb>
|
||||
<ChildContent>
|
||||
|
||||
<Spin Spinning="pageLoading">
|
||||
<Card Title="货币信息">
|
||||
<Form @ref="editform" Model="@model" LabelColSpan="5" WrapperColSpan="14" OnFinish="OnFormFinishAsync">
|
||||
<FormItem Label="名称" Required>
|
||||
<Input @bind-Value="@context.Name" Placeholder="货币名称" />
|
||||
</FormItem>
|
||||
<FormItem Label="货币代码">
|
||||
<Input @bind-Value="@context.CurrencyCode" Placeholder="货币代码" />
|
||||
</FormItem>
|
||||
<FormItem Label="汇率">
|
||||
<Input @bind-Value="@context.Rate" Placeholder="汇率" />
|
||||
</FormItem>
|
||||
<FormItem Label="展示本地">
|
||||
<SimpleSelect @bind-Value="@context.DisplayLocale" Placeholder="语言文化">
|
||||
<SelectOptions>
|
||||
@foreach (var item in LanguageCultures)
|
||||
{
|
||||
<SimpleSelectOption Value="@item.Key" Label="@($"{item.Value} - {item.Key}")"></SimpleSelectOption>
|
||||
}
|
||||
</SelectOptions>
|
||||
</SimpleSelect>
|
||||
</FormItem>
|
||||
<FormItem Label="自定义格式">
|
||||
<Input @bind-Value="@context.CustomFormatting" Placeholder="自定义格式" />
|
||||
</FormItem>
|
||||
<FormItem Label="显示排序">
|
||||
<Input @bind-Value="@context.DisplayOrder" Placeholder="显示排序" />
|
||||
</FormItem>
|
||||
<FormItem Label="状态">
|
||||
<Checkbox Checked="@context.Enabled">启用</Checkbox>
|
||||
</FormItem>
|
||||
<FormItem WrapperCol="new ColLayoutParam { Span = 24, Offset = 5 }">
|
||||
<Button Type="@ButtonType.Primary" HtmlType="submit" Loading="saving">
|
||||
提交保存
|
||||
</Button>
|
||||
</FormItem>
|
||||
</Form>
|
||||
</Card>
|
||||
</Spin>
|
||||
</ChildContent>
|
||||
</PageContainer>
|
||||
@code {
|
||||
[Parameter]
|
||||
public string Locale { get; set; } = string.Empty;
|
||||
|
||||
[Parameter]
|
||||
public long Id { get; set; }
|
||||
|
||||
[SupplyParameterFromForm]
|
||||
CurrencyModel model { get; set; } = new();
|
||||
Form<CurrencyModel> editform = null!;
|
||||
Dictionary<string, string> 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<ApiResult<Currency>>(url);
|
||||
if (apiResult.Success)
|
||||
{
|
||||
if (apiResult.Data == null)
|
||||
{
|
||||
Navigation.NavigateTo($"/currency/create");
|
||||
}
|
||||
else
|
||||
{
|
||||
model = apiResult.Data.Adapt<CurrencyModel>();
|
||||
}
|
||||
}
|
||||
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<string>();
|
||||
result = await HttpService.Post<ApiResult<string>>(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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,266 @@
|
||||
<h3>CountryList</h3>
|
||||
@page "/country/list"
|
||||
@page "/{locale}/country/list"
|
||||
@inject ILogger<CountryList> Logger
|
||||
@attribute [Authorize]
|
||||
|
||||
|
||||
|
||||
<PageContainer Title="国家地区">
|
||||
<Breadcrumb>
|
||||
<Breadcrumb>
|
||||
<BreadcrumbItem>Home</BreadcrumbItem>
|
||||
<BreadcrumbItem>系统配置</BreadcrumbItem>
|
||||
<BreadcrumbItem>货币管理</BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
</Breadcrumb>
|
||||
<ChildContent>
|
||||
<Spin Spinning="pageLoading">
|
||||
<Card>
|
||||
<Form @ref="searchForm" Model="search" Layout="FormLayout.Inline" Class="search-form" OnFinish="OnSearchFinish">
|
||||
<Row Justify="RowJustify.Start" Gutter="16">
|
||||
<Col>
|
||||
<FormItem Label="名称">
|
||||
<Input @bind-Value="search.Name" Placeholder="名称" AllowClear />
|
||||
</FormItem>
|
||||
</Col>
|
||||
@if (searchExpand)
|
||||
{
|
||||
<AntDesign.Col>
|
||||
<FormItem Label="发布时间">
|
||||
<RangePicker @bind-Value="search.RangeTime"></RangePicker>
|
||||
</FormItem>
|
||||
</AntDesign.Col>
|
||||
<AntDesign.Col>
|
||||
<FormItem Label="状态">
|
||||
<SimpleSelect DefaultValue="" Style="width:120px;" @bind-Value="@search.Status">
|
||||
<SelectOptions>
|
||||
<SimpleSelectOption Value="" Label="全部"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="1" Label="草稿"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="2" Label="已发布"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="3" Label="已删除"></SimpleSelectOption>
|
||||
</SelectOptions>
|
||||
</SimpleSelect>
|
||||
</FormItem>
|
||||
</AntDesign.Col>
|
||||
}
|
||||
<Col>
|
||||
<div class="ant-form-item">
|
||||
<Button Type="ButtonType.Primary" HtmlType="submit">查询</Button>
|
||||
<Button Style="margin: 0 8px;" OnClick="OnSearchReset">重置</Button>
|
||||
<a style="font-size:12px; display:flex; align-items:center;text-align:center;" @onclick="()=>{searchExpand=!searchExpand;}">
|
||||
<Icon Type="@(searchExpand?"up":"down")"></Icon> @if (searchExpand)
|
||||
{
|
||||
<span>收起</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>展开</span>
|
||||
}
|
||||
</a>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</Form>
|
||||
</Card>
|
||||
<Card Title="" Class="hideborder">
|
||||
<Extra>
|
||||
<div class="extraContent">
|
||||
<Button Type="ButtonType.Primary" HtmlType="submit" OnClick="HandleAddNew">新增货币</Button>
|
||||
</div>
|
||||
</Extra>
|
||||
<ChildContent>
|
||||
<Table DataSource="PagingList.Items" PageSize="100" HidePagination="true">
|
||||
<Selection CheckStrictly />
|
||||
<PropertyColumn Property="c => c.Name" Title="名称" />
|
||||
<PropertyColumn Property="c => c.CurrencyCode" Title="货币代码" />
|
||||
<PropertyColumn Property="c => c.Rate" Title="汇率" />
|
||||
<PropertyColumn Property="c => c.PrimaryCurrency" Title="默认货币">
|
||||
@if (context.PrimaryCurrency)
|
||||
{
|
||||
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme="IconThemeType.Outline" /></AntDesign.Text>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Icon Type="minus" Theme="IconThemeType.Outline" />
|
||||
}
|
||||
</PropertyColumn>
|
||||
<PropertyColumn Property="c => c.Enabled" Title="状态">
|
||||
@if (context.Enabled)
|
||||
{
|
||||
<Text>已激活</text>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Text>未激活</text>
|
||||
}
|
||||
</PropertyColumn>
|
||||
<PropertyColumn Property="c => c.DisplayOrder" Title="排序" />
|
||||
<ActionColumn Title="操作" Align="ColumnAlign.Right">
|
||||
<Space>
|
||||
<SpaceItem>
|
||||
<a @onclick="(e)=>HandleEdit(context)">编辑</a>
|
||||
</SpaceItem>
|
||||
@*<SpaceItem>
|
||||
<Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")"
|
||||
OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))"
|
||||
OkText="确定"
|
||||
CancelText="取消">
|
||||
<a>删除</a>
|
||||
</Popconfirm>
|
||||
</SpaceItem>*@
|
||||
</Space>
|
||||
</ActionColumn>
|
||||
</Table>
|
||||
<br />
|
||||
<Row Justify="RowJustify.End">
|
||||
@if (PagingList.Count > 0)
|
||||
{
|
||||
<Pagination Current="PagingList.Index" Total="PagingList.Count" PageSize="PagingList.Size" ShowSizeChanger="false" OnChange="OnPageChanged"></Pagination>
|
||||
}
|
||||
</Row>
|
||||
</ChildContent>
|
||||
</Card>
|
||||
</Spin>
|
||||
</ChildContent>
|
||||
</PageContainer>
|
||||
|
||||
@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<CurrencySearchModel> searchForm = new();
|
||||
CurrencySearchModel search = new();
|
||||
|
||||
PagingList<CurrencyModel> 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<CurrencyModel>(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 {
|
||||
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
@page "/stateprovince/create"
|
||||
@page "/stateprovince/edit/{id:long}"
|
||||
@page "/{locale}/stateprovince/create"
|
||||
@page "/{locale}/stateprovince/edit/{id:long}"
|
||||
|
||||
@inject ILogger<StateProvinceEdit> Logger
|
||||
@attribute [Authorize]
|
||||
|
||||
<PageContainer Title="@(Id > 0 ? "编辑国家信息" : "新增国家信息")">
|
||||
<Breadcrumb>
|
||||
<Breadcrumb>
|
||||
<BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
|
||||
<BreadcrumbItem Href="/admin/list">系统配置</BreadcrumbItem>
|
||||
<BreadcrumbItem Href="/country/list">国家管理</BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
</Breadcrumb>
|
||||
<ChildContent>
|
||||
|
||||
<Spin Spinning="pageLoading">
|
||||
<Card Title="货币信息">
|
||||
<Form @ref="editform" Model="@model" LabelColSpan="5" WrapperColSpan="14" OnFinish="OnFormFinishAsync">
|
||||
<FormItem Label="名称" Required>
|
||||
<Input @bind-Value="@context.Name" Placeholder="货币名称" />
|
||||
</FormItem>
|
||||
<FormItem Label="货币代码">
|
||||
<Input @bind-Value="@context.CurrencyCode" Placeholder="货币代码" />
|
||||
</FormItem>
|
||||
<FormItem Label="汇率">
|
||||
<Input @bind-Value="@context.Rate" Placeholder="汇率" />
|
||||
</FormItem>
|
||||
<FormItem Label="展示本地">
|
||||
<SimpleSelect @bind-Value="@context.DisplayLocale" Placeholder="语言文化">
|
||||
<SelectOptions>
|
||||
@foreach (var item in LanguageCultures)
|
||||
{
|
||||
<SimpleSelectOption Value="@item.Key" Label="@($"{item.Value} - {item.Key}")"></SimpleSelectOption>
|
||||
}
|
||||
</SelectOptions>
|
||||
</SimpleSelect>
|
||||
</FormItem>
|
||||
<FormItem Label="自定义格式">
|
||||
<Input @bind-Value="@context.CustomFormatting" Placeholder="自定义格式" />
|
||||
</FormItem>
|
||||
<FormItem Label="显示排序">
|
||||
<Input @bind-Value="@context.DisplayOrder" Placeholder="显示排序" />
|
||||
</FormItem>
|
||||
<FormItem Label="状态">
|
||||
<Checkbox Checked="@context.Enabled">启用</Checkbox>
|
||||
</FormItem>
|
||||
<FormItem WrapperCol="new ColLayoutParam { Span = 24, Offset = 5 }">
|
||||
<Button Type="@ButtonType.Primary" HtmlType="submit" Loading="saving">
|
||||
提交保存
|
||||
</Button>
|
||||
</FormItem>
|
||||
</Form>
|
||||
</Card>
|
||||
</Spin>
|
||||
</ChildContent>
|
||||
</PageContainer>
|
||||
@code {
|
||||
[Parameter]
|
||||
public string Locale { get; set; } = string.Empty;
|
||||
|
||||
[Parameter]
|
||||
public long Id { get; set; }
|
||||
|
||||
[SupplyParameterFromForm]
|
||||
CurrencyModel model { get; set; } = new();
|
||||
Form<CurrencyModel> editform = null!;
|
||||
Dictionary<string, string> 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<ApiResult<Currency>>(url);
|
||||
if (apiResult.Success)
|
||||
{
|
||||
if (apiResult.Data == null)
|
||||
{
|
||||
Navigation.NavigateTo($"/currency/create");
|
||||
}
|
||||
else
|
||||
{
|
||||
model = apiResult.Data.Adapt<CurrencyModel>();
|
||||
}
|
||||
}
|
||||
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<string>();
|
||||
result = await HttpService.Post<ApiResult<string>>(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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
@page "/stateprovince/list"
|
||||
@page "/{locale}/stateprovince/list"
|
||||
@inject ILogger<StateProvinceList> Logger
|
||||
@attribute [Authorize]
|
||||
|
||||
|
||||
|
||||
<PageContainer Title="州省管理">
|
||||
<Breadcrumb>
|
||||
<Breadcrumb>
|
||||
<BreadcrumbItem>Home</BreadcrumbItem>
|
||||
<BreadcrumbItem>系统配置</BreadcrumbItem>
|
||||
<BreadcrumbItem>州省管理</BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
</Breadcrumb>
|
||||
<ChildContent>
|
||||
<Spin Spinning="pageLoading">
|
||||
<Card>
|
||||
<Form @ref="searchForm" Model="search" Layout="FormLayout.Inline" Class="search-form" OnFinish="OnSearchFinish">
|
||||
<Row Justify="RowJustify.Start" Gutter="16">
|
||||
<Col>
|
||||
<FormItem Label="名称">
|
||||
<Input @bind-Value="search.Name" Placeholder="名称" AllowClear />
|
||||
</FormItem>
|
||||
</Col>
|
||||
@if (searchExpand)
|
||||
{
|
||||
<AntDesign.Col>
|
||||
<FormItem Label="发布时间">
|
||||
<RangePicker @bind-Value="search.RangeTime"></RangePicker>
|
||||
</FormItem>
|
||||
</AntDesign.Col>
|
||||
<AntDesign.Col>
|
||||
<FormItem Label="状态">
|
||||
<SimpleSelect DefaultValue="" Style="width:120px;" @bind-Value="@search.Status">
|
||||
<SelectOptions>
|
||||
<SimpleSelectOption Value="" Label="全部"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="1" Label="草稿"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="2" Label="已发布"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="3" Label="已删除"></SimpleSelectOption>
|
||||
</SelectOptions>
|
||||
</SimpleSelect>
|
||||
</FormItem>
|
||||
</AntDesign.Col>
|
||||
}
|
||||
<Col>
|
||||
<div class="ant-form-item">
|
||||
<Button Type="ButtonType.Primary" HtmlType="submit">查询</Button>
|
||||
<Button Style="margin: 0 8px;" OnClick="OnSearchReset">重置</Button>
|
||||
<a style="font-size:12px; display:flex; align-items:center;text-align:center;" @onclick="()=>{searchExpand=!searchExpand;}">
|
||||
<Icon Type="@(searchExpand?"up":"down")"></Icon> @if (searchExpand)
|
||||
{
|
||||
<span>收起</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>展开</span>
|
||||
}
|
||||
</a>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</Form>
|
||||
</Card>
|
||||
<Card Title="" Class="hideborder">
|
||||
<Extra>
|
||||
<div class="extraContent">
|
||||
<Button Type="ButtonType.Primary" HtmlType="submit" OnClick="HandleAddNew">新增货币</Button>
|
||||
</div>
|
||||
</Extra>
|
||||
<ChildContent>
|
||||
<Table DataSource="PagingList.Items" PageSize="100" HidePagination="true">
|
||||
<Selection CheckStrictly />
|
||||
<PropertyColumn Property="c => c.Name" Title="名称" />
|
||||
<PropertyColumn Property="c => c.CurrencyCode" Title="货币代码" />
|
||||
<PropertyColumn Property="c => c.Rate" Title="汇率" />
|
||||
<PropertyColumn Property="c => c.PrimaryCurrency" Title="默认货币">
|
||||
@if (context.PrimaryCurrency)
|
||||
{
|
||||
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme="IconThemeType.Outline" /></AntDesign.Text>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Icon Type="minus" Theme="IconThemeType.Outline" />
|
||||
}
|
||||
</PropertyColumn>
|
||||
<PropertyColumn Property="c => c.Enabled" Title="状态">
|
||||
@if (context.Enabled)
|
||||
{
|
||||
<Text>已激活</text>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Text>未激活</text>
|
||||
}
|
||||
</PropertyColumn>
|
||||
<PropertyColumn Property="c => c.DisplayOrder" Title="排序" />
|
||||
<ActionColumn Title="操作" Align="ColumnAlign.Right">
|
||||
<Space>
|
||||
<SpaceItem>
|
||||
<a @onclick="(e)=>HandleEdit(context)">编辑</a>
|
||||
</SpaceItem>
|
||||
@*<SpaceItem>
|
||||
<Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")"
|
||||
OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))"
|
||||
OkText="确定"
|
||||
CancelText="取消">
|
||||
<a>删除</a>
|
||||
</Popconfirm>
|
||||
</SpaceItem>*@
|
||||
</Space>
|
||||
</ActionColumn>
|
||||
</Table>
|
||||
<br />
|
||||
<Row Justify="RowJustify.End">
|
||||
@if (PagingList.Count > 0)
|
||||
{
|
||||
<Pagination Current="PagingList.Index" Total="PagingList.Count" PageSize="PagingList.Size" ShowSizeChanger="false" OnChange="OnPageChanged"></Pagination>
|
||||
}
|
||||
</Row>
|
||||
</ChildContent>
|
||||
</Card>
|
||||
</Spin>
|
||||
</ChildContent>
|
||||
</PageContainer>
|
||||
|
||||
@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<CurrencySearchModel> searchForm = new();
|
||||
CurrencySearchModel search = new();
|
||||
|
||||
PagingList<CurrencyModel> 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<CurrencyModel>(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 {
|
||||
|
||||
}
|
||||
@@ -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())
|
||||
|
||||
@@ -51,10 +51,23 @@
|
||||
public int LoginErrorLockDuration { get; set; } = 30;
|
||||
|
||||
/// <summary>
|
||||
/// 是否多个法定货币钱包
|
||||
/// facebook页面地址
|
||||
/// </summary>
|
||||
public bool MultipleLegalTenderWallets { get; set; } = false;
|
||||
public string FacebookUrl { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 推特页面地址
|
||||
/// </summary>
|
||||
public string TwitterUrl { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// YouTube页面地址
|
||||
/// </summary>
|
||||
public string YouTubeUrl { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Instagram页面地址
|
||||
/// </summary>
|
||||
public string InstagramUrl { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
namespace Atomx.Common.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 地区(国家、省、市、区)
|
||||
/// 地区(市、区)
|
||||
/// </summary>
|
||||
[Table("Areas")]
|
||||
public class Area
|
||||
@@ -16,6 +16,16 @@ namespace Atomx.Common.Entities
|
||||
[Key]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 国家ID
|
||||
/// </summary>
|
||||
public long CountryId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 州省ID
|
||||
/// </summary>
|
||||
public long StateProvinceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上级ID
|
||||
/// </summary>
|
||||
@@ -34,23 +44,6 @@ namespace Atomx.Common.Entities
|
||||
[Column(TypeName = "varchar(1)")]
|
||||
public string Initial { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 双字母代码
|
||||
/// </summary>
|
||||
[Column(TypeName = "varchar(2)")]
|
||||
public string TwoLetterISOCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 三字母代码
|
||||
/// </summary>
|
||||
[Column(TypeName = "varchar(3)")]
|
||||
public string ThreeLetterISOCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 数字代码
|
||||
/// </summary>
|
||||
public int NumericISOCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否允许配送
|
||||
/// </summary>
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Atomx.Common.Entities
|
||||
/// <summary>
|
||||
/// 数据ID
|
||||
/// </summary>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
|
||||
64
Atomx.Common/Entities/Country.cs
Normal file
64
Atomx.Common/Entities/Country.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Atomx.Common.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 国家数据
|
||||
/// </summary>
|
||||
[Table("Countries")]
|
||||
public class Country
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据ID
|
||||
/// </summary>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Key]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地区名称
|
||||
/// </summary>
|
||||
|
||||
[Column(TypeName = "varchar(256)")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 首字母
|
||||
/// </summary>
|
||||
[Column(TypeName = "varchar(1)")]
|
||||
public string Initial { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 双字母代码
|
||||
/// </summary>
|
||||
[Column(TypeName = "varchar(2)")]
|
||||
public string TwoLetterISOCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 三字母代码
|
||||
/// </summary>
|
||||
[Column(TypeName = "varchar(3)")]
|
||||
public string ThreeLetterISOCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 数字代码
|
||||
/// </summary>
|
||||
public int NumericISOCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否允许配送
|
||||
/// </summary>
|
||||
public bool AllowShipping { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示排序
|
||||
/// </summary>
|
||||
public int DisplayOrder { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ namespace Atomx.Common.Entities
|
||||
/// <summary>
|
||||
/// 支付通道ID
|
||||
/// </summary>
|
||||
public int PayChannelId { get; set; }
|
||||
public int ChannelId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 每天可用开始时间
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Atomx.Common.Entities
|
||||
/// <summary>
|
||||
/// 语言编码
|
||||
/// </summary>
|
||||
public int LanguageNumber { get; set; }
|
||||
public int LanguageId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据类型
|
||||
|
||||
@@ -13,8 +13,16 @@ namespace Atomx.Common.Entities
|
||||
[Key]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 内容类型
|
||||
/// </summary>
|
||||
public int Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 语言编码
|
||||
/// </summary>
|
||||
public int LanguageId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 作者ID
|
||||
/// </summary>
|
||||
|
||||
53
Atomx.Common/Entities/StateProvince.cs
Normal file
53
Atomx.Common/Entities/StateProvince.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Atomx.Common.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 州省
|
||||
/// </summary>
|
||||
[Table("StateProvinces")]
|
||||
public class StateProvince
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据ID
|
||||
/// </summary>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Key]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地区名称
|
||||
/// </summary>
|
||||
|
||||
[Column(TypeName = "varchar(256)")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 国家ID
|
||||
/// </summary>
|
||||
public long CountryId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 首字母
|
||||
/// </summary>
|
||||
[Column(TypeName = "varchar(1)")]
|
||||
public string Initial { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 缩写
|
||||
/// </summary>
|
||||
[Column(TypeName = "varchar(32)")]
|
||||
public string Abbreviation { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示排序
|
||||
/// </summary>
|
||||
public int DisplayOrder { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -23,11 +23,11 @@ namespace Atomx.Data
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
builder.Entity<Currency>(entity =>
|
||||
{
|
||||
entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
||||
});
|
||||
//base.OnModelCreating(builder);
|
||||
//builder.Entity<Currency>(entity =>
|
||||
//{
|
||||
// entity.Property(e => e.Id).ValueGeneratedOnAdd();
|
||||
//});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -46,7 +46,7 @@ namespace Atomx.Data
|
||||
public DbSet<AppVersion> AppVersions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 国家省市地区
|
||||
/// 市区数据
|
||||
/// </summary>
|
||||
public DbSet<Area> Areas { get; set; }
|
||||
|
||||
@@ -60,6 +60,11 @@ namespace Atomx.Data
|
||||
/// </summary>
|
||||
public DbSet<Channel> Channels { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 国家数据
|
||||
/// </summary>
|
||||
public DbSet<Country> Countries { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货币信息
|
||||
/// </summary>
|
||||
@@ -136,6 +141,11 @@ namespace Atomx.Data
|
||||
/// </summary>
|
||||
public DbSet<SpecificationAttributeOption> SpecificationAttributeOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 州省份数据
|
||||
/// </summary>
|
||||
public DbSet<StateProvince> StateProvinces { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 刷新Tokens
|
||||
/// </summary>
|
||||
|
||||
@@ -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
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@@ -242,6 +242,9 @@ namespace Atomx.Data.Migrations
|
||||
b.Property<bool>("AllowShipping")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<long>("CountryId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("DisplayOrder")
|
||||
.HasColumnType("integer");
|
||||
|
||||
@@ -256,19 +259,11 @@ namespace Atomx.Data.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<int>("NumericISOCode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<long>("ParentId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("ThreeLetterISOCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(3)");
|
||||
|
||||
b.Property<string>("TwoLetterISOCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(2)");
|
||||
b.Property<long>("StateProvinceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -350,8 +345,11 @@ namespace Atomx.Data.Migrations
|
||||
modelBuilder.Entity("Atomx.Common.Entities.Channel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Config")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
@@ -394,6 +392,44 @@ namespace Atomx.Data.Migrations
|
||||
b.ToTable("Channels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Atomx.Common.Entities.Country", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("AllowShipping")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("DisplayOrder")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Enabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Initial")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<int>("NumericISOCode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ThreeLetterISOCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(3)");
|
||||
|
||||
b.Property<string>("TwoLetterISOCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Countries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Atomx.Common.Entities.Currency", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -460,6 +496,9 @@ namespace Atomx.Data.Migrations
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("ChannelId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("timestamptz");
|
||||
|
||||
@@ -473,9 +512,6 @@ namespace Atomx.Data.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("PayChannelId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal>("Rate")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
@@ -581,7 +617,7 @@ namespace Atomx.Data.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<int>("LanguageNumber")
|
||||
b.Property<int>("LanguageId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Type")
|
||||
@@ -1339,6 +1375,37 @@ namespace Atomx.Data.Migrations
|
||||
b.ToTable("SpecificationAttributeOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Atomx.Common.Entities.StateProvince", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Abbreviation")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(32)");
|
||||
|
||||
b.Property<long>("CountryId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("DisplayOrder")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Enabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Initial")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("StateProvinces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Atomx.Common.Entities.Tag", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@@ -101,12 +101,11 @@ namespace Atomx.Data.Migrations
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false),
|
||||
CountryId = table.Column<long>(type: "bigint", nullable: false),
|
||||
StateProvinceId = table.Column<long>(type: "bigint", nullable: false),
|
||||
ParentId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Name = table.Column<string>(type: "varchar(256)", nullable: false),
|
||||
Initial = table.Column<string>(type: "varchar(1)", nullable: false),
|
||||
TwoLetterISOCode = table.Column<string>(type: "varchar(2)", nullable: false),
|
||||
ThreeLetterISOCode = table.Column<string>(type: "varchar(3)", nullable: false),
|
||||
NumericISOCode = table.Column<int>(type: "integer", nullable: false),
|
||||
AllowShipping = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Enabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
DisplayOrder = table.Column<int>(type: "integer", nullable: false)
|
||||
@@ -149,7 +148,8 @@ namespace Atomx.Data.Migrations
|
||||
name: "Channels",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false),
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
SiteId = table.Column<int>(type: "integer", nullable: false),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
Network = table.Column<int>(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<long>(type: "bigint", nullable: false),
|
||||
Name = table.Column<string>(type: "varchar(256)", nullable: false),
|
||||
Initial = table.Column<string>(type: "varchar(1)", nullable: false),
|
||||
TwoLetterISOCode = table.Column<string>(type: "varchar(2)", nullable: false),
|
||||
ThreeLetterISOCode = table.Column<string>(type: "varchar(3)", nullable: false),
|
||||
NumericISOCode = table.Column<int>(type: "integer", nullable: false),
|
||||
AllowShipping = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Enabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
DisplayOrder = table.Column<int>(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<long>(type: "bigint", nullable: false),
|
||||
Title = table.Column<string>(type: "text", nullable: false),
|
||||
CurrencyId = table.Column<int>(type: "integer", nullable: false),
|
||||
PayChannelId = table.Column<int>(type: "integer", nullable: false),
|
||||
ChannelId = table.Column<int>(type: "integer", nullable: false),
|
||||
StartTime = table.Column<int>(type: "integer", nullable: false),
|
||||
EndTime = table.Column<int>(type: "integer", nullable: false),
|
||||
TimeZone = table.Column<int>(type: "integer", nullable: false),
|
||||
@@ -256,7 +275,7 @@ namespace Atomx.Data.Migrations
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false),
|
||||
LanguageNumber = table.Column<int>(type: "integer", nullable: false),
|
||||
LanguageId = table.Column<int>(type: "integer", nullable: false),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
EntityId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Key = table.Column<string>(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<long>(type: "bigint", nullable: false),
|
||||
Name = table.Column<string>(type: "varchar(256)", nullable: false),
|
||||
CountryId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Initial = table.Column<string>(type: "varchar(1)", nullable: false),
|
||||
Abbreviation = table.Column<string>(type: "varchar(32)", nullable: false),
|
||||
Enabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
DisplayOrder = table.Column<int>(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");
|
||||
|
||||
@@ -239,6 +239,9 @@ namespace Atomx.Data.Migrations
|
||||
b.Property<bool>("AllowShipping")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<long>("CountryId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("DisplayOrder")
|
||||
.HasColumnType("integer");
|
||||
|
||||
@@ -253,19 +256,11 @@ namespace Atomx.Data.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<int>("NumericISOCode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<long>("ParentId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("ThreeLetterISOCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(3)");
|
||||
|
||||
b.Property<string>("TwoLetterISOCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(2)");
|
||||
b.Property<long>("StateProvinceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -347,8 +342,11 @@ namespace Atomx.Data.Migrations
|
||||
modelBuilder.Entity("Atomx.Common.Entities.Channel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Config")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
@@ -391,6 +389,44 @@ namespace Atomx.Data.Migrations
|
||||
b.ToTable("Channels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Atomx.Common.Entities.Country", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("AllowShipping")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("DisplayOrder")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Enabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Initial")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<int>("NumericISOCode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ThreeLetterISOCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(3)");
|
||||
|
||||
b.Property<string>("TwoLetterISOCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Countries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Atomx.Common.Entities.Currency", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -457,6 +493,9 @@ namespace Atomx.Data.Migrations
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("ChannelId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("timestamptz");
|
||||
|
||||
@@ -470,9 +509,6 @@ namespace Atomx.Data.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("PayChannelId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<decimal>("Rate")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
@@ -578,7 +614,7 @@ namespace Atomx.Data.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<int>("LanguageNumber")
|
||||
b.Property<int>("LanguageId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Type")
|
||||
@@ -1336,6 +1372,37 @@ namespace Atomx.Data.Migrations
|
||||
b.ToTable("SpecificationAttributeOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Atomx.Common.Entities.StateProvince", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Abbreviation")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(32)");
|
||||
|
||||
b.Property<long>("CountryId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("DisplayOrder")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Enabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Initial")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("StateProvinces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Atomx.Common.Entities.Tag", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
|
||||
Reference in New Issue
Block a user