瀏覽代碼

fix : 新增阿里手机通讯接口

bilingfeng 1 年之前
父節點
當前提交
a7a1aa25c4

+ 22 - 1
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/AliApiServiceImpl.java

@@ -1,5 +1,6 @@
 package com.zanxiang.game.module.sdk.service.impl;
 
+import cn.hutool.http.ContentType;
 import com.zanxiang.game.module.sdk.pojo.result.CardCheckResult;
 import com.zanxiang.game.module.sdk.pojo.result.IpCheckResult;
 import com.zanxiang.game.module.sdk.service.IAliApiService;
@@ -36,7 +37,27 @@ public class AliApiServiceImpl implements IAliApiService {
      */
     private final String APP_CODE = "f395b1587fc04a49a975f908660fb1e9";
 
-
+    public void phoneCall(String param) {
+        RestTemplate restTemplate = new RestTemplate();
+        String host = "https://jumfixed.market.alicloudapi.com/voice-notify/send";
+        HttpHeaders headers = new HttpHeaders();
+        headers.set("Authorization", "APPCODE " + this.APP_CODE);
+        headers.set("Content-Type", ContentType.FORM_URLENCODED.getValue());
+        //参数
+        MultiValueMap<String, String> requestParams = new LinkedMultiValueMap<>();
+        requestParams.add("mobile", "13100690278");
+        requestParams.add("templateId", "JMJNAWUQOJP9");
+        requestParams.add("param", param);
+        String result = null;
+        try {
+            ResponseEntity<String> responseEntity = restTemplate.exchange(host, HttpMethod.POST,
+                    new HttpEntity<>(requestParams, headers), String.class);
+            result = responseEntity.getBody();
+        } catch (Exception e) {
+            log.error("阿里语音呼叫失败, requestParams : {}, e : {}", JsonUtil.toString(requestParams), e.getMessage());
+        }
+        log.error("阿里语音呼叫结果, result : {}", result);
+    }
 
     @Override
     public Tuple2<Boolean, String> authenticationCheck(String cardName, String cardId) {