Ver código fonte

特殊字符转义

lyhzzz 2 anos atrás
pai
commit
954834792e

+ 2 - 0
src/main/java/com/fdkankan/ucenter/controller/api/LaserController.java

@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.net.URLEncoder;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -42,6 +43,7 @@ public class LaserController extends BaseController {
     @RequestMapping(value = "/getSnCodeByPhone",method = RequestMethod.GET)
     public Result getSnCodeByUserName(@RequestParam(required = false)String phone,
                                       @RequestParam(required = false)Integer sceneSource) throws Exception {
+        phone = URLEncoder.encode(phone, "utf-8");
         List<Long> userIds = userService.getLikeUserName(phone);
         HashMap<String,Object> map = new HashMap<>();
         Set<String> snCodeSet = new HashSet<>();