增加8uquick渠道

main
grimm 2026-04-27 13:53:29 +08:00
parent aa7cfdea0a
commit 637a95d73d
4 changed files with 107 additions and 0 deletions

View File

@ -2848,4 +2848,75 @@ public class PayController {
return result;
}
/**
* QuickGame Android
*
* https://www.quicksdk.com/doc-15.html
* http://1.13.176.142/idip/sfzb/pay/quickNotify
*/
@RequestMapping(value = "/pay/quick8uNotify", method = {RequestMethod.POST,RequestMethod.GET})
public String quick8uNotify(HttpServletRequest request1,String nt_data,String sign,String md5Sign) {
try {
LOGGER.info("quickNotify--01, nt_data={}sign={}md5Sign={}", nt_data,sign,md5Sign);
String signStr = nt_data + sign + Constant.U8_MD5_KEY;
String mySign=MD5Util.encrypByMd5(signStr);
if(!mySign.equals(md5Sign)){
LOGGER.error("错误信息:签名不一致 mySign={}md5Sign={}", mySign,md5Sign);
return "-1";
}
String deCodeDateXml = QuickSDKUtil.decode(nt_data, Constant.U8_CALLBACK_KEY);
LOGGER.info("quick8uNotify--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("quick8uNotify--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";
}
}

View File

@ -167,6 +167,9 @@ public class SDKController {
case "DNA_IOS"://dnaios渠道
uid = SdkVerfy.dnaVerify(userId, sdktoken,2);
break;
case "8u"://8uquick渠道
uid = SdkVerfy.quick8uVerfy(userId, sdktoken,sdktoken);
break;
default:
uid = "-1";
}

View File

@ -724,4 +724,30 @@ public class SdkVerfy {
JSONObject jsonObject = JSONObject.fromObject(resurl);
LOGGER.info("res:{}", jsonObject.toString());
}
/**
* QuickGame Android
* @param userId
* @param sdksign
* @param sdktoken
* @return
*/
public static String quick8uVerfy(String userId,String sdksign, String sdktoken) {
try {
// 请求参数
Map<String, String> params = new HashMap<String, String>();
params.put("product_code", Constant.U8_PRODUCT_CODE);
params.put("uid", userId);
params.put("token", sdktoken);
String resurl = HttpUtil.postForm(Constant.U8_QUICK_LOGIN_VERIFY_URL, params);
LOGGER.info("res=" + resurl);
if(resurl.equals("1")){
return userId;
}
} catch (Exception e) {
e.printStackTrace();
}
return "-1";
}
}

View File

@ -164,4 +164,11 @@ public class Constant {
public static final String DNA_AD_APP_KEY = "d3efca4c80cbbf4d56bf63ffad99a590";
public static final String DNA_IOS_APPID = "55";
public static final String DNA_IOS_APP_KEY = "d1931d53a8d86925d798479bae03a557";
//国内渠道 QuickGame 8u
public static final String U8_PRODUCT_CODE = "41287154217555968290238433951116";
public static final String U8_PRODUCT_KEY = "24405958";
public static final String U8_CALLBACK_KEY = "13478346637875319260486631790272"; //用来解码通知的密文
public static final String U8_MD5_KEY = "zcxpam6fko7vkreeili7czov8wpdmcrm"; //用来验证签名
public static final String U8_QUICK_LOGIN_VERIFY_URL = "http://checkuser.sdk.quicksdk.net/v2/checkUserInfo";
}