|
@@ -7,7 +7,6 @@ import com.zanxiang.game.module.sdk.service.IAliApiService;
|
|
|
import com.zanxiang.module.util.JsonUtil;
|
|
|
import com.zanxiang.module.util.exception.BaseException;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.logging.log4j.util.Strings;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.*;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -18,8 +17,6 @@ import org.springframework.web.util.UriComponentsBuilder;
|
|
|
import reactor.util.function.Tuple2;
|
|
|
import reactor.util.function.Tuples;
|
|
|
|
|
|
-import java.util.UUID;
|
|
|
-
|
|
|
/**
|
|
|
* @author : lingfeng
|
|
|
* @time : 2023-12-12
|
|
@@ -37,7 +34,8 @@ public class AliApiServiceImpl implements IAliApiService {
|
|
|
*/
|
|
|
private final String APP_CODE = "f395b1587fc04a49a975f908660fb1e9";
|
|
|
|
|
|
- public void phoneCall(String param) {
|
|
|
+ @Override
|
|
|
+ public void phoneCall(String param, String mobile) {
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
String host = "https://jumfixed.market.alicloudapi.com/voice-notify/send";
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
@@ -45,7 +43,7 @@ public class AliApiServiceImpl implements IAliApiService {
|
|
|
headers.set("Content-Type", ContentType.FORM_URLENCODED.getValue());
|
|
|
//参数
|
|
|
MultiValueMap<String, String> requestParams = new LinkedMultiValueMap<>();
|
|
|
- requestParams.add("mobile", "13100690278");
|
|
|
+ requestParams.add("mobile", mobile);
|
|
|
requestParams.add("templateId", "JMJNAWUQOJP9");
|
|
|
requestParams.add("param", param);
|
|
|
String result = null;
|
|
@@ -59,29 +57,6 @@ public class AliApiServiceImpl implements IAliApiService {
|
|
|
log.error("阿里语音呼叫结果, result : {}", result);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public Tuple2<Boolean, String> authenticationCheck(String cardName, String cardId) {
|
|
|
- String host = "https://dskj.market.alicloudapi.com/platform/check/verified";
|
|
|
- String url = host + "?certCode=" + cardId + "&realName=" + cardName;
|
|
|
- HttpHeaders headers = new HttpHeaders();
|
|
|
- headers.set("Authorization", "APPCODE " + this.APP_CODE);
|
|
|
- headers.set("X-Ca-Nonce", UUID.randomUUID().toString());
|
|
|
- HttpEntity httpEntity = new HttpEntity<>(headers);
|
|
|
- CardCheckResult result;
|
|
|
- try {
|
|
|
- String resultStr = restTemplate.postForObject(url, httpEntity, String.class);
|
|
|
- result = JsonUtil.toObj(resultStr, CardCheckResult.class);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("请求阿里实名认证接口异常(OLD), cardName : {}, cardId : {}, e : {}", cardName, cardId, e.getMessage());
|
|
|
- throw new BaseException("请求阿里实名认证接口异常");
|
|
|
- }
|
|
|
- if (result == null || !result.isSuccess()) {
|
|
|
- log.error("请求阿里实名认证接口返回值为空(OLD), cardName : {}, cardId : {}, result : {}", cardName, cardId, JsonUtil.toString(result));
|
|
|
- throw new BaseException("实名认证失败");
|
|
|
- }
|
|
|
- return Tuples.of(result.isPast(), Strings.EMPTY);
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public Tuple2<Boolean, String> userCardCheck(String cardName, String cardId) {
|
|
|
String url = "https://eid.shumaidata.com/eid/check";
|
|
@@ -98,11 +73,11 @@ public class AliApiServiceImpl implements IAliApiService {
|
|
|
String body = responseEntity.getBody();
|
|
|
result = JsonUtil.toObj(body, CardCheckResult.class);
|
|
|
} catch (Exception e) {
|
|
|
- log.error("请求阿里实名认证接口异常(NEW), cardName : {}, cardId : {}, e : {}", cardName, cardId, e.getMessage());
|
|
|
+ log.error("请求阿里实名认证接口异常, cardName : {}, cardId : {}, e : {}", cardName, cardId, e.getMessage());
|
|
|
throw new BaseException("请求阿里实名认证接口异常");
|
|
|
}
|
|
|
if (result == null || result.isFail()) {
|
|
|
- log.error("请求阿里实名认证接口返回值为空(NEW),cardName : {},cardId : {}, result : {}", cardName, cardId, JsonUtil.toString(result));
|
|
|
+ log.error("请求阿里实名认证接口返回值为空,cardName : {},cardId : {}, result : {}", cardName, cardId, JsonUtil.toString(result));
|
|
|
throw new BaseException("实名认证失败");
|
|
|
}
|
|
|
log.error("实名认证结果, result : {}", JsonUtil.toString(result));
|