generated from root/miduo_server
增加F5sdk
parent
2f5f23e4d6
commit
c21563c183
|
|
@ -1855,4 +1855,115 @@ public class PayController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* F5支付回调
|
||||
* @param appId
|
||||
* @param orderId
|
||||
* @param defaultAmount
|
||||
* @param defaultCurrency
|
||||
* @param gameAmount
|
||||
* @param gameCurrency
|
||||
* @param productId
|
||||
* @param payChannel
|
||||
* @param userId
|
||||
* @param serverId
|
||||
* @param orderStatus
|
||||
* @param statusMsg
|
||||
* @param ots
|
||||
* @param payDoneTime
|
||||
* @param extInfo
|
||||
* @param osign
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/pay/f5Notify", method = {RequestMethod.POST,RequestMethod.GET})
|
||||
public String f5Notify(@RequestParam("appId") String appId,
|
||||
@RequestParam("orderId") String orderId,
|
||||
@RequestParam("defaultAmount") double defaultAmount,
|
||||
@RequestParam("defaultCurrency") String defaultCurrency,
|
||||
@RequestParam("gameAmount") int gameAmount,
|
||||
@RequestParam("gameCurrency") String gameCurrency,
|
||||
String productId,
|
||||
@RequestParam("payChannel") String payChannel,
|
||||
@RequestParam("userId") long userId,
|
||||
@RequestParam("serverId") String serverId,
|
||||
@RequestParam("orderStatus") int orderStatus,
|
||||
@RequestParam("statusMsg") String statusMsg,
|
||||
@RequestParam("ots") int ots,
|
||||
String payDoneTime,
|
||||
@RequestParam("extInfo") String extInfo,
|
||||
@RequestParam("osign") String osign) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("appId", Constant.F5_APPID);
|
||||
json.put("userId", userId);
|
||||
try {
|
||||
LOGGER.info("f5Notify--01, appId={},orderId={},defaultAmount={},defaultCurrency={},gameAmount={}," +
|
||||
"gameCurrency={},productId={},payChannel={},userId={},serverId={}," +
|
||||
"orderStatus={},statusMsg={},ots={},payDoneTime={},extInfo={},osign={}", appId,orderId,defaultAmount
|
||||
,defaultCurrency,gameAmount,gameCurrency,productId,payChannel,userId,serverId,orderStatus,statusMsg,ots,payDoneTime,extInfo,osign);
|
||||
if(productId == null){
|
||||
productId = "";
|
||||
}
|
||||
if(payDoneTime == null){
|
||||
payDoneTime = "";
|
||||
}
|
||||
String signStr = appId + orderId + defaultAmount + defaultCurrency + gameAmount + gameCurrency + productId +
|
||||
userId + serverId + orderStatus + ots + payDoneTime + extInfo + Constant.F5_SECURE_KEY;
|
||||
String mySign=MD5Util.encrypByMd5(signStr);
|
||||
|
||||
if(!mySign.equals(osign)){
|
||||
LOGGER.error("错误信息:签名不一致 mySign={},osign={}", mySign,osign);
|
||||
json.put("code", "-1");
|
||||
json.put("msg", "签名不一致");
|
||||
json.put("deliverStatus", 2);
|
||||
return json.toString();
|
||||
}
|
||||
//extInfo为游戏订单号
|
||||
if(StringUtils.isEmpty(extInfo)){
|
||||
LOGGER.error("错误信息:extInfo empty");
|
||||
json.put("code", "-2");
|
||||
json.put("msg", "extInfo empty");
|
||||
json.put("deliverStatus", 2);
|
||||
return json.toString();
|
||||
}
|
||||
//渠道订单号不能为空
|
||||
if(StringUtils.isEmpty(orderId)){
|
||||
LOGGER.error("错误信息:orderId empty");
|
||||
json.put("code", "-2");
|
||||
json.put("msg", "orderId empty");
|
||||
json.put("deliverStatus", 2);
|
||||
return json.toString();
|
||||
}
|
||||
// 统一发货接口
|
||||
int payres = 0;
|
||||
Double amountDouble = defaultAmount * 100;
|
||||
payres = payHandler.processOrderNew(extInfo, orderId,amountDouble.intValue());
|
||||
// 成功
|
||||
if (payres == 1) {
|
||||
json.put("code", 200);
|
||||
json.put("msg", "SUCCESS");
|
||||
json.put("deliverStatus", 1);
|
||||
return json.toString();
|
||||
} else if (payres == -1) {
|
||||
LOGGER.error("pay:gameNoticeInterface, {} 订单不存在,", orderId);
|
||||
json.put("msg", "订单不存在");
|
||||
} else if (payres == -2) {
|
||||
LOGGER.error("pay:gameNoticeInterface, {} 订单参数错误,", orderId);
|
||||
json.put("msg", "订单参数错误");
|
||||
} else if (payres == -3) {
|
||||
LOGGER.error("pay:gameNoticeInterface, {} 服务器配置错误,", orderId);
|
||||
json.put("msg", "服务器配置错误");
|
||||
} else if (payres == -4) {
|
||||
LOGGER.error("pay:gameNoticeInterface, {} 充值失败,", orderId);
|
||||
json.put("msg", "充值失败");
|
||||
} else {
|
||||
LOGGER.error("pay:gameNoticeInterface, {} 返回错误,payres = {}", orderId,payres);
|
||||
json.put("msg", "game exception");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
json.put("code", -3);
|
||||
return json.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,6 +155,9 @@ public class SDKController {
|
|||
case "QKZB02"://quick直播2
|
||||
uid = SdkVerfy.quickGameVerfy2(userId, sdksign, sdktoken);
|
||||
break;
|
||||
case "F5"://quick直播2
|
||||
uid = SdkVerfy.f5Verify(userId, sdktoken);
|
||||
break;
|
||||
default:
|
||||
uid = "-1";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -596,8 +596,10 @@ public class SdkVerfy {
|
|||
try {
|
||||
// 请求参数
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("super_user_id", userId);
|
||||
params.put("token", sdktoken);
|
||||
params.put("appId", Constant.F5_APPID);
|
||||
String osign = MD5Util.encrypByMd5(Constant.F5_APPID + sdktoken + Constant.F5_SECURE_KEY);
|
||||
params.put("osign", osign);
|
||||
// String jsonStr = JSON.toJSONString(params);
|
||||
String resurl = HttpUtil.postForm(Constant.SUPER_VERIFY_URL, params);
|
||||
JSONObject jsonObject = JSONObject.fromObject(resurl);
|
||||
|
|
@ -612,4 +614,31 @@ public class SdkVerfy {
|
|||
}
|
||||
return "-1";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
* @param sdktoken
|
||||
* @return
|
||||
*/
|
||||
public static String f5Verify(String userId, String sdktoken) {
|
||||
try {
|
||||
// 请求参数
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("super_user_id", userId);
|
||||
params.put("token", sdktoken);
|
||||
// String jsonStr = JSON.toJSONString(params);
|
||||
String resurl = HttpUtil.postForm(Constant.F5_VERIFY_URL, params);
|
||||
JSONObject jsonObject = JSONObject.fromObject(resurl);
|
||||
LOGGER.info("res:{}", jsonObject.toString());
|
||||
// code状态为200时 登陆成功 其他为失败
|
||||
if (jsonObject.getInt("code") == 200) {
|
||||
return userId;
|
||||
}
|
||||
return jsonObject.getString("msg");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "-1";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,4 +144,10 @@ public class Constant {
|
|||
public static final String QUICK_PRODUCT_CODE_2 = "19804280896394556877394266362523";
|
||||
public static final String QUICK_MD5_KEY_2 = "lgnyk8tgfaa9iait77scencrxb1vemgp";
|
||||
public static final String QUICK_CALLBACK_KEY_2 = "27512079957341517989513927959071";
|
||||
|
||||
//F5渠道
|
||||
public static final String F5_APPID = "0977b6d3e84611ef8f2202c85f0429f5";
|
||||
public static final String F5_APP_KEY = "4KFXCMH1dyTMrzBQbbkLFEOY3DCTtHOD";
|
||||
public static final String F5_SECURE_KEY = "Dw4bOiwgtHwjxCZ6dr68CwjcuVepTQu5";
|
||||
public static final String F5_VERIFY_URL = "https://api.wingsdk.com/cpapi/v2/user/authorize.do";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue