根据新需求更改
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Azure;
|
||||
using Azure;
|
||||
using FastEndpoints;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MoviconWebApi.Common;
|
||||
@@ -36,18 +36,29 @@ namespace MoviconWebApi.API.ClearDataQrApi
|
||||
{
|
||||
try
|
||||
{
|
||||
var dataList = await Data.GetClearDataByQr(request, _freeSql);
|
||||
// 参数兜底
|
||||
if (request.PageNo <= 0) request.PageNo = 1;
|
||||
if (request.PageSize <= 0) request.PageSize = 100;
|
||||
if (request.PageSize > 100) request.PageSize = 100;
|
||||
|
||||
if (dataList == null || dataList.Count == 0)
|
||||
var result = await Data.GetClearDataByQr(request, _freeSql);
|
||||
var dataList = result.Item1;
|
||||
var total = result.Item2;
|
||||
|
||||
var resp = ApiResponse<List<ClearDataQrResponse>>.Success(
|
||||
dataList ?? new List<ClearDataQrResponse>(),
|
||||
(dataList != null && dataList.Count > 0) ? "请求成功" : "暂无数据");
|
||||
|
||||
resp.pagination = new MoviconWebApi.Common.Pagination
|
||||
{
|
||||
Response = ApiResponse<List<ClearDataQrResponse>>.Success(
|
||||
new List<ClearDataQrResponse>(), "暂无数据");// "暂无数据"
|
||||
}
|
||||
else
|
||||
{
|
||||
Response = ApiResponse<List<ClearDataQrResponse>>.Success(
|
||||
dataList, "查询成功");// "查询成功"
|
||||
}
|
||||
total = total,
|
||||
count = dataList?.Count ?? 0,
|
||||
pageNo = request.PageNo,
|
||||
totalPage = request.PageSize > 0 ? (int)Math.Ceiling((double)total / request.PageSize) : 0,
|
||||
pageSize = request.PageSize
|
||||
};
|
||||
|
||||
Response = resp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -57,7 +68,8 @@ namespace MoviconWebApi.API.ClearDataQrApi
|
||||
Logger.LogError(ex, "根据二维码查询清洗数据失败");
|
||||
Response = ApiResponse<List<ClearDataQrResponse>>.Error(
|
||||
"500",
|
||||
"服务器内部错误"
|
||||
"服务器内部错误",
|
||||
new List<ClearDataQrResponse>()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user