123456789101112131415161718192021222324252627282930 |
- package com.futu.goose.user.controller;
- import com.futu.goose.user.service.ValidateCodeService;
- import com.futu.goose.utils.RedisClient;
- import com.futu.goose.utils.Result;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- @RestController
- @RequestMapping("/validateCode")
- public class ValidateCode {
- @Autowired
- private ValidateCodeService validateCodeService;
- @Autowired
- private RedisClient redisClient;
- @RequestMapping("/send4Order")
- public Result send4Order(@RequestParam("telephone") String telephone) {
- Integer code = validateCodeService.send4Order(telephone);
- redisClient.set("CODE", code);
- redisClient.expire("CODE", 60);
- System.out.println("您的验证码为:------"+code);
- return new Result(true,"验证码发送成功");
- }
- }
|