From efdb99f8cecc4afb592afad79c761081d5d5cf22 Mon Sep 17 00:00:00 2001 From: lee <4766465@qq.com> Date: Wed, 18 Dec 2024 13:27:00 +0800 Subject: [PATCH] init --- yami-shop-api/src/main/java/com/yami/shop/api/controller/SmsController.java | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-) diff --git a/yami-shop-api/src/main/java/com/yami/shop/api/controller/SmsController.java b/yami-shop-api/src/main/java/com/yami/shop/api/controller/SmsController.java new file mode 100644 index 0000000..938a2d2 --- /dev/null +++ b/yami-shop-api/src/main/java/com/yami/shop/api/controller/SmsController.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. + * + * https://www.mall4j.com/ + * + * 未经允许,不可做商业用途! + * + * 版权所有,侵权必究! + */ +package com.yami.shop.api.controller; + +import com.google.common.collect.Maps; +import com.yami.shop.bean.app.param.SendSmsParam; +import com.yami.shop.bean.enums.SendType; +import com.yami.shop.common.response.ServerResponseEntity; +import com.yami.shop.service.SmsLogService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +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.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author LGH + */ +@RestController +@RequestMapping("/sms") +@Tag(name = "发送验证码接口") +public class SmsController { + + @Autowired + private SmsLogService smsLogService; + + @PostMapping("/sendLoginCode") + @Operation(summary = "发送登录验证码" , description = "用户发送登录验证码") + public ServerResponseEntity<Void> sendLoginCode(@RequestBody SendSmsParam sendSmsParam) { + // 每个手机号每分钟只能发十个注册的验证码,免得接口被利用 + smsLogService.sendSms(SendType.LOGIN, sendSmsParam.getMobile(), sendSmsParam.getMobile(), Maps.newHashMap()); + return ServerResponseEntity.success(); + } + + @PostMapping("/sendUpdatePwdCode") + @Operation(summary = "发送修改密码验证码接口" , description = "发送修改密码验证码接口") + public ServerResponseEntity<Void> sendUpdatePwdCode(@RequestBody SendSmsParam sendSmsParam) { + // 每个手机号每分钟只能发十个注册的验证码,免得接口被利用 + smsLogService.sendSms(SendType.UPDATE_PASSWORD, sendSmsParam.getMobile(), sendSmsParam.getMobile(), Maps.newHashMap()); + return ServerResponseEntity.success(); + } +} -- Gitblit v1.9.3