init
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.ruoyi.yunxin.manager;
|
||||
|
||||
import com.ruoyi.yunxin.config.YunxinProperties;
|
||||
import com.ruoyi.yunxin.util.CheckSumBuilder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class YunxinManager {
|
||||
|
||||
@Autowired
|
||||
private YunxinProperties yunxinProperties;
|
||||
|
||||
public boolean checkNotify(String body,String curTime, String checkSum,String md5){
|
||||
try {
|
||||
String appSecret = yunxinProperties.getAppSecret();
|
||||
String verifyMD5 = CheckSumBuilder.getMD5(body);
|
||||
if(md5 == null || !md5.equals(verifyMD5)){
|
||||
log.error("云信回调校验异常,md5 不相等");
|
||||
return false;
|
||||
}
|
||||
String verifyChecksum = CheckSumBuilder.getCheckSum(appSecret, verifyMD5, curTime);
|
||||
if(checkSum == null || !checkSum.equals(verifyChecksum)){
|
||||
log.error("云信回调校验异常,checkSum 不相等");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}catch (Exception e){
|
||||
log.info("检查云信回调数据失败",e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user