@@ -1,4 +1,5 @@ | |||
using BPA.SAAS.KitChenManage.Application.Food.Services; | |||
using BPA.SAAS.KitChenManage.Application.Authorization.Dtos; | |||
using BPA.SAAS.KitChenManage.Application.Food.Services; | |||
using BPA.SAAS.KitChenManage.Core.Base; | |||
using BPA.SAAS.KitChenManage.Core.Model; | |||
using System; | |||
@@ -36,9 +37,9 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpPost("/api/authorization/addstoreauthorization")] | |||
public async Task<bool> AddStoreAuthorization(string storeId) | |||
public async Task<bool> AddStoreAuthorization(CreateOrUpDateStoreAuthorizationDto input) | |||
{ | |||
return await _authorizationService.AddStoreAuthorization(storeId); | |||
return await _authorizationService.AddStoreAuthorization(input); | |||
} | |||
/// <summary> | |||
@@ -52,6 +53,17 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization | |||
return await _authorizationService.UpdateStoreAuthorization(id); | |||
} | |||
/// <summary> | |||
/// 修改店铺授权时间 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/authorization/updatestoreauthtime")] | |||
public async Task<bool> UpdateStoreAuthTime(CreateOrUpDateStoreAuthorizationDto input) | |||
{ | |||
return await _authorizationService.UpdateStoreAuthTime(input); | |||
} | |||
/// <summary> | |||
/// CodeFirst | |||
/// </summary> | |||
@@ -12,4 +12,18 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization.Dtos | |||
public string StoreName { get; set; } | |||
public string StoreId { get; set; } | |||
} | |||
public class CreateOrUpDateStoreAuthorizationDto | |||
{ | |||
public string Id { get; set; } | |||
public string Key { get; set; } | |||
public string StoreId { get; set; } | |||
/// <summary> | |||
/// 有效期 长期有效为空 | |||
/// </summary> | |||
public DateTime? PeriodValidity { get; set; } | |||
} | |||
} |
@@ -52,9 +52,9 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization.Services | |||
/// 添加店铺授权码 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<bool> AddStoreAuthorization(string storeId) | |||
public async Task<bool> AddStoreAuthorization(CreateOrUpDateStoreAuthorizationDto input) | |||
{ | |||
var data = _db.Queryable<BPA_StoreAuthorization>().Where(x=>x.StoreId== storeId).ToList(); | |||
var data = _db.Queryable<BPA_StoreAuthorization>().Where(x=>x.StoreId== input.StoreId).ToList(); | |||
if (data.Count > 0) | |||
{ | |||
throw Oops.Oh("店铺授权码已存在"); | |||
@@ -62,8 +62,10 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization.Services | |||
var res = await _db.Insertable(new BPA_StoreAuthorization() | |||
{ | |||
StoreId = storeId, | |||
StoreId = input.StoreId, | |||
Key = Guid.NewGuid().ToString(), | |||
PeriodValidity = input.PeriodValidity, | |||
UpdateAt=DateTime.Now, | |||
}).CallEntityMethod(t => t.Create()).ExecuteCommandAsync(); | |||
@@ -83,6 +85,27 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization.Services | |||
throw Oops.Oh("授权信息不存在"); | |||
} | |||
data.Key = Guid.NewGuid().ToString(); | |||
data.UpdateAt = DateTime.Now; | |||
return await _db.Updateable(data).ExecuteCommandHasChangeAsync(); | |||
} | |||
/// <summary> | |||
/// 修改店铺授权码 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateStoreAuthTime(CreateOrUpDateStoreAuthorizationDto input) | |||
{ | |||
var data = await _db.Queryable<BPA_StoreAuthorization>().FirstAsync(x => x.Id == input.Id); | |||
if (data == null) | |||
{ | |||
throw Oops.Oh("授权信息不存在"); | |||
} | |||
data.Key = Guid.NewGuid().ToString(); | |||
data.PeriodValidity = input.PeriodValidity; | |||
data.UpdateAt = DateTime.Now; | |||
return await _db.Updateable(data).ExecuteCommandHasChangeAsync(); | |||
} | |||
@@ -1,4 +1,5 @@ | |||
using BPA.SAAS.KitChenManage.Core.Base; | |||
using BPA.SAAS.KitChenManage.Application.Authorization.Dtos; | |||
using BPA.SAAS.KitChenManage.Core.Base; | |||
using BPA.SAAS.KitChenManage.Core.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
@@ -23,7 +24,7 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization.Services | |||
/// 添加店铺授权码 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<bool> AddStoreAuthorization(string storeId); | |||
Task<bool> AddStoreAuthorization(CreateOrUpDateStoreAuthorizationDto input); | |||
/// <summary> | |||
/// 修改店铺授权码 | |||
@@ -32,6 +33,8 @@ namespace BPA.SAAS.KitChenManage.Application.Authorization.Services | |||
/// <returns></returns> | |||
Task<bool> UpdateStoreAuthorization(string id); | |||
Task<bool> UpdateStoreAuthTime(CreateOrUpDateStoreAuthorizationDto input); | |||
@@ -11,7 +11,7 @@ | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.AuthorizationServices.AddStoreAuthorization(System.String)"> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.AuthorizationServices.AddStoreAuthorization(BPA.SAAS.KitChenManage.Application.Authorization.Dtos.CreateOrUpDateStoreAuthorizationDto)"> | |||
<summary> | |||
添加店铺授权码 | |||
</summary> | |||
@@ -24,12 +24,24 @@ | |||
<param name="id"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.AuthorizationServices.UpdateStoreAuthTime(BPA.SAAS.KitChenManage.Application.Authorization.Dtos.CreateOrUpDateStoreAuthorizationDto)"> | |||
<summary> | |||
修改店铺授权时间 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.AuthorizationServices.CodeFirst"> | |||
<summary> | |||
CodeFirst | |||
</summary> | |||
<param name="tableNames"></param> | |||
</member> | |||
<member name="P:BPA.SAAS.KitChenManage.Application.Authorization.Dtos.CreateOrUpDateStoreAuthorizationDto.PeriodValidity"> | |||
<summary> | |||
有效期 长期有效为空 | |||
</summary> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.Services.AuthorizationService.PageStoreAuthorization(BPA.SAAS.KitChenManage.Core.Base.PageInputBase)"> | |||
<summary> | |||
分页店铺授权码 | |||
@@ -37,7 +49,7 @@ | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.Services.AuthorizationService.AddStoreAuthorization(System.String)"> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.Services.AuthorizationService.AddStoreAuthorization(BPA.SAAS.KitChenManage.Application.Authorization.Dtos.CreateOrUpDateStoreAuthorizationDto)"> | |||
<summary> | |||
添加店铺授权码 | |||
</summary> | |||
@@ -50,6 +62,13 @@ | |||
<param name="id"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.Services.AuthorizationService.UpdateStoreAuthTime(BPA.SAAS.KitChenManage.Application.Authorization.Dtos.CreateOrUpDateStoreAuthorizationDto)"> | |||
<summary> | |||
修改店铺授权码 | |||
</summary> | |||
<param name="id"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.Services.AuthorizationService.CodeFirst"> | |||
<summary> | |||
CodeFirst | |||
@@ -63,7 +82,7 @@ | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.Services.IAuthorizationService.AddStoreAuthorization(System.String)"> | |||
<member name="M:BPA.SAAS.KitChenManage.Application.Authorization.Services.IAuthorizationService.AddStoreAuthorization(BPA.SAAS.KitChenManage.Application.Authorization.Dtos.CreateOrUpDateStoreAuthorizationDto)"> | |||
<summary> | |||
添加店铺授权码 | |||
</summary> | |||
@@ -80,6 +80,11 @@ | |||
商品id | |||
</summary> | |||
</member> | |||
<member name="P:BPA.SAAS.KitChenManage.Core.Model.BPA_StoreAuthorization.PeriodValidity"> | |||
<summary> | |||
有效期 长期有效为空 | |||
</summary> | |||
</member> | |||
<member name="M:BPA.KitChen.GroupMeal.SqlSugar.SqlSugarDb.TableFilterItem(SqlSugar.SqlSugarClient)"> | |||
<summary> | |||
全局过滤 | |||
@@ -14,5 +14,12 @@ namespace BPA.SAAS.KitChenManage.Core.Model | |||
public string StoreId { get; set; } | |||
public string Key { get; set; } | |||
public string GroupId { get; set; } | |||
/// <summary> | |||
/// 有效期 长期有效为空 | |||
/// </summary> | |||
public DateTime? PeriodValidity { get; set; } | |||
public DateTime UpdateAt { get; set; } | |||
} | |||
} |