feat(wallet): 新增用户钱包余额查询功能

This commit is contained in:
2025-12-10 18:52:38 +08:00
parent 5227b81acb
commit 0d1545f568
8 changed files with 216 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
package com.yolo.keyborad.controller;
import cn.dev33.satoken.stp.StpUtil;
import com.yolo.keyborad.common.BaseResponse;
import com.yolo.keyborad.common.ResultUtils;
import com.yolo.keyborad.model.vo.wallet.KeyboardUserWalletRespVO;
import com.yolo.keyborad.service.KeyboardUserWalletService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/*
* @author: ziin
* @date: 2025/12/10
*/
@RestController
@Slf4j
@RequestMapping("/wallet")
@Tag(name = "钱包", description = "用户钱包接口")
public class WalletController {
@Resource
private KeyboardUserWalletService walletService;
@GetMapping("/balance")
@Operation(summary = "查询钱包余额", description = "查询当前登录用户的钱包余额")
public BaseResponse<KeyboardUserWalletRespVO> getBalance() {
Long userId = StpUtil.getLoginIdAsLong();
KeyboardUserWalletRespVO balance = walletService.getWalletBalance(userId);
return ResultUtils.success(balance);
}
}