package com.njzscloud.common.security.support.controller;

import com.njzscloud.common.core.utils.R;
import com.njzscloud.common.security.support.VerificationCodeService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 登录
 */
@RestController
@RequestMapping("/auth")
@RequiredArgsConstructor
public class VerificationCodeController {
    private final VerificationCodeService verificationCodeService;

    /**
     * 获取验证码
     *
     * @param phone 手机号
     * @return 验证码标识符
     */
    @GetMapping("/obtain_code")
    public R<String> obtainCode(@RequestParam("phone") String phone) {
        return R.success(verificationCodeService.obtainCode(phone));
    }
}
