refactor: 拆分微信API到独立项目并迁移相关代码
1. 新增WeChatApi独立项目,将原WebApi中的微信相关控制器迁移至新项目 2. 新增后台权限管理相关实体、服务接口和基础控制器 3. 完善管理员用户服务,增加角色关联查询和赋值逻辑 4. 修复WebApi Swagger文档过滤微信API版本的问题 5. 更新解决方案文件,添加新的微信API项目引用 6. 新增微信API基础配置文件和项目属性配置
This commit is contained in:
@ -0,0 +1,52 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using QYZH.InteractiveMagazine.IService;
|
||||
using QYZH.InteractiveMagazine.Models.Dto;
|
||||
using QYZH.InteractiveMagazine.Models.Dto.Bag;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.WeChatApi.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 小程序背包控制器
|
||||
/// </summary>
|
||||
public class BagController(IWxMallService mallService, ILogger<BagController> logger) : WeChatBaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取背包物品列表
|
||||
/// </summary>
|
||||
/// <param name="itemType">物品类型筛选(可选): MakeUpCard, PetBg</param>
|
||||
[HttpGet("items")]
|
||||
public async Task<BaseResponse<List<UserBagOutput>>> GetBagItems([FromQuery] string? itemType = null)
|
||||
{
|
||||
var userId = GetCurrentUserId();
|
||||
if (userId == 0) return Fail("未获取到用户信息") as dynamic;
|
||||
|
||||
var items = await mallService.GetBagItemsAsync(userId, itemType);
|
||||
return Success(items);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用背包物品(补签卡等消耗品)
|
||||
/// </summary>
|
||||
[HttpPost("useItem")]
|
||||
public async Task<BaseResponse<UseItemOutput>> UseItem([FromBody] UseItemInput input)
|
||||
{
|
||||
var userId = GetCurrentUserId();
|
||||
if (userId == 0) return Fail("未获取到用户信息") as dynamic;
|
||||
|
||||
var result = await mallService.UseItemAsync(userId, input);
|
||||
return Success(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 宠物换肤
|
||||
/// </summary>
|
||||
[HttpPost("equipSkin")]
|
||||
public async Task<BaseResponse<object>> EquipSkin([FromBody] EquipSkinInput input)
|
||||
{
|
||||
var userId = GetCurrentUserId();
|
||||
if (userId == 0) return Fail("未获取到用户信息") as dynamic;
|
||||
|
||||
await mallService.EquipSkinAsync(userId, input);
|
||||
return Success<object>(null!, input.SkinId == 0 ? "已恢复默认皮肤" : "换肤成功");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user