package org.dromara.payment.sys.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import org.dromara.common.core.domain.R;
import org.dromara.common.encrypt.annotation.ApiEncrypt;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.web.core.BaseController;
import org.dromara.payment.sys.domain.bo.SysPayPwdBo;
import org.dromara.payment.sys.service.ISysPayPwdService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author sunzexing
 * @version 1.0
 * @title SysPayPwdController
 * @description
 * @create 2024-05-13 11:28
 */
@RestController
@RequestMapping("/sys/")
public class SysPayPwdController extends BaseController {

    @Resource
    public ISysPayPwdService sysPayPwdService;


    /****
     * 修改支付密码
     * @param bo
     * @return
     */

    @ApiEncrypt
    @SaCheckPermission("payment:sys:updPayPwd")
    @PutMapping("/updPayPwd")
    @Log(title = "修改支付密码", businessType = BusinessType.UPDATE)
    public R<String> updPayPwd(@Validated  @RequestBody SysPayPwdBo bo){
        return R.ok(sysPayPwdService.updPayPwd(bo));
    }


    /****
     * 发送支付密码短信
     * @param domain
     * @return
     */
    @GetMapping("/sendPayPwd")
    @Log(title = "发送修改支付密码短信", businessType = BusinessType.UPDATE)
    public R<Boolean> sendPaySms(String domain){
        return R.ok(this.sysPayPwdService.sendSmsCode(domain));
    }


}
