|
|
@@ -1,4 +1,4 @@
|
|
|
-package main.java.com.ljsd.channel;
|
|
|
+package com.ljsd.channel;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.net.URLEncoder;
|
|
|
@@ -12,15 +12,32 @@ import java.util.Properties;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
+import com.google.gson.JsonObject;
|
|
|
+import com.mongodb.BasicDBObject;
|
|
|
+import com.mongodb.DBObject;
|
|
|
+import org.apache.http.client.methods.CloseableHttpResponse;
|
|
|
+import org.apache.http.client.methods.HttpGet;
|
|
|
+import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
+import org.apache.http.impl.client.HttpClients;
|
|
|
+import org.apache.http.util.EntityUtils;
|
|
|
+import org.slf4j.ILoggerFactory;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.apache.http.client.utils.URIBuilder;
|
|
|
+
|
|
|
import com.ljsd.channel.MockQuickSDK;
|
|
|
import com.ljsd.util.BaseGlobal;
|
|
|
import com.ljsd.util.TimeUtil;
|
|
|
import com.ljsd.util.XmlParser;
|
|
|
+import com.google.gson.Gson;
|
|
|
+import com.google.gson.JsonObject;
|
|
|
+
|
|
|
|
|
|
public class MsySDK {
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(MsySDK.class);
|
|
|
private static final CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
|
- //private final static String _COLLECTION_PAY = "pay";
|
|
|
+ private final static String _COLLECTION_PAY = "pay";
|
|
|
+ private static final Gson GSON = new Gson();
|
|
|
public static boolean verifyUser(String uid, String token) {
|
|
|
try {
|
|
|
Properties properties = BaseGlobal.getInstance().properties;
|
|
|
@@ -29,7 +46,7 @@ public class MsySDK {
|
|
|
// String nToken = URLEncoder.encode(token, String.valueOf(StandardCharsets.UTF_8));
|
|
|
//uriBuilder.addParameter("product_code", productCode);
|
|
|
uriBuilder.addParameter("uid", uid);
|
|
|
- uriBuilder.addParameter("token", toekn);
|
|
|
+ uriBuilder.addParameter("token", token);
|
|
|
// uriBuilder.addParameter("channel_code", ""); // 必须传渠道 ID
|
|
|
LOGGER.info("MsySDK 验证参数, token:{}, uid:{}",token,uid);
|
|
|
|
|
|
@@ -39,10 +56,10 @@ public class MsySDK {
|
|
|
String result = EntityUtils.toString(response.getEntity());
|
|
|
response.close();
|
|
|
JsonObject jsonObject = GSON.fromJson(result, JsonObject.class);
|
|
|
- boolean status = jsonObject.getBoolean("status");
|
|
|
- LOGGER.info("QuickSDK 验证结果:{}", result);
|
|
|
- if(state != true){
|
|
|
- String content = jsonObject.getString("message");
|
|
|
+ boolean state = jsonObject.get("status").getAsBoolean();
|
|
|
+ LOGGER.info("MsySDK 验证结果:{}", result);
|
|
|
+ if(!state){
|
|
|
+ String content = jsonObject.get("message").getAsString();
|
|
|
LOGGER.info("MSYSdk parseLoginResult content={}",content);
|
|
|
return false;
|
|
|
}
|
|
|
@@ -60,7 +77,7 @@ public class MsySDK {
|
|
|
return false;
|
|
|
}
|
|
|
Properties properties = BaseGlobal.getInstance().properties;
|
|
|
- String md5Key = properties.getProperty("Msy_sdk_md5key_"+subChannel);
|
|
|
+ String md5Key = properties.getProperty("Msy_sdk_md5key_");
|
|
|
String rawString = nt_data + sign + md5Key;
|
|
|
LOGGER.info("rawString = {}", rawString);
|
|
|
|
|
|
@@ -118,7 +135,7 @@ public class MsySDK {
|
|
|
LOGGER.info("与目标金额对比结果= {}, 订单金额 = {}", isEqual, amount);
|
|
|
if(!isEqual) {
|
|
|
LOGGER.error("金额不一致,请检查!");
|
|
|
- return null;
|
|
|
+ return null;
|
|
|
}
|
|
|
payInfo.put("gameorderId", fields.get("order_no"));
|
|
|
payInfo.put("billno", orderId);
|