package com.dcsoft.auth.controller;


import com.dcsoft.auth.form.RegisterBody;
import com.dcsoft.auth.service.SysLoginService;
import com.dcsoft.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 短信验证码控制
 */
@RestController
public class SmsLoginController {

    @Autowired
    private SysLoginService sysLoginService;

    @PostMapping("app/sendSms")
    public R<?> sendSms(@RequestBody RegisterBody register) {
        R<String> result = sysLoginService.sendSms(register);
        if (null != result && 200 == result.getCode()) {
            return R.ok();
        }
        return R.fail("获取短信验证码失败");
    }
}
