|
@@ -100,8 +100,9 @@ namespace Hotline.Api.Controllers
|
|
|
{
|
|
|
WhiteBlackLog whiteBlackLog = new()
|
|
|
{
|
|
|
- LogType = "删除黑名单",
|
|
|
- LogContent = phone
|
|
|
+ LogType = "1",
|
|
|
+ LogAction = "删除",
|
|
|
+ PhoneNum = phone
|
|
|
};
|
|
|
await _whiteBlackLogRepository.AddAsync(whiteBlackLog, HttpContext.RequestAborted);
|
|
|
}
|
|
@@ -123,7 +124,7 @@ namespace Hotline.Api.Controllers
|
|
|
throw UserFriendlyException.SameMessage("有效期不能为空!");
|
|
|
|
|
|
var isEx = await _db.Queryable<XingtangBlackPhone>().Where(p => p.StartPhone == dto.PhoneNum).AnyAsync();
|
|
|
- if(isEx)
|
|
|
+ if (isEx)
|
|
|
throw UserFriendlyException.SameMessage("此号码已经是黑名单!");
|
|
|
|
|
|
var id = await _db.Queryable<XingtangBlackPhone>().MaxAsync(p => p.BlackPhoneId);
|
|
@@ -142,8 +143,10 @@ namespace Hotline.Api.Controllers
|
|
|
{
|
|
|
WhiteBlackLog whiteBlackLog = new()
|
|
|
{
|
|
|
- LogType = "新增黑名单",
|
|
|
- LogContent = dto.PhoneNum + "/" + dto.ValidDateTime
|
|
|
+ LogType = "1",
|
|
|
+ LogAction = "新增",
|
|
|
+ PhoneNum = dto.PhoneNum,
|
|
|
+ ValidDateTime = dto.ValidDateTime
|
|
|
};
|
|
|
await _whiteBlackLogRepository.AddAsync(whiteBlackLog, HttpContext.RequestAborted);
|
|
|
}
|
|
@@ -180,8 +183,9 @@ namespace Hotline.Api.Controllers
|
|
|
{
|
|
|
WhiteBlackLog whiteBlackLog = new()
|
|
|
{
|
|
|
- LogType = "删除白名单",
|
|
|
- LogContent = phone
|
|
|
+ LogType = "2",
|
|
|
+ LogAction = "删除",
|
|
|
+ PhoneNum = phone
|
|
|
};
|
|
|
await _whiteBlackLogRepository.AddAsync(whiteBlackLog, HttpContext.RequestAborted);
|
|
|
}
|
|
@@ -219,8 +223,10 @@ namespace Hotline.Api.Controllers
|
|
|
{
|
|
|
WhiteBlackLog whiteBlackLog = new()
|
|
|
{
|
|
|
- LogType = "新增白名单",
|
|
|
- LogContent = dto.PhoneNum + "/" + dto.ValidDateTime
|
|
|
+ LogType = "2",
|
|
|
+ LogAction = "新增",
|
|
|
+ PhoneNum = dto.PhoneNum,
|
|
|
+ ValidDateTime = dto.ValidDateTime
|
|
|
};
|
|
|
await _whiteBlackLogRepository.AddAsync(whiteBlackLog, HttpContext.RequestAborted);
|
|
|
}
|
|
@@ -239,8 +245,9 @@ namespace Hotline.Api.Controllers
|
|
|
.WhereIF(dto.StartTime.HasValue, p => p.CreationTime >= dto.StartTime)
|
|
|
.WhereIF(dto.EndTime.HasValue, p => p.CreationTime <= dto.EndTime)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.LogType), p => p.LogType == dto.LogType)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.LogAction), p => p.LogAction == dto.LogAction)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.UserName), p => p.CreatorName == dto.UserName)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.LogContent), p => p.LogContent.Contains(dto.LogContent))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.PhoneNum), p => p.PhoneNum == dto.PhoneNum)
|
|
|
.ToPagedListAsync(dto, HttpContext.RequestAborted);
|
|
|
return new PagedDto<WhiteBlackLog>(total, items);
|
|
|
}
|