root 1 year ago
parent
commit
bb137e26a6
3 changed files with 61 additions and 5 deletions
  1. 4 5
      node/message.js
  2. 24 0
      node/test.html
  3. 33 0
      node/test.js

+ 4 - 5
node/message.js

@@ -749,7 +749,10 @@ us.updatecscl = function (messageInfo, classId, ty) {
         _obj.backgroundUrl = messageInfo.backgroundUrl;
         _obj.edges = _obj.edges || [];
         _obj.nodes = _obj.nodes || [];
-
+        console.log("------------s------------");
+        console.log(messageInfo);
+        console.log(_obj);
+        console.log(ty);
         for (j = 0; j < messageInfo.edges.length; j++) {
             _is = true;
             for (i = 0; i < _obj.edges.length; i++) {
@@ -768,10 +771,6 @@ us.updatecscl = function (messageInfo, classId, ty) {
                 _obj.edges.push(messageInfo.edges[j])
             }
         }
-        console.log("------------s------------");
-        console.log(messageInfo.nodes);
-        console.log(_obj.nodes);
-        console.log(ty);
         for (j = 0; j < messageInfo.nodes.length; j++) {
             _is = true;
             for (i = 0; i < _obj.nodes.length; i++) {

+ 24 - 0
node/test.html

@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wb="http://open.weibo.com/wb" style="overflow: hidden;">
+
+<head>
+
+    <script>
+
+        var xhr = new XMLHttpRequest();
+        xhr.open("GET", "http://127.0.0.1:1473", true);
+        xhr.setRequestHeader("Connection", "keep-alive");
+        xhr.onreadystatechange = function () {
+            if (xhr.readyState == e && xhr.status == 200) {
+                //var data = JSON.parse(xhr.responseText);
+                console.log(data);
+            }
+        }
+    </script>
+</head>
+
+<body>
+
+</body>
+
+</html>

+ 33 - 0
node/test.js

@@ -0,0 +1,33 @@
+us = {};
+us.qs = require("querystring"); //引用文件解析包
+us.http = require("http"); //引用http server服务
+
+
+
+/**
+* 创建服务
+*
+* @param  {object} requset 请求对象
+* @param  {object} response 响应对象
+**/
+us.server = us.http.createServer(function (requset, response) {
+    //设置跨域
+    response.writeHead(200, {
+        "Content-Type": "application/json",
+        'Access-Control-Allow-Origin': '*',
+        "Connection": "keep-alive",
+        'Access-Control-Allow-Headers': 'Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With'
+    });
+    var data = { "name": "John", "age": 30 };
+    res.write(JSON.stringify(data));
+});
+
+
+/**
+* 监听1473端口的处理
+*
+**/
+us.server.listen('1473', '', function () {
+    //在控制台输出监听提示
+    console.log("开始监听" + us.server.address().port + "......");
+});