123
This commit is contained in:
@@ -16,9 +16,11 @@ import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.yunxin.Yunxin;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -26,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -34,6 +37,7 @@ import java.util.Map;
|
||||
@SaIgnore
|
||||
@Tag(name = "权限相关接口,免鉴权")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class AuthAppController {
|
||||
|
||||
@Autowired
|
||||
@@ -60,6 +64,8 @@ public class AuthAppController {
|
||||
return R.ok(vo);
|
||||
}
|
||||
|
||||
private final static String[] headers = new String[]{"X-Forwarded-For", "X-Real-IP", "Proxy-Client-IP", "WL-Proxy-Client-IP", "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR"};
|
||||
|
||||
@PostMapping("/register/code")
|
||||
@Operation(summary = "获取注册验证码")
|
||||
@Log(title = "获取注册验证码", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||
@@ -68,6 +74,14 @@ public class AuthAppController {
|
||||
if(!mobile){
|
||||
return R.fail(600,"请输入正确的手机格式");
|
||||
}
|
||||
HttpServletRequest request = ServletUtils.getRequest();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("注册验证码IP检测;");
|
||||
sb.append("remoteAddr:").append(request.getRemoteAddr());
|
||||
for (String header : headers) {
|
||||
sb.append(header).append(":").append(request.getHeader(header));
|
||||
}
|
||||
log.info(sb.toString());
|
||||
smsVerifyService.put(CodeEnum.REGISTER,code.getMobile());
|
||||
return R.ok("发送成功");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user