|
|
@@ -0,0 +1,43 @@
|
|
|
+package org.springblade.gateway.pointsChannel_gateway.controller;
|
|
|
+
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.util.RandomUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.common.enums.AppConstant;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.webSocket.WebSocketServer;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.TreeSet;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author cy-computer
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/pointsChannel")
|
|
|
+@AllArgsConstructor
|
|
|
+public class PointsChannelController {
|
|
|
+
|
|
|
+ private WebSocketServer webSocketServer;
|
|
|
+
|
|
|
+ @RequestMapping("/callBack")
|
|
|
+ public R test(String response) {
|
|
|
+ JSONObject jsonObject = JSON.parseObject(response);
|
|
|
+ String requestId = (String) jsonObject.get("requestId");
|
|
|
+ Long userId = Convert.toLong(StrUtil.sub(requestId, 0, 19));
|
|
|
+ webSocketServer.sendInfo(
|
|
|
+ AppConstant.SOCKET_PRE.USER.getName() + userId,
|
|
|
+ JSON.toJSONString(jsonObject)
|
|
|
+ );
|
|
|
+ return R.data(true);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|