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