From 1fdf6fe77c003afd34268c3eb6109896194428a8 Mon Sep 17 00:00:00 2001 From: Gary Date: Mon, 22 Jan 2024 14:12:41 +0800 Subject: [PATCH] 1.change getSupportedCountryCode response from List to List --- .../luoo/user/controller/LoginController.java | 6 +++--- .../luoo/user/dto/response/CountryCodeDTO.java | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 luoo_user/src/main/java/com/luoo/user/dto/response/CountryCodeDTO.java diff --git a/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java b/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java index c65d7e6..cbcd601 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java @@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*; import constants.Constants; import controller.BaseController; +import com.luoo.user.dto.response.CountryCodeDTO; import com.luoo.user.dto.response.CreateImageCode; import com.luoo.user.pojo.UserInfo; import com.luoo.user.service.UserInfoService; @@ -46,7 +47,7 @@ import util.StringTools; @RequestMapping("/user") @Api(tags = "LoginController") public class LoginController extends BaseController{ - private static final List DEFAULT_SUPPORTED_COUNTRY_CODES=Arrays.asList("+86"); + private static final List DEFAULT_SUPPORTED_COUNTRY_CODES=Arrays.asList(new CountryCodeDTO("中国","+86")); @Autowired private UserInfoService userInfoService; @@ -182,8 +183,7 @@ public class LoginController extends BaseController{ */ @ApiOperation(value = "6.获取支持的手机号国家码", notes = "v1仅支持'+86'") @GetMapping("/supportedCountryCode") - @GlobalInterceptor - public Result> getSupportedCountryCode(){ + public Result> getSupportedCountryCode(){ return Result.success(DEFAULT_SUPPORTED_COUNTRY_CODES); } } diff --git a/luoo_user/src/main/java/com/luoo/user/dto/response/CountryCodeDTO.java b/luoo_user/src/main/java/com/luoo/user/dto/response/CountryCodeDTO.java new file mode 100644 index 0000000..3798715 --- /dev/null +++ b/luoo_user/src/main/java/com/luoo/user/dto/response/CountryCodeDTO.java @@ -0,0 +1,17 @@ +package com.luoo.user.dto.response; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class CountryCodeDTO { + @ApiModelProperty(value = "国家名", example = "中国") + private String countryName; + @ApiModelProperty(value = "国际电话区号", example = "+86") + private String countryCode; + + public CountryCodeDTO(String countryName, String countryCode) { + this.countryName = countryName; + this.countryCode = countryCode; + } +}