generated from root/miduo_server
自在修仙 渠道1专服
parent
2a7469dd60
commit
a26aa0c2cc
|
@ -34,14 +34,25 @@ public class ItemSendController {
|
|||
|
||||
private static final String SECRET_KEY = "38444756b58ff89b799291b3d8ed7ccf";
|
||||
|
||||
private static final String QD01_SECRET_KEY = "0a746c4e20fb6dc875f754957ddaf055";
|
||||
|
||||
private static CUserDao cuserDao;
|
||||
@Autowired
|
||||
public ItemSendController(CUserDao cuserDao) {
|
||||
this.cuserDao = cuserDao;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/qd01sendItem")
|
||||
public String qd01sendItem(HttpServletRequest request) throws Exception {
|
||||
return sendItem(request, QD01_SECRET_KEY);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/sendItem")
|
||||
public String youguSendItem(HttpServletRequest request) throws Exception {
|
||||
return sendItem(request, SECRET_KEY);
|
||||
}
|
||||
|
||||
public String sendItem(HttpServletRequest request, String secretKey) throws Exception {
|
||||
// 返回json
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("data", "");
|
||||
|
@ -49,7 +60,7 @@ public class ItemSendController {
|
|||
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap2(request);
|
||||
LOGGER.info("运营返利参数:{}", parameterMap);
|
||||
// 校验签名
|
||||
boolean checkSign = checkSignature(parameterMap);
|
||||
boolean checkSign = checkSignature(parameterMap, secretKey);
|
||||
if (!checkSign) {
|
||||
result.put("code", 1);
|
||||
result.put("msg", "sign verify fail");
|
||||
|
@ -131,11 +142,11 @@ public class ItemSendController {
|
|||
LOGGER.info("redis返利邮件标记:key:{}, time:{}, mail:{}",key,timeKey,mail);
|
||||
}
|
||||
|
||||
public boolean checkSignature(Map<String, String> map) {
|
||||
public boolean checkSignature(Map<String, String> map, String secretKey) {
|
||||
HashMap<String, String> params = new HashMap<>(map);
|
||||
String sign = params.remove("sign");
|
||||
// 1. 生成签名
|
||||
String signature = generateSignature(params, SECRET_KEY);
|
||||
String signature = generateSignature(params, secretKey);
|
||||
LOGGER.info("返利发放道具验证签名,签名:{}, 生成的签名:{}", sign, signature);
|
||||
if (signature == null || signature.isEmpty()) {
|
||||
return false;
|
||||
|
@ -186,4 +197,13 @@ public class ItemSendController {
|
|||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String props = "[{\"cpid\":\"3\",\"num\":100}]";
|
||||
Gson gson = new Gson();
|
||||
Type listType = new TypeToken<List<YouGuProp>>() {}.getType();
|
||||
List<YouGuProp> list = gson.fromJson(props, listType);
|
||||
String reward = ToolUtils.getMailReward(list);
|
||||
System.out.println(reward);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,19 @@ import javax.servlet.http.HttpServletRequest;
|
|||
* 自在修仙,bt1折 小七专服
|
||||
*/
|
||||
@RestController
|
||||
public class Zzxxxq01RechargeController {
|
||||
public class Zzxx01RechargeController {
|
||||
|
||||
private static final String PAYKEY = "38444756b58ff89b799291b3d8ed7ccf";
|
||||
|
||||
private static final String QD01_PAYKEY = "0a746c4e20fb6dc875f754957ddaf055";
|
||||
|
||||
@RequestMapping(value = "/Web/Zzxxxq01Callback")
|
||||
public String zzxxxq01TenthCallback(HttpServletRequest request) throws Exception {
|
||||
return YouGuRechargeController.callback(request, PAYKEY);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/Web/Zzxxqd01Callback")
|
||||
public String zzxxQD01TenthCallback(HttpServletRequest request) throws Exception {
|
||||
return YouGuRechargeController.callback(request, QD01_PAYKEY);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue