123333
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package com.ruoyi.web.controller.cai.app;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.cai.service.UserOnlineService;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.yunxin.manager.YunxinManager;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -24,6 +27,8 @@ public class YxNotifyController {
|
||||
|
||||
@Autowired
|
||||
private YunxinManager yunxinManager;
|
||||
@Autowired
|
||||
private UserOnlineService onlineService;
|
||||
|
||||
@PostMapping("/notify")
|
||||
@Operation(hidden = true)
|
||||
@@ -33,14 +38,23 @@ public class YxNotifyController {
|
||||
String curTime = request.getHeader("CurTime");
|
||||
String md5 = request.getHeader("MD5");
|
||||
String checkSum = request.getHeader("CheckSum");
|
||||
log.info("request headers: AppKey = {}, CurTime = {}, " +
|
||||
"MD5 = {}, CheckSum = {}", appKey, curTime, md5, checkSum);
|
||||
log.info("request headers: AppKey = {}, CurTime = {},MD5 = {}, CheckSum = {}", appKey, curTime, md5, checkSum);
|
||||
String requestBody = readBody(request);
|
||||
log.info("request body = {}", requestBody);
|
||||
boolean check = yunxinManager.checkNotify(requestBody, curTime);
|
||||
boolean check = yunxinManager.checkNotify(requestBody, curTime, checkSum,md5);
|
||||
if(!check){
|
||||
log.info("检验失败!");
|
||||
return R.fail("500",null);
|
||||
return R.fail("401",null);
|
||||
}
|
||||
JSONObject body = JSON.parseObject(requestBody);
|
||||
if(body == null){
|
||||
return R.fail("401",null);
|
||||
}
|
||||
String eventType = body.getString("eventType");
|
||||
if("2".equals(eventType) || "3".equals(eventType)){ // 登陆登出事件
|
||||
String accid = body.getString("accid");
|
||||
String timestamp = body.getString("timestamp");
|
||||
onlineService.updateOnlineByYunxin(eventType,Long.valueOf(accid),Long.valueOf(timestamp));
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user