1557492053 1 год назад
Родитель
Сommit
2e60336320
3 измененных файлов с 53 добавлено и 5 удалено
  1. 1 1
      addons/fastchat/config.php
  2. 4 4
      public/assets/addons/fastchat/js/fastchat.js
  3. 48 0
      public/test.html

+ 1 - 1
addons/fastchat/config.php

@@ -31,7 +31,7 @@ return [
         'title' => '新用户欢迎文案',
         'type' => 'string',
         'content' => [],
-        'value' => '您准备好体验贵菲到家了吗?',
+        'value' => '您准备好体验相约台球助教了吗?',
         'rule' => '',
         'msg' => '',
         'tip' => '只为新用户显示,且不填写则不显示',

+ 4 - 4
public/assets/addons/fastchat/js/fastchat.js

@@ -67,6 +67,7 @@ var FastChat = {
                     }, 10000);
                 }
 
+
                 if (typeof initSuccess == 'function') {
                     initSuccess();
                 }
@@ -76,12 +77,11 @@ var FastChat = {
                     FastChat.new_message_prompt('#chat_button');
                 }
             }
-        })
+        });
 
         FastChat.eventReg();
     },
     ConnectSocket: function () {
-
         if ("WebSocket" in window) {
             var ws = new WebSocket(FastChat.ws.url);
             FastChat.ws.SocketTask = ws;
@@ -723,7 +723,7 @@ var FastChat = {
     },
     getCookie: function (cname) {
         var name = FastChat.cookie_prefix + cname + "=";
-        var decodedCookie = document.cookie
+        var decodedCookie = document.cookie;
         var ca = decodedCookie.split(';');
         for (var i = 0; i < ca.length; i++) {
             var c = ca[i];
@@ -751,7 +751,7 @@ var FastChat = {
         if (FastChat.ws.SocketTask && FastChat.ws.SocketTask.readyState == 1) {
             FastChat.ws.SocketTask.send(JSON.stringify(message));
         } else {
-            console.log('消息发送出错', message)
+            console.log('消息发送出错', message);
             FastChat.ws.ErrorMsg.push(message);
         }
 

+ 48 - 0
public/test.html

@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>Title</title>
+</head>
+<body>
+
+</body>
+<script>
+
+    var queue = {
+        ws: null,
+        timer: null,
+    }
+
+
+    const wsURL = 'wss://billiards.websocket.xunsoftware.com:1818/?modulename=admin&token=1|864000|1729932794|7333aa88d70f2521a4e7703b88ffa35c&fastchat_user=';
+    var ws = new WebSocket(wsURL);
+    queue.ws = ws;
+    ws.onopen = function (event) {
+        if (ws.readyState === ws.OPEN) {
+            console.log("Connection Success");
+        }
+        console.log("============onopen==============")
+        console.log(event);
+        ws.send(JSON.stringify({
+            "c": "Message",
+            "a": "send_message",
+            "data": {
+                "message": "123123",
+                "session_id": 4119
+            }
+        }));
+    };
+    ws.onmessage = (mEvent) => {
+        console.log("============onmessage==============")
+        console.log(mEvent);
+        // ws.close();
+    }
+    ws.onclose = (cEvent) => {
+        console.log("============onclose==============")
+        console.log(cEvent);
+    }
+
+
+</script>
+</html>