package com.bonus.zlpt.system.controller;

import com.bonus.zlpt.common.core.web.controller.BaseController;
import com.bonus.zlpt.common.core.web.domain.AjaxResult;
import com.bonus.zlpt.system.service.ISmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Description: 短信发送接口
 *
 * @Author 阮世耀
 * @Create 2023/12/6 15:13
 * @Version 1.0
 */
@RestController
@RequestMapping("/sms")
public class SmsSendController extends BaseController {

    @Autowired
    private ISmsService smsService;

    @RequestMapping("/send")
    public AjaxResult send(@RequestParam("phone") String phone){
        try {
            String msg = smsService.sendCode(phone, 5 * 60 * 1000);
            return success(msg);
        } catch (Exception e) {
            return error(e.getMessage());
        }
    }

}
