package com.playlet.web.controller.app;


import com.playlet.common.core.domain.Result;
import com.playlet.system.domain.PlayletUserWithdrawalPassword;
import com.playlet.web.service.app.IPlayletUserWithdrawalPasswordAppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @Date: 2024-03-30 12:27
 * @Author: 但星霖
 * @Version: v1.0
 * @Description: 用户提现密码app Controller
 */
@Controller
@Api(tags = "小程序*提现密码")
@RequestMapping("/app/userWithdrawalPassword")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PlayletUserWithdrawalPasswordAppController {

    private final IPlayletUserWithdrawalPasswordAppService appService;

    /**
     * 新增保存用户提现密码
     */
    @PostMapping("/add")
    @ResponseBody
    @ApiOperation(value = "新增保存用户提现密码")
    public Result<String> addSave(PlayletUserWithdrawalPassword playletUserWithdrawalPassword) {
        appService.insertData(playletUserWithdrawalPassword);
        return Result.success();
    }

    /**
     * 修改保存用户提现密码
     */
    @PostMapping("/edit")
    @ResponseBody
    @ApiOperation(value = "修改保存用户提现密码")
    public Result<String> editSave(@RequestBody PlayletUserWithdrawalPassword playletUserWithdrawalPassword) {
        appService.updateData(playletUserWithdrawalPassword);
        return Result.success();
    }

    @ApiOperation(value = "用户确认密码")
    @ResponseBody
    @PostMapping("/validatePassword")
    public Result<Boolean> statisticsTime(@RequestBody PlayletUserWithdrawalPassword playletUserWithdrawalPassword) {
        return Result.success(appService.validatePassword(playletUserWithdrawalPassword));
    }

}
