generated from root/miduo_server
时空新渠道
parent
711c1202ab
commit
4f0ccd7472
|
@ -1052,6 +1052,76 @@ public class PayController {
|
|||
return "-3";
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付回调:国内渠道 QuickGame Android
|
||||
*
|
||||
* 说明文档: https://www.quicksdk.com/doc-15.html
|
||||
* 测试服回调地址:http://1.13.176.142/idip/sfzb/pay/quickNotify
|
||||
*/
|
||||
@RequestMapping(value = "/pay/quickNotifyNew", method = {RequestMethod.POST,RequestMethod.GET})
|
||||
public String quickNotifyNew(String nt_data, String sign, String md5Sign) {
|
||||
|
||||
try {
|
||||
LOGGER.info("quickNotifyNew--01, nt_data={},sign={},md5Sign={}", nt_data,sign,md5Sign);
|
||||
|
||||
String signStr = nt_data + sign + Constant.MD5_KEY_NEW;
|
||||
String mySign=MD5Util.encrypByMd5(signStr);
|
||||
|
||||
if(!mySign.equals(md5Sign)){
|
||||
LOGGER.error("错误信息:签名不一致 mySign={},md5Sign={}", mySign,md5Sign);
|
||||
return "-1";
|
||||
}
|
||||
|
||||
String deCodeDateXml = QuickSDKUtil.decode(nt_data, Constant.CALLBACK_KEY_NEW);
|
||||
LOGGER.info("quickNotifyNew--02 deCodeDateXml={}",deCodeDateXml);
|
||||
|
||||
Map<String, Object> stringObjectMap = XmlUtil.xmlToMap(deCodeDateXml);
|
||||
Map<String, Object> message = (Map<String, Object>)stringObjectMap.get("message");
|
||||
|
||||
String is_test=(String) message.get("is_test"); //是否为测试订单 1为测试 0为线上正式订单,游戏应根据情况确定上线后是否向测试订单发放道具。
|
||||
String channel=(String) message.get("channel"); //渠道标示ID 注意:游戏可根据实情,确定发放道具时是否校验充值来源渠道是否与该角色注册渠道相符
|
||||
String channel_uid=(String) message.get("channel_uid"); //渠道用户唯一标示,该值从客户端GetUserId()中可获取
|
||||
String game_order=(String) message.get("game_order"); //游戏在调用QuickSDK发起支付时传递的游戏方订单,这里会原样传回
|
||||
String order_no=(String) message.get("order_no"); //QuickSDK唯一订单号
|
||||
String pay_time=(String) message.get("pay_time"); //支付时间 2015-01-01 23:00:00
|
||||
String amount=(String) message.get("amount"); //成交金额,单位元,游戏最终发放道具金额应以此为准
|
||||
String status=(String) message.get("status"); //充值状态:0成功, 1失败(为1时 应返回FAILED失败)
|
||||
String extras_params=(String) message.get("extras_params"); //可为空,充值状态游戏客户端调用SDK发起支付时填写的透传参数.没有则为空
|
||||
|
||||
LOGGER.info("quickNotifyNew--03, is_test={},channel={},channel_uid={},game_order={},order_no={},pay_time={},amount={},status={},extras_params={}", is_test,channel,channel_uid,game_order,order_no,pay_time,amount,status,extras_params);
|
||||
|
||||
String orderId = game_order; //游戏订单号
|
||||
String out_trade_no = order_no; //渠道订单号
|
||||
|
||||
// 统一发货接口
|
||||
int payres = 0;
|
||||
if(is_test.equals("0")){ //正式订单 (0:一般支付,1:测试支付)
|
||||
Double amountDouble = Double.valueOf(amount) * 100;
|
||||
payres = payHandler.processOrderNew(orderId, out_trade_no,amountDouble.intValue()); //orderId 游戏订单号 out_trade_no 渠道订单号,支付金额 单位分
|
||||
}else if(is_test.equals("1")){ //测试订单
|
||||
payres = payHandler.processOrderTest(orderId, out_trade_no); //orderId 游戏订单号 out_trade_no 渠道订单号
|
||||
}
|
||||
|
||||
// 成功
|
||||
if (payres == 1) {
|
||||
return "SUCCESS";
|
||||
} else if (payres == -1) {
|
||||
LOGGER.error("pay:gameNoticeInterface, {} 订单不存在,", orderId);
|
||||
} else if (payres == -2) {
|
||||
LOGGER.error("pay:gameNoticeInterface, {} 订单参数错误,", orderId);
|
||||
} else if (payres == -3) {
|
||||
LOGGER.error("pay:gameNoticeInterface, {} 服务器配置错误,", orderId);
|
||||
} else if (payres == -4) {
|
||||
LOGGER.error("pay:gameNoticeInterface, {} 充值失败,", orderId);
|
||||
} else {
|
||||
LOGGER.error("pay:gameNoticeInterface, {} 返回错误,payres = {}", orderId,payres);
|
||||
return "-2";
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return "-3";
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付回调:国内渠道 QuickGame IOS
|
||||
|
|
|
@ -97,7 +97,10 @@ public class SDKController {
|
|||
break;
|
||||
case "Android_QuickGame": //国内--时空战场 Android
|
||||
case "Android_QuickGame_douyin":
|
||||
uid = SdkVerfy.quickGameVerfy(userId,sdksign, sdktoken);
|
||||
uid = SdkVerfy.quickGameVerfy(userId, sdksign, sdktoken);
|
||||
break;
|
||||
case "Android_QuickGame_New":
|
||||
uid = SdkVerfy.quickGameVerfyNew(userId, sdktoken);
|
||||
break;
|
||||
case "iOS_QuickGame": //国内--时空战场 IOS
|
||||
uid = SdkVerfy.quickGameVerfy_IOS(userId,sdksign, sdktoken);
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.net.URLEncoder;
|
|||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -401,6 +400,31 @@ public class SdkVerfy {
|
|||
return "-1";
|
||||
}
|
||||
|
||||
/**
|
||||
* 国内渠道QuickGame Android
|
||||
* @param userId
|
||||
* @param sdktoken
|
||||
* @return
|
||||
*/
|
||||
public static String quickGameVerfyNew(String userId, String sdktoken) {
|
||||
try {
|
||||
// 请求参数
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("product_code", Constant.PRODUCT_CODE_NEW);
|
||||
params.put("uid", userId);
|
||||
params.put("token", sdktoken);
|
||||
|
||||
String resurl = HttpUtil.postForm(Constant.QUICK_LOGIN_VERIFY_URL_NEW, params);
|
||||
LOGGER.info("res=" + resurl);
|
||||
if(resurl.equals("1")){
|
||||
return userId;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "-1";
|
||||
}
|
||||
|
||||
/**
|
||||
* 国内渠道QuickGame IOS
|
||||
* @param userId
|
||||
|
|
|
@ -85,6 +85,13 @@ public class Constant {
|
|||
public static final String MD5_KEY = "vw4tgkkeebdreianlroeugwpnnkg4cna"; //用来验证签名
|
||||
public static final String QUICK_LOGIN_VERIFY_URL = "http://checkuser.sdk.quicksdk.net/v2/checkUserInfo"; //登录验证地址
|
||||
|
||||
//国内渠道 QuickGame Android new
|
||||
public static final String PRODUCT_CODE_NEW = "87863613203357433581346794535264";
|
||||
public static final String PRODUCT_KEY_NEW = "05041174";
|
||||
public static final String CALLBACK_KEY_NEW = "21778212793140834460634685007840"; //用来解码通知的密文
|
||||
public static final String MD5_KEY_NEW = "1fousz9dzxkozdh1em5khz1z66cqz5r1"; //用来验证签名
|
||||
public static final String QUICK_LOGIN_VERIFY_URL_NEW = "http://checkuser.sdk.quicksdk.net/v2/checkUserInfo"; //登录验证地址
|
||||
|
||||
//国内渠道 QuickGame IOS
|
||||
public static final String QUICK_IOS_PRODUCT_CODE = "35830695725172284797896935402546";
|
||||
public static final String QUICK_IOS_CALLBACK_KEY = "13929976238051898777747091027588"; //用来解码通知的密文
|
||||
|
|
Loading…
Reference in New Issue