Browse Source

no message

kuaifan 5 years atrás
parent
commit
7e36a2a86e

+ 19 - 0
app/Http/Controllers/IndexController.php

@@ -28,6 +28,25 @@ class IndexController extends Controller
     }
 
     /**
+     * 获取终端详细信息
+     * @return array
+     */
+    public function get()
+    {
+        if (Request::input("key") !== env('APP_KEY')) {
+            return [];
+        }
+        return Base::retSuccess('success', [
+            'ip' => Base::getIp(),
+            'ip-info' => Base::getIpInfo(Base::getIp()),
+            'ip-iscn' => Base::isCnIp(Base::getIp()),
+            'header' => Request::header(),
+            'token' => Base::getToken(),
+            'url' => url('') . Base::getUrl(),
+        ]);
+    }
+
+    /**
      * 获取IP地址
      * @return array|mixed
      */

+ 1 - 1
app/Module/Base.php

@@ -2357,7 +2357,7 @@ class Base
             return '';
         }
         $fchar = ord($str[0]);
-        if ($fchar >= ord('A') && $fchar <= ord('z')) return strtoupper($str{0});
+        if ($fchar >= ord('A') && $fchar <= ord('z')) return strtoupper($str[0]);
         $s1 = iconv('UTF-8', 'gb2312', $str);
         $s2 = iconv('gb2312', 'UTF-8', $s1);
         $s = $s2 == $str ? $s1 : $str;

+ 3 - 3
resources/assets/js/main/components/WHeader.vue

@@ -109,13 +109,13 @@
                 <TabPane :label="$L('账号密码')" name="account">
                     <Form ref="formPass" :model="formPass" :rules="rulePass" :label-width="100">
                         <FormItem :label="$L('旧密码')" prop="oldpass">
-                            <Input v-model="formPass.oldpass"></Input>
+                            <Input v-model="formPass.oldpass" type="password"></Input>
                         </FormItem>
                         <FormItem :label="$L('新密码')" prop="newpass">
-                            <Input v-model="formPass.newpass"></Input>
+                            <Input v-model="formPass.newpass" type="password"></Input>
                         </FormItem>
                         <FormItem :label="$L('确认新密码')" prop="checkpass">
-                            <Input v-model="formPass.checkpass"></Input>
+                            <Input v-model="formPass.checkpass" type="password"></Input>
                         </FormItem>
                         <FormItem>
                             <Button :loading="loadIng > 0" type="primary" @click="handleSubmit('formPass')">{{$L('提交')}}</Button>

+ 17 - 14
resources/assets/js/main/main.js

@@ -331,17 +331,20 @@ import '../../sass/main.scss';
                     if (tempNum === this.__autoNum) {
                         this.__autoNum++
                         if ($A.getToken() === false) {
-                            console.log("[WS] No token");
+                            this.__log("[WS] No token");
                             this.__autoLine(timeout + 5);
                         } else {
                             this.sendTo('refresh', (res) => {
-                                console.log("[WS] Connection " + (res.status ? 'success' : 'error'));
+                                this.__log("[WS] Connection " + (res.status ? 'success' : 'error'));
                                 this.__autoLine(timeout + 5);
                             });
                         }
                     }
                 }, Math.min(timeout, 30) * 1000);
             },
+            __log(text) {
+                //console.log(text);
+            },
 
             /**
              * 连接
@@ -350,17 +353,17 @@ import '../../sass/main.scss';
                 let url = $A.getObject(window.webSocketConfig, 'URL');
                 url += ($A.strExists(url, "?") ? "&" : "?") + "token=" + $A.getToken();
                 if (!$A.leftExists(url, "ws://") && !$A.leftExists(url, "wss://")) {
-                    console.log("[WS] No connection address");
+                    this.__log("[WS] No connection address");
                     return;
                 }
 
                 if ($A.getToken() === false) {
-                    console.log("[WS] No connected token");
+                    this.__log("[WS] No connected token");
                     return;
                 }
 
                 if (this.__instance !== null && force !== true) {
-                    console.log("[WS] Connection exists");
+                    this.__log("[WS] Connection exists");
                     return;
                 }
 
@@ -369,14 +372,14 @@ import '../../sass/main.scss';
 
                 // 连接建立时触发
                 this.__instance.onopen = (event) => {
-                    console.log("[WS] Connection opened");
+                    this.__log("[WS] Connection opened");
                 }
 
                 // 接收到服务端推送时执行
                 this.__instance.onmessage = (event) => {
                     let msgDetail = $A.jsonParse(event.data);
                     if (msgDetail.messageType === 'open') {
-                        console.log("[WS] Connection connected");
+                        this.__log("[WS] Connection connected");
                         msgDetail.openNum = this.__openNum;
                         this.__openNum++;
                         this.__connected = true;
@@ -394,7 +397,7 @@ import '../../sass/main.scss';
 
                 // 连接关闭时触发
                 this.__instance.onclose = (event) => {
-                    console.log("[WS] Connection closed");
+                    this.__log("[WS] Connection closed");
                     this.__connected = false;
                     this.__instance = null;
                     this.__autoLine(5);
@@ -402,7 +405,7 @@ import '../../sass/main.scss';
 
                 // 连接出错
                 this.__instance.onerror = (event) => {
-                    console.log("[WS] Connection error");
+                    this.__log("[WS] Connection error");
                     this.__connected = false;
                     this.__instance = null;
                     this.__autoLine(5);
@@ -504,18 +507,18 @@ import '../../sass/main.scss';
                             this.connection();
                         }
                     } else {
-                        console.log("[WS] Service not connected");
+                        this.__log("[WS] Service not connected");
                         typeof callback === "function" && callback({status: 0, message: '服务未连接'});
                     }
                     return;
                 }
                 if (this.__connected === false) {
-                    console.log("[WS] Failed connection");
+                    this.__log("[WS] Failed connection");
                     typeof callback === "function" && callback({status: 0, message: '未连接成功'});
                     return;
                 }
                 if (['refresh', 'unread', 'read', 'roger', 'user', 'team'].indexOf(type) === -1) {
-                    console.log("[WS] Wrong message type: " + type);
+                    this.__log("[WS] Wrong message type: " + type);
                     typeof callback === "function" && callback({status: 0, message: '错误的消息类型: ' + type});
                     return;
                 }
@@ -553,11 +556,11 @@ import '../../sass/main.scss';
              */
             close() {
                 if (this.__instance === null) {
-                    console.log("[WS] Service not connected");
+                    this.__log("[WS] Service not connected");
                     return;
                 }
                 if (this.__connected === false) {
-                    console.log("[WS] Failed connection");
+                    this.__log("[WS] Failed connection");
                     return;
                 }
                 this.__instance.close();