修改dna支付

master
DESKTOP-C3M45P4\dengdan 2025-04-23 12:58:34 +08:00
parent 989ae509f9
commit 5b9edd0069
2 changed files with 27 additions and 5 deletions

View File

@ -25,6 +25,6 @@ public class Dna01AdRechargeController extends Dna01IosRechargeController{
@RequestMapping(value = "/Dna01AdCallback")
public String Dna01Callback(HttpServletRequest request) throws Exception {
return process(request,adAppId,adAppKey);
return process(request,adAppId,adAppKey,"android");
}
}

View File

@ -3,6 +3,7 @@ package com.jmfy.controller;
import com.jmfy.paramBean.PaySdkEnum;
import com.jmfy.util.HttpUtils;
import com.jmfy.util.JsonUtil;
import com.jmfy.util.MD5Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
@ -25,10 +26,10 @@ public class Dna01IosRechargeController {
@RequestMapping(value = "/Dna01IosCallback")
public String Dna01Callback(HttpServletRequest request) throws Exception {
return process(request,iosAppId,iosAppKey);
return process(request,iosAppId,iosAppKey,"ios");
}
public static String process(HttpServletRequest request,String appId,String appKey) throws Exception{
public static String process(HttpServletRequest request,String appId,String appKey,String type) throws Exception{
String result = "FAILURE";
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap2(request);
if (parameterMap.isEmpty()) {
@ -190,9 +191,30 @@ public class Dna01IosRechargeController {
LOGGER.error("Dna01Callback request sign is null");
return result;
}
StringBuffer signStr = new StringBuffer("app_id=" + appId);
signStr.append("&ch_id=" + chId);
signStr.append("&ch_order_id==" + chOrderId);
signStr.append("&cp_order_id=" + cpOrderId);
signStr.append("&ext=" + extInfo);
signStr.append("&finish_time=" + finishTime);
signStr.append("&mem_id=" + userId);
signStr.append("&order_id=" + orderId);
signStr.append("&order_status=" + orderStatus);
signStr.append("&pay_time=" + payTime);
signStr.append("&product_id==" + productId);
signStr.append("&product_name=" + productName);
signStr.append("&product_price=" + moneyStr);
signStr.append("&role_id=" + roleId);
signStr.append("&server_id=" + serverId);
signStr.append("&app_key==" + appKey);
String md5Str = MD5Util.encrypByMd5(signStr.toString());
if(!md5Str.equals(sign)){
LOGGER.error("Dna01Callback sign error md5Sign:" + md5Str + " -- md5Str:" + md5Str + " -- sign:" + sign);
return result;
}
//充值成功
if(orderStatus == 1){
String inserted = insertOrder(roleId, productId,"IOS",cpOrderId,money);
if(orderStatus == 2){
String inserted = insertOrder(roleId, productId,type,cpOrderId,money);
if("SUCCESS".equals(inserted)){
result = "SUCCESS";
}