likang 2 éve
szülő
commit
3fb28fece6

+ 1 - 1
.gitignore

@@ -7,7 +7,7 @@
 composer.lock
 /public/images/
 /public/export/
-.env
 node_modules/
 package-lock.json
 yarn.lock
+.env

+ 0 - 3
catch/permissions/controller/User.php

@@ -92,7 +92,6 @@ class User extends CatchController
             $this->user->attachJobs($request->param('jobs'));
         }
 
-        $this->user->equUserUpdate($this->user);
         return CatchResponse::success('', '添加成功');
     }
 
@@ -142,7 +141,6 @@ class User extends CatchController
             $user->attachJobs($request->param('jobs'));
         }
 
-        $this->user->equUserUpdate($this->user->where('id', $id)->find());
         return CatchResponse::success();
     }
 
@@ -166,7 +164,6 @@ class User extends CatchController
             $user->detachJobs();
 
             $this->user->deleteBy($_id, true);
-            $this->user->equUserUpdate($array);
         }
 
         return CatchResponse::success();

+ 26 - 4
catch/tag_history/controller/TagHistory.php

@@ -5,11 +5,12 @@
  * @Author: likang
  * @Date: 2022-08-12 11:31:01
  * @LastEditors: likang
- * @LastEditTime: 2022-08-13 14:23:39
+ * @LastEditTime: 2022-08-13 17:00:52
  */
 
 namespace catchAdmin\tag_history\controller;
 
+use catchAdmin\report\model\Report;
 use catcher\base\CatchRequest as Request;
 use catcher\CatchResponse;
 use catcher\base\CatchController;
@@ -38,12 +39,12 @@ class TagHistory extends CatchController
         $mac = isset($data['mac']) ? $data['mac'] : '';
         $tage = isset($data['tage']) ? $data['tage'] : '';
         $endtime = isset($data['endtime']) ? $data['endtime'] : "";
-
+        $meter = isset($data['meter']) ? $data['meter'] : "";
         $where = [];
         if (!empty($time)) {
             $where[] = ['addTime', '>=', $time];
         } else {
-            $where[] = ['addTime', '>=', $time];
+            $where[] = ['addTime', '>=', time()];
         }
 
         if (!empty($mac)) {
@@ -53,6 +54,22 @@ class TagHistory extends CatchController
         if (!empty($tage)) {
             $where[] = ['lable', 'in',  implode(",", $tage)];
         }
+        if ($endtime == 1) {
+            //生成报告
+            $end = time();
+
+            $tagList =  $this->tagHistoryModel->where($where)->where('addTime', '<=', $end)->select();
+            $content = [
+                'mac' => json_encode($mac),
+                'lable' => json_encode($tage),
+                'meter' => $meter,
+                'startTime' => $time,
+                'endTime' => $end,
+                'data' => json_encode($tagList)
+            ];
+            $report = new Report();
+            $report->save($content);
+        }
 
         $list = $this->tagHistoryModel->group('mac,lable')->where($where)
             ->field('mac,lable,max(addTime) as addTime,AVG(rssi) as ave_rssi,count(*) as num')->select()->toArray();
@@ -67,6 +84,7 @@ class TagHistory extends CatchController
             $list[$key]['rssi'] = $da['rssi'];
             $list[$key]['addTime'] = date('Y-m-d H:i:s', $value['addTime']);
             $list[$key]['time'] = date('Y-m-d H:i:s', $da['time']);
+            $list[$key]['id'] = $da['id'];
         }
         return CatchResponse::success($list);
     }
@@ -133,7 +151,11 @@ class TagHistory extends CatchController
         $list = $this->tagHistoryModel->group('lable')->column('lable');
         return CatchResponse::success($list);
     }
-
+    /**
+     * @Descripttion: 获取时间
+     * @name: likang
+     * @return {*}
+     */
     public function getTime()
     {