xin
2025-06-03 95dc030ad8e77303207a1a42a3afd9a7a6612d75
oying-system/src/main/java/com/oying/modules/security/rest/VerificationController.java
@@ -2,6 +2,7 @@
import cn.hutool.core.util.IdUtil;
import com.oying.annotation.rest.AnonymousGetMapping;
import com.oying.utils.R;
import com.oying.utils.RedisUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -9,8 +10,8 @@
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
@@ -31,14 +32,14 @@
    @Value("${sms.time}")
    private Long time;
    @AnonymousGetMapping("/{phone}")
    @AnonymousGetMapping
    @ApiOperation("短信验证码")
    public ResponseEntity<Object> toPayAsPc(@PathVariable String phone) {
    public ResponseEntity<Object> toPayAsPc(@RequestParam 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);
        return ResponseEntity.ok(R.success(uuid));
    }
}