package com.zhongzheng.controller.user;

import com.zhongzheng.common.core.controller.BaseController;
import com.zhongzheng.common.core.domain.AjaxResult;
import com.zhongzheng.modules.alisms.bo.SmsAddBo;
import com.zhongzheng.modules.alisms.service.IAliSmsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 客户端用户Controller
 *
 * @author hjl
 * @date 2021-06-08
 */
@Api(value = "短信控制器", tags = {"短信控制器"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/app/common/sms")
public class SmsController extends BaseController {

    private final IAliSmsService iSmsService;


    @ApiOperation("获取注册短信")
    @PostMapping("/register")
    public AjaxResult register(@RequestBody SmsAddBo bo) {
        iSmsService.sendRegisterSms(bo.getTel());
        return AjaxResult.success();
    }


    @ApiOperation("获取登录短信")
    @PostMapping("/login")
    public AjaxResult login(@RequestBody SmsAddBo bo) {
        iSmsService.sendLoginSms(bo.getTel());
        return AjaxResult.success();
    }

    @ApiOperation("获取忘记短信")
    @PostMapping("/forget")
    public AjaxResult forget(@RequestBody SmsAddBo bo) {
        iSmsService.sendForgetSms(bo.getTel());
        return AjaxResult.success();
    }
}
