From 31ba7bc69070f4e3d6e8aabaeeaa266654e52e4d Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Thu, 29 May 2025 01:00:14 +0800
Subject: [PATCH] 短信

---
 oying-system/src/main/java/com/oying/modules/security/rest/VerificationController.java |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/oying-system/src/main/java/com/oying/modules/security/rest/VerificationController.java b/oying-system/src/main/java/com/oying/modules/security/rest/VerificationController.java
new file mode 100644
index 0000000..6cb597e
--- /dev/null
+++ b/oying-system/src/main/java/com/oying/modules/security/rest/VerificationController.java
@@ -0,0 +1,44 @@
+package com.oying.modules.security.rest;
+
+import cn.hutool.core.util.IdUtil;
+import com.oying.annotation.rest.AnonymousGetMapping;
+import com.oying.utils.RedisUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author xin
+ * @description
+ * @date 2025/5/29 00:54
+ */
+@Slf4j
+@RestController
+@RequestMapping("/auth/verification")
+@RequiredArgsConstructor
+@Api(tags = "系统:短信验证码")
+public class VerificationController {
+
+    private final RedisUtils redisUtils;
+    @Value("${sms.key}")
+    private String key;
+    @Value("${sms.time}")
+    private Long time;
+
+    @AnonymousGetMapping("/{phone}")
+    @ApiOperation("短信验证码")
+    public ResponseEntity<Object> toPayAsPc(@PathVariable String phone) {
+        String uuid = key + IdUtil.simpleUUID();
+        System.out.println(phone);
+        //创建验证码
+        String verification = (int) ((Math.random() * 9 + 1) * 100000) + "";
+        redisUtils.set(uuid, verification, time);
+        return ResponseEntity.ok(uuid);
+    }
+}

--
Gitblit v1.9.3