Browse Source

移除长链接配置

evoxwht 4 years ago
parent
commit
f6303ef57e

+ 0 - 13
crmeb/app/adminapi/controller/v1/setting/SystemConfig.php

@@ -301,19 +301,6 @@ class SystemConfig extends AuthController
             @copy($from, $toHome);
             @copy($from, $toPublic);
         }
-        if (isset($post['admin_port'])) {
-            $res = include(config_path() . 'workerman.php');
-            $old_admin_port = $res['admin']['port'];
-            $old_channel_port = $res['channel']['port'];
-            $admin_port = substr($post['admin_port'], strrpos($post['admin_port'], ":") + 1);
-            $channel_port = substr($post['channel_port'], strrpos($post['channel_port'], ":") + 1);
-            if ($admin_port == '') $admin_port = 999999;
-            if ($channel_port == '') $channel_port = 999999;
-            $info = file_get_contents(config_path() . 'workerman.php');
-            $info = str_replace($old_admin_port, $admin_port, $info);
-            $info = str_replace($old_channel_port, $channel_port, $info);
-            file_put_contents(config_path() . 'workerman.php', $info);
-        }
         \crmeb\services\CacheService::clear();
         return app('json')->success('修改成功');
 

+ 4 - 4
crmeb/app/common.php

@@ -24,10 +24,10 @@ if (!function_exists('getWorkerManUrl')) {
      */
     function getWorkerManUrl()
     {
-        $ws = sys_config('wss_open', 0) ? 'wss://' : 'ws://';
-        $data['chat'] = $ws . sys_config('chat_port', '');
-        $data['admin'] = $ws . sys_config('admin_port', '');
-        $data['channel'] = $ws . sys_config('channel_port', '');
+        $ws = $_SERVER['HTTPS'] == 'on' ? 'wss://' : 'ws://';
+        $host = $_SERVER['HTTP_HOST'];
+        $data['admin'] = $ws . $host . '/notice';
+        $data['channel'] = $ws . $host . '/msg';
         return $data;
     }
 }

File diff suppressed because it is too large
+ 1 - 1
crmeb/public/admin/index.html


File diff suppressed because it is too large
+ 0 - 1
crmeb/public/admin/js/app.0ae90713.js


File diff suppressed because it is too large
+ 1 - 0
crmeb/public/admin/js/app.9db51be2.js


File diff suppressed because it is too large
+ 1 - 7
crmeb/public/install/crmeb.sql


+ 4 - 4
template/admin/src/libs/socket.js

@@ -14,12 +14,12 @@ import {getWorkermanUrl} from '@/api/kefu'
 import Vue from 'vue';
 const vm = new Vue;
 let wsAdminSocketUrl = getCookies('WS_ADMIN_URL') || ''
-let wsKefuSocketUrl = getCookies('WS_CHAT_URL') || ''
+// let wsKefuSocketUrl = getCookies('WS_CHAT_URL') || ''
 getWorkermanUrl().then(res=>{
     wsAdminSocketUrl = res.data.admin
-    wsKefuSocketUrl = res.data.chat
+    // wsKefuSocketUrl = res.data.chat
     setCookies('WS_ADMIN_URL',res.data.admin)
-    setCookies('WS_CHAT_URL',res.data.chat)
+    // setCookies('WS_CHAT_URL',res.data.chat)
 })
 class wsSocket {
     constructor (opt) {
@@ -124,7 +124,7 @@ function createSocket(key) {
 
 
 export const adminSocket = createSocket(1);
-export const Socket = createSocket(2);
+// export const Socket = createSocket(2);
 //
 // class Socket {
 //     constructor () {