|
|
@@ -0,0 +1,41 @@
|
|
|
+package com.sckw.message.controller.background;
|
|
|
+
|
|
|
+import com.sckw.core.exception.BusinessException;
|
|
|
+import com.sckw.core.web.response.HttpResult;
|
|
|
+import com.sckw.message.model.vo.req.GetSmsVerifyCoderReqVO;
|
|
|
+import com.sckw.message.service.SmsService;
|
|
|
+import jakarta.validation.Valid;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @desc: 短信后台接口
|
|
|
+ * @author: yzc
|
|
|
+ * @date: 2023-08-29 19:22
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping(value = "/kwmBackgroundSms")
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class SmsBackgroundController {
|
|
|
+
|
|
|
+ private final SmsService smsService;
|
|
|
+
|
|
|
+ @Value("${background.sms.getVerifyCode.token}")
|
|
|
+ private String verifyCodeToken;
|
|
|
+
|
|
|
+ @PostMapping(value = "/getVerifyCode", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ public HttpResult sendVerifyCode(@Valid @RequestBody GetSmsVerifyCoderReqVO param) {
|
|
|
+ if (!Objects.equals(param.getToken(), verifyCodeToken)) {
|
|
|
+ throw new BusinessException("非法token!");
|
|
|
+ }
|
|
|
+ return HttpResult.ok("获取验证码成功", smsService.getVerifyCode(param));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|