1. 新增宠物皮肤初始枚举值、下拉列表接口及相关DTO 2. 完善商品实体与DTO,新增虚拟商品标记和类型ID字段 3. 重构用户认证体系,支持多用户切换并重新生成JWT令牌 4. 新增签到配置管理全套功能,包括增删改查和状态管理 5. 优化模型验证过滤器和基础响应类的命名规范 6. 新增补签功能,完善签到服务逻辑 7. 拆分用户详情DTO,新增各子数据分页查询接口 8. 重构微信控制器的用户ID获取逻辑,统一使用激活用户ID 9. 修复背包服务中补签卡的扣减逻辑 10. 新增家长姓名修改接口和相关服务实现
84 lines
3.0 KiB
C#
84 lines
3.0 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using QYZH.InteractiveMagazine.IService;
|
||
using QYZH.InteractiveMagazine.Models.Common;
|
||
using QYZH.InteractiveMagazine.Models.Dto;
|
||
|
||
namespace QYZH.InteractiveMagazine.WebApi.Controllers.WeChat;
|
||
|
||
/// <summary>
|
||
/// 小程序期刊管理控制器
|
||
/// </summary>
|
||
public class JournalController : WeChatBaseController
|
||
{
|
||
private readonly IUserJournalService _userJournalService;
|
||
private readonly ILogger<JournalController> _logger;
|
||
|
||
public JournalController(IUserJournalService userJournalService, ILogger<JournalController> logger)
|
||
{
|
||
_userJournalService = userJournalService;
|
||
_logger = logger;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 用户扫码绑定期刊
|
||
/// </summary>
|
||
/// <param name="input">绑定输入(JournalId、JournalInstanceId 从扫码内容解析,Type 默认 Subscribe)</param>
|
||
/// <returns>绑定结果</returns>
|
||
[HttpPost("bind")]
|
||
public async Task<BaseResponse<BindJournalOutput>> BindAsync([FromBody] BindJournalInput input)
|
||
{
|
||
try
|
||
{
|
||
var userId = GetCurrentUserId();
|
||
if (userId == 0)
|
||
{
|
||
return BaseResponse<BindJournalOutput>.Fail(ResultCode.DENY, "未获取到用户信息");
|
||
}
|
||
|
||
var result = await _userJournalService.BindJournalAsync(userId, input);
|
||
return Success(result, "绑定期刊成功");
|
||
}
|
||
catch (BusinessException ex)
|
||
{
|
||
_logger.LogWarning(ex, "绑定期刊业务异常: {Message}", ex.Message);
|
||
return BaseResponse<BindJournalOutput>.Fail(ex.Message);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
_logger.LogError(ex, "绑定期刊系统异常,参数:{Input}", input);
|
||
return BaseResponse<BindJournalOutput>.Fail("绑定期刊失败,请稍后重试");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取当前用户的期刊绑定列表
|
||
/// </summary>
|
||
/// <param name="input">查询条件(期刊Id、实例Id、关联类型)</param>
|
||
/// <returns>分页结果</returns>
|
||
[HttpPost("list")]
|
||
public async Task<BaseResponse<PageListModel<BindJournalOutput>>> GetListAsync([FromBody] UserJournalQueryInput input)
|
||
{
|
||
try
|
||
{
|
||
var userId = GetCurrentUserId();
|
||
if (userId == 0)
|
||
{
|
||
return BaseResponse<PageListModel<BindJournalOutput>>.Fail(ResultCode.DENY, "未获取到用户信息");
|
||
}
|
||
|
||
var result = await _userJournalService.GetUserJournalsAsync(userId, input);
|
||
return Success(result);
|
||
}
|
||
catch (BusinessException ex)
|
||
{
|
||
_logger.LogWarning(ex, "查询期刊绑定列表业务异常: {Message}", ex.Message);
|
||
return BaseResponse<PageListModel<BindJournalOutput>>.Fail(ex.Message);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
_logger.LogError(ex, "查询期刊绑定列表系统异常");
|
||
return BaseResponse<PageListModel<BindJournalOutput>>.Fail("查询期刊绑定列表失败,请稍后重试");
|
||
}
|
||
}
|
||
}
|