Pārlūkot izejas kodu

小店域名人机校验

zoujiajian 2 gadi atpakaļ
vecāks
revīzija
f3a214f8a6

+ 21 - 8
netflix-service/src/main/java/com/cyksj/service/user/impl/BadIntentionOpServiceImpl.java

@@ -25,6 +25,9 @@ public class BadIntentionOpServiceImpl implements BadIntentionOpService {
     @Value("${smsVerify.apikey}")
     String apiKey;
 
+    @Value("${smsVerify.shoppingApikey}")
+    String shoppingApikey;
+
     private final RedisService redisService;
 
     private static final int PHONE_CODE_GET_NUM_DAY_LIMIT = 30;
@@ -41,15 +44,16 @@ public class BadIntentionOpServiceImpl implements BadIntentionOpService {
         }
         if (StringUtils.isBlank(verifyCode)) {
             throw BusinessRuntimeException.getInstance("人机校验不通过");
-        }else {
-            Map<String, Object> parmas = new HashMap<>();
-            parmas.put("api_key", apiKey);
-            parmas.put("response", verifyCode);
-            String post = HttpUtil.post(VERIFY_URL, parmas);
-            JSONObject res = new JSONObject(post);
+        } else {
+            //银河官网
+            JSONObject res = checkVerifyCode(apiKey, verifyCode);
             if (!res.getStr("res").equals("success")) {
-                log.error("手机号:{}验证码校验不通过 res:{}", phone, res);
-                throw BusinessRuntimeException.getInstance("人机校验不通过");
+                //小店域名
+                res = checkVerifyCode(shoppingApikey, verifyCode);
+                if (!res.getStr("res").equals("success")) {
+                    log.error("手机号:{}验证码校验不通过 res:{}", phone, res);
+                    throw BusinessRuntimeException.getInstance("人机校验不通过");
+                }
             }
         }
         String dayKey = RedisService.key.PHONE_CODE_USER_NUM_KEY_DAY.getName() + phone;
@@ -95,4 +99,13 @@ public class BadIntentionOpServiceImpl implements BadIntentionOpService {
             redisService.setNx(RetryTimeKey, 1, RedisService.key.PHONE_CODE_RETRY_TIME_KEY.getTimeout());
         }
     }
+
+    public JSONObject checkVerifyCode(String apiKey, String verifyCode) {
+        Map<String, Object> parmas = new HashMap<>();
+        parmas.put("api_key", apiKey);
+        parmas.put("response", verifyCode);
+        String post = HttpUtil.post(VERIFY_URL, parmas);
+        JSONObject res = new JSONObject(post);
+        return res;
+    }
 }

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
netflix-web/src/main/resources/application-dev.yml


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
netflix-web/src/main/resources/application-prd.yml


+ 2 - 1
netflix-web/src/main/resources/application-pre.yml

@@ -183,4 +183,5 @@ chatgpt:
     domain: "https://car.galaxydvd.com"
 
 smsVerify:
-  apikey: bc0737b7339ab0f275f954a161fdb313
+  apikey: bc0737b7339ab0f275f954a161fdb313
+  shoppingApikey: 0e22fe772ebcf3b55ebcf1d1adc3963f

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels