21
This commit is contained in:
parent
ae169a6785
commit
c61f7fc3c3
|
|
@ -535,13 +535,13 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
handleTabChange(index) {
|
||||
async handleTabChange(index) {
|
||||
this.currentTab = index;
|
||||
// 添加延迟加载动画
|
||||
if (index === 1 && this.participantList.length > 0) {
|
||||
this.animateListItems('participant-row');
|
||||
} else if (index === 2 && this.awardRecordList.length > 0) {
|
||||
this.animateListItems('award-row');
|
||||
// 切换到参与人数或赏品记录时,重新加载数据
|
||||
if (index === 1) {
|
||||
await this.loadParticipants(this.goods_id);
|
||||
} else if (index === 2) {
|
||||
await this.loadAwardRecords(this.goods_id);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -238,61 +238,69 @@ public class WelfareController : ControllerBase
|
|||
|
||||
/// <summary>
|
||||
/// 获取福利屋参与者列表
|
||||
/// POST /api/fuliwu_participants
|
||||
/// Requirements: 14.1
|
||||
/// GET /api/fuliwu_participants
|
||||
/// </summary>
|
||||
[HttpPost("fuliwu_participants")]
|
||||
[HttpGet("fuliwu_participants")]
|
||||
[Authorize]
|
||||
public async Task<ApiResponse<List<ParticipantDto>>> GetParticipants([FromForm] ParticipantsRequest request)
|
||||
public async Task<ApiResponse<WelfareParticipantsResponse>> GetParticipants(
|
||||
[FromQuery(Name = "goods_id")] int goodsId,
|
||||
[FromQuery] int page = 1,
|
||||
[FromQuery] int limit = 15)
|
||||
{
|
||||
var userId = GetCurrentUserId();
|
||||
if (userId == null)
|
||||
{
|
||||
return ApiResponse<List<ParticipantDto>>.Unauthorized();
|
||||
return ApiResponse<WelfareParticipantsResponse>.Unauthorized();
|
||||
}
|
||||
|
||||
if (goodsId <= 0)
|
||||
{
|
||||
return ApiResponse<WelfareParticipantsResponse>.Fail("商品ID不能为空");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var result = await _welfareService.GetParticipantsAsync(
|
||||
request.GoodsId,
|
||||
request.Page,
|
||||
request.Limit);
|
||||
return ApiResponse<List<ParticipantDto>>.Success(result);
|
||||
var result = await _welfareService.GetParticipantsAsync(goodsId, page, limit);
|
||||
return ApiResponse<WelfareParticipantsResponse>.Success(new WelfareParticipantsResponse { List = result });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to get participants: GoodsId={GoodsId}", request.GoodsId);
|
||||
return ApiResponse<List<ParticipantDto>>.Fail("获取参与者列表失败");
|
||||
_logger.LogError(ex, "Failed to get participants: GoodsId={GoodsId}", goodsId);
|
||||
return ApiResponse<WelfareParticipantsResponse>.Fail("获取参与者列表失败");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取福利屋开奖记录
|
||||
/// POST /api/fuliwu_records
|
||||
/// Requirements: 14.2
|
||||
/// GET /api/fuliwu_records
|
||||
/// </summary>
|
||||
[HttpPost("fuliwu_records")]
|
||||
[HttpGet("fuliwu_records")]
|
||||
[Authorize]
|
||||
public async Task<ApiResponse<List<WinningRecordDto>>> GetWinningRecords([FromForm] WinningRecordsRequest request)
|
||||
public async Task<ApiResponse<WelfareRecordsResponse>> GetWinningRecords(
|
||||
[FromQuery(Name = "goods_id")] int goodsId,
|
||||
[FromQuery] int page = 1,
|
||||
[FromQuery] int limit = 15)
|
||||
{
|
||||
var userId = GetCurrentUserId();
|
||||
if (userId == null)
|
||||
{
|
||||
return ApiResponse<List<WinningRecordDto>>.Unauthorized();
|
||||
return ApiResponse<WelfareRecordsResponse>.Unauthorized();
|
||||
}
|
||||
|
||||
if (goodsId <= 0)
|
||||
{
|
||||
return ApiResponse<WelfareRecordsResponse>.Fail("商品ID不能为空");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var result = await _welfareService.GetWinningRecordsAsync(
|
||||
request.GoodsId,
|
||||
request.Page,
|
||||
request.Limit);
|
||||
return ApiResponse<List<WinningRecordDto>>.Success(result);
|
||||
var result = await _welfareService.GetWinningRecordsAsync(goodsId, page, limit);
|
||||
return ApiResponse<WelfareRecordsResponse>.Success(new WelfareRecordsResponse { List = result });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to get winning records: GoodsId={GoodsId}", request.GoodsId);
|
||||
return ApiResponse<List<WinningRecordDto>>.Fail("获取开奖记录失败");
|
||||
_logger.LogError(ex, "Failed to get winning records: GoodsId={GoodsId}", goodsId);
|
||||
return ApiResponse<WelfareRecordsResponse>.Fail("获取开奖记录失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -629,3 +629,26 @@ public class FuliwuListResponse
|
|||
/// </summary>
|
||||
public int LastPage { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 福利屋参与者列表响应
|
||||
/// </summary>
|
||||
public class WelfareParticipantsResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 参与者列表
|
||||
/// </summary>
|
||||
public List<ParticipantDto> List { get; set; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 福利屋开奖记录响应
|
||||
/// </summary>
|
||||
public class WelfareRecordsResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 开奖记录列表
|
||||
/// </summary>
|
||||
public List<WinningRecordDto> List { get; set; } = new();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user