luodangjia
2024-11-28 06f455915bb9d11caa8829942f9007809ee9ae3d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.ruoyi.account.controller;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.account.api.model.BalanceChangeRecord;
import com.ruoyi.account.service.BalanceChangeRecordService;
import com.ruoyi.account.service.WalletService;
import com.ruoyi.account.vo.WalletVO;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.Resource;
import java.util.List;
 
@Api("钱包")
@RestController
@RequestMapping("wallet")
public class WalletController extends BaseController {
    @Resource
    private BalanceChangeRecordService balanceChangeRecordService;
    @Resource
    private TokenService tokenService;
    @Resource
    private WalletService walletService;
 
    /**
     * 钱包详情
     */
    @GetMapping("detail")
    @ApiOperation(value = "钱包详情", notes = "钱包详情", tags = {"小程序-个人中心-我的钱包-钱包详情"})
    public R<WalletVO> detail() {
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        WalletVO walletVO = walletService.getWalletByUserId(loginUserApplet.getUserid());
        return R.ok(walletVO);
    }
 
    /**
     * 变更明细
     */
    @ApiOperation(value = "变更明细", notes = "变更明细", tags = {"小程序-个人中心-我的钱包-变更记录"})
    @GetMapping("change")
    public R<List<BalanceChangeRecord>> change() {
        Long userId = SecurityUtils.getUserId();
        return R.ok(balanceChangeRecordService.list(new LambdaQueryWrapper<BalanceChangeRecord>()
                .eq(BalanceChangeRecord::getAppUserId, userId)));
    }
 
//    /**
//     * 充值
//     */
//    @GetMapping("recharge")
//    @ApiOperation(value = "充值", notes = "钱包充值")
//    public AjaxResult recharge(@ApiParam(value = "充值金额", required = true) @RequestParam BigDecimal amount) {
//        Long userId = SecurityUtils.getUserId();
//        String openId;
//        // 商户号
//        String partnerTradeNo;
//        // TODO 充值
//        return AjaxResult.success();
//    }
 
}