调整数据库结构,实现消息模板管理

This commit is contained in:
2025-12-16 11:26:55 +08:00
parent 98e3f7ab73
commit ed32b98867
45 changed files with 1100 additions and 1319 deletions

View File

@@ -1,20 +0,0 @@
namespace Atomx.Admin.Client.Models
{
public class MaterialSearch : BaseSearch
{
/// <summary>
/// 类型
/// </summary>
public int? Type { get; set; }
/// <summary>
/// 原料归属公司ID
/// </summary>
public long CorporationId { get; set; }
/// <summary>
/// 原料归属店铺网点ID
/// </summary>
public long StoreId { get; set; }
}
}

View File

@@ -7,6 +7,16 @@
/// </summary> /// </summary>
public long Id { get; set; } public long Id { get; set; }
/// <summary>
/// 站点ID
/// </summary>
public long SiteId { get; set; }
/// <summary>
/// 语言编码
/// </summary>
public int LanguageId { get; set; }
/// <summary> /// <summary>
/// 消息模板类型 /// 消息模板类型
/// </summary> /// </summary>
@@ -32,6 +42,11 @@
/// </summary> /// </summary>
public string Body { get; set; } = string.Empty; public string Body { get; set; } = string.Empty;
/// <summary>
/// 附件文件地址列表,多个附件以逗号分隔
/// </summary>
public string Attachments { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 是否可用 /// 是否可用
/// </summary> /// </summary>

View File

@@ -4,6 +4,8 @@
{ {
public int? Type { get; set; } public int? Type { get; set; }
public int? Language { get; set; }
public string Key { get; set; } = string.Empty; public string Key { get; set; } = string.Empty;
} }
} }

View File

@@ -24,6 +24,9 @@
<li> <li>
<a href="/system/role/list">角色管理</a> <a href="/system/role/list">角色管理</a>
</li> </li>
<li>
<a href="/currency/list">货币设置</a>
</li>
</PageContainer> </PageContainer>
@code { @code {

View File

@@ -0,0 +1,5 @@
<h3>CountryEdit</h3>
@code {
}

View File

@@ -0,0 +1,5 @@
<h3>CountryList</h3>
@code {
}

View File

@@ -0,0 +1,22 @@
@page "/currency/list"
@page "/{locale}/currency/list"
@inject ILogger<CurrencyList> Logger
@attribute [Authorize]
<PageContainer Title="货币管理">
<Breadcrumb>
<Breadcrumb>
<BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
<BreadcrumbItem Href="/admin/list">系统功能</BreadcrumbItem>
<BreadcrumbItem>货币管理</BreadcrumbItem>
</Breadcrumb>
</Breadcrumb>
<ChildContent>
<h3>Tools</h3>
</ChildContent>
</PageContainer>
@code {
[Parameter]
public string Locale { get; set; } = string.Empty;
}

View File

@@ -1,144 +1,162 @@
@page "/setting/messagetemplate/list" @page "/setting/messagetemplate/list"
@page "/{locale}/setting/messagetemplate/list"
@inject ILogger<MessageTemplateList> Logger @inject ILogger<MessageTemplateList> Logger
@attribute [Authorize] @attribute [Authorize]
<PageTitle>消息模板</PageTitle> <PageContainer Title="消息模板">
<Title Level="4">消息模版管理</Title> <Breadcrumb>
<Card> <Breadcrumb>
<Form @ref="searchForm" Model="search" Layout="FormLayout.Inline" Class="search-form" OnFinish="OnSearchFinish"> <BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
<Row Justify="RowJustify.Start" Gutter="16"> <BreadcrumbItem Href="/admin/list">系统功能</BreadcrumbItem>
<Col> <BreadcrumbItem>系统设置</BreadcrumbItem>
<FormItem Label="名称"> </Breadcrumb>
<Input @bind-Value="search.Key" Placeholder="名称" AllowClear /> </Breadcrumb>
</FormItem> <ChildContent>
</Col> <Card>
<Col> <Form @ref="searchForm" Model="search" Layout="FormLayout.Inline" Class="search-form" OnFinish="OnSearchFinish">
<div class="ant-form-item" style="width:200px;display:flex;"> <Row Justify="RowJustify.Start" Gutter="16">
<Button Type="ButtonType.Primary" HtmlType="submit">查询</Button> <Col>
<Button Style="margin: 0 8px;" OnClick="OnSearchReset">重置</Button> <FormItem Label="名称">
</div> <Input @bind-Value="search.Key" Placeholder="名称" AllowClear />
</Col> </FormItem>
</Row> </Col>
</Form> <Col>
</Card> <div class="ant-form-item" style="width:200px;display:flex;">
<Button Type="ButtonType.Primary" HtmlType="submit">查询</Button>
<Button Style="margin: 0 8px;" OnClick="OnSearchReset">重置</Button>
</div>
</Col>
</Row>
</Form>
</Card>
<br />
<Card Class="mt-3">
<Table DataSource="PagingList.Items" PageSize="100" HidePagination="true" Resizable>
<TitleTemplate>
<Flex Justify="FlexJustify.SpaceBetween">
菜单列表
<div>
<Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">新增</Button>
</div>
</Flex>
</TitleTemplate>
<ColumnDefinitions>
<PropertyColumn Property="c => c.Type" Title="模版类型" Width="150px">
@if (context.Type == (int)MessageTemplateType.Message)
{
<AntDesign.Text>站内信</AntDesign.Text>
}
else if (context.Type == (int)MessageTemplateType.Email)
{
<AntDesign.Text>邮件</AntDesign.Text>
}
else if (context.Type == (int)MessageTemplateType.Sms)
{
<AntDesign.Text>短信</AntDesign.Text>
}
</PropertyColumn>
<PropertyColumn Property="c => c.Name" Title="模版名称" />
<PropertyColumn Property="c => c.LanguageId" Title="语言">
@GetLanuageName(context.LanguageId)
</PropertyColumn>
<PropertyColumn Property="c => c.Key" Title="模版Code" Width="100px" />
<PropertyColumn Property="c => c.Title" Title="模版标题" />
<PropertyColumn Property="c => c.Enabled" Title="状态" Width="80px" Align="ColumnAlign.Center">
@if (context.Enabled)
{
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme=" IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text>
<Card Class="mt-3"> }
<Table DataSource="PagingList.Items" PageSize="100" HidePagination="true" Resizable> else
<TitleTemplate> {
<Flex Justify="FlexJustify.SpaceBetween"> <Icon Type="close" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" />
菜单列表 }
<div> </PropertyColumn>
<Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">新增</Button> <PropertyColumn Property="c => c.CreateTime" Title="时间" Width="190px" />
</div> <ActionColumn Title="操作" Align="ColumnAlign.Right" Width="160px">
</Flex> <Space>
</TitleTemplate> <SpaceItem>
<ColumnDefinitions> <Dropdown Trigger="@(new Trigger[] { Trigger.Click })">
<PropertyColumn Property="c => c.Type" Title="模版类型" Width="150px"> <Overlay>
@if (context.Type == (int)MessageTemplateType.Message) <Menu>
{
<AntDesign.Text>站内信</AntDesign.Text>
}
else if (context.Type == (int)MessageTemplateType.Email)
{
<AntDesign.Text>邮件</AntDesign.Text>
}
else if (context.Type == (int)MessageTemplateType.Sms)
{
<AntDesign.Text>短信</AntDesign.Text>
}
</PropertyColumn>
<PropertyColumn Property="c => c.Name" Title="模版名称" />
<PropertyColumn Property="c => c.Key" Title="模版Code" Width="100px" />
<PropertyColumn Property="c => c.Title" Title="模版标题" />
<PropertyColumn Property="c => c.Enabled" Title="状态" Width="80px" Align="ColumnAlign.Center">
@if (context.Enabled)
{
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme=" IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text>
} <MenuItem>
else <a @onclick="(e) => HandleEdit(context)"> <Icon Type="@IconType.Outline.Edit" /> 编辑</a>
{ </MenuItem>
<Icon Type="close" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" /> <MenuDivider />
} <MenuItem>
</PropertyColumn> <Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")"
<PropertyColumn Property="c => c.CreateTime" Title="时间" Width="190px" /> OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))"
<ActionColumn Title="操作" Align="ColumnAlign.Right" Width="160px"> OkText="确定"
<Space> CancelText="取消">
<SpaceItem> <a> <Icon Type="@IconType.Outline.Delete" /> 删除</a>
<Dropdown Trigger="@(new Trigger[] { Trigger.Click })"> </Popconfirm>
<Overlay> </MenuItem>
<Menu> </Menu>
</Overlay>
<MenuItem> <ChildContent>
<a @onclick="(e) => HandleEdit(context)"> <Icon Type="@IconType.Outline.Edit" /> 编辑</a> <a class="ant-dropdown-link" @onclick:preventDefault>
</MenuItem> <Icon Type="@IconType.Outline.Menu" />
<MenuDivider /> </a>
<MenuItem> </ChildContent>
<Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")" </Dropdown>
OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))" </SpaceItem>
OkText="确定" </Space>
CancelText="取消"> </ActionColumn>
<a> <Icon Type="@IconType.Outline.Delete" /> 删除</a> </ColumnDefinitions>
</Popconfirm> </Table>
</MenuItem> <br />
</Menu> <Row Justify="RowJustify.End">
</Overlay> <Pagination PageIndex="PagingList.Index" Total="PagingList.Count" PageSize="PagingList.Size" ShowSizeChanger="false" OnChange="OnPageChanged"></Pagination>
<ChildContent> </Row>
<a class="ant-dropdown-link" @onclick:preventDefault> </Card>
<Icon Type="@IconType.Outline.Menu" />
</a>
</ChildContent>
</Dropdown>
</SpaceItem>
</Space>
</ActionColumn>
</ColumnDefinitions>
</Table>
<Row Justify="RowJustify.End">
<Pagination PageIndex="PagingList.Index" Total="PagingList.Count" PageSize="PagingList.Size" ShowSizeChanger="false" OnChange="OnPageChanged"></Pagination>
</Row>
</Card>
<Modal Title="@("消息模版设置")" Visible="@modalVisible" Width="700" MaskClosable="true" OkText="@("保存")" CancelText="@("取消")" OnOk="@HandleModalOk" OnCancel="@HandleCancel"> <Modal Title="@("消息模版设置")" Visible="@modalVisible" Width="700" MaskClosable="true" OkText="@("保存")" CancelText="@("取消")" OnOk="@HandleModalOk" OnCancel="@HandleCancel">
<Form Model="@template" @ref="@editForm" LabelCol="new ColLayoutParam { Span = 5 }" WrapperCol="new ColLayoutParam { Span = 15 }" Name="modalForm" OnFinish="OnFormFinish"> <Form Model="@model" @ref="@editForm" LabelCol="new ColLayoutParam { Span = 5 }" WrapperCol="new ColLayoutParam { Span = 15 }" Name="modalForm" OnFinish="OnFormFinish">
<FluentValidationValidator /> <FluentValidationValidator />
<FormItem Label="消息模版类型"> <FormItem Label="消息模版类型">
<SimpleSelect DefaultValue="" Style="width:120px;" @bind-Value="@context.Type"> <SimpleSelect DefaultValue="" Style="width:120px;" @bind-Value="@context.Type">
<SelectOptions> <SelectOptions>
<SimpleSelectOption Value="" Label="请选择消息模版类型"></SimpleSelectOption> <SimpleSelectOption Value="" Label="请选择消息模版类型"></SimpleSelectOption>
<SimpleSelectOption Value="@(((int)MessageTemplateType.Message).ToString())" Label="站内信"></SimpleSelectOption> <SimpleSelectOption Value="@(((int)MessageTemplateType.Message).ToString())" Label="站内信"></SimpleSelectOption>
<SimpleSelectOption Value="@(((int)MessageTemplateType.Email).ToString())" Label="邮件模版"></SimpleSelectOption> <SimpleSelectOption Value="@(((int)MessageTemplateType.Email).ToString())" Label="邮件模版"></SimpleSelectOption>
<SimpleSelectOption Value="@(((int)MessageTemplateType.Sms).ToString())" Label="短信模版"></SimpleSelectOption> <SimpleSelectOption Value="@(((int)MessageTemplateType.Sms).ToString())" Label="短信模版"></SimpleSelectOption>
</SelectOptions> </SelectOptions>
</SimpleSelect> </SimpleSelect>
</FormItem> </FormItem>
<FormItem Label="消息模版名称"> <FormItem Label="消息模版名称">
<Input Placeholder="消息模版名称" @bind-Value="@context.Name" /> <Input Placeholder="消息模版名称" @bind-Value="@context.Name" />
</FormItem> </FormItem>
<FormItem Label="语言">
<FormItem Label="模版Code"> <Select DataSource="@languages" @bind-Value="@context.LanguageId" ItemValue="p => p.Id" ItemLabel="p => p.Title" Disabled="@(context.Id > 0)">
<Input Placeholder="模版Code" @bind-Value="@context.Key" Disabled="@(context.Id > 0)" /> </Select>
</FormItem> </FormItem>
<FormItem Label="消息标题"> <FormItem Label="模版Code">
<Input Placeholder="消息标题" @bind-Value="@context.Title" /> <Input Placeholder="模版Code" @bind-Value="@context.Key" Disabled="@(context.Id > 0)" />
</FormItem> </FormItem>
<FormItem Label="消息内容"> <FormItem Label="消息标题">
<TextArea Placeholder="消息内容" @bind-Value="@context.Body" /> <Input Placeholder="消息标题" @bind-Value="@context.Title" />
</FormItem> </FormItem>
<FormItem Label="状态"> <FormItem Label="消息内容">
<Checkbox @bind-Value="@context.Enabled" Disabled=false> <TextArea Placeholder="消息内容" @bind-Value="@context.Body" />
启用 </FormItem>
</Checkbox> <FormItem Label="状态">
</FormItem> <Checkbox @bind-Value="@context.Enabled" Disabled=false>
</Form> 启用
</Modal> </Checkbox>
</FormItem>
</Form>
</Modal>
</ChildContent>
</PageContainer>
@code { @code {
[Parameter]
public string Locale { get; set; } = string.Empty;
[SupplyParameterFromQuery] [SupplyParameterFromQuery]
int? Page { get; set; } int? Page { get; set; }
@@ -147,10 +165,10 @@
Form<MessageTemplateSearch> searchForm = null!; Form<MessageTemplateSearch> searchForm = null!;
[SupplyParameterFromForm] [SupplyParameterFromForm]
MessageTemplateModel template { get; set; } = new(); MessageTemplateModel model { get; set; } = new();
Form<MessageTemplateModel> editForm = null!; Form<MessageTemplateModel> editForm = null!;
List<Language> languages = new();
PagingList<MessageTemplate> PagingList = new(); PagingList<MessageTemplate> PagingList = new();
bool loading { get; set; } = true; bool loading { get; set; } = true;
bool searchExpand { get; set; } = false; bool searchExpand { get; set; } = false;
@@ -166,7 +184,7 @@
{ {
loadQueryString(); loadQueryString();
LoadList(); LoadList();
_ = LoadLanguages();
base.OnParametersSet(); base.OnParametersSet();
} }
@@ -177,6 +195,20 @@
search.Key = query.GetQueryString("Key"); search.Key = query.GetQueryString("Key");
} }
private async Task LoadLanguages()
{
var url = $"/api/language/enabled";
var apiResult = await HttpService.Get<ApiResult<List<Language>>>(url);
if (apiResult.Success)
{
if (apiResult.Data != null)
{
languages = apiResult.Data;
StateHasChanged();
}
}
}
private async void LoadList() private async void LoadList()
{ {
@@ -265,13 +297,13 @@
void OnCreateClick() void OnCreateClick()
{ {
template = new(); model = new();
modalVisible = true; modalVisible = true;
} }
void HandleEdit(MessageTemplate model) void HandleEdit(MessageTemplate data)
{ {
template = model.Adapt<MessageTemplateModel>(); model = data.Adapt<MessageTemplateModel>();
modalVisible = true; modalVisible = true;
} }
@@ -285,18 +317,8 @@
if (editForm.Validate()) if (editForm.Validate())
{ {
var result = new ApiResult<string>(); var result = new ApiResult<string>();
var data = template.Adapt<MessageTemplate>(); var url = $"api/messagetemplate/save";
result = await HttpService.Post<ApiResult<string>>(url, model);
if (template.Id > 0)
{
var url = $"api/messagetemplate/edit";
result = await HttpService.Post<ApiResult<string>>(url, data);
}
else
{
var url = $"api/messagetemplate/add";
result = await HttpService.Post<ApiResult<string>>(url, data);
}
if (result.Code == (int)ResultCode.Success) if (result.Code == (int)ResultCode.Success)
{ {
@@ -314,4 +336,14 @@
{ {
modalVisible = false; modalVisible = false;
} }
string GetLanuageName(int languageId)
{
var language = languages.FirstOrDefault(l => l.Id == languageId);
if (language != null)
{
return language.Title;
}
return "-";
}
} }

View File

@@ -1,7 +1,22 @@
@page "/settings" @page "/settings"
@page "/{locale}/settings"
@attribute [Authorize] @attribute [Authorize]
@inject ILogger<Settings> Logger @inject ILogger<Settings> Logger
@code { <PageContainer Title="系统设置">
<Breadcrumb>
<Breadcrumb>
<BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
<BreadcrumbItem Href="/admin/list">系统功能</BreadcrumbItem>
<BreadcrumbItem>系统设置</BreadcrumbItem>
</Breadcrumb>
</Breadcrumb>
<ChildContent>
<h3>Tools</h3>
</ChildContent>
</PageContainer>
@code {
[Parameter]
public string Locale { get; set; } = string.Empty;
} }

View File

@@ -3,20 +3,19 @@
@inject ILogger<AppVersionList> Logger @inject ILogger<AppVersionList> Logger
@attribute [Authorize] @attribute [Authorize]
<div>
<PageContainer Title="App版本管理"> <PageContainer Title="App版本管理">
<Breadcrumb>
<Breadcrumb> <Breadcrumb>
<Breadcrumb> <BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
<BreadcrumbItem Href="/">管理后台</BreadcrumbItem> <BreadcrumbItem Href="/settings">系统配置</BreadcrumbItem>
<BreadcrumbItem Href="/settings">系统配置</BreadcrumbItem> <BreadcrumbItem>版本管理</BreadcrumbItem>
<BreadcrumbItem>版本管理</BreadcrumbItem>
</Breadcrumb>
</Breadcrumb> </Breadcrumb>
<ChildContent> </Breadcrumb>
<h3>App Version List</h3> <ChildContent>
</ChildContent> <h3>App Version List</h3>
</PageContainer> </ChildContent>
</div> </PageContainer>
@code { @code {

View File

@@ -1,7 +1,22 @@
@page "/system/app/list" @page "/system/app/list"
@page "/{locale}/system/app/list"
@inject ILogger<SiteAppList> Logger @inject ILogger<SiteAppList> Logger
@attribute [Authorize] @attribute [Authorize]
@code { <PageContainer Title="系统工具">
<Breadcrumb>
<Breadcrumb>
<BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
<BreadcrumbItem Href="/admin/list">系统功能</BreadcrumbItem>
<BreadcrumbItem>系统工具</BreadcrumbItem>
</Breadcrumb>
</Breadcrumb>
<ChildContent>
<h3>Tools</h3>
</ChildContent>
</PageContainer>
@code {
[Parameter]
public string Locale { get; set; } = string.Empty;
} }

View File

@@ -1,103 +1,113 @@
@page "/system/file/list" @page "/system/file/list"
@page "/{locale}/system/file/list"
@inject ILogger<UploadList> Logger @inject ILogger<UploadList> Logger
@attribute [Authorize] @attribute [Authorize]
<PageTitle>上传文件</PageTitle> <PageContainer Title="上传文件">
<Title Level="4">上传文件</Title> <Breadcrumb>
<Card> <Breadcrumb>
<Form @ref="searchForm" Model="search" Layout="FormLayout.Inline" Class="search-form" OnFinish="OnSearchFinish"> <BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
<Row Justify="RowJustify.Start" Gutter="16"> <BreadcrumbItem Href="/admin/list">系统功能</BreadcrumbItem>
<Col> <BreadcrumbItem>上传文件</BreadcrumbItem>
<FormItem Label="文件名"> </Breadcrumb>
<Input @bind-Value="search.Name" Placeholder="文件名" AllowClear /> </Breadcrumb>
</FormItem> <ChildContent>
</Col> <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>
<Col> <Col>
<div class="ant-form-item" style="width:200px;display:flex;"> <div class="ant-form-item" style="width:200px;display:flex;">
<Button Type="ButtonType.Primary" HtmlType="submit">查询</Button> <Button Type="ButtonType.Primary" HtmlType="submit">查询</Button>
<Button Style="margin: 0 8px;" OnClick="OnSearchReset">重置</Button> <Button Style="margin: 0 8px;" OnClick="OnSearchReset">重置</Button>
</div> </div>
</Col> </Col>
</Row> </Row>
</Form> </Form>
</Card> </Card>
<Card Class="mt-3"> <Card Class="mt-3">
<Table DataSource="PagingList.Items" PageSize="100" HidePagination="true" Resizable> <Table DataSource="PagingList.Items" PageSize="100" HidePagination="true" Resizable>
<TitleTemplate> <TitleTemplate>
<Flex Justify="FlexJustify.SpaceBetween"> <Flex Justify="FlexJustify.SpaceBetween">
文件列表 文件列表
<div> <div>
<Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">上传新文件</Button> <Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">上传新文件</Button>
</div> </div>
</Flex> </Flex>
</TitleTemplate> </TitleTemplate>
<ColumnDefinitions> <ColumnDefinitions>
<PropertyColumn Property="c => c.Name" Title="文件"> <PropertyColumn Property="c => c.Name" Title="文件">
</PropertyColumn> </PropertyColumn>
<PropertyColumn Property="c => c.ContentType" Title="类型" Width="80px" Align="ColumnAlign.Center"> <PropertyColumn Property="c => c.ContentType" Title="类型" Width="80px" Align="ColumnAlign.Center">
</PropertyColumn> </PropertyColumn>
<PropertyColumn Property="c => c.Size" Title="文件大小" Width="100px" /> <PropertyColumn Property="c => c.Size" Title="文件大小" Width="100px" />
<PropertyColumn Property="c => c.Type" Title="状态" Width="80px" Align="ColumnAlign.Center"> <PropertyColumn Property="c => c.Type" Title="状态" Width="80px" Align="ColumnAlign.Center">
@if (context.Type == 1) @if (context.Type == 1)
{ {
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme=" IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text> <AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme=" IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text>
} }
else else
{ {
<Icon Type="close" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" /> <Icon Type="close" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" />
} }
</PropertyColumn> </PropertyColumn>
<PropertyColumn Property="c => c.CreateTime" Title="最后登录" Width="190px" /> <PropertyColumn Property="c => c.CreateTime" Title="最后登录" Width="190px" />
<PropertyColumn Property="c => c.UpdateTime" Title="最后更新" Width="190px" /> <PropertyColumn Property="c => c.UpdateTime" Title="最后更新" Width="190px" />
<ActionColumn Title="操作" Align="ColumnAlign.Right" Width="160px"> <ActionColumn Title="操作" Align="ColumnAlign.Right" Width="160px">
<Space> <Space>
<SpaceItem> <SpaceItem>
<Dropdown Trigger="@(new Trigger[] { Trigger.Click })"> <Dropdown Trigger="@(new Trigger[] { Trigger.Click })">
<Overlay> <Overlay>
<Menu> <Menu>
<MenuItem> <MenuItem>
<a @onclick="(e) => OnEditClick(context)"> <Icon Type="@IconType.Outline.Edit" /> 编辑</a> <a @onclick="(e) => OnEditClick(context)"> <Icon Type="@IconType.Outline.Edit" /> 编辑</a>
</MenuItem> </MenuItem>
<MenuDivider /> <MenuDivider />
<MenuItem> <MenuItem>
<Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")" <Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")"
OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))" OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))"
OkText="确定" OkText="确定"
CancelText="取消"> CancelText="取消">
<a> <Icon Type="@IconType.Outline.Delete" /> 删除</a> <a> <Icon Type="@IconType.Outline.Delete" /> 删除</a>
</Popconfirm> </Popconfirm>
</MenuItem> </MenuItem>
</Menu> </Menu>
</Overlay> </Overlay>
<ChildContent> <ChildContent>
<a class="ant-dropdown-link" @onclick:preventDefault> <a class="ant-dropdown-link" @onclick:preventDefault>
<Icon Type="@IconType.Outline.Menu" /> <Icon Type="@IconType.Outline.Menu" />
</a> </a>
</ChildContent> </ChildContent>
</Dropdown> </Dropdown>
</SpaceItem> </SpaceItem>
</Space> </Space>
</ActionColumn> </ActionColumn>
</ColumnDefinitions> </ColumnDefinitions>
</Table> </Table>
</Card> </Card>
<Drawer Closable="true" Width="520" Visible="drawerVisible" Title='(model.Id == 0 ? "新增帐号" : "编辑帐号")' OnClose="_ => CloseDrawer()"> <Drawer Closable="true" Width="520" Visible="drawerVisible" Title='(model.Id == 0 ? "新增帐号" : "编辑帐号")' OnClose="_ => CloseDrawer()">
<Form LabelColSpan="5" @ref="@editform" Model="@model" OnFinish="OnFormFinish"> <Form LabelColSpan="5" @ref="@editform" Model="@model" OnFinish="OnFormFinish">
<FluentValidationValidator /> <FluentValidationValidator />
<FormItem Label="帐号名称"> <FormItem Label="帐号名称">
<Input @bind-Value="model.Name" For="(()=>model.Name)" Placeholder="帐号名称" /> <Input @bind-Value="model.Name" For="(()=>model.Name)" Placeholder="帐号名称" />
</FormItem> </FormItem>
<FormItem WrapperColOffset="4"> <FormItem WrapperColOffset="4">
<Button Type="ButtonType.Primary" HtmlType="submit" Style="width: 100%;">保存</Button> <Button Type="ButtonType.Primary" HtmlType="submit" Style="width: 100%;">保存</Button>
</FormItem> </FormItem>
</Form> </Form>
</Drawer> </Drawer>
</ChildContent>
</PageContainer>
@code { @code {
[SupplyParameterFromQuery] [SupplyParameterFromQuery]

View File

@@ -1,9 +0,0 @@
@page "/system/currency/list"
@inject ILogger<CurrencyList> Logger
@attribute [Authorize]
<h3>CurrencyList</h3>
@code {
}

View File

@@ -1,6 +1,17 @@
@page "/system/info" @page "/system/info"
@page "/{locale}/system/info" @page "/{locale}/system/info"
<h3>Info</h3> <PageContainer Title="系统信息">
<Breadcrumb>
<Breadcrumb>
<BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
<BreadcrumbItem Href="/admin/list">系统功能</BreadcrumbItem>
<BreadcrumbItem>系统信息</BreadcrumbItem>
</Breadcrumb>
</Breadcrumb>
<ChildContent>
<h3>Tools</h3>
</ChildContent>
</PageContainer>
@code { @code {
[Parameter] [Parameter]

View File

@@ -1,110 +1,121 @@
@page "/system/language/list" @page "/system/language/list"
@page "/{locale}/system/language/list"
@inject ILogger<LanguageList> Logger @inject ILogger<LanguageList> Logger
@attribute [Authorize] @attribute [Authorize]
<PageTitle>语言管理</PageTitle> <PageContainer Title="语言管理">
<Breadcrumb>
<Breadcrumb>
<BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
<BreadcrumbItem Href="/admin/list">系统功能</BreadcrumbItem>
<BreadcrumbItem>语言管理</BreadcrumbItem>
</Breadcrumb>
</Breadcrumb>
<ChildContent>
<Card Class="mt-3">
<Table DataSource="PagingList.Items" PageSize="100" HidePagination="true" Resizable>
<TitleTemplate>
<Flex Justify="FlexJustify.SpaceBetween">
多语言列表
<div>
<Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">新增</Button>
</div>
</Flex>
</TitleTemplate>
<ColumnDefinitions>
<PropertyColumn Property="c => c.Name" Title="语言名称">
</PropertyColumn>
<PropertyColumn Property="c => c.Title" Title="语言标题">
<Title Level="4">多语言</Title> </PropertyColumn>
<PropertyColumn Property="c => c.Culture" Title="语言文化" Width="100px" />
<PropertyColumn Property="c => c.Enabled" Title="状态" Width="80px" Align="ColumnAlign.Center">
@if (context.Enabled)
{
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme=" IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text>
<Card Class="mt-3"> }
<Table DataSource="PagingList.Items" PageSize="100" HidePagination="true" Resizable> else
<TitleTemplate> {
<Flex Justify="FlexJustify.SpaceBetween"> <Icon Type="close" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" />
多语言列表 }
<div> </PropertyColumn>
<Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">新增</Button> <PropertyColumn Property="c => c.ResourceVersion" Title="资源版本" />
</div> <PropertyColumn Property="c => c.UpdateTime" Title="最后更新" />
</Flex> <ActionColumn Title="操作" Align="ColumnAlign.Right">
</TitleTemplate> <Space>
<ColumnDefinitions> <SpaceItem>
<PropertyColumn Property="c => c.Name" Title="语言名称"> <a href="@($"/system/locale/resource/list/{context.Id}")"> <Icon Type="@IconType.Outline.Edit" /> 语言资源</a>
</PropertyColumn> </SpaceItem>
<PropertyColumn Property="c => c.Title" Title="语言标题"> <SpaceItem>
<Dropdown Trigger="@(new Trigger[] { Trigger.Click })">
<Overlay>
<Menu>
</PropertyColumn> <MenuItem>
<PropertyColumn Property="c => c.Culture" Title="语言文化" Width="100px" /> <a @onclick="(e) => OnEditClick(context)"> <Icon Type="@IconType.Outline.Edit" /> 编辑</a>
<PropertyColumn Property="c => c.Enabled" Title="状态" Width="80px" Align="ColumnAlign.Center"> </MenuItem>
@if (context.Enabled) <MenuDivider />
{ <MenuItem>
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme=" IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text> <Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")"
OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))"
OkText="确定"
CancelText="取消">
<a> <Icon Type="@IconType.Outline.Delete" /> 删除</a>
</Popconfirm>
</MenuItem>
</Menu>
</Overlay>
<ChildContent>
<a class="ant-dropdown-link" @onclick:preventDefault>
<Icon Type="@IconType.Outline.Menu" />
</a>
</ChildContent>
</Dropdown>
</SpaceItem>
</Space>
</ActionColumn>
</ColumnDefinitions>
</Table>
</Card>
} <Drawer Closable="true" Width="520" Visible="drawerVisible" Title='(model.Id == 0 ? "新增语言" : "编辑语言")' OnClose="_ => CloseDrawer()">
else <Form LabelColSpan="5" @ref="@editform" Model="@model" OnFinish="OnFormFinish">
{ <FluentValidationValidator />
<Icon Type="close" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" /> <FormItem Label="语言标题">
} <Input @bind-Value="model.Title" For="(()=>model.Title)" Placeholder="语言标题" />
</PropertyColumn> </FormItem>
<PropertyColumn Property="c => c.ResourceVersion" Title="资源版本"/> <FormItem Label="语言名称">
<PropertyColumn Property="c => c.UpdateTime" Title="最后更新" /> <Input @bind-Value="model.Name" For="(()=>model.Name)" Placeholder="语言名称" />
<ActionColumn Title="操作" Align="ColumnAlign.Right"> </FormItem>
<Space> <FormItem Label="语言文化">
<SpaceItem> <SimpleSelect @bind-Value="model.Culture" For="(()=>model.Culture)" Placeholder="语言文化">
<a href="@($"/system/locale/resource/list/{context.Id}")"> <Icon Type="@IconType.Outline.Edit" /> 语言资源</a> <SelectOptions>
</SpaceItem> @foreach (var item in LanguageCultures)
<SpaceItem> {
<Dropdown Trigger="@(new Trigger[] { Trigger.Click })"> <SimpleSelectOption Value="@item.Key" Label="@($"{item.Value} - {item.Key}")"></SimpleSelectOption>
<Overlay> }
<Menu> </SelectOptions>
</SimpleSelect>
<MenuItem> </FormItem>
<a @onclick="(e) => OnEditClick(context)"> <Icon Type="@IconType.Outline.Edit" /> 编辑</a> <FormItem Label="显示排序">
</MenuItem> <AntDesign.InputNumber @bind-Value="model.DisplayOrder" For="(()=>model.DisplayOrder)" Placeholder="显示排序" />
<MenuDivider /> </FormItem>
<MenuItem> <FormItem Label="可用状态">
<Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")" <Checkbox T="bool" Label="启用" @bind-value="model.Enabled" Size="InputSize.Small" Class="ps-0" />
OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))" </FormItem>
OkText="确定" <FormItem WrapperColOffset="4">
CancelText="取消"> <Button Type="ButtonType.Primary" HtmlType="submit" Style="width: 100%;">保存</Button>
<a> <Icon Type="@IconType.Outline.Delete" /> 删除</a> </FormItem>
</Popconfirm> </Form>
</MenuItem> </Drawer>
</Menu> </ChildContent>
</Overlay> </PageContainer>
<ChildContent>
<a class="ant-dropdown-link" @onclick:preventDefault>
<Icon Type="@IconType.Outline.Menu" />
</a>
</ChildContent>
</Dropdown>
</SpaceItem>
</Space>
</ActionColumn>
</ColumnDefinitions>
</Table>
</Card>
<Drawer Closable="true" Width="520" Visible="drawerVisible" Title='(model.Id == 0 ? "新增语言" : "编辑语言")' OnClose="_ => CloseDrawer()">
<Form LabelColSpan="5" @ref="@editform" Model="@model" OnFinish="OnFormFinish">
<FluentValidationValidator />
<FormItem Label="语言标题">
<Input @bind-Value="model.Title" For="(()=>model.Title)" Placeholder="语言标题" />
</FormItem>
<FormItem Label="语言名称">
<Input @bind-Value="model.Name" For="(()=>model.Name)" Placeholder="语言名称" />
</FormItem>
<FormItem Label="语言文化">
<SimpleSelect @bind-Value="model.Culture" For="(()=>model.Culture)" Placeholder="语言文化">
<SelectOptions>
@foreach (var item in LanguageCultures)
{
<SimpleSelectOption Value="@item.Key" Label="@($"{item.Value} - {item.Key}")"></SimpleSelectOption>
}
</SelectOptions>
</SimpleSelect>
</FormItem>
<FormItem Label="显示排序">
<AntDesign.InputNumber @bind-Value="model.DisplayOrder" For="(()=>model.DisplayOrder)" Placeholder="显示排序" />
</FormItem>
<FormItem Label="可用状态">
<Checkbox T="bool" Label="启用" @bind-value="model.Enabled" Size="InputSize.Small" Class="ps-0" />
</FormItem>
<FormItem WrapperColOffset="4">
<Button Type="ButtonType.Primary" HtmlType="submit" Style="width: 100%;">保存</Button>
</FormItem>
</Form>
</Drawer>
@code { @code {
[Parameter]
public string Locale { get; set; } = string.Empty;
[SupplyParameterFromQuery] [SupplyParameterFromQuery]
int? Page { get; set; } int? Page { get; set; }

View File

@@ -1,92 +1,103 @@
@page "/system/locale/resource/detail/{Name}" @page "/system/locale/resource/detail/{Name}"
@page "/{locale}/system/locale/resource/detail/{Name}"
@inject ILogger<LocaleResourceList> Logger @inject ILogger<LocaleResourceList> Logger
@attribute [Authorize] @attribute [Authorize]
<PageContainer Title="本地化语言资源">
<Breadcrumb>
<Breadcrumb>
<BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
<BreadcrumbItem Href="/admin/list">系统功能</BreadcrumbItem>
<BreadcrumbItem>本地化语言资源</BreadcrumbItem>
</Breadcrumb>
</Breadcrumb>
<ChildContent>
<Spin Spinning="loading">
<Card Class="mt-3">
<Table DataSource="ResourceItems" PageSize="100" HidePagination="true" Resizable>
<TitleTemplate>
<Flex Justify="FlexJustify.SpaceBetween">
@(@Name)多语言资源列表,可用语言@(@languages.Count)种
<div>
<Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">新增</Button>
</div>
</Flex>
</TitleTemplate>
<ColumnDefinitions>
<PropertyColumn Property="c => c.Name" Title="资源Key">
</PropertyColumn>
<PropertyColumn Property="c => c.Title" Title="语言">
</PropertyColumn>
<PropertyColumn Property="c => c.Value" Title="内容">
<PageTitle>本地化语言资源</PageTitle> </PropertyColumn>
<Title Level="4">多语言本地资源管理</Title> <PropertyColumn Property="c => c.UpdateTime" Title="最后更新" Width="120px" />
<Spin Spinning="loading"> <ActionColumn Title="操作" Align="ColumnAlign.Right" Width="100px">
<Card Class="mt-3"> <Space>
<Table DataSource="ResourceItems" PageSize="100" HidePagination="true" Resizable> <SpaceItem>
<TitleTemplate> <Dropdown Trigger="@(new Trigger[] { Trigger.Click })">
<Flex Justify="FlexJustify.SpaceBetween"> <Overlay>
@(@Name)多语言资源列表,可用语言@(@languages.Count)种 <Menu>
<div>
<Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">新增</Button>
</div>
</Flex>
</TitleTemplate>
<ColumnDefinitions>
<PropertyColumn Property="c => c.Name" Title="资源Key">
</PropertyColumn>
<PropertyColumn Property="c => c.Title" Title="语言">
</PropertyColumn>
<PropertyColumn Property="c => c.Value" Title="内容">
</PropertyColumn> <MenuItem>
<PropertyColumn Property="c => c.UpdateTime" Title="最后更新" Width="120px" /> <a @onclick="(e) => OnEditClick(context)"> <Icon Type="@IconType.Outline.Edit" /> 编辑</a>
<ActionColumn Title="操作" Align="ColumnAlign.Right" Width="100px"> </MenuItem>
<Space> <MenuDivider />
<SpaceItem> <MenuItem>
<Dropdown Trigger="@(new Trigger[] { Trigger.Click })"> <Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")"
<Overlay> OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))"
<Menu> OkText="确定"
CancelText="取消">
<a> <Icon Type="@IconType.Outline.Delete" /> 删除</a>
</Popconfirm>
</MenuItem>
</Menu>
</Overlay>
<ChildContent>
<a class="ant-dropdown-link" @onclick:preventDefault>
<Icon Type="@IconType.Outline.Menu" />
</a>
</ChildContent>
</Dropdown>
</SpaceItem>
</Space>
</ActionColumn>
</ColumnDefinitions>
</Table>
</Card>
</Spin>
<MenuItem> <Modal Title="@("语言资源设置")" Visible="@modalVisible" Width="700" MaskClosable="true" OkText="@("保存")" CancelText="@("取消")" OnOk="@HandleModalOk" OnCancel="@HandleCancel">
<a @onclick="(e) => OnEditClick(context)"> <Icon Type="@IconType.Outline.Edit" /> 编辑</a> <Form Model="@model" @ref="@editform" LabelCol="new ColLayoutParam { Span = 5 }" WrapperCol="new ColLayoutParam { Span = 15 }" Name="modalForm" OnFinish="OnFormFinish">
</MenuItem> <FluentValidationValidator />
<MenuDivider /> <FormItem Label="语言文字">
<MenuItem> @if (context.Id == 0)
<Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")" {
OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))" <Select DataSource="@languages" @bind-Value="@context.LanguageId" ItemValue="p => p.Id" ItemLabel="p => p.Title">
OkText="确定" </Select>
CancelText="取消"> }
<a> <Icon Type="@IconType.Outline.Delete" /> 删除</a> else
</Popconfirm> {
</MenuItem> <Input Placeholder="资源名称" @bind-Value="@context.Title" Disabled />
</Menu> }
</Overlay>
<ChildContent>
<a class="ant-dropdown-link" @onclick:preventDefault>
<Icon Type="@IconType.Outline.Menu" />
</a>
</ChildContent>
</Dropdown>
</SpaceItem>
</Space>
</ActionColumn>
</ColumnDefinitions>
</Table>
</Card>
</Spin>
<Modal Title="@("语言资源设置")" Visible="@modalVisible" Width="700" MaskClosable="true" OkText="@("保存")" CancelText="@("取消")" OnOk="@HandleModalOk" OnCancel="@HandleCancel"> </FormItem>
<Form Model="@model" @ref="@editform" LabelCol="new ColLayoutParam { Span = 5 }" WrapperCol="new ColLayoutParam { Span = 15 }" Name="modalForm" OnFinish="OnFormFinish"> <FormItem Label="资源名称">
<FluentValidationValidator /> <Input Placeholder="资源名称" @bind-Value="@context.Name" Disabled />
<FormItem Label="语言文字"> </FormItem>
@if (context.Id == 0) <FormItem Label="资源内容">
{ <TextArea Placeholder="资源内容" @bind-Value="@context.Value" />
<Select DataSource="@languages" @bind-Value="@context.LanguageId" ItemValue="p => p.Id" ItemLabel="p => p.Title"> </FormItem>
</Select> </Form>
} </Modal>
else </ChildContent>
{ </PageContainer>
<Input Placeholder="资源名称" @bind-Value="@context.Title" Disabled />
}
</FormItem>
<FormItem Label="资源名称">
<Input Placeholder="资源名称" @bind-Value="@context.Name" Disabled />
</FormItem>
<FormItem Label="资源内容">
<TextArea Placeholder="资源内容" @bind-Value="@context.Value" />
</FormItem>
</Form>
</Modal>
@code { @code {
bool loading = false; bool loading = false;
[Parameter]
public string Locale { get; set; } = string.Empty;
[Parameter] [Parameter]
public string Name { get; set; } public string Name { get; set; }

View File

@@ -1,111 +1,121 @@
@page "/system/locale/resource/list/{Id:int}" @page "/system/locale/resource/list/{Id:int}"
@page "/{locale}/system/locale/resource/list/{Id:int}"
@inject ILogger<LocaleResourceList> Logger @inject ILogger<LocaleResourceList> Logger
@attribute [Authorize] @attribute [Authorize]
<PageContainer Title="多语言本地资源管理">
<Breadcrumb>
<Breadcrumb>
<BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
<BreadcrumbItem Href="/admin/list">系统功能</BreadcrumbItem>
<BreadcrumbItem>多语言本地资源管理</BreadcrumbItem>
</Breadcrumb>
</Breadcrumb>
<ChildContent>
<Spin Spinning="loading">
<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>
<Col>
<FormItem Label="内容">
<Input @bind-Value="search.Value" Placeholder="名称" AllowClear />
</FormItem>
</Col>
<Col>
<div class="ant-form-item" style="width:200px;display:flex;">
<Button Type="ButtonType.Primary" HtmlType="submit">查询</Button>
<Button Style="margin: 0 8px;" OnClick="OnSearchReset">重置</Button>
</div>
</Col>
</Row>
</Form>
</Card>
<br />
<Card Class="mt-3">
<Table DataSource="PagingList.Items" PageSize="100" HidePagination="true" Resizable>
<TitleTemplate>
<Flex Justify="FlexJustify.SpaceBetween">
@(@language.Name)语言资源列表
<div>
<Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">新增</Button>
</div>
</Flex>
</TitleTemplate>
<ColumnDefinitions>
<PropertyColumn Property="c => c.Name" Title="资源Key">
</PropertyColumn>
<PropertyColumn Property="c => c.Value" Title="内容">
<PageTitle>本地化语言资源</PageTitle> </PropertyColumn>
<Title Level="4">多语言本地资源管理</Title> <PropertyColumn Property="c => c.UpdateTime" Title="最后更新" Width="120px" />
<Spin Spinning="loading"> <ActionColumn Title="操作" Align="ColumnAlign.Right" Width="120px">
<Card> <Space>
<Form @ref="searchForm" Model="search" Layout="FormLayout.Inline" Class="search-form" OnFinish="OnSearchFinish"> <SpaceItem>
<Row Justify="RowJustify.Start" Gutter="16"> <a @onclick="(e) => OnEditClick(context)"> <Icon Type="@IconType.Outline.Edit" /> 编辑</a>
<Col> </SpaceItem>
<FormItem Label="名称"> <SpaceItem>
<Input @bind-Value="search.Name" Placeholder="名称" AllowClear /> <Dropdown Trigger="@(new Trigger[] { Trigger.Click })">
<Overlay>
<Menu>
<MenuItem>
<a href="@($"/system/locale/resource/detail/{context.Name}")"> <Icon Type="@IconType.Outline.Edit" /> 其他语言比对</a>
</MenuItem>
<MenuDivider />
<MenuItem>
<Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")"
OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))"
OkText="确定"
CancelText="取消">
<a> <Icon Type="@IconType.Outline.Delete" /> 删除</a>
</Popconfirm>
</MenuItem>
</Menu>
</Overlay>
<ChildContent>
<a class="ant-dropdown-link" @onclick:preventDefault>
<Icon Type="@IconType.Outline.Menu" />
</a>
</ChildContent>
</Dropdown>
</SpaceItem>
</Space>
</ActionColumn>
</ColumnDefinitions>
</Table>
<br />
<Row Justify="RowJustify.End">
<Pagination PageIndex="pager.Index" Total="PagingList.Count" PageSize="PagingList.Size" ShowSizeChanger="false" OnChange="OnPageChanged"></Pagination>
</Row>
</Card>
</Spin>
<Modal Title="@("语言资源设置")" Visible="@modalVisible" Width="700" MaskClosable="true" OkText="@("保存")" CancelText="@("取消")" OnOk="@HandleModalOk" OnCancel="@HandleCancel">
<Form Model="@model" @ref="@editform" LabelCol="new ColLayoutParam { Span = 5 }" WrapperCol="new ColLayoutParam { Span = 15 }" Name="modalForm" OnFinish="OnFormFinish">
<FluentValidationValidator />
<FormItem Label="语言文字">
@language.Name
</FormItem> </FormItem>
</Col> <FormItem Label="资源名称">
<Col> <Input Placeholder="资源名称" @bind-Value="@context.Name" />
<FormItem Label="内容">
<Input @bind-Value="search.Value" Placeholder="名称" AllowClear />
</FormItem> </FormItem>
</Col> <FormItem Label="资源内容">
<Col> <TextArea Placeholder="资源内容" @bind-Value="@context.Value" />
<div class="ant-form-item" style="width:200px;display:flex;"> </FormItem>
<Button Type="ButtonType.Primary" HtmlType="submit">查询</Button> </Form>
<Button Style="margin: 0 8px;" OnClick="OnSearchReset">重置</Button> </Modal>
</div> </ChildContent>
</Col> </PageContainer>
</Row>
</Form>
</Card>
<br />
<Card Class="mt-3">
<Table DataSource="PagingList.Items" PageSize="100" HidePagination="true" Resizable>
<TitleTemplate>
<Flex Justify="FlexJustify.SpaceBetween">
@(@language.Name)语言资源列表
<div>
<Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">新增</Button>
</div>
</Flex>
</TitleTemplate>
<ColumnDefinitions>
<PropertyColumn Property="c => c.Name" Title="资源Key">
</PropertyColumn>
<PropertyColumn Property="c => c.Value" Title="内容">
</PropertyColumn>
<PropertyColumn Property="c => c.UpdateTime" Title="最后更新" Width="120px" />
<ActionColumn Title="操作" Align="ColumnAlign.Right" Width="120px">
<Space>
<SpaceItem>
<a @onclick="(e) => OnEditClick(context)"> <Icon Type="@IconType.Outline.Edit" /> 编辑</a>
</SpaceItem>
<SpaceItem>
<Dropdown Trigger="@(new Trigger[] { Trigger.Click })">
<Overlay>
<Menu>
<MenuItem>
<a href="@($"/system/locale/resource/detail/{context.Name}")"> <Icon Type="@IconType.Outline.Edit" /> 其他语言比对</a>
</MenuItem>
<MenuDivider />
<MenuItem>
<Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")"
OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))"
OkText="确定"
CancelText="取消">
<a> <Icon Type="@IconType.Outline.Delete" /> 删除</a>
</Popconfirm>
</MenuItem>
</Menu>
</Overlay>
<ChildContent>
<a class="ant-dropdown-link" @onclick:preventDefault>
<Icon Type="@IconType.Outline.Menu" />
</a>
</ChildContent>
</Dropdown>
</SpaceItem>
</Space>
</ActionColumn>
</ColumnDefinitions>
</Table>
<br />
<Row Justify="RowJustify.End">
<Pagination PageIndex="pager.Index" Total="PagingList.Count" PageSize="PagingList.Size" ShowSizeChanger="false" OnChange="OnPageChanged"></Pagination>
</Row>
</Card>
</Spin>
<Modal Title="@("语言资源设置")" Visible="@modalVisible" Width="700" MaskClosable="true" OkText="@("保存")" CancelText="@("取消")" OnOk="@HandleModalOk" OnCancel="@HandleCancel">
<Form Model="@model" @ref="@editform" LabelCol="new ColLayoutParam { Span = 5 }" WrapperCol="new ColLayoutParam { Span = 15 }" Name="modalForm" OnFinish="OnFormFinish">
<FluentValidationValidator />
<FormItem Label="语言文字">
@language.Name
</FormItem>
<FormItem Label="资源名称">
<Input Placeholder="资源名称" @bind-Value="@context.Name" />
</FormItem>
<FormItem Label="资源内容">
<TextArea Placeholder="资源内容" @bind-Value="@context.Value" />
</FormItem>
</Form>
</Modal>
@code { @code {
bool loading = false; bool loading = false;
[Parameter]
public string Locale { get; set; } = string.Empty;
[Parameter] [Parameter]
public int Id { get; set; } public int Id { get; set; }

View File

@@ -1,142 +1,152 @@
@page "/system/menu/list" @page "/system/menu/list"
@page "/{locale}/system/menu/list"
@inject ILogger<MenuList> Logger @inject ILogger<MenuList> Logger
@using MenuItem = Atomx.Admin.Client.Models.MenuItem @using MenuItem = Atomx.Admin.Client.Models.MenuItem
@using Menu = Atomx.Common.Entities.Menu @using Menu = Atomx.Common.Entities.Menu
@attribute [Authorize] @attribute [Authorize]
<PageTitle>菜单管理</PageTitle> <PageContainer Title="菜单管理">
<Breadcrumb>
<Breadcrumb>
<BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
<BreadcrumbItem Href="/admin/list">系统功能</BreadcrumbItem>
<BreadcrumbItem>菜单管理</BreadcrumbItem>
</Breadcrumb>
</Breadcrumb>
<ChildContent>
<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>
<Title Level="4">菜单管理</Title> <Col>
<Card> <div class="ant-form-item" style="width:200px;display:flex;">
<Form @ref="searchForm" Model="search" Layout="FormLayout.Inline" Class="search-form" OnFinish="OnSearchFinish"> <Button Type="ButtonType.Primary" HtmlType="submit">查询</Button>
<Row Justify="RowJustify.Start" Gutter="16"> <Button Style="margin: 0 8px;" OnClick="OnSearchReset">重置</Button>
<Col> </div>
<FormItem Label="名称"> </Col>
<Input @bind-Value="search.Name" Placeholder="名称" AllowClear /> </Row>
</FormItem> </Form>
</Col> </Card>
<Card Class="mt-3">
<Table DataSource="Menus" PageSize="100" HidePagination="true" Resizable>
<TitleTemplate>
<Flex Justify="FlexJustify.SpaceBetween">
菜单列表
<div>
<Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">新增</Button>
</div>
<Col> </Flex>
<div class="ant-form-item" style="width:200px;display:flex;"> </TitleTemplate>
<Button Type="ButtonType.Primary" HtmlType="submit">查询</Button> <ColumnDefinitions>
<Button Style="margin: 0 8px;" OnClick="OnSearchReset">重置</Button> <PropertyColumn Property="c => c.Name" Title="名称">
</div> <AntDesign.Text>@GetName(context)</AntDesign.Text>
</Col> </PropertyColumn>
</Row> <PropertyColumn Property="c => c.Icon" Title="图标" Width="60px" Align="ColumnAlign.Center">
</Form> @if (!string.IsNullOrEmpty(context.Icon))
</Card> {
<Card Class="mt-3"> <Icon Type="@context.Icon" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" />
<Table DataSource="Menus" PageSize="100" HidePagination="true" Resizable> }
<TitleTemplate> </PropertyColumn>
<Flex Justify="FlexJustify.SpaceBetween"> <PropertyColumn Property="c => c.Key" Title="分组标识" Ellipsis />
菜单列表 <PropertyColumn Property="c => c.Url" Title="链接" />
<div> <PropertyColumn Property="c => c.DisplayOrder" Title="排序" Width="80px" Align="ColumnAlign.Center" />
<Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">新增</Button> <PropertyColumn Property="c => c.Enabled" Title="状态" Width="80px" Align="ColumnAlign.Center">
</div> @if (context.Enabled)
{
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme=" IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text>
</Flex> }
</TitleTemplate> else
<ColumnDefinitions> {
<PropertyColumn Property="c=>c.Name" Title="名称"> <Icon Type="close" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" />
<AntDesign.Text>@GetName(context)</AntDesign.Text> }
</PropertyColumn> </PropertyColumn>
<PropertyColumn Property="c=>c.Icon" Title="图标" Width="60px" Align="ColumnAlign.Center"> <PropertyColumn Property="c => c.CreateTime" Title="时间" Width="150px" />
@if (!string.IsNullOrEmpty(context.Icon)) { <ActionColumn Title="操作" Align="ColumnAlign.Right" Width="120px">
<Icon Type="@context.Icon" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" /> <Space>
} <SpaceItem>
</PropertyColumn> <a @onclick="(e) => OnEditClick(context)">编辑</a>
<PropertyColumn Property="c=>c.Key" Title="分组标识" Ellipsis/> </SpaceItem>
<PropertyColumn Property="c=>c.Url" Title="链接" /> <SpaceItem>
<PropertyColumn Property="c=>c.DisplayOrder" Title="排序" Width="80px" Align="ColumnAlign.Center" /> <Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")"
<PropertyColumn Property="c=>c.Enabled" Title="状态" Width="80px" Align="ColumnAlign.Center"> OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))"
@if (context.Enabled) OkText="确定"
CancelText="取消">
<a>删除</a>
</Popconfirm>
</SpaceItem>
</Space>
</ActionColumn>
</ColumnDefinitions>
</Table>
</Card>
<Drawer Closable="true" Width="520" Visible="drawerVisible" Title='("设置菜单")' OnClose="_ => CloseDrawer()">
<Form LabelColSpan="4" @ref="@editform" Model="@menu" Class="px-5" OnFinish="OnFormFinish">
<FluentValidationValidator />
<FormItem Label="名称">
<Input @bind-Value="menu.Name" For="(()=>menu.Name)" />
</FormItem>
<FormItem Label="分组标识">
<Input @bind-Value="menu.Key" For="(()=>menu.Key)" />
</FormItem>
<FormItem Label="链接">
<Input @bind-Value="menu.Url" For="(()=>menu.Url)" />
</FormItem>
<FormItem Label="上级分类">
<Select @bind-Value="@menu.ParentId" TItemValue="long" TItem="string" Placeholder="请选择上级分类">
<SelectOptions>
<SelectOption Value="0L" Label="无" />
@foreach (var item in Menus)
{
<SelectOption Value="@item.Id" Label="@GetName(item)" />
}
</SelectOptions>
</Select>
</FormItem>
@if (menu.ParentId == 0)
{ {
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme=" IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text>
<FormItem Label="图标">
<Select ItemValue="c => c"
ItemLabel="c => c"
DataSource="IconsExtension.IconList()"
@bind-Value="@menu.Icon">
<ItemTemplate Context="Icon">
<p class="mt-2"><Icon Type="@Icon" /> @Icon</p>
</ItemTemplate>
<LabelTemplate Context="Icon">
<p class="mt-1"><Icon Type="@Icon" /> @Icon</p>
</LabelTemplate>
</Select>
</FormItem>
} }
else <FormItem Label="显示排序">
{ <Input @bind-Value="menu.DisplayOrder" For="(()=>menu.DisplayOrder)" />
<Icon Type="close" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" /> </FormItem>
} <FormItem Label="状态">
</PropertyColumn> <Checkbox T="bool" Label="启用" @bind-value="menu.Enabled" Size="InputSize.Small" Class="ps-0" />
<PropertyColumn Property="c=>c.CreateTime" Title="时间" Width="150px" /> </FormItem>
<ActionColumn Title="操作" Align="ColumnAlign.Right" Width="120px"> <FormItem WrapperColOffset="4">
<Space> <Button Type="ButtonType.Primary" HtmlType="submit" Class="mt-5" Style="width: 100%;">保存</Button>
<SpaceItem> </FormItem>
<a @onclick="(e)=>OnEditClick(context)">编辑</a> </Form>
</SpaceItem> </Drawer>
<SpaceItem> </ChildContent>
<Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")" </PageContainer>
OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))"
OkText="确定"
CancelText="取消">
<a>删除</a>
</Popconfirm>
</SpaceItem>
</Space>
</ActionColumn>
</ColumnDefinitions>
</Table>
</Card>
<Drawer Closable="true" Width="520" Visible="drawerVisible" Title='("设置菜单")' OnClose="_=>CloseDrawer()">
<Form LabelColSpan="4" @ref="@editform" Model="@menu" Class="px-5" OnFinish="OnFormFinish">
<FluentValidationValidator />
<FormItem Label="名称">
<Input @bind-Value="menu.Name" For="(()=>menu.Name)" />
</FormItem>
<FormItem Label="分组标识">
<Input @bind-Value="menu.Key" For="(()=>menu.Key)" />
</FormItem>
<FormItem Label="链接">
<Input @bind-Value="menu.Url" For="(()=>menu.Url)" />
</FormItem>
<FormItem Label="上级分类">
<Select @bind-Value="@menu.ParentId" TItemValue="long" TItem="string" Placeholder="请选择上级分类">
<SelectOptions>
<SelectOption Value="0L" Label="无" />
@foreach(var item in Menus)
{
<SelectOption Value="@item.Id" Label="@GetName(item)" />
}
</SelectOptions>
</Select>
</FormItem>
@if (menu.ParentId == 0)
{
<FormItem Label="图标">
<Select ItemValue="c=>c"
ItemLabel="c=>c"
DataSource="IconsExtension.IconList()"
@bind-Value="@menu.Icon">
<ItemTemplate Context="Icon">
<p class="mt-2"><Icon Type="@Icon" /> @Icon</p>
</ItemTemplate>
<LabelTemplate Context="Icon">
<p class="mt-1"><Icon Type="@Icon" /> @Icon</p>
</LabelTemplate>
</Select>
</FormItem>
}
<FormItem Label="显示排序">
<Input @bind-Value="menu.DisplayOrder" For="(()=>menu.DisplayOrder)" />
</FormItem>
<FormItem Label="状态">
<Checkbox T="bool" Label="启用" @bind-value="menu.Enabled" Size="InputSize.Small" Class="ps-0" />
</FormItem>
<FormItem WrapperColOffset="4">
<Button Type="ButtonType.Primary" HtmlType="submit" Class="mt-5" Style="width: 100%;">保存</Button>
</FormItem>
</Form >
</Drawer>
@code { @code {
[Parameter]
public string Locale { get; set; } = string.Empty;
[SupplyParameterFromQuery] [SupplyParameterFromQuery]
int? Page { get; set; } int? Page { get; set; }
@@ -285,7 +295,7 @@
CloseDrawer(); CloseDrawer();
LoadList(); LoadList();
await ModalService.InfoAsync(new ConfirmOptions() { Title="提示", Content="数据提交成功!" }); await ModalService.InfoAsync(new ConfirmOptions() { Title = "提示", Content = "数据提交成功!" });
} }
else else
{ {

View File

@@ -1,7 +1,18 @@
@page "/system/tools" @page "/system/tools"
@page "/{locale}/system/tools" @page "/{locale}/system/tools"
<h3>Tools</h3> <PageContainer Title="系统工具">
<Breadcrumb>
<Breadcrumb>
<BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
<BreadcrumbItem Href="/admin/list">系统功能</BreadcrumbItem>
<BreadcrumbItem>系统工具</BreadcrumbItem>
</Breadcrumb>
</Breadcrumb>
<ChildContent>
<h3>Tools</h3>
</ChildContent>
</PageContainer>
@code { @code {
[Parameter] [Parameter]

View File

@@ -1,13 +0,0 @@
using Atomx.Common.Entities;
using FluentValidation;
namespace Atomx.Admin.Client.Validators
{
public class MaterialBatchValidator : AbstractValidator<MaterialBatch>
{
public MaterialBatchValidator()
{
RuleFor(p => p.Price).NotEmpty().WithMessage("价格不能为空");
}
}
}

View File

@@ -1,13 +0,0 @@
using Atomx.Common.Entities;
using FluentValidation;
namespace Atomx.Admin.Client.Validators
{
public class MaterialRecordValidator : AbstractValidator<MaterialRecord>
{
public MaterialRecordValidator()
{
RuleFor(p => p.UserId).NotEmpty().WithMessage("名称不能为空");
}
}
}

View File

@@ -1,13 +0,0 @@
using Atomx.Common.Entities;
using FluentValidation;
namespace Atomx.Admin.Client.Validators
{
public class MaterialValidator : AbstractValidator<Material>
{
public MaterialValidator()
{
//RuleFor(p => p.Name).NotEmpty().WithMessage("名称不能为空");
}
}
}

View File

@@ -1,11 +1,12 @@
using Atomx.Admin.Client.Models; using Atomx.Admin.Client.Models;
using FluentValidation; using FluentValidation;
using Microsoft.Extensions.Localization;
namespace Atomx.Admin.Client.Validators namespace Atomx.Admin.Client.Validators
{ {
public class MessageTemplateModelValidator : AbstractValidator<MessageTemplateModel> public class MessageTemplateModelValidator : AbstractValidator<MessageTemplateModel>
{ {
public MessageTemplateModelValidator() public MessageTemplateModelValidator(IStringLocalizer<MessageTemplateModelValidator> localizer)
{ {
RuleFor(p => p.Name).NotEmpty().WithMessage("消息模板名称不能为空"); RuleFor(p => p.Name).NotEmpty().WithMessage("消息模板名称不能为空");
RuleFor(p => p.Title).NotEmpty().WithMessage("消息模板标题不能为空"); RuleFor(p => p.Title).NotEmpty().WithMessage("消息模板标题不能为空");

View File

@@ -1,16 +1,14 @@
using Atomx.Admin.Client.Models; using Atomx.Admin.Client.Models;
using Atomx.Admin.Client.Validators;
using Atomx.Admin.Services; using Atomx.Admin.Services;
using Atomx.Common.Entities;
using Atomx.Common.Models; using Atomx.Common.Models;
using Atomx.Data; using Atomx.Data;
using Atomx.Data.CacheServices; using Atomx.Data.CacheServices;
using Atomx.Data.Services; using Atomx.Data.Services;
using Atomx.Utils.Extension; using FluentValidation;
using Atomx.Utils.Models;
using MapsterMapper; using MapsterMapper;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
namespace Atomx.Admin.Controllers namespace Atomx.Admin.Controllers
{ {
@@ -26,6 +24,8 @@ namespace Atomx.Admin.Controllers
private readonly IMapper _mapper; private readonly IMapper _mapper;
private readonly JwtSetting _jwtSettings; private readonly JwtSetting _jwtSettings;
private readonly ICacheService _cacheService; private readonly ICacheService _cacheService;
readonly IValidator<CurrencyModel> _validator;
readonly IStringLocalizer<CurrencyController> _localizer;
/// <summary> /// <summary>
@@ -38,7 +38,8 @@ namespace Atomx.Admin.Controllers
/// <param name="mapper"></param> /// <param name="mapper"></param>
/// <param name="jwtSettings"></param> /// <param name="jwtSettings"></param>
/// <param name="cacheService"></param> /// <param name="cacheService"></param>
public CurrencyController(ILogger<CurrencyController> logger, IIdCreatorService idCreator, IIdentityService identityService, DataContext dbContext, IMapper mapper, JwtSetting jwtSettings, ICacheService cacheService) public CurrencyController(ILogger<CurrencyController> logger, IIdCreatorService idCreator, IIdentityService identityService,
DataContext dbContext, IMapper mapper, JwtSetting jwtSettings, ICacheService cacheService,IValidator<CurrencyModel> validator, IStringLocalizer<CurrencyController> stringLocalizer)
{ {
_logger = logger; _logger = logger;
_idCreator = idCreator; _idCreator = idCreator;
@@ -47,6 +48,8 @@ namespace Atomx.Admin.Controllers
_mapper = mapper; _mapper = mapper;
_jwtSettings = jwtSettings; _jwtSettings = jwtSettings;
_cacheService = cacheService; _cacheService = cacheService;
_validator = validator;
_localizer = stringLocalizer;
} }
///// <summary> ///// <summary>

View File

@@ -1,4 +1,5 @@
using Atomx.Admin.Client.Models; using AntDesign;
using Atomx.Admin.Client.Models;
using Atomx.Admin.Client.Validators; using Atomx.Admin.Client.Validators;
using Atomx.Admin.Services; using Atomx.Admin.Services;
using Atomx.Common.Entities; using Atomx.Common.Entities;
@@ -6,9 +7,11 @@ using Atomx.Common.Models;
using Atomx.Data; using Atomx.Data;
using Atomx.Data.CacheServices; using Atomx.Data.CacheServices;
using Atomx.Data.Services; using Atomx.Data.Services;
using FluentValidation;
using MapsterMapper; using MapsterMapper;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Localization;
namespace Atomx.Admin.Controllers namespace Atomx.Admin.Controllers
{ {
@@ -22,6 +25,8 @@ namespace Atomx.Admin.Controllers
readonly IMapper _mapper; readonly IMapper _mapper;
readonly DataContext _dbContext; readonly DataContext _dbContext;
readonly ICacheService _cacheService; readonly ICacheService _cacheService;
readonly IValidator<MessageTemplateModel> _validator;
readonly IStringLocalizer<MessageTemplateController> _localizer;
/// <summary> /// <summary>
/// ///
@@ -31,7 +36,8 @@ namespace Atomx.Admin.Controllers
/// <param name="idCreator"></param> /// <param name="idCreator"></param>
/// <param name="messageTemplateService"></param> /// <param name="messageTemplateService"></param>
/// <param name="mapper"></param> /// <param name="mapper"></param>
public MessageTemplateController(ILogger<MessageTemplateController> logger, IIdentityService identityService, IIdCreatorService idCreator, IMapper mapper, DataContext dataContext, ICacheService cacheService) public MessageTemplateController(ILogger<MessageTemplateController> logger, IIdentityService identityService,
IIdCreatorService idCreator, IMapper mapper, DataContext dataContext, ICacheService cacheService, IValidator<MessageTemplateModel> validator, IStringLocalizer<MessageTemplateController> stringLocalizer)
{ {
_logger = logger; _logger = logger;
_identityService = identityService; _identityService = identityService;
@@ -39,6 +45,8 @@ namespace Atomx.Admin.Controllers
_mapper = mapper; _mapper = mapper;
_dbContext = dataContext; _dbContext = dataContext;
_cacheService = cacheService; _cacheService = cacheService;
_validator = validator;
_localizer = stringLocalizer;
} }
@@ -64,6 +72,12 @@ namespace Atomx.Admin.Controllers
where p.Type == search.Type where p.Type == search.Type
select p; select p;
} }
if (search.Language.HasValue)
{
query = from p in query
where p.LanguageId == search.Language
select p;
}
if (!string.IsNullOrEmpty(search.Key)) if (!string.IsNullOrEmpty(search.Key))
{ {
query = from p in query query = from p in query
@@ -107,81 +121,57 @@ namespace Atomx.Admin.Controllers
} }
/// <summary> /// <summary>
/// 添加版本信息 /// 保存消息模板配置
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("add")] [HttpPost("save")]
public IActionResult Add(MessageTemplateModel model) public async Task<IActionResult> SaveAsync(MessageTemplateModel model)
{ {
var result = new ApiResult<string>(); var validation = await _validator.ValidateAsync(model);
var validator = new MessageTemplateModelValidator();
var validation = validator.Validate(model);
if (!validation.IsValid) if (!validation.IsValid)
{ {
var message = validation.Errors.FirstOrDefault()?.ErrorMessage; var message = validation.Errors.FirstOrDefault()?.ErrorMessage ?? string.Empty;
result = result.IsFail(message ?? string.Empty, null); return new JsonResult(new ApiResult<string>().IsFail(message, null));
return new JsonResult(result);
} }
try try
{ {
model.Id = _idCreator.CreateId(); var data = _dbContext.MessageTemplates.SingleOrDefault(p => p.Key == model.Key && p.LanguageId == model.LanguageId && p.SiteId == model.SiteId && p.Id != model.Id);
var message = _mapper.Map<MessageTemplate>(model); if (data != null)
message.CreateTime = DateTime.UtcNow; {
return new JsonResult(new ApiResult<string>().IsFail("当前站点语言下已经存在这个配置,请认真检查", null));
}
_dbContext.MessageTemplates.Add(message); if (model.Id > 0)
var count = _dbContext.SaveChanges(); {
data = _dbContext.MessageTemplates.SingleOrDefault(p => p.Id == model.Id);
if (data == null)
{
return new JsonResult(new ApiResult<string>().IsFail("数据不存在", null));
}
data = _mapper.Map<MessageTemplateModel, MessageTemplate>(model, data);
data.UpdateTime = DateTime.UtcNow;
_dbContext.SaveChanges();
}
else
{
model.Id = _idCreator.CreateId();
data = _mapper.Map<MessageTemplate>(model);
data.CreateTime = DateTime.UtcNow;
_dbContext.MessageTemplates.Add(data);
_dbContext.SaveChanges();
}
result = result.IsSuccess(count.ToString());
return new JsonResult(new ApiResult<string>().IsSuccess("操作成功"));
} }
catch (Exception ex) catch (Exception ex)
{ {
result = result.IsFail(ex.Message);
_logger.LogError(ex.Message); _logger.LogError(ex.Message);
return new JsonResult(new ApiResult<string>().IsFail(ex.Message, null));
} }
return new JsonResult(result);
} }
/// <summary>
/// 编辑
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost("edit")]
public IActionResult Edit(MessageTemplateModel model)
{
var result = new ApiResult<string>();
var validator = new MessageTemplateModelValidator();
var validation = validator.Validate(model);
if (!validation.IsValid)
{
var message = validation.Errors.FirstOrDefault()?.ErrorMessage;
result = result.IsFail(message ?? string.Empty, null);
return new JsonResult(result);
}
var data = _dbContext.MessageTemplates.SingleOrDefault(p => p.Id == model.Id);
if (data == null)
{
result = result.IsFail("数据不存在");
return new JsonResult(result);
}
data.UpdateTime = DateTime.UtcNow;
try
{
int count = _dbContext.SaveChanges();
result = result.IsSuccess(count.ToString());
}
catch (Exception ex)
{
result = result.IsFail(ex.Message);
_logger.LogError(ex.Message);
Console.WriteLine(ex.Message);
}
return new JsonResult(result);
}
/// <summary> /// <summary>
/// 根据ID删除 /// 根据ID删除

View File

@@ -0,0 +1,3 @@
{
}

View File

@@ -6,6 +6,7 @@ namespace Atomx.Common.Entities
/// <summary> /// <summary>
/// 地区(国家、省、市、区) /// 地区(国家、省、市、区)
/// </summary> /// </summary>
[Table("Areas")]
public class Area public class Area
{ {
/// <summary> /// <summary>

View File

@@ -6,6 +6,7 @@ namespace Atomx.Common.Entities
/// <summary> /// <summary>
/// 分类 /// 分类
/// </summary> /// </summary>
[Table("Categories")]
public class Category public class Category
{ {
/// <summary> /// <summary>

View File

@@ -3,7 +3,8 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Atomx.Common.Entities namespace Atomx.Common.Entities
{ {
public class PaymentChannel [Table("Channels")]
public class Channel
{ {
/// <summary> /// <summary>
/// 数据ID /// 数据ID
@@ -13,26 +14,31 @@ namespace Atomx.Common.Entities
public int Id { get; set; } public int Id { get; set; }
/// <summary> /// <summary>
/// 付款方式,银行、微信、支付宝USDT /// 站点ID
/// </summary>
public long SiteId { get; set; }
/// <summary>
/// 通道类型,例如通知、支付、登录等
/// </summary> /// </summary>
public int Type { get; set; } public int Type { get; set; }
/// <summary> /// <summary>
/// 支付网络,区块链-TRC20Online-WechatBank-ICBC /// 通道网络,例如API、SMS、Email,MQTT,区块链网络等
/// </summary> /// </summary>
public int Network { get; set; } public int Network { get; set; }
/// <summary> /// <summary>
/// 支付渠道名称 /// 道名称
/// </summary> /// </summary>
[Column(TypeName = "varchar(20)")] [Column(TypeName = "varchar(20)")]
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 支付渠道标题名称 /// 道标题名称
/// </summary> /// </summary>
[Column(TypeName = "varchar(20)")] [Column(TypeName = "varchar(20)")]
public string Title { get; set; }=string.Empty; public string Title { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 描述说明 /// 描述说明
@@ -40,15 +46,8 @@ namespace Atomx.Common.Entities
[Column(TypeName = "varchar(512)")] [Column(TypeName = "varchar(512)")]
public string Description { get; set; } = string.Empty; public string Description { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 收款账号 /// 通道的设置
/// </summary>
[Column(TypeName = "varchar(256)")]
public string Account { get; set; } = string.Empty;
/// <summary>
/// 支付通道的设置
/// </summary> /// </summary>
[Column(TypeName = "text")] [Column(TypeName = "text")]
public string Config { get; set; } = string.Empty; public string Config { get; set; } = string.Empty;

View File

@@ -1,35 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Atomx.Common.Entities
{
/// <summary>
/// 企业供应商关系
/// </summary>
[Table("CorporationManufacturerRelations")]
public class CorporationManufacturerRelation
{
/// <summary>
/// 产品属性关联数据ID
/// </summary>
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Key]
public long Id { get; set; }
/// <summary>
/// 企业ID
/// </summary>
public long CorporationId { get; set; }
/// <summary>
/// 供应制造商ID
/// </summary>
public long ManufacturerId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[Column(TypeName = "timestamptz")]
public DateTime CreateTime { get; set; }
}
}

View File

@@ -1,43 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Atomx.Common.Entities
{
/// <summary>
/// 用户公司关系
/// </summary>
[Table("CorporationUserRelations")]
public class CorporationUserRelation
{
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Key]
public long Id { get; set; }
/// <summary>
/// 公司ID
/// </summary>
public long CorporationId { get; set; }
/// <summary>
/// 用户ID
/// </summary>
public long UserId { get; set; }
/// <summary>
/// 数据状态
/// </summary>
public int Status { get; set; }
/// <summary>
/// 数据创建时间
/// </summary>
[Column(TypeName = "timestamptz")]
public DateTime CreateTime { get; set; } = DateTime.UtcNow;
/// <summary>
/// 数据更新时间
/// </summary>
[Column(TypeName = "timestamptz")]
public DateTime? UpdateTime { get; set; }
}
}

View File

@@ -6,6 +6,7 @@ namespace Atomx.Common.Entities
/// <summary> /// <summary>
/// 货币信息 /// 货币信息
/// </summary> /// </summary>
[Table("Currencies")]
public class Currency public class Currency
{ {
/// <summary> /// <summary>
@@ -15,6 +16,11 @@ namespace Atomx.Common.Entities
[Key] [Key]
public int Id { get; set; } public int Id { get; set; }
/// <summary>
/// 站点ID
/// </summary>
public long SiteId { get; set; }
/// <summary> /// <summary>
/// 货币名称,系统 /// 货币名称,系统
/// </summary> /// </summary>

View File

@@ -6,6 +6,7 @@ namespace Atomx.Common.Entities
/// <summary> /// <summary>
/// 货币与支付通道关联表 /// 货币与支付通道关联表
/// </summary> /// </summary>
[Table("CurrencyChannelRelations")]
public class CurrencyChannelRelation public class CurrencyChannelRelation
{ {
[DatabaseGenerated(DatabaseGeneratedOption.None)] [DatabaseGenerated(DatabaseGeneratedOption.None)]

View File

@@ -1,45 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Atomx.Common.Entities
{
/// <summary>
/// 物料原料类型数据
/// </summary>
[Table("Materials")]
public class Material
{
/// <summary>
/// 数据ID
/// </summary>
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Key]
public long Id { get; set; }
/// <summary>
/// 原料类型
/// </summary>
public int Type { get; set; }
/// <summary>
/// 原料归属公司ID
/// </summary>
public long CorporationId { get; set; }
/// <summary>
/// 原料归属店铺网点ID
/// </summary>
public long StoreId { get; set; }
/// <summary>
/// 原料数量
/// </summary>
public decimal Quantity { get; set; }
/// <summary>
/// 数据最后更新时间
/// </summary>
[Column(TypeName = "timestamptz")]
public DateTime? UpdateTime { get; set; }
}
}

View File

@@ -1,66 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Atomx.Common.Entities
{
/// <summary>
/// 原料采购批次
/// </summary>
[Table("MaterialBatchs")]
public class MaterialBatch
{
/// <summary>
/// 数据ID
/// </summary>
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Key]
public long Id { get; set; }
/// <summary>
/// 类型:采购、借调、借调归还
/// </summary>
public int Type { get; set; }
/// <summary>
/// 原料数据ID
/// </summary>
public long MaterialId { get; set; }
/// <summary>
/// 原料归属公司ID
/// </summary>
public long CorporationId { get; set; }
/// <summary>
/// 原料归属店铺网点ID
/// </summary>
public long StoreId { get; set; }
/// <summary>
/// 原料当前数量
/// </summary>
public decimal Quantity { get; set; }
/// <summary>
/// 原料批次总量
/// </summary>
public decimal TotalQuantity { get; set; }
/// <summary>
/// 原料采购价格
/// </summary>
public decimal Price { get; set; }
/// <summary>
/// 数据创建时间
/// </summary>
[Column(TypeName = "timestamptz")]
public DateTime CreateTime { get; set; } = DateTime.UtcNow;
/// <summary>
/// 数据最后更新时间
/// </summary>
[Column(TypeName = "timestamptz")]
public DateTime? UpdateTime { get; set; }
}
}

View File

@@ -1,81 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Atomx.Common.Entities
{
/// <summary>
/// 原料详细记录,采购入库、使用出库、借调、归还、盘点校对
/// </summary>
[Table("MaterialRecords")]
public class MaterialRecord
{
/// <summary>
/// 数据ID
/// </summary>
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Key]
public long Id { get; set; }
/// <summary>
/// 操作类型,采购入库、使用出库、借调出库、归还入库、盘点校对
/// </summary>
public int Type { get; set; }
/// <summary>
/// 原料Id
/// </summary>
public long MaterialId { get; set; }
/// <summary>
/// 归属原料批次ID
/// </summary>
public long MaterialBatchId { get; set; }
/// <summary>
/// 归属公司id
/// </summary>
public long CorporationId { get; set; }
/// <summary>
/// 数据店铺网点id
/// </summary>
public long StoreId { get; set; }
/// <summary>
/// 操作用户ID
/// </summary>
public long UserId { get; set; }
/// <summary>
/// 原料价格
/// </summary>
public decimal Price { get; set; }
/// <summary>
/// 数量
/// </summary>
public decimal Quantity { get; set; }
/// <summary>
/// 使用原料产生的费用
/// </summary>
public decimal Expenses { get; set; }
/// <summary>
/// 标记
/// </summary>
public int Mark { get; set; }
/// <summary>
/// 备注说明
/// </summary>
[Column(TypeName = "varchar(256)")]
public string Note { get; set; } = string.Empty;
/// <summary>
/// 注册数据创建时间
/// </summary>
[Column(TypeName = "timestamptz")]
public DateTime CreateTime { get; set; } = DateTime.UtcNow;
}
}

View File

@@ -16,6 +16,11 @@ namespace Atomx.Common.Entities
[Key] [Key]
public long Id { get; set; } public long Id { get; set; }
/// <summary>
/// 站点ID
/// </summary>
public long SiteId { get; set; }
/// <summary> /// <summary>
/// 语言编码 /// 语言编码
/// </summary> /// </summary>
@@ -50,6 +55,12 @@ namespace Atomx.Common.Entities
[Column(TypeName = "text")] [Column(TypeName = "text")]
public string Body { get; set; } = string.Empty; public string Body { get; set; } = string.Empty;
/// <summary>
/// 附件文件地址列表,多个附件以逗号分隔
/// </summary>
[Column(TypeName = "varchar(1024)")]
public string Attachments { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 是否可用 /// 是否可用
/// </summary> /// </summary>

View File

@@ -1,72 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Atomx.Common.Entities
{
/// <summary>
/// 价格走势
/// </summary>
[Table("PriceTrends")]
public class PriceTrend
{
/// <summary>
/// 数据ID
/// </summary>
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Key]
public long Id { get; set; }
/// <summary>
/// 日期
/// </summary>
public int Date { get; set; }
/// <summary>
/// 类型
/// </summary>
public int Type { get; set; }
/// <summary>
/// 当前价格
/// </summary>
public decimal Price { get; set; }
/// <summary>
/// 最低价格
/// </summary>
public decimal LowestPrice { get; set; }
/// <summary>
/// 最高价格
/// </summary>
public decimal HighestPrice { get; set; }
/// <summary>
/// 当前零售价格
/// </summary>
public decimal RetailPrice { get; set; }
/// <summary>
/// 最低零售价格
/// </summary>
public decimal LowestRetailPrice { get; set; }
/// <summary>
/// 最高零售价格
/// </summary>
public decimal HighestRetailPrice { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[Column(TypeName = "timestamptz")]
public DateTime CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[Column(TypeName = "timestamptz")]
public DateTime? UpdateTime { get; set; }
}
}

View File

@@ -22,13 +22,7 @@ namespace Atomx.Common.Entities
public long SiteId { get; set; } public long SiteId { get; set; }
/// <summary> /// <summary>
/// 系统设置KEY /// 配置类型,见 SettingType 枚举
/// </summary>
[Column(TypeName = "varchar(64)")]
public string Key { get; set; } = string.Empty;
/// <summary>
/// 配置类型,0 系统设置,
/// </summary> /// </summary>
public int Type { get; set; } public int Type { get; set; }
@@ -38,6 +32,12 @@ namespace Atomx.Common.Entities
[Column(TypeName = "varchar(64)")] [Column(TypeName = "varchar(64)")]
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
/// <summary>
/// 系统设置KEY
/// </summary>
[Column(TypeName = "varchar(64)")]
public string Key { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 系统设置项 /// 系统设置项
/// </summary> /// </summary>

View File

@@ -6,6 +6,7 @@ namespace Atomx.Common.Entities
/// <summary> /// <summary>
/// 站点应用 /// 站点应用
/// </summary> /// </summary>
[Table("SiteApps")]
public class SiteApp public class SiteApp
{ {
/// <summary> /// <summary>

View File

@@ -1,41 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Atomx.Common.Entities
{
/// <summary>
/// 出入库记录
/// </summary>
[Table("WarehouseStockRecords")]
public class WarehouseStockRecord
{
/// <summary>
/// 数据ID
/// </summary>
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Key]
public long Id { get; set; }
/// <summary>
/// 类型,0入库1出库初始
/// </summary>
public int? Type { get; set; }
/// <summary>
/// 产生动作的用户ID
/// </summary>
public long? Operator { get; set; }
/// <summary>
/// 备注说明
/// </summary>
[Column(TypeName = "varchar(256)")]
public string Note { get; set; } = string.Empty;
/// <summary>
/// 注册数据创建时间
/// </summary>
[Column(TypeName = "timestamptz")]
public DateTime CreateTime { get; set; } = DateTime.UtcNow;
}
}

View File

@@ -51,6 +51,11 @@ namespace Atomx.Data
/// </summary> /// </summary>
public DbSet<Category> Categories { get; set; } public DbSet<Category> Categories { get; set; }
/// <summary>
/// 系统通道
/// </summary>
public DbSet<Channel> Channels { get; set; }
/// <summary> /// <summary>
/// 货币信息 /// 货币信息
/// </summary> /// </summary>
@@ -71,11 +76,6 @@ namespace Atomx.Data
/// </summary> /// </summary>
public DbSet<LocalizedProperty> LocalizedProperties { get; set; } public DbSet<LocalizedProperty> LocalizedProperties { get; set; }
/// <summary>
/// 支付通道信息
/// </summary>
public DbSet<PaymentChannel> PaymentChannels { get; set; }
/// <summary> /// <summary>
/// 权限信息 /// 权限信息
/// </summary> /// </summary>

View File

@@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Atomx.Data.Migrations namespace Atomx.Data.Migrations
{ {
[DbContext(typeof(DataContext))] [DbContext(typeof(DataContext))]
[Migration("20251214094758_0.1")] [Migration("20251216011300_0.1")]
partial class _01 partial class _01
{ {
/// <inheritdoc /> /// <inheritdoc />
@@ -347,6 +347,53 @@ namespace Atomx.Data.Migrations
b.ToTable("Categories"); b.ToTable("Categories");
}); });
modelBuilder.Entity("Atomx.Common.Entities.Channel", b =>
{
b.Property<int>("Id")
.HasColumnType("integer");
b.Property<string>("Config")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("CreateTime")
.HasColumnType("timestamptz");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("varchar(512)");
b.Property<int>("DisplayOrder")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("varchar(20)");
b.Property<int>("Network")
.HasColumnType("integer");
b.Property<long>("SiteId")
.HasColumnType("bigint");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("varchar(20)");
b.Property<int>("Type")
.HasColumnType("integer");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("timestamptz");
b.HasKey("Id");
b.ToTable("Channels");
});
modelBuilder.Entity("Atomx.Common.Entities.Currency", b => modelBuilder.Entity("Atomx.Common.Entities.Currency", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@@ -386,6 +433,9 @@ namespace Atomx.Data.Migrations
b.Property<decimal>("Rate") b.Property<decimal>("Rate")
.HasColumnType("decimal(16, 4)"); .HasColumnType("decimal(16, 4)");
b.Property<long>("SiteId")
.HasColumnType("bigint");
b.Property<string>("Symbolic") b.Property<string>("Symbolic")
.IsRequired() .IsRequired()
.HasColumnType("varchar(8)"); .HasColumnType("varchar(8)");
@@ -606,6 +656,10 @@ namespace Atomx.Data.Migrations
b.Property<long>("Id") b.Property<long>("Id")
.HasColumnType("bigint"); .HasColumnType("bigint");
b.Property<string>("Attachments")
.IsRequired()
.HasColumnType("varchar(1024)");
b.Property<string>("Body") b.Property<string>("Body")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
@@ -620,10 +674,16 @@ namespace Atomx.Data.Migrations
.IsRequired() .IsRequired()
.HasColumnType("varchar(64)"); .HasColumnType("varchar(64)");
b.Property<int>("LanguageId")
.HasColumnType("integer");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("varchar(256)"); .HasColumnType("varchar(256)");
b.Property<long>("SiteId")
.HasColumnType("bigint");
b.Property<string>("Title") b.Property<string>("Title")
.IsRequired() .IsRequired()
.HasColumnType("varchar(256)"); .HasColumnType("varchar(256)");
@@ -639,54 +699,6 @@ namespace Atomx.Data.Migrations
b.ToTable("MessageTemplates"); b.ToTable("MessageTemplates");
}); });
modelBuilder.Entity("Atomx.Common.Entities.PaymentChannel", b =>
{
b.Property<int>("Id")
.HasColumnType("integer");
b.Property<string>("Account")
.IsRequired()
.HasColumnType("varchar(256)");
b.Property<string>("Config")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("CreateTime")
.HasColumnType("timestamptz");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("varchar(512)");
b.Property<int>("DisplayOrder")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("varchar(20)");
b.Property<int>("Network")
.HasColumnType("integer");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("varchar(20)");
b.Property<int>("Type")
.HasColumnType("integer");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("timestamptz");
b.HasKey("Id");
b.ToTable("PaymentChannels");
});
modelBuilder.Entity("Atomx.Common.Entities.Permission", b => modelBuilder.Entity("Atomx.Common.Entities.Permission", b =>
{ {
b.Property<long>("Id") b.Property<long>("Id")

View File

@@ -145,11 +145,34 @@ namespace Atomx.Data.Migrations
table.PrimaryKey("PK_Categories", x => x.Id); table.PrimaryKey("PK_Categories", x => x.Id);
}); });
migrationBuilder.CreateTable(
name: "Channels",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false),
SiteId = table.Column<long>(type: "bigint", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
Network = table.Column<int>(type: "integer", nullable: false),
Name = table.Column<string>(type: "varchar(20)", nullable: false),
Title = table.Column<string>(type: "varchar(20)", nullable: false),
Description = table.Column<string>(type: "varchar(512)", nullable: false),
Config = table.Column<string>(type: "text", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Channels", x => x.Id);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Currencies", name: "Currencies",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "integer", nullable: false), Id = table.Column<int>(type: "integer", nullable: false),
SiteId = table.Column<long>(type: "bigint", nullable: false),
Name = table.Column<string>(type: "varchar(50)", nullable: false), Name = table.Column<string>(type: "varchar(50)", nullable: false),
Title = table.Column<string>(type: "varchar(50)", nullable: false), Title = table.Column<string>(type: "varchar(50)", nullable: false),
CurrencyCode = table.Column<string>(type: "varchar(10)", nullable: false), CurrencyCode = table.Column<string>(type: "varchar(10)", nullable: false),
@@ -273,11 +296,14 @@ namespace Atomx.Data.Migrations
columns: table => new columns: table => new
{ {
Id = table.Column<long>(type: "bigint", nullable: false), Id = table.Column<long>(type: "bigint", nullable: false),
SiteId = table.Column<long>(type: "bigint", nullable: false),
LanguageId = table.Column<int>(type: "integer", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false), Type = table.Column<int>(type: "integer", nullable: false),
Key = table.Column<string>(type: "varchar(64)", nullable: false), Key = table.Column<string>(type: "varchar(64)", nullable: false),
Name = table.Column<string>(type: "varchar(256)", nullable: false), Name = table.Column<string>(type: "varchar(256)", nullable: false),
Title = table.Column<string>(type: "varchar(256)", nullable: false), Title = table.Column<string>(type: "varchar(256)", nullable: false),
Body = table.Column<string>(type: "text", nullable: false), Body = table.Column<string>(type: "text", nullable: false),
Attachments = table.Column<string>(type: "varchar(1024)", nullable: false),
Enabled = table.Column<bool>(type: "boolean", nullable: false), Enabled = table.Column<bool>(type: "boolean", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false), CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true) UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
@@ -287,28 +313,6 @@ namespace Atomx.Data.Migrations
table.PrimaryKey("PK_MessageTemplates", x => x.Id); table.PrimaryKey("PK_MessageTemplates", x => x.Id);
}); });
migrationBuilder.CreateTable(
name: "PaymentChannels",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
Network = table.Column<int>(type: "integer", nullable: false),
Name = table.Column<string>(type: "varchar(20)", nullable: false),
Title = table.Column<string>(type: "varchar(20)", nullable: false),
Description = table.Column<string>(type: "varchar(512)", nullable: false),
Account = table.Column<string>(type: "varchar(256)", nullable: false),
Config = table.Column<string>(type: "text", nullable: false),
DisplayOrder = table.Column<int>(type: "integer", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
CreateTime = table.Column<DateTime>(type: "timestamptz", nullable: false),
UpdateTime = table.Column<DateTime>(type: "timestamptz", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PaymentChannels", x => x.Id);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Permissions", name: "Permissions",
columns: table => new columns: table => new
@@ -563,9 +567,9 @@ namespace Atomx.Data.Migrations
{ {
Id = table.Column<long>(type: "bigint", nullable: false), Id = table.Column<long>(type: "bigint", nullable: false),
SiteId = table.Column<long>(type: "bigint", nullable: false), SiteId = table.Column<long>(type: "bigint", nullable: false),
Key = table.Column<string>(type: "varchar(64)", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false), Type = table.Column<int>(type: "integer", nullable: false),
Name = table.Column<string>(type: "varchar(64)", nullable: false), Name = table.Column<string>(type: "varchar(64)", nullable: false),
Key = table.Column<string>(type: "varchar(64)", nullable: false),
Content = table.Column<string>(type: "text", nullable: false) Content = table.Column<string>(type: "text", nullable: false)
}, },
constraints: table => constraints: table =>
@@ -691,6 +695,9 @@ namespace Atomx.Data.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Categories"); name: "Categories");
migrationBuilder.DropTable(
name: "Channels");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Currencies"); name: "Currencies");
@@ -712,9 +719,6 @@ namespace Atomx.Data.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "MessageTemplates"); name: "MessageTemplates");
migrationBuilder.DropTable(
name: "PaymentChannels");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Permissions"); name: "Permissions");

View File

@@ -344,6 +344,53 @@ namespace Atomx.Data.Migrations
b.ToTable("Categories"); b.ToTable("Categories");
}); });
modelBuilder.Entity("Atomx.Common.Entities.Channel", b =>
{
b.Property<int>("Id")
.HasColumnType("integer");
b.Property<string>("Config")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("CreateTime")
.HasColumnType("timestamptz");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("varchar(512)");
b.Property<int>("DisplayOrder")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("varchar(20)");
b.Property<int>("Network")
.HasColumnType("integer");
b.Property<long>("SiteId")
.HasColumnType("bigint");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("varchar(20)");
b.Property<int>("Type")
.HasColumnType("integer");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("timestamptz");
b.HasKey("Id");
b.ToTable("Channels");
});
modelBuilder.Entity("Atomx.Common.Entities.Currency", b => modelBuilder.Entity("Atomx.Common.Entities.Currency", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@@ -383,6 +430,9 @@ namespace Atomx.Data.Migrations
b.Property<decimal>("Rate") b.Property<decimal>("Rate")
.HasColumnType("decimal(16, 4)"); .HasColumnType("decimal(16, 4)");
b.Property<long>("SiteId")
.HasColumnType("bigint");
b.Property<string>("Symbolic") b.Property<string>("Symbolic")
.IsRequired() .IsRequired()
.HasColumnType("varchar(8)"); .HasColumnType("varchar(8)");
@@ -603,6 +653,10 @@ namespace Atomx.Data.Migrations
b.Property<long>("Id") b.Property<long>("Id")
.HasColumnType("bigint"); .HasColumnType("bigint");
b.Property<string>("Attachments")
.IsRequired()
.HasColumnType("varchar(1024)");
b.Property<string>("Body") b.Property<string>("Body")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
@@ -617,10 +671,16 @@ namespace Atomx.Data.Migrations
.IsRequired() .IsRequired()
.HasColumnType("varchar(64)"); .HasColumnType("varchar(64)");
b.Property<int>("LanguageId")
.HasColumnType("integer");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("varchar(256)"); .HasColumnType("varchar(256)");
b.Property<long>("SiteId")
.HasColumnType("bigint");
b.Property<string>("Title") b.Property<string>("Title")
.IsRequired() .IsRequired()
.HasColumnType("varchar(256)"); .HasColumnType("varchar(256)");
@@ -636,54 +696,6 @@ namespace Atomx.Data.Migrations
b.ToTable("MessageTemplates"); b.ToTable("MessageTemplates");
}); });
modelBuilder.Entity("Atomx.Common.Entities.PaymentChannel", b =>
{
b.Property<int>("Id")
.HasColumnType("integer");
b.Property<string>("Account")
.IsRequired()
.HasColumnType("varchar(256)");
b.Property<string>("Config")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("CreateTime")
.HasColumnType("timestamptz");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("varchar(512)");
b.Property<int>("DisplayOrder")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("varchar(20)");
b.Property<int>("Network")
.HasColumnType("integer");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("varchar(20)");
b.Property<int>("Type")
.HasColumnType("integer");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("timestamptz");
b.HasKey("Id");
b.ToTable("PaymentChannels");
});
modelBuilder.Entity("Atomx.Common.Entities.Permission", b => modelBuilder.Entity("Atomx.Common.Entities.Permission", b =>
{ {
b.Property<long>("Id") b.Property<long>("Id")