Candy %!s(int64=6) %!d(string=hai) anos
pai
achega
af6c4e1ede

+ 1 - 1
thinkphp/TCPserver/tcpServer.php

@@ -198,7 +198,7 @@ $workerTcp->onWorkerStart = function ($workerTcp) {
                     // 接口服务器向我发送的信息
                     $connection_to_tcp->onMessage = function ($connection_to_tcp, $data) {
 
-                            tcpMessHandle($data);
+                        tcpMessHandle($data);
                     };
 
                     $connection_to_tcp->onClose = function($connection_to_tcp)

+ 46 - 0
thinkphp/application/index/controller/Base.php

@@ -0,0 +1,46 @@
+<?php
+/**
+ * 登录和退出登录入口
+ * User: Titan 名字就是密码
+ * Date: 2019/6/4
+ * Time: 17:11
+ */
+
+namespace app\index\controller;
+
+use think\Controller;
+use think\Db;
+use think\Request;
+
+class Base extends Controller
+{
+    public function login()
+    {
+
+            $data = input();
+            $username = $data['username'];               //获取到的 用户名
+            $password = md5($data['password']);          //获取到的 加密后的密码
+            $ip = $_SERVER['REMOTE_ADDR'];
+            $userModel = model('User');
+            $data = $userModel->login($username,$password,$ip);
+            if(!$data){
+                return resultArray(['error'=>$userModel->getError()]);
+            }else{
+                return resultArray(['data'=>$data]);
+            }
+
+    }
+
+    public function logout(Request $request)
+    {
+
+        $header = Request::instance()->header();
+        $data = input(); //获取信息(登录状态为0,ip置为空)
+        $data['ip'] = '';
+        $data['error_num'] = 0;
+        $authKey = $header['authkey'];
+        $result = Db::name('admin')->where(['id'=>1])->update($data);
+        cache('Auth_'.$authKey, null);
+        return json(['code'=>'00','msg'=>'更新数据成功']);
+    }
+}

+ 3 - 3
vue-admin-master/src/views/nav1/Table.vue

@@ -378,7 +378,7 @@
 									this.display_step = true;       //展示步长
 									this.orderloading = false;
 									this.filters.volume = data.VOLUME;
-                                    data.VOLUME = (data.VOLUME)/100;   //前端显示的时候需要进行部分的计算
+                   data.VOLUME = (data.VOLUME)/100;   //前端显示的时候需要进行部分的计算
                                     this.order_data.push(data);
                                     this.loading_getorder = false;
 									this.roolback_query();
@@ -1039,14 +1039,14 @@
 									this.rollback_page_size = 100;
 									this.rollbackdata_list = this.rollbackdata.slice((this.rollback_page-1)*this.rollback_page_size,this.rollback_page*this.rollback_page_size);
 								}else{
-									this.rollbackloading =false;
+									this.rollbackloading = false;
 									this.rollback_total=0;
 									this.rollbackdata =[];
 									this.rollbackdata_list = [];	
 								}
 							} else {
 
-								this.rollbackloading =false;
+								this.rollbackloading = false;
 								console.log(response.message);
 
 							}