package com.bicloud.controller;


import com.bicloud.common.result.Result;
import com.bicloud.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/user")
@Tag(name = "用户管理")
@Slf4j
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 发送手机验证码
     */
    @PostMapping("code")
    @Operation(summary = "发送验证码")
    public Result sendCode(@RequestParam("phone") String phone, HttpSession session, HttpServletRequest request) {
        // 发送短信验证码并保存验证码
        return userService.sendCode(phone, session, request);
    }

}
