|
|
@ -8,6 +8,7 @@ using System.Linq;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Core.Service
|
|
|
|
namespace Myshipping.Core.Service
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -42,24 +43,21 @@ namespace Myshipping.Core.Service
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 增加网站账号维护(同一用户、同类型账号不会重复插入)
|
|
|
|
/// 增加网站账号维护(同一用户、同类型账号不允许重复)
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("/DjyWebsiteAccountConfig/add")]
|
|
|
|
[HttpPost("/DjyWebsiteAccountConfig/add")]
|
|
|
|
public async Task Add(AddDjyWebsiteAccountConfigInput input)
|
|
|
|
public async Task Add(AddDjyWebsiteAccountConfigInput input)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var entity = _rep.FirstOrDefault(x => x.TypeCode == input.TypeCode && x.CreatedUserId == UserManager.UserId);
|
|
|
|
var cc = _rep.Count(x => x.TypeCode == input.TypeCode && x.CreatedUserId == UserManager.UserId);
|
|
|
|
if (entity == null)
|
|
|
|
if (cc > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
entity = input.Adapt<DjyWebsiteAccountConfig>();
|
|
|
|
throw Oops.Bah("已存在同类型账号");
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
entity = input.Adapt(entity);
|
|
|
|
|
|
|
|
await _rep.UpdateAsync(entity);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entity = input.Adapt<DjyWebsiteAccountConfig>();
|
|
|
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -70,6 +68,12 @@ namespace Myshipping.Core.Service
|
|
|
|
[HttpPost("/DjyWebsiteAccountConfig/edit")]
|
|
|
|
[HttpPost("/DjyWebsiteAccountConfig/edit")]
|
|
|
|
public async Task Update(UpdateDjyWebsiteAccountConfigInput input)
|
|
|
|
public async Task Update(UpdateDjyWebsiteAccountConfigInput input)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
var cc = _rep.Count(x => x.TypeCode == input.TypeCode && x.CreatedUserId == UserManager.UserId && x.Id != input.Id);
|
|
|
|
|
|
|
|
if (cc > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah("已存在同类型账号");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var entity = input.Adapt<DjyWebsiteAccountConfig>();
|
|
|
|
var entity = input.Adapt<DjyWebsiteAccountConfig>();
|
|
|
|
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|