package com.ruoyi.web.controller.common;

import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.SendSmsUtils;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: tjf
 * @Date: 2023/10/13 17:15
 * @Describe:
 */
@RestController
@RequestMapping("/sendSms")
public class SendSmsController {


    /**
     * 发送密码验证码短信
     * @param
     * @return
     */
    @GetMapping("/{phone}")
    public AjaxResult sendSms(@PathVariable String phone) {
        JSONObject jsonObject = new JSONObject();
        String code = SendSmsUtils.getCode(4);
        jsonObject.put("code", code);
        SendSmsUtils.sendSms(phone,"SMS_219525380",jsonObject.toString());
        return AjaxResult.success(code);
    }



}