package com.sqx.modules.app.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.app.service.UserMoneyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

@RestController
@RequestMapping("/userMoney")
@AllArgsConstructor
@Api(value = "钱包", tags = {"钱包"})
public class UserMoneyController {

    @Autowired
    private UserMoneyService userMoneyService;

    @GetMapping("/selectUserMoney")
    @ApiOperation("查询用户钱包余额")
    public Result selectUserMoney(Long userId){
        return Result.success().put("data",userMoneyService.selectUserMoneyByUserId(userId));
    }

    @ApiOperation("修改用户保证金")
    @GetMapping(value = "/updateCashDeposit")
    public Result updateCashDeposit(Long userId, BigDecimal money, Integer type) {

        return userMoneyService.updateCashDeposit(userId, money, type);
    }

}
