tongshanglei před 2 roky
rodič
revize
0b21343f27

+ 7 - 2
catch/alarm/controller/ControlManage.php

@@ -33,7 +33,12 @@ class ControlManage extends CatchController
      */
     public function save(Request $request) : \think\Response
     {
-        return CatchResponse::success($this->controlManageModel->storeBy($request->post()));
+        $params=$request->post();
+        $params['start_time']=strtotime($params['timeRange'][0]);
+        $params['end_time']=strtotime($params['timeRange'][1]);
+        $params['state']=1;
+        // var_dump($params);
+        return CatchResponse::success($this->controlManageModel->storeBy($params));
     }
     
     /**
@@ -64,6 +69,6 @@ class ControlManage extends CatchController
      */
     public function delete($id) : \think\Response
     {
-        return CatchResponse::success($this->controlManageModel->deleteBy($id));
+        return CatchResponse::success($this->controlManageModel->deleteBy($id,true));
     }
 }

+ 15 - 10
catch/alarm/database/migrations/20221026102401_control_manage.php

@@ -30,16 +30,21 @@ class ControlManage extends Migrator
     public function change()
     {
         $table = $this->table('control_manage', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '布控管理' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
-        $table->addColumn('type', 'string', ['limit' => 16,'null' => true,'signed' => true,'comment' => '布控类型',])
-			->addColumn('start_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => false,'comment' => '布控开始时间',])
-			->addColumn('end_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => false,'comment' => '布控结束时间',])
-			->addColumn('plate_no', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '车牌',])
-			->addColumn('rfid_sn', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '车辆标签',])
-			->addColumn('station_ids', 'string', ['limit' => 255,'null' => true,'signed' => true,'comment' => '区域基站',])
-			->addColumn('area_type', 'string', ['limit' => 8,'null' => true,'signed' => true,'comment' => '区域类型',])
-			->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建人ID',])
-			->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
-			->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
+        $table->addColumn('name', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '名称',])
+            ->addColumn('state', 'boolean', ['null' => true,'signed' => true,'comment' => '启用停用(0-停用,1-启用)',])
+            ->addColumn('type', 'string', ['limit' => 16,'null' => true,'signed' => true,'comment' => '布控类型',])
+			->addColumn('start_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => false,'comment' => '布控开始时间',])
+			->addColumn('end_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => false,'comment' => '布控结束时间',])
+			->addColumn('revoke_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => false,'comment' => '撤控时间',])
+			->addColumn('revoke_res', 'string', ['limit' => 255,'null' => true,'signed' => true,'comment' => '撤控理由',])
+			->addColumn('phone', 'string', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => false,'comment' => '联系电话',])
+			->addColumn('control_obj', 'string', ['limit' => 255,'null' => true,'signed' => true,'comment' => '布控对象',])
+            ->addColumn('area_type', 'string', ['limit' => 8,'null' => true,'signed' => true,'comment' => '区域类型',])
+			->addColumn('remark', 'string', ['limit' => 255,'null' => true,'signed' => true,'comment' => '备注',])
+            
+			->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建人ID',])
+			->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
+			->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
 			->addColumn('deleted_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '软删除',])
             ->create();
     }

+ 2 - 1
catch/alarm/model/BwList.php

@@ -61,7 +61,8 @@ class BwList extends Model
         return (string)$value;
     }
     public function getTypeTextAttr($value){
-        return $value ?'白名单': '黑名单';
+        $type = $this->getData('type');
+        return $type ?'白名单': '黑名单';
     }
     public function getRfidTypeTextAttr($value){
         $rfid_type = $this->getData('rfid_type');

+ 57 - 7
catch/alarm/model/ControlManage.php

@@ -3,28 +3,33 @@
 namespace catchAdmin\alarm\model;
 
 use catcher\base\CatchModel as Model;
-
+use catchAdmin\permissions\model\DataRangScopeTrait;
+use catchAdmin\system\model\SysDictData;
 class ControlManage extends Model
 {
+    use DataRangScopeTrait;
     // 表名
     public $name = 'control_manage';
     // 数据库字段映射
     public $field = array(
         'id',
         // 布控类型
+        'name',
         'type',
+        'state',
         // 布控开始时间
         'start_time',
         // 布控结束时间
         'end_time',
-        // 车牌
-        'plate_no',
-        // 车辆标签
-        'rfid_sn',
-        // 区域基站
-        'station_ids',
+        
+        // 布控对象
+        'control_obj',
         // 区域类型
         'area_type',
+        'revoke_time',
+        'revoke_res',
+        'phone',
+        'remark',
         // 创建人ID
         'creator_id',
         // 创建时间
@@ -34,4 +39,49 @@ class ControlManage extends Model
         // 软删除
         'deleted_at',
     );
+    /**
+     * 列表
+     */
+    public function getList()
+    {
+        $res=$this->dataRange()
+            ->catchSearch()
+            ->append(['type_text','rfid_type_text','state_text','timeRange'])
+            ->order($this->aliasField('id'), 'desc')
+            ->paginate();
+        return $res;
+    }
+    //根据姓名搜索
+    public function searchNameAttr($query, $value, $data)
+    {
+        return $query->where('name', 'like', '%' . $value . '%');
+    }
+
+    public function getTimeRangeAttr($value){
+        $start_time = $this->getData('start_time');
+        $end_time = $this->getData('end_time');
+        return [date('Y-m-d H:i:s',$start_time),date('Y-m-d H:i:s',$end_time)];
+    }
+    public function getStateTextAttr($value){
+        $state = $this->getData('state');
+        return (new SysDictData())->getValueByCode('ControlStateEnum', $state) ?: '';
+    }
+
+    public function getTypeTextAttr($value){
+        $type = $this->getData('type');
+        if($type=='1'){
+            return '车辆布控';
+        }elseif($type=='2'){
+            return '区域布控';
+        }else{
+            return '未知';
+        }
+        
+    }
+    public function getStartTimeAttr($value){
+        return $value?date('Y-m-d H:i:s',$value):'';
+    }
+    public function getEndTimeAttr($value){
+        return $value?date('Y-m-d H:i:s',$value):'';
+    }
 }

+ 65 - 0
catch/device/controller/Station.php

@@ -73,6 +73,71 @@ class Station extends CatchController
             return $response;
        
     }
+    /**
+     * 所有列表
+     * @time 2022年01月20日 10:09
+     * @param Request $request 
+     */
+    public function getAllList(Request $request) 
+    {
+
+        
+ 
+        $cond=[
+            '_string'=>'a.DEVICE_CODE = r.DEVICE_CODE',
+        ];
+            
+
+        $cond['page']=1;
+        $cond['limit']=2000;
+
+           
+        $conn = null;
+        $tableName='(SELECT * FROM DSSC2.ADM_DEV  ORDER BY ID DESC) a,DSSC2.ADM_DEV_RFID_CHN r';
+        $field='a.ID,a.IS_ONLINE,a.LOGIN_NAME,a.DEVICE_CODE,a.DEVICE_NAME,a.OWNER_CODE,to_char(a.UPDATE_DATE,\'yyyy-mm-dd hh24:mi:ss\') UPDATE_DATE,r.GPS_X,r.GPS_Y';
+        $host=    Env::get('oracle.hostname',  '127.0.0.1');
+        $port=    Env::get('oracle.hostport',  '1521');
+        $instance_name=    Env::get('oracle.instance',  'ORCL');
+        $username=    Env::get('oracle.username',  'root');
+        $password=    Env::get('oracle.password',  'root');
+        // $conn = oci_connect('用户名', '密码', '远程数据库名(eg.//192.168.1.133/orcl)');
+        $conn = oci_connect($username, $password, $host.':'.$port.'/'. $instance_name,'AL32UTF8');
+
+        if (!$conn) {
+            $e = oci_error();
+            trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
+        }
+        $start=($cond['page']-1)*$cond['limit'];
+        $end=$cond['page']*$cond['limit'];
+        $whereStr=buildQueryCond2($cond);
+        $sql='SELECT * FROM ( SELECT '.$field.',ROWNUM RN FROM '.$tableName.' WHERE ROWNUM <='.$end.' '.$whereStr.'  ) WHERE RN >'. $start;
+        // var_dump($sql);
+        // 查询并渲染
+        $stid = oci_parse($conn, $sql);
+        $r = oci_execute($stid);
+        $rows=[];
+        while($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
+            if($row['GPS_Y'] && $row['GPS_X']){
+                $wgsLoc = \algorithm\Geometry::wgsTOgcj((float)$row['GPS_Y'],(float)$row['GPS_X']);
+                $lngLat = \algorithm\Geometry::convertGcj02ToBd09($wgsLoc['lat'],$wgsLoc['lng']);
+                $row['GPS_X']=$lngLat['lng'];
+                $row['GPS_Y']=$lngLat['lat'];
+                $rows[]=$row;
+            }
+            
+            
+        }
+        oci_free_statement($stid);
+        $response=[
+            'code'=>10000,
+            'message'=>'查询成功',
+            'data'=>$rows,
+        ];
+        return $response;
+            
+          
+       
+    }
      /**
      * 保存信息
      * @time 2022年01月20日 10:55

+ 1 - 0
catch/device/route.php

@@ -15,6 +15,7 @@ $router->group(function () use ($router) {
 	$router->resource('device', '\catchAdmin\device\controller\Device');
 	// station路由
 	$router->get('station/getdeviceListByStation','\catchAdmin\device\controller\Station@getdeviceListByStation');
+	$router->get('station/getAllList','\catchAdmin\device\controller\Station@getAllList');
 	//导入基站
 	$router->post('station/importStation', '\catchAdmin\device\controller\Station@importStation');
 	$router->resource('station', '\catchAdmin\device\controller\Station');

+ 0 - 23
catch/stations/StationsService.php

@@ -1,23 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | CatchAdmin [Just Like ~ ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2017~{$year} http://catchadmin.com All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
-// +----------------------------------------------------------------------
-// | Author: JaguarJack [ njphper@gmail.com ]
-// +----------------------------------------------------------------------
-
-namespace catchAdmin\stations;
-
-use catcher\ModuleService;
-
-class StationsService extends ModuleService
-{
-    public function loadRouteFrom()
-    {
-        // TODO: Implement loadRouteFrom() method.
-        return __DIR__ . DIRECTORY_SEPARATOR . 'route.php';
-    }
-}

+ 0 - 231
catch/stations/controller/DwStation.php

@@ -1,231 +0,0 @@
-<?php
-
-namespace catchAdmin\stations\controller;
-
-use catcher\base\CatchRequest as Request;
-use catcher\CatchResponse;
-use catcher\base\CatchController;
-use catchAdmin\stations\model\Station as stationModel;
-use catchAdmin\wechat\library\messages\events\Location;
-use \think\facade\Db;
-use catcher\Utils;
-use catcher\library\excel\Excel;
-use catchAdmin\stations\excel\DwExport;
-
-class DwStation extends CatchController
-{
-    protected $stationModel;
-
-    public function __construct(StationModel $stationModel)
-    {
-        $this->stationModel = $stationModel;
-    }
-
-    /**
-     * 列表
-     * @time 2021年05月21日 15:17
-     * @param Request $request 
-     */
-    public function index(Request $request): \think\Response
-    {
-        $field = $request->get('field')?:'id';
-        $order = $request->get('order')?:'desc';
-        return CatchResponse::paginate($this->stationModel->getStationList($field,$order));
-    }
-
-    /**
-     * 保存信息
-     * @time 2021年05月21日 15:17
-     * @param Request $request 
-     */
-    public function save(Request $request): \think\Response
-    {
-        $data = $request->post();
-        $location = explode(',', $data['area_id']);
-        if(empty($location)){
-            return CatchResponse::fail('请选择所属区域');
-        }
-        $dis = Db::table('areas')->where('id',end($location))->value('area_type');
-        if ($dis != 'county') {
-            return CatchResponse::fail('区域请精确到县区');
-        }
-        if(count($location) == 3){
-            $data['province_id'] = $location[0];
-            $data['city_id'] = $location[1];
-            $data['district_id'] = $location[2];
-        }
-        if(count($location) == 2){
-            $data['city_id'] = $location[0];
-            $data['district_id'] = $location[1];
-            $data['province_id'] = Db::table('areas')->where('id',$location[0])->value('parent_id');
-        }
-        if(count($location) == 1){
-            $data['district_id'] = $location[0];
-            $data['city_id'] = Db::table('areas')->where('id',$location[0])->value('parent_id');
-            $data['province_id'] = Db::table('areas')->where('id',$data['city_id'])->value('parent_id');
-        }
-        //基站Mac校验
-        $data['station_mac'] = strtoupper(trim($data['station_mac']));
-        if (!$data['station_mac']) {
-            return CatchResponse::fail('请输入基站Mac');
-        }
-        $regex = "/^([A-F0-9]{12})$/";
-        if (!preg_match($regex, $data['station_mac'])) {
-            return CatchResponse::fail('基站Mac格式不正确');
-        }
-        if ($this->stationModel->where('station_mac', $data['station_mac'])->count()) {
-            return CatchResponse::fail('该基站已存在');
-        }
-        $data['station_code'] = substr($data['station_mac'], -6);
-        if(!trim($data['station_name'])){
-            return CatchResponse::fail('请输入基站名称');
-        }
-        if(!trim($data['longitude'])){
-            return CatchResponse::fail('请输入经度');
-        }
-        if(!trim($data['latitude'])){
-            return CatchResponse::fail('请输入纬度');
-        }
-        if(!trim($data['address'])){
-            return CatchResponse::fail('请输入安装地址');
-        }
-        $data['station_type'] = 2;
-        return CatchResponse::success($this->stationModel->storeBy($data));
-    }
-
-    /**
-     * 读取
-     * @time 2021年05月21日 15:17
-     * @param $id 
-     */
-    public function read($id): \think\Response
-    {
-        return CatchResponse::success($this->stationModel->findBy($id));
-    }
-
-    /**
-     * 更新
-     * @time 2021年05月21日 15:17
-     * @param Request $request 
-     * @param $id
-     */
-    public function update(Request $request, $id): \think\Response
-    {
-        $data = $request->post();
-        $location = explode(',', $data['area_id']);
-        if(empty($location)){
-            return CatchResponse::fail('请选择所属区域');
-        }
-        $dis = Db::table('areas')->where('id',end($location))->value('area_type');
-        if ($dis != 'county') {
-            return CatchResponse::fail('区域请精确到县区');
-        }
-        if(count($location) == 3){
-            $data['province_id'] = $location[0];
-            $data['city_id'] = $location[1];
-            $data['district_id'] = $location[2];
-        }
-        if(count($location) == 2){
-            $data['city_id'] = $location[0];
-            $data['district_id'] = $location[1];
-            $data['province_id'] = Db::table('areas')->where('id',$location[0])->value('parent_id');
-        }
-        if(count($location) == 1){
-            $data['district_id'] = $location[0];
-            $data['city_id'] = Db::table('areas')->where('id',$location[0])->value('parent_id');
-            $data['province_id'] = Db::table('areas')->where('id',$data['city_id'])->value('parent_id');
-        }
-        //基站Mac校验
-        $data['station_mac'] = strtoupper(trim($data['station_mac']));
-        if (!$data['station_mac']) {
-            return CatchResponse::fail('请输入基站Mac');
-        }
-        $regex = "/^([A-F0-9]{12})$/";
-        if (!preg_match($regex, $data['station_mac'])) {
-            return CatchResponse::fail('基站Mac格式不正确');
-        }
-        $gid = $this->stationModel->where('station_mac', $data['station_mac'])->value('id');
-        if ($gid && $gid != $id) {
-            return CatchResponse::fail('该基站已存在');
-        }
-        $data['station_code'] = substr($data['station_mac'], -6);
-        if(!trim($data['station_name'])){
-            return CatchResponse::fail('请输入基站名称');
-        }
-        if(!trim($data['longitude'])){
-            return CatchResponse::fail('请输入经度');
-        }
-        if(!trim($data['latitude'])){
-            return CatchResponse::fail('请输入纬度');
-        }
-        if(!trim($data['address'])){
-            return CatchResponse::fail('请输入安装地址');
-        }
-        unset($data['creator_id']);
-        return CatchResponse::success($this->stationModel->updateBy($id, $data));
-    }
-
-    /**
-     * 更新配置
-     * @time 2021年05月21日 15:17
-     * @param Request $request 
-     * @param $id
-     */
-    public function updateStationConfig(Request $request, $id): \think\Response
-    {
-        $data = $request->post();
-        // var_dump($data);
-        if($data['rfid_enable_throttle_rlian']){
-            $data['rfid_enable_throttle_rlian']=1;
-        }else{
-            $data['rfid_enable_throttle_rlian']=0;
-        }
-        
-        if($data['command']=='is_reboot_device'){
-            $data['is_reboot_device']=1;
-            $data['is_restore_device']=0;
-        }elseif($data['command']=='is_restore_device'){
-            $data['is_reboot_device']=0;
-            $data['is_restore_device']=1;
-        }else{
-            $data['is_reboot_device']=0;
-            $data['is_restore_device']=0;
-        }
-        unset($data['command']);
-        // var_dump($data);
-        return CatchResponse::success( $this->stationModel->where('id', $id) ->update($data));
-    }
-    
-    /**
-     * 删除
-     * @time 2021年05月21日 15:17
-     * @param $id
-     */
-    public function delete($id): \think\Response
-    {
-        return CatchResponse::success($this->stationModel->deleteBy($id,true));
-    }
-
-    /**
-     * 获取全部数据
-     */
-    public function rangeData(Request $request): \think\Response
-    {
-        return CatchResponse::success($this->stationModel->getRangeData());
-    }
-
-    /**
-     * 导出定位基站
-     *
-     * @time 2020年09月08日
-     * @param Excel $excel
-     * @param DeviceExport $deviceExport
-     * @throws \PhpOffice\PhpSpreadsheet\Exception
-     * @return \think\response\Json
-     */
-    public function export(Excel $excel, DwExport $dwExport)
-    {
-        return CatchResponse::success($excel->save($dwExport, Utils::publicPath('export/dwstations'), 'local', '定位基站'));
-    }
-
-}

+ 0 - 204
catch/stations/controller/IndoorStation.php

@@ -1,204 +0,0 @@
-<?php
-
-namespace catchAdmin\stations\controller;
-
-use catcher\base\CatchRequest as Request;
-use catcher\CatchResponse;
-use catcher\base\CatchController;
-use catchAdmin\stations\model\Station as StationModel;
-use catchAdmin\school\model\KqBuilding as BuildingModel;
-use catcher\Utils;
-use catcher\library\excel\Excel;
-use catchAdmin\stations\excel\SkExport;
-
-class IndoorStation extends CatchController
-{
-    protected $stationModel;
-    protected $buildingModel;
-
-    public function __construct(StationModel $stationModel, BuildingModel $buildingModel)
-    {
-        $this->stationModel = $stationModel;
-        $this->buildingModel = $buildingModel;
-    }
-
-    /**
-     * 列表
-     * @time 2021年05月21日 15:17
-     * @param Request $request 
-     */
-    public function index(Request $request): \think\Response
-    {
-        $field = $request->get('field')?:'id';
-        $order = $request->get('order')?:'desc';
-        return CatchResponse::paginate($this->stationModel->getStationList($field,$order));
-    }
-
-    /**
-     * 检测保存字段
-     */
-    protected function checkSaveData($post)
-    {
-        if (!isset($post['station_mac']) || !$post['station_mac']) {
-            return ['success' => false, 'message' =>'设备MAC不能为空'];
-        }
-        if (!$this->stationModel->checkStationMacFormat($post['station_mac'])) {
-            return ['success' => false, 'message' =>'设备Mac格式不正确'];
-        }
-        if ($this->stationModel->isStationMacDuplicate($post['station_mac'])) {
-            return ['success' => false, 'message' =>'设备MAC已存在'];
-        }
-        if (!isset($post['station_name']) || !$post['station_name']) {
-            return ['success' => false, 'message' =>'设备名称不能为空'];
-        }
-        if(!trim($post['coordinate_x'])){
-            return ['success' => false, 'message' =>'未获取到横向坐标'];
-        }
-        if(!trim($post['coordinate_y'])){
-            return ['success' => false, 'message' =>'未获取到纵向坐标'];
-        }
-        if (!is_numeric($post['coordinate_x']) || !is_numeric($post['coordinate_y'])) {
-            return CatchResponse::fail('坐标必须是数字');
-        }
-        // if (!isset($post['room_no']) || !$post['room_no']) {
-        //     return ['success' => false, 'message' =>'房间号不能为空'];
-        // }
-        if (!isset($post['school_id']) || !$post['school_id']) {
-            return ['success' => false, 'message' =>'未获取到所属学校'];
-        }
-        if (!isset($post['building_id']) || !$post['building_id']) {
-            return ['success' => false, 'message' =>'未获取到所属建筑'];
-        }
-        if (!isset($post['floor_id']) || !$post['floor_id']) {
-            return ['success' => false, 'message' =>'未获取到所属楼层'];
-        }
-    }
-
-    /**
-     * 保存信息
-     * @time 2021年05月21日 15:17
-     * @param Request $request 
-     */
-    public function save(Request $request): \think\Response
-    {
-        $post = $request->post();
-        // 检测字段
-        $res = $this->checkSaveData($post);
-        if ($res && !$res['success']) {
-            return CatchResponse::fail($res['message']);
-        }
-        $post['station_mac'] = strtoupper(trim($post['station_mac']));
-        $post['station_name'] = trim($post['station_name']);
-        $post['station_code'] = substr($post['station_mac'], -6);
-        // 是否需要检测房间号重复,一个房间可装多台?
-
-        // 省市区随建筑
-        $buildingInfo = $this->buildingModel->where('id', $post['building_id'])->find();
-        if (empty($buildingInfo)) {
-            return CatchResponse::fail('获取建筑信息失败');
-        }
-        $post['province_id'] = $buildingInfo['province_id'];
-        $post['city_id'] = $buildingInfo['city_id'];
-        $post['district_id'] = $buildingInfo['district_id'];
-        $post['longitude'] = $buildingInfo['longitude'];
-        $post['latitude'] = $buildingInfo['latitude'];
-        $post['station_type'] = 3; // 1-考勤,2-定位,3-室内(插座)
-        $post['station_model'] = 1; // 1-G31W1,2-G23
-
-        return CatchResponse::success($this->stationModel->storeBy($post), '修改成功');
-    }
-
-    /**
-     * 读取
-     * @time 2021年05月21日 15:17
-     * @param $id 
-     */
-    public function read($id): \think\Response
-    {
-        return CatchResponse::success($this->stationModel->findBy($id));
-    }
-
-    /**
-     * 更新
-     * @time 2021年05月21日 15:17
-     * @param Request $request 
-     * @param $id
-     */
-    public function update(Request $request, $id): \think\Response
-    {
-        $post = $request->post();
-        
-        if (!isset($post['station_mac']) || !$post['station_mac']) {
-            return CatchResponse::fail('设备MAC不能为空');
-        }
-        if (!$this->stationModel->checkStationMacFormat($post['station_mac'])) {
-            return CatchResponse::fail('设备Mac格式不正确');
-        }
-        if ($this->stationModel->isStationMacDuplicate($post['station_mac'], $id)) {
-            return CatchResponse::fail('设备MAC已存在');
-        }
-        if(!trim($post['station_name'])){
-            return CatchResponse::fail('设备名称不能为空');
-        }
-        if(!trim($post['coordinate_x'])){
-            return CatchResponse::fail('未获取到横向坐标');
-        }
-        if(!trim($post['coordinate_y'])){
-            return CatchResponse::fail('未获取到纵向坐标');
-        }
-        if (!is_numeric($post['coordinate_x']) || !is_numeric($post['coordinate_y'])) {
-            return CatchResponse::fail('坐标必须是数字');
-        }
-        //基站Mac校验
-        $post['station_mac'] = strtoupper(trim($post['station_mac']));
-        $post['station_code'] = substr($post['station_mac'], -6);
-
-        return CatchResponse::success($this->stationModel->updateBy($id, $post), '修改成功');
-    }
-
-    /**
-     * 删除
-     * @time 2021年05月21日 15:17
-     * @param $id
-     */
-    public function delete($id): \think\Response
-    {
-        return CatchResponse::success($this->stationModel->deleteBy($id,true));
-    }
-
-    /**
-     * 更新坐标
-     */
-    public function updateLocation(Request $request, $id): \think\Response
-    {
-        $coor_x = $request->post('coordinate_x');
-        $coor_y = $request->post('coordinate_y');
-        if(!trim($coor_x)){
-            return CatchResponse::fail('未获取到横向坐标');
-        }
-        if(!trim($coor_y)){
-            return CatchResponse::fail('未获取到纵向坐标');
-        }
-        $save_data = [
-            'coordinate_x' => $coor_x,
-            'coordinate_y' => $coor_y,
-        ];
-        return CatchResponse::success($this->stationModel->updateBy($id, $save_data), '修改成功');
-    }
-    
-    /**
-     * 导出室内插座基站
-     *
-     * @time 2020年09月08日
-     * @param Excel $excel
-     * @param DeviceExport $deviceExport
-     * @throws \PhpOffice\PhpSpreadsheet\Exception
-     * @return \think\response\Json
-     */
-    public function export(Excel $excel, SkExport $skExport)
-    {
-        // var_dump(Utils::publicPath('export/students'));//导出路径
-        return CatchResponse::success($excel->save($skExport, Utils::publicPath('export/skstations'), 'local', '室内插座基站'));
-    }
-
-}

+ 0 - 348
catch/stations/controller/Station.php

@@ -1,348 +0,0 @@
-<?php
-
-namespace catchAdmin\stations\controller;
-
-use catcher\base\CatchRequest as Request;
-use catcher\CatchResponse;
-use catcher\base\CatchController;
-use catchAdmin\stations\model\Station as stationModel;
-use think\facade\Db;
-use catcher\Utils;
-use catcher\library\excel\Excel;
-use catchAdmin\stations\excel\KqExport;
-use catchAdmin\stations\excel\DwExport;
-use catchAdmin\stations\excel\SkExport;
-
-class Station extends CatchController
-{
-    protected $stationModel;
-
-    public function __construct(StationModel $stationModel)
-    {
-        $this->stationModel = $stationModel;
-    }
-
-    /**
-     * 列表
-     * @time 2021年05月21日 15:17
-     * @param Request $request 
-     */
-    public function index(Request $request): \think\Response
-    {
-        $field = $request->get('field')?:'id';
-        $order = $request->get('order')?:'desc';
-        return CatchResponse::paginate($this->stationModel->getStationList($field,$order));
-    }
-
-    /**
-     * 保存信息
-     * @time 2021年05月21日 15:17
-     * @param Request $request 
-     */
-    public function save(Request $request): \think\Response
-    {
-        $data = $request->post();
-        if (!$data['school_id']) {
-            return CatchResponse::fail('请选择学校');
-        }
-        if (!$data['access_id']) {
-            return CatchResponse::fail('请选择出入口');
-        }
-        if (!$data['orientation']) {
-            return CatchResponse::fail('请选择基站朝向');
-        }
-        $data['station_mac'] = strtoupper(trim($data['station_mac']));
-        if (!$data['station_mac']) {
-            return CatchResponse::fail('请输入基站Mac');
-        }
-        $regex = "/^([A-F0-9]{12})$/";
-        if (!preg_match($regex, $data['station_mac'])) {
-            return CatchResponse::fail('基站Mac格式不正确');
-        }
-        if ($this->stationModel->where('station_mac', $data['station_mac'])->count()) {
-            return CatchResponse::fail('该基站已存在');
-        }
-        $data['station_code'] = substr($data['station_mac'], -6);
-        if (!trim($data['station_name'])) {
-            return CatchResponse::fail('请输入基站名称');
-        }
-        if (!trim($data['longitude'])) {
-            return CatchResponse::fail('请输入经度');
-        }
-        if (!trim($data['latitude'])) {
-            return CatchResponse::fail('请输入纬度');
-        }
-        if (!trim($data['address'])) {
-            return CatchResponse::fail('请输入安装地址');
-        }
-        $data['station_type'] = 1;
-        $data['station_model'] = 2; // 1-G31W1,2-G23
-        $city_info = Db::table('departments')->where('id', $data['school_id'])->field('province_id,city_id,district_id')->find();
-        $data = array_merge($data, $city_info);
-        return CatchResponse::success($this->stationModel->storeBy($data));
-    }
-
-    /**
-     * 读取
-     * @time 2021年05月21日 15:17
-     * @param $id 
-     */
-    public function read($id): \think\Response
-    {
-        return CatchResponse::success($this->stationModel->findBy($id));
-    }
-
-    /**
-     * 更新
-     * @time 2021年05月21日 15:17
-     * @param Request $request 
-     * @param $id
-     */
-    public function update(Request $request, $id): \think\Response
-    {
-        $data = $request->post();
-        if (!$data['school_id']) {
-            return CatchResponse::fail('请选择学校');
-        }
-        if (!$data['access_id']) {
-            return CatchResponse::fail('请选择出入口');
-        }
-        if (!$data['orientation']) {
-            return CatchResponse::fail('请选择基站朝向');
-        }
-        $data['station_mac'] = strtoupper(trim($data['station_mac']));
-        if (!$data['station_mac']) {
-            return CatchResponse::fail('请输入基站Mac');
-        }
-        $regex = "/^([A-F0-9]{12})$/";
-        if (!preg_match($regex, $data['station_mac'])) {
-            return CatchResponse::fail('基站Mac格式不正确');
-        }
-        $gid = $this->stationModel->where('station_mac', $data['station_mac'])->value('id');
-        if ($gid && $gid != $id) {
-            return CatchResponse::fail('该基站已存在');
-        }
-        $data['station_code'] = substr($data['station_mac'], -6);
-        if (!trim($data['station_name'])) {
-            return CatchResponse::fail('请输入基站名称');
-        }
-        if (!trim($data['longitude'])) {
-            return CatchResponse::fail('请输入经度');
-        }
-        if (!trim($data['latitude'])) {
-            return CatchResponse::fail('请输入纬度');
-        }
-        if (!trim($data['address'])) {
-            return CatchResponse::fail('请输入安装地址');
-        }
-        unset($data['creator_id']);
-        //城市
-        $city_info = Db::table('departments')->where('id', $data['school_id'])->field('province_id,city_id,district_id')->find();
-        $data = array_merge($data, $city_info);
-        return CatchResponse::success($this->stationModel->updateBy($id, $data));
-    }
-
-    /**
-     * 删除
-     * @time 2021年05月21日 15:17
-     * @param $id
-     */
-    public function delete($id): \think\Response
-    {
-        return CatchResponse::success($this->stationModel->deleteBy($id, true));
-    }
-    /**
-     * 导出考勤基站
-     *
-     * @time 2020年09月08日
-     * @param Excel $excel
-     * @param DeviceExport $deviceExport
-     * @throws \PhpOffice\PhpSpreadsheet\Exception
-     * @return \think\response\Json
-     */
-    public function kqexport(Excel $excel, KqExport $kqExport)
-    {
-        // var_dump(Utils::publicPath('export/students'));导出路径
-        return CatchResponse::success($excel->save($kqExport, Utils::publicPath('export/kqstations'), 'local', '考勤基站'));
-    }
-    /**
-     * 导出定位基站
-     *
-     * @time 2020年09月08日
-     * @param Excel $excel
-     * @param DeviceExport $deviceExport
-     * @throws \PhpOffice\PhpSpreadsheet\Exception
-     * @return \think\response\Json
-     */
-    public function dwexport(Excel $excel, DwExport $dwExport)
-    {
-        // var_dump(Utils::publicPath('export/students'));导出路径
-        return CatchResponse::success($excel->save($dwExport, Utils::publicPath('export/dwstations'), 'local', '定位基站'));
-    }
-    /**
-     * 导出室内插座基站
-     *
-     * @time 2020年09月08日
-     * @param Excel $excel
-     * @param DeviceExport $deviceExport
-     * @throws \PhpOffice\PhpSpreadsheet\Exception
-     * @return \think\response\Json
-     */
-    public function skexport(Excel $excel, SkExport $skExport)
-    {
-        // var_dump(Utils::publicPath('export/students'));//导出路径
-        return CatchResponse::success($excel->save($skExport, Utils::publicPath('export/skstations'), 'local', '室内插座基站'));
-    }
-    /**
-     * 更新考勤基站配置
-     * @time 2021年05月21日 15:17
-     * @param Request $request 
-     * @param $id
-     */
-    public function updateKqStationConfig(Request $request, $id): \think\Response
-    {
-        $data = $request->post();
-        $config_list=$data['config_list'];
-        if($config_list['IS_SLAVE']){
-            $config_list['IS_SLAVE']=1;
-        }else{
-            $config_list['IS_SLAVE']=0;
-        }
-
-        $save_data = array(
-            'in_station_mac' => strtoupper($config_list['Card_INMAC']),
-            'out_station_mac' => strtoupper($config_list['Card_OUTMAC']),
-            'config_list' => json_encode($config_list),
-            'updated_at' =>time()
-        );
-   
-        return CatchResponse::success( $this->stationModel->where('id', $id) ->update($save_data));
-        // return CatchResponse::success( $this->stationModel->updateBy($id, $save_data));
-        
-    }
-
-    /**
-     * 获取发送主机信息
-     * @time 2021年05月21日 15:17
-     * @param $id
-     */
-    public function getSendHostInfo($id){
-        $info =  $this->stationModel->where('id', $id) ->field('station_version,station_mac')->find();
-        if(empty($info)){
-            return array('success'=>false,'message'=>'未获取到终端信息');
-        }
-        if(!$info['station_mac']){
-            return array('success'=>false,'message'=>'无终端版Imei号');
-
-        }
-        if(!$info['station_version']){
-            return array('success'=>false,'message'=>'无终端版本号');
-        }
-       
-        $host = Db::table('sys_config')->where('type','station_config')->where('field','kq_station_host')->value('fieldValue');
-        if(!$host){
-            $host='127.0.0.1';
-        }
-        if(substr($info['station_version'],-1) == 'G'){
-            $port = 10242;
-        }else{
-            $port = 10241;
-        }
-        $host_info = array(
-            'imei' => $info['station_mac'],
-            'host' => $host,
-            'port' => $port,
-        );
-        return array('success'=>true, 'message'=>'获取成功', 'data'=>$host_info);
-
-    }
-
-    /**
-     * 下发IP配置
-     * @time 2021年05月21日 15:17
-     * @param Request $request 
-     * @param $id
-     */
-    public function sendIpConfig(Request $request, $id): \think\Response
-    {   
-        $data = $request->post();
-        $config_list=$data['config_list'];
-        if($config_list['IS_SLAVE']){
-            $config_list['IS_SLAVE']=1;
-        }else{
-            $config_list['IS_SLAVE']=0;
-        }
-
-        $save_data = array(
-            'in_station_mac' => strtoupper($config_list['Card_INMAC']),
-            'out_station_mac' => strtoupper($config_list['Card_OUTMAC']),
-            'config_list' => json_encode($config_list),
-            'updated_at' =>time()
-        );
-        // $res=$this->stationModel->updateBy($id, $save_data);
-        // var_dump($res);
-        $result=$this->getSendHostInfo($id);
-        if(!$result['success']){
-            CatchResponse::fail($result['message']);
-        }
-        $host_info = $result['data'];
-
-        $socket = new \tcpclient\TcpClient( $host_info['host'],$host_info['port']);
-        $cmd = array(
-            "method" => "configRfid",
-            "imei" => $host_info['imei'],
-            'ip' => $config_list['LOCAL_IP'],
-            'mask' => $config_list['LOCAL_MASK'],
-            'gateway' => $config_list['LOCAL_GATEWAY'],
-            'reportIp' => $config_list['REPORT_IP'],
-            'master' => $config_list['IS_SLAVE'],
-        );
-        $res = $socket->send(json_encode($cmd));
-     
-        if(!$res['success']){
-            return CatchResponse::fail($res['message']);
-        }
-        $res=$this->stationModel->where('id', $id)->update($save_data);
-        if(!$res){
-            CatchResponse::fail('保存配置失败');
-        }
-        return CatchResponse::success('下发成功');
-    }
-
-
-    /**
-     * 终端控制指令
-     * @time 2021年05月21日 15:17
-     * @param Request $request 
-     * @param $id
-     */
-    public function controlConfig(Request $request, $id): \think\Response
-    {   
-        $data = $request->post();
-
-        $result=$this->getSendHostInfo($id);
-        if(!$result['success']){
-            CatchResponse::fail($result['message']);
-        }
-        $host_info = $result['data'];
-
-        $socket = new \tcpclient\TcpClient( $host_info['host'],$host_info['port']);
-        $cmd = array(
-            "method" =>$data['command'],
-            "imei" => $host_info['imei'],
-        );
-        if($data['command']=='upgrade'){
-            $cmd['url']="no upgrade url";
-            $cmd['version']="empty";
-        }
-        
-        $res = $socket->send(json_encode($cmd));
-        if(!$res['success']){
-            return CatchResponse::fail($res['message']);
-        }
-      
-        return CatchResponse::success('下发成功');
-    }
-    
-    
-}

+ 0 - 69
catch/stations/controller/StationHeartbeat.php

@@ -1,69 +0,0 @@
-<?php
-
-namespace catchAdmin\stations\controller;
-
-use catcher\base\CatchRequest as Request;
-use catcher\CatchResponse;
-use catcher\base\CatchController;
-use catchAdmin\stations\model\StationHeartbeat as stationHeartbeatModel;
-
-class StationHeartbeat extends CatchController
-{
-    protected $stationHeartbeatModel;
-    
-    public function __construct(StationHeartbeatModel $stationHeartbeatModel)
-    {
-        $this->stationHeartbeatModel = $stationHeartbeatModel;
-    }
-    
-    /**
-     * 列表
-     * @time 2021年06月01日 10:16
-     * @param Request $request 
-     */
-    public function index(Request $request) : \think\Response
-    {
-        return CatchResponse::paginate($this->stationHeartbeatModel->getList());
-    }
-    
-    /**
-     * 保存信息
-     * @time 2021年06月01日 10:16
-     * @param Request $request 
-     */
-    public function save(Request $request) : \think\Response
-    {
-        return CatchResponse::success($this->stationHeartbeatModel->storeBy($request->post()));
-    }
-    
-    /**
-     * 读取
-     * @time 2021年06月01日 10:16
-     * @param $id 
-     */
-    public function read($id) : \think\Response
-    {
-        return CatchResponse::success($this->stationHeartbeatModel->findBy($id));
-    }
-    
-    /**
-     * 更新
-     * @time 2021年06月01日 10:16
-     * @param Request $request 
-     * @param $id
-     */
-    public function update(Request $request, $id) : \think\Response
-    {
-        return CatchResponse::success($this->stationHeartbeatModel->updateBy($id, $request->post()));
-    }
-    
-    /**
-     * 删除
-     * @time 2021年06月01日 10:16
-     * @param $id
-     */
-    public function delete($id) : \think\Response
-    {
-        return CatchResponse::success($this->stationHeartbeatModel->deleteBy($id));
-    }
-}

+ 0 - 72
catch/stations/database/migrations/20210521151719_station.php

@@ -1,72 +0,0 @@
-<?php
-
-use think\migration\Migrator;
-use think\migration\db\Column;
-use Phinx\Db\Adapter\MysqlAdapter;
-
-class Station extends Migrator
-{
-    /**
-     * Change Method.
-     *
-     * Write your reversible migrations using this method.
-     *
-     * More information on writing migrations is available here:
-     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
-     *
-     * The following commands can be used in this method and Phinx will
-     * automatically reverse them when rolling back:
-     *
-     *    createTable
-     *    renameTable
-     *    addColumn
-     *    renameColumn
-     *    addIndex
-     *    addForeignKey
-     *
-     * Remember to call "create()" or "update()" and NOT "save()" when working
-     * with the Table class.
-     */
-    public function change()
-    {
-        $table = $this->table('station', ['engine' => 'InnoDB',  'comment' => '' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
-        $table->addColumn('station_name', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '基站名称',])
-			->addColumn('station_mac', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '基站Mac',])
-			->addColumn('station_code', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '基站简码',])
-			->addColumn('station_type', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '基站类型',])
-			->addColumn('longitude', 'decimal', ['precision' => 10,'scale' => 6,'null' => true,'signed' => true,'comment' => '经度',])
-			->addColumn('latitude', 'decimal', ['precision' => 10,'scale' => 6,'null' => true,'signed' => true,'comment' => '纬度',])
-			->addColumn('coordinate_x', 'integer', ['limit' => 4,'null' => true,'signed' => true,'comment' => 'x轴坐标',])
-			->addColumn('coordinate_y', 'integer', ['limit' => 4,'null' => true,'signed' => true,'comment' => 'y轴坐标',])
-			->addColumn('access_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '出入口id',])
-			->addColumn('province_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '省',])
-			->addColumn('city_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '市',])
-			->addColumn('district_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '县区',])
-			->addColumn('online_time', 'datetime', ['null' => true,'signed' => true,'comment' => '在线时间',])
-			->addColumn('install_photo', 'string', ['limit' => 200,'null' => true,'signed' => true,'comment' => '安装图片',])
-			->addColumn('orientation', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '基站朝向 0-未知 1-朝外 2-朝内',])
-			->addColumn('school_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '学校id',])
-			->addColumn('station_model', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '基站型号',])
-			->addColumn('station_sn', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '基站串号',])
-			->addColumn('station_version', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '基站版本',])
-			->addColumn('wan_ip', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => 'WAN口IP',])
-			->addColumn('net_model', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '网络模式 0-静态地址,1-动态获取,2-PPPOE拨号,3-3G拨号,4-4G拨号',])
-			->addColumn('rssi', 'string', ['limit' => 10,'null' => true,'signed' => true,'comment' => '信号强度(dbm)',])
-			->addColumn('sim_serial_number', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => 'sim卡序列号',])
-			->addColumn('cmcc_phone_id', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '话机编号',])
-			->addColumn('attendance_config', 'text', ['limit' => MysqlAdapter::TEXT_REGULAR,'null' => true,'signed' => true,'comment' => '考勤配置',])
-			->addColumn('device_status', 'text', ['limit' => MysqlAdapter::TEXT_REGULAR,'null' => true,'signed' => true,'comment' => '设备状态',])
-			
-			->addColumn('rssi_sensitive', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 62,'signed' => true,'comment' => '信号灵敏度 默认62,大于此值会被过滤',])
-			->addColumn('throttling', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '节流 0-关闭,1-开启',])
-			->addColumn('address', 'string', ['limit' => 100,'null' => true,'signed' => true,'comment' => '安装地址',])
-			->addColumn('enable_push_qywx', 'boolean', ['null' => false,'default' => 0,'signed' => true,'comment' => '推送企业微信0-否,1-是',])
-			->addColumn('building_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '建筑id',])
-			->addColumn('floor_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '楼层id',])
-			->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建人ID',])
-			->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
-			->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
-			->addColumn('deleted_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '软删除',])
-            ->create();
-    }
-}

+ 0 - 44
catch/stations/database/migrations/20210522073324_add_room_no.php

@@ -1,44 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | CatchAdmin [Just Like ~ ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2017~{$year} http://catchadmin.com All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
-// +----------------------------------------------------------------------
-// | Author: JaguarJack [ njphper@gmail.com ]
-// +----------------------------------------------------------------------
-
-use think\migration\Migrator;
-use think\migration\db\Column;
-
-class AddRoomNo extends Migrator
-{
-    /**
-     * Change Method.
-     *
-     * Write your reversible migrations using this method.
-     *
-     * More information on writing migrations is available here:
-     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
-     *
-     * The following commands can be used in this method and Phinx will
-     * automatically reverse them when rolling back:
-     *
-     *    createTable
-     *    renameTable
-     *    addColumn
-     *    renameColumn
-     *    addIndex
-     *    addForeignKey
-     *
-     * Remember to call "create()" or "update()" and NOT "save()" when working
-     * with the Table class.
-     */
-    public function change()
-    {
-        $table = $this->table('station', ['engine' => 'InnoDB',  'comment' => '' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
-        $table->addColumn('room_no', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '房间编号',])
-              ->update();
-    }
-}

+ 0 - 75
catch/stations/database/migrations/20210523173324_add_config_field.php

@@ -1,75 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | CatchAdmin [Just Like ~ ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2017~{$year} http://catchadmin.com All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
-// +----------------------------------------------------------------------
-// | Author: JaguarJack [ njphper@gmail.com ]
-// +----------------------------------------------------------------------
-
-use think\migration\Migrator;
-use think\migration\db\Column;
-use Phinx\Db\Adapter\MysqlAdapter;
-class AddConfigField extends Migrator
-{
-    /**
-     * Change Method.
-     *
-     * Write your reversible migrations using this method.
-     *
-     * More information on writing migrations is available here:
-     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
-     *
-     * The following commands can be used in this method and Phinx will
-     * automatically reverse them when rolling back:
-     *
-     *    createTable
-     *    renameTable
-     *    addColumn
-     *    renameColumn
-     *    addIndex
-     *    addForeignKey
-     *
-     * Remember to call "create()" or "update()" and NOT "save()" when working
-     * with the Table class.
-     */
-    public function change()
-    {
-        if ($this->hasTable('station')) {
-            $table = $this->table('station');  
-            $table  ->addColumn('http_request_time', 'datetime', ['null' => true,'signed' => true,'comment' => '设备请求时间',])
-                    ->addColumn('is_enable', 'boolean', ['null' => true,'signed' => true,'comment' => '是否启用',])
-                    ->addColumn('ddzx_ip', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '调度中心ip',])
-                    ->addColumn('ddzx_tcp_port', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '调度中心tcp端口',])
-                    ->addColumn('ddzx_wait_recv_msg_maxTime', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '等待接收超时时间',])
-                    ->addColumn('rfid_offline_timeout', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rfid离线超时时间',])
-                    ->addColumn('is_reboot_device', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '是否重启设备',])
-                    ->addColumn('is_restore_device', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '是否恢复出厂设置',])
-                    ->addColumn('dev_reboot_time', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '设备定时重启时间',])
-                    ->addColumn('http_devops_url', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => 'http运维通道地址',])
-                    ->addColumn('http_devops_interval', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'http运维通道请求间隔',])
-                    ->addColumn('device_sn', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '设备序列号',])
-                    ->addColumn('is_start_ota', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '是否升级设备',])
-                    ->addColumn('core_version', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '底层固件版本号',])
-                    ->addColumn('script_version', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '脚本版本号',])
-                    ->addColumn('sim_iccid', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => 'sim卡iccid',])
-                    ->addColumn('sim_imsi', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => 'sim卡imsi',])
-                    ->addColumn('rfid_rssi_filter_val', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rssi信号过滤值',])
-                    ->addColumn('ota_check_interval', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '空中升级检测周期',])
-                    ->addColumn('error_log_report_interval', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '错误日志上报间隔',])
-                    ->addColumn('error_log_report_url', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '错误日志上报地址',])
-                    ->addColumn('data_tcp_port', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '数据通道TCP端口',])
-                    ->addColumn('data_udp_port', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '数据通道UDP端口',])
-                    ->addColumn('data_ip', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '数据通道IP',])
-                    ->addColumn('rfid_report_interval_rlian', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rfid数据上报周期',])
-                    ->addColumn('rfid_buffer_max_count_rlian', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rfid缓存信号数',])
-                    ->addColumn('rfid_enable_throttle_rlian', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '是否启用节流模式',])
-                    ->addColumn('rfid_offline_timeout_rlian', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rfid离线时间阀值',])
-                    ->addColumn('rfid_min_diff_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '首末次信号最小时间差',])
-                    
-                    ->update();
-        }      
-    }
-}

+ 0 - 72
catch/stations/database/migrations/20210601101625_station_heartbeat.php

@@ -1,72 +0,0 @@
-<?php
-
-use think\migration\Migrator;
-use think\migration\db\Column;
-use Phinx\Db\Adapter\MysqlAdapter;
-
-class StationHeartbeat extends Migrator
-{
-    /**
-     * Change Method.
-     *
-     * Write your reversible migrations using this method.
-     *
-     * More information on writing migrations is available here:
-     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
-     *
-     * The following commands can be used in this method and Phinx will
-     * automatically reverse them when rolling back:
-     *
-     *    createTable
-     *    renameTable
-     *    addColumn
-     *    renameColumn
-     *    addIndex
-     *    addForeignKey
-     *
-     * Remember to call "create()" or "update()" and NOT "save()" when working
-     * with the Table class.
-     */
-    public function change()
-    {
-        $table = $this->table('station_heartbeat', ['engine' => 'InnoDB',  'comment' => '' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
-        $table->addColumn('device_id', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '设备ID',])
-			->addColumn('device_imei', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '设备Imei',])
-			->addColumn('station_sn', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '序列号',])
-			->addColumn('core_version', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '底层固件版本号',])
-			->addColumn('script_version', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '脚本版本号',])
-			->addColumn('sim_iccid', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => 'sim卡iccid',])
-			->addColumn('sim_imsi', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => 'sim卡imsi',])
-			->addColumn('add_time', 'datetime', ['null' => true,'signed' => true,'comment' => '请求时间',])
-			->addColumn('ddzx_ip', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '调度中心ip',])
-			->addColumn('ddzx_tcp_port', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '调度中心tcp端口',])
-			->addColumn('ddzx_wait_recv_msg_max_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '等待接收超时时间',])
-			->addColumn('rfid_offline_timeout', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rfid离线超时时间',])
-			->addColumn('dev_reboot_time', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '设备定时重启时间',])
-			->addColumn('http_devops_interval', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'http运维通道请求间隔',])
-			->addColumn('rfid_rssi_filter_val', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rssi信号过滤值',])
-			->addColumn('response_content', 'text', ['limit' => MysqlAdapter::TEXT_REGULAR,'null' => true,'signed' => true,'comment' => '响应内容',])
-			->addColumn('response_time', 'datetime', ['null' => true,'signed' => true,'comment' => '响应时间',])
-			->addColumn('ota_check_interval', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '空中升级检测周期',])
-			->addColumn('error_log_report_url', 'string', ['limit' => 100,'null' => true,'signed' => true,'comment' => '错误日志上报地址',])
-			->addColumn('error_log_report_interval', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '错误日志上报间隔',])
-			->addColumn('boot_num', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '设备开机次数',])
-			->addColumn('data_ip', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '数据通道IP',])
-			->addColumn('data_tcp_port', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '数据通道TCP端口',])
-			->addColumn('data_udp_port', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '数据通道UDP端口',])
-			->addColumn('rfid_report_interval_rlian', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rfid数据上报周期',])
-			->addColumn('rfid_buffer_max_count_rlian', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rfid缓存信号数',])
-			->addColumn('rfid_enable_throttle_rlian', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '是否启用节流模式',])
-			->addColumn('rfid_offline_timeout_rlian', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => 'rfid离线时间阀值',])
-			->addColumn('dev_model', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '设备型号',])
-			->addColumn('ram_used', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '使用内存',])
-			->addColumn('free_flash', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '剩余flash空间',])
-			->addColumn('net_rssi', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '4G信号强度',])
-			->addColumn('rfid_min_diff_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '首末次信号最小时间差',])
-			->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建人ID',])
-			->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
-			->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
-			->addColumn('deleted_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '软删除',])
-            ->create();
-    }
-}

+ 0 - 49
catch/stations/database/migrations/20210705101024_add_kq_config.php

@@ -1,49 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | CatchAdmin [Just Like ~ ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2017~{$year} http://catchadmin.com All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
-// +----------------------------------------------------------------------
-// | Author: JaguarJack [ njphper@gmail.com ]
-// +----------------------------------------------------------------------
-
-use think\migration\Migrator;
-use think\migration\db\Column;
-use Phinx\Db\Adapter\MysqlAdapter;
-class AddKqConfig extends Migrator
-{
-    /**
-     * Change Method.
-     *
-     * Write your reversible migrations using this method.
-     *
-     * More information on writing migrations is available here:
-     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
-     *
-     * The following commands can be used in this method and Phinx will
-     * automatically reverse them when rolling back:
-     *
-     *    createTable
-     *    renameTable
-     *    addColumn
-     *    renameColumn
-     *    addIndex
-     *    addForeignKey
-     *
-     * Remember to call "create()" or "update()" and NOT "save()" when working
-     * with the Table class.
-     */
-    public function change()
-    {
-        if ($this->hasTable('station')) {
-            $table = $this->table('station');  
-            $table  ->addColumn('in_station_mac', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '进基站',])
-                    ->addColumn('out_station_mac', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '出基站',])
-                    ->addColumn('config_list', 'text', ['null' => true,'signed' => true,'comment' => '配置列表',])
-
-                    ->update();
-        }      
-    }
-}

+ 0 - 130
catch/stations/excel/DwExport.php

@@ -1,130 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | CatchAdmin [Just Like ~ ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
-// +----------------------------------------------------------------------
-// | Author: JaguarJack [ njphper@gmail.com ]
-// +----------------------------------------------------------------------
-namespace catchAdmin\stations\excel;
-
-use catcher\base\CatchRequest as Request;
-use catchAdmin\stations\model\Station as stationModel;
-use catcher\library\excel\ExcelContract;
-use PhpOffice\PhpSpreadsheet\Style\Alignment;
-
-class DwExport implements ExcelContract
-{
-    public $memory = '1024M';
-
-    protected $stationModel;
-
-    public function __construct(stationModel $stationModel)
-    {
-        $this->stationModel = $stationModel;
-    }
-
-    /**
-     * 设置头部
-     *
-     * @time 2020年09月08日
-     * @return string[]
-     */
-    public function headers(): array
-    {
-        // TODO: Implement headers() method.
-        return [
-            '省份', '市区', '县区', '基站名称', '基站Mac', '基站简码', '基站型号', '安装照片', '安装地址', 'SIM卡序列号', '在线时间','安装时间'
-        ];
-    }
-
-
-    /**
-     * 处理数据
-     *
-     * @time 2020年09月08日
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @return \think\Collection
-     */
-    public function sheets()
-    {
-        $list = $this->stationModel->getExportList();
-        // var_dump($list);
-        /*
-        foreach ($list as &$val) {
-            $val->student_no ="\t".$val->student_no."\t";
-            $val->passive_rfid ="\t".$val->passive_rfid."\t";
-            $val->active_rfid ="\t".$val->active_rfid."\t";
-            $val->parent_phone ="\t".$val->parent_phone."\t";
-        }
-        */
-        return $list;
-    }
-    public function keys(): array
-    {
-        // TODO: Implement keys() method.
-        return [
-            'province_name', 'city_name', 'district_name', 'station_name', 'station_mac', 'station_code', 'station_model', 'install_photo', 'address', 'sim_serial_number', 'online_time','created_at'
-        ];
-    }
-    /**
-     * 设置开始行
-     *
-     * @time 2020年09月08日
-     * @return int
-     */
-    public function setRow()
-    {
-        return 2;
-    }
-
-    /**
-     * 设置标题
-     *
-     * @time 2020年09月08日
-     * @return array
-     */
-    public function setTitle()
-    {
-        return [
-            'A1:I1', '导出定位基站', Alignment::HORIZONTAL_CENTER
-        ];
-    }
-     /**
-     * 设置宽度
-     *
-     * @time 2020年09月08日
-     * @return array
-     */
-    public function setWidth()
-    {
-        return [
-            'A' => 20,
-            'B' => 20,
-            'C' => 20,
-            'D' => 20,
-            'E' => 20,
-            'F' => 20,
-            'G' => 20,
-            'H' => 20,
-            'I' => 20,
-            'J' => 20,
-            'K' => 20,
-            'L' => 20,
-        ];
-    }
-    public function getWorksheet($sheet)
-    {
-        // $sheet->getStyle('B')->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
-        // $sheet->getColumnDimension('B')->setAutoSize(true);
-        // $sheet->getColumnDimension('C')->setAutoSize(true);
-        // $sheet->getColumnDimension('D')->setAutoSize(true);
-        // $sheet->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
-        // $sheet->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
-        return $sheet;
-    }
-}

+ 0 - 128
catch/stations/excel/KqExport.php

@@ -1,128 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | CatchAdmin [Just Like ~ ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
-// +----------------------------------------------------------------------
-// | Author: JaguarJack [ njphper@gmail.com ]
-// +----------------------------------------------------------------------
-namespace catchAdmin\stations\excel;
-
-use catcher\base\CatchRequest as Request;
-use catchAdmin\stations\model\Station as stationModel;
-use catcher\library\excel\ExcelContract;
-use PhpOffice\PhpSpreadsheet\Style\Alignment;
-
-class KqExport implements ExcelContract
-{
-    public $memory = '1024M';
-
-    protected $stationModel;
-
-    public function __construct(stationModel $stationModel)
-    {
-        $this->stationModel = $stationModel;
-    }
-
-    /**
-     * 设置头部
-     *
-     * @time 2020年09月08日
-     * @return string[]
-     */
-    public function headers(): array
-    {
-        // TODO: Implement headers() method.
-        return [
-            '学校', '出入口', '基站名称', '基站Mac', '基站简码', '基站朝向', '在线时间', '安装时间', '安装照片', '安装地址'
-        ];
-    }
-
-
-    /**
-     * 处理数据
-     *
-     * @time 2020年09月08日
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @return \think\Collection
-     */
-    public function sheets()
-    {
-        $list = $this->stationModel->getExportList();
-        // var_dump($list);
-        /*
-        foreach ($list as &$val) {
-            $val->student_no ="\t".$val->student_no."\t";
-            $val->passive_rfid ="\t".$val->passive_rfid."\t";
-            $val->active_rfid ="\t".$val->active_rfid."\t";
-            $val->parent_phone ="\t".$val->parent_phone."\t";
-        }
-        */
-        return $list;
-    }
-    public function keys(): array
-    {
-        // TODO: Implement keys() method.
-        return [
-            'school_name', 'access_name', 'station_name', 'station_mac', 'station_code', 'orientation_text', 'online_time', 'created_at', 'install_photo', 'address'
-        ];
-    }
-    /**
-     * 设置开始行
-     *
-     * @time 2020年09月08日
-     * @return int
-     */
-    public function setRow()
-    {
-        return 2;
-    }
-
-    /**
-     * 设置标题
-     *
-     * @time 2020年09月08日
-     * @return array
-     */
-    public function setTitle()
-    {
-        return [
-            'A1:I1', '导出考勤基站', Alignment::HORIZONTAL_CENTER
-        ];
-    }
-     /**
-     * 设置宽度
-     *
-     * @time 2020年09月08日
-     * @return array
-     */
-    public function setWidth()
-    {
-        return [
-            'A' => 20,
-            'B' => 20,
-            'C' => 20,
-            'D' => 20,
-            'E' => 20,
-            'F' => 20,
-            'G' => 20,
-            'H' => 20,
-            'I' => 20,
-            'J' => 20,
-        ];
-    }
-    public function getWorksheet($sheet)
-    {
-        // $sheet->getStyle('B')->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
-        // $sheet->getColumnDimension('B')->setAutoSize(true);
-        // $sheet->getColumnDimension('C')->setAutoSize(true);
-        // $sheet->getColumnDimension('D')->setAutoSize(true);
-        // $sheet->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
-        // $sheet->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
-        return $sheet;
-    }
-}

+ 0 - 126
catch/stations/excel/SkExport.php

@@ -1,126 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | CatchAdmin [Just Like ~ ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
-// +----------------------------------------------------------------------
-// | Author: JaguarJack [ njphper@gmail.com ]
-// +----------------------------------------------------------------------
-namespace catchAdmin\stations\excel;
-
-use catcher\base\CatchRequest as Request;
-use catchAdmin\stations\model\Station as stationModel;
-use catcher\library\excel\ExcelContract;
-use PhpOffice\PhpSpreadsheet\Style\Alignment;
-
-class SkExport implements ExcelContract
-{
-    public $memory = '1024M';
-
-    protected $stationModel;
-
-    public function __construct(stationModel $stationModel)
-    {
-        $this->stationModel = $stationModel;
-    }
-
-    /**
-     * 设置头部
-     *
-     * @time 2020年09月08日
-     * @return string[]
-     */
-    public function headers(): array
-    {
-        // TODO: Implement headers() method.
-        return [
-            '学校', '建筑', '楼层', '房间', '基站名称', '基站Mac', '基站简码', '安装照片', '在线时间', '安装时间'
-        ];
-    }
-
-
-    /**
-     * 处理数据
-     *
-     * @time 2020年09月08日
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @return \think\Collection
-     */
-    public function sheets()
-    {
-        $list = $this->stationModel->getExportList();
-        // var_dump($list);
-        foreach ($list as &$val) {
-            // $val->student_no ="\t".$val->student_no."\t";
-            // $val->passive_rfid ="\t".$val->passive_rfid."\t";
-            // $val->active_rfid ="\t".$val->active_rfid."\t";
-            // $val->parent_phone ="\t".$val->parent_phone."\t";
-        }
-        return $list;
-    }
-    public function keys(): array
-    {
-        // TODO: Implement keys() method.
-        return [
-            'school_name', 'building_name', 'floor_name', 'room_no', 'station_name', 'station_mac', 'station_code','install_photo','online_time','created_at'
-        ];
-    }
-    /**
-     * 设置开始行
-     *
-     * @time 2020年09月08日
-     * @return int
-     */
-    public function setRow()
-    {
-        return 2;
-    }
-
-    /**
-     * 设置标题
-     *
-     * @time 2020年09月08日
-     * @return array
-     */
-    public function setTitle()
-    {
-        return [
-            'A1:I1', '导出室内插座', Alignment::HORIZONTAL_CENTER
-        ];
-    }
-     /**
-     * 设置宽度
-     *
-     * @time 2020年09月08日
-     * @return array
-     */
-    public function setWidth()
-    {
-        return [
-            'A' => 20,
-            'B' => 20,
-            'C' => 20,
-            'D' => 20,
-            'E' => 20,
-            'F' => 20,
-            'G' => 20,
-            'H' => 20,
-            'I' => 20,
-            'J' => 20,
-        ];
-    }
-    public function getWorksheet($sheet)
-    {
-        // $sheet->getStyle('B')->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT);
-        // $sheet->getColumnDimension('B')->setAutoSize(true);
-        // $sheet->getColumnDimension('C')->setAutoSize(true);
-        // $sheet->getColumnDimension('D')->setAutoSize(true);
-        // $sheet->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
-        // $sheet->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
-        return $sheet;
-    }
-}

+ 0 - 157
catch/stations/model/Station.php

@@ -1,157 +0,0 @@
-<?php
-
-namespace catchAdmin\stations\model;
-
-use catcher\base\CatchModel as Model;
-use catchAdmin\permissions\model\DataRangScopeTrait;
-use catchAdmin\stations\model\StationGet;
-use catchAdmin\stations\model\StationSearch;
-
-class Station extends Model
-{
-    use DataRangScopeTrait;
-    use StationGet;
-    use StationSearch;
-    // 表名
-    public $name = 'stations';
-    // 数据库字段映射
-    public $field = array(
-        'id',
-        // 基站名称
-        'station_name',
-        // 基站Mac
-        'station_mac',
-        // 基站简码
-        'station_code',
-        // 基站类型
-        'station_type',
-        // 经度
-        'longitude',
-        // 纬度
-        'latitude',
-        // x轴坐标
-        'coordinate_x',
-        // y轴坐标
-        'coordinate_y',
-        // 出入口id
-        'access_id',
-        // 省
-        'province_id',
-        // 市
-        'city_id',
-        // 县区
-        'district_id',
-        // 在线时间
-        'online_time',
-        // 安装图片
-        'install_photo',
-        // 基站朝向 0-未知 1-朝外 2-朝内
-        'orientation',
-        // 学校id
-        'school_id',
-        // 基站型号
-        'station_model',
-        // 基站串号
-        'station_sn',
-        // 基站版本
-        'station_version',
-        // WAN口IP
-        'wan_ip',
-        // 网络模式 0-静态地址,1-动态获取,2-PPPOE拨号,3-3G拨号,4-4G拨号
-        'net_model',
-        // 信号强度(dbm)
-        'rssi',
-        // sim卡序列号
-        'sim_serial_number',
-        // 话机编号
-        'cmcc_phone_id',
-        // 考勤配置
-        'attendance_config',
-        // 信号灵敏度 默认62,大于此值会被过滤
-        'rssi_sensitive',
-        // 节流 0-关闭,1-开启
-        'throttling',
-        // 安装地址
-        'address',
-        // 推送企业微信0-否,1-是
-        'enable_push_qywx',
-        // 建筑id
-        'building_id',
-        // 楼层id
-        'floor_id',
-        //房间
-        'room_no',
-        // 创建人ID
-        'creator_id',
-        // 创建时间
-        'created_at',
-        // 更新时间
-        'updated_at',
-        // 软删除
-        'deleted_at',
-    );
-    /**
-     * 获取基站列表
-     */
-    public function getStationList($field,$order)
-    {
-        $res =  $this->dataRange()
-            ->catchSearch()
-            ->append(['school_name', 'building_name', 'floor_name', 'push_text', 'throttling_text', 'orientation_text','command'])
-            ->order($this->aliasField($field), $order)
-            ->paginate();
-        return $res;
-    }
-
-    /**
-    * 获取所有基站数据(no limit)
-    */
-    public function getRangeData(){
-        $res = $this->dataRange()
-                ->catchSearch()
-                ->append(['area_id','province_name','city_name','district_name','school_name','access_name','building_name','floor_name','push_text','throttling_text','orientation_text'])
-                ->order($this->aliasField('id'), 'desc')
-                ->select();
-        return $res;
-
-    }
-    
-    /**
-     * 检测基站MAC格式是否正确
-     */
-    public function checkStationMacFormat($mac)
-    {
-        $mac = strtoupper(trim($mac));
-        $regex = "/^([A-F0-9]{12})$/";
-
-        if (!preg_match($regex, $mac)) {
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * 检测设备mac是否重复
-     */
-    public function isStationMacDuplicate($mac, $id = '')
-    {
-        $cond = [['station_mac', '=', strtoupper(trim($mac))]];
-        if ($id) {
-            $cond[] = ['id', '<>', $id];
-        }
-        return $this->where($cond)->count();
-    }
-    /**
-     * 导出基站列表
-     * 
-     */
-    public function getExportList()
-    {
-        $res =  $this->dataRange()
-            ->catchSearch()
-            ->append(['area_id', 'province_name', 'city_name', 'district_name', 'school_name', 'access_name', 'building_name', 'floor_name', 'push_text', 'throttling_text', 'orientation_text'])
-            ->order($this->aliasField('id'), 'desc')
-            ->select();
-        return $res;
-    }
-}

+ 0 - 119
catch/stations/model/StationGet.php

@@ -1,119 +0,0 @@
-<?php
-
-namespace catchAdmin\stations\model;
-use think\facade\Db;
-trait StationGet
-{
-   
-     /**
-     * 获取学校名称(文本)
-     */
-    public function getSchoolNameAttr($value)
-    {
-       $id = $this->school_id;
-       $name = Db::table('departments')->where('id',$id)->value('department_name');
-       return $name;
-    }
-      /**
-     * 获取学校id(文本)
-     */
-    // public function getSchoolIdAttr($value)
-    // {
-    // //    var_dump($value);
-    //    $parent_id = Db::table('departments')->where('id',$value)->value('parent_id');
-    //    return [$parent_id,$value];
-    // }
-     
-     
-     /**
-     * 获取基站朝向名称(文本)
-     */
-    public function getOrientationTextAttr($value)
-    {
-        $value = $this->orientation;
-        if($value == 1){
-            $value = '朝外';
-        }elseif($value == 2){
-            $value = '朝内';
-        }else{
-            $value = '未知';
-        }
-       return $value;
-    }
-     /**
-     * 获取是否推送企业微信消息名称(文本)
-     */
-    public function getPushTextAttr($value)
-    {
-        $value = $this->enable_push_qywx;
-        if($value == 1){
-            $value = '是';
-        }else{
-            $value = '否';
-        }
-       return $value;
-    }
-      /**
-     * 获取是否节流名称(文本)
-     */
-    public function getThrottlingTextAttr($value)
-    {
-        $value = $this->throttling;
-        if($value == 1){
-            $value = '开启';
-        }else{
-            $value = '关闭';
-        }
-       return $value;
-    }
-     /**
-     * 获取建筑名称(文本)
-     */
-    public function getBuildingNameAttr($value)
-    {
-       $id = $this->building_id;
-       $value = Db::table('kq_building')->where('id',$id)->value('name');
-       return $value;
-    }
-     /**
-     * 获取楼层名称(文本)
-     */
-    public function getFloorNameAttr($value)
-    {
-       $id = $this->floor_id;
-       $value = Db::table('kq_floor')->where('id',$id)->value('name');
-       return $value;
-    }
-
-    /**
-     * 获取楼层名称(文本)
-     */
-    public function getCommandAttr($value)
-    {
-       
-        if($this->is_reboot_device){
-            return 'is_reboot_device';
-        }elseif($this->is_restore_device){
-          return 'is_restore_device';
-        }else{
-            return 'null';
-        }
-       
-    }
-
-     /**
-     * 获取楼层名称(文本)
-     */
-    public function getConfigListAttr($value){
-        $config_list=json_decode($value,true);
-        $config_list['Card_INMAC']=$this->in_station_mac;
-        $config_list['Card_OUTMAC']=$this->out_station_mac;
-        $config_list['id']=$this->id;
-        if(isset($config_list['IS_SLAVE']) && $config_list['IS_SLAVE']==1){
-            $config_list['IS_SLAVE']=true;
-        }else{
-            $config_list['IS_SLAVE']=false;
-        }
-        return $config_list;
-    }
-}

+ 0 - 112
catch/stations/model/StationHeartbeat.php

@@ -1,112 +0,0 @@
-<?php
-
-namespace catchAdmin\stations\model;
-
-use catcher\base\CatchModel as Model;
-use catchAdmin\permissions\model\DataRangScopeTrait;
-class StationHeartbeat extends Model
-{
-    // 表名
-    public $name = 'station_heartbeat';
-    use DataRangScopeTrait;
-    // 数据库字段映射
-    public $field = array(
-        'id',
-        // 设备ID
-        'device_id',
-        // 设备Imei
-        'device_imei',
-        // 序列号
-        'station_sn',
-        // 底层固件版本号
-        'core_version',
-        // 脚本版本号
-        'script_version',
-        // sim卡iccid
-        'sim_iccid',
-        // sim卡imsi
-        'sim_imsi',
-        // 请求时间
-        'add_time',
-        // 调度中心ip
-        'ddzx_ip',
-        // 调度中心tcp端口
-        'ddzx_tcp_port',
-        // 等待接收超时时间
-        'ddzx_wait_recv_msg_max_time',
-        // rfid离线超时时间
-        'rfid_offline_timeout',
-        // 设备定时重启时间
-        'dev_reboot_time',
-        // http运维通道请求间隔
-        'http_devops_interval',
-        // rssi信号过滤值
-        'rfid_rssi_filter_val',
-        // 响应内容
-        'response_content',
-        // 响应时间
-        'response_time',
-        // 空中升级检测周期
-        'ota_check_interval',
-        // 错误日志上报地址
-        'error_log_report_url',
-        // 错误日志上报间隔
-        'error_log_report_interval',
-        // 设备开机次数
-        'boot_num',
-        // 数据通道IP
-        'data_ip',
-        // 数据通道TCP端口
-        'data_tcp_port',
-        // 数据通道UDP端口
-        'data_udp_port',
-        // rfid数据上报周期
-        'rfid_report_interval_rlian',
-        // rfid缓存信号数
-        'rfid_buffer_max_count_rlian',
-        // 是否启用节流模式
-        'rfid_enable_throttle_rlian',
-        // rfid离线时间阀值
-        'rfid_offline_timeout_rlian',
-        // 首末次信号最小时间差
-        'rfid_min_diff_time',
-        
-        // 设备型号
-        'dev_model',
-        // 使用内存
-        'ram_used',
-        // 剩余flash空间
-        'free_flash',
-        // 4G信号强度
-        'net_rssi',
-        // 创建人ID
-        'creator_id',
-        // 创建时间
-        'created_at',
-        // 更新时间
-        'updated_at',
-        // 软删除
-        'deleted_at',
-    );
-    /**
-     * 获取基站列表
-     */
-    public function getList()
-    {
-        $res = $this
-            ->catchSearch()
-            ->order($this->aliasField('id'), 'desc')
-            ->paginate();
-            // var_dump($this->getLastSql());
-        return $res;
-    }
-
-    /**
-     * 基站编码
-     */
-    public function searchDeviceIdAttr($query, $value, $data)
-    {
-        return $query->where('device_id', $value);
-    }
-
-}

+ 0 - 95
catch/stations/model/StationSearch.php

@@ -1,95 +0,0 @@
-<?php
-
-namespace catchAdmin\stations\model;
-
-use catchAdmin\permissions\model\Department;
-trait StationSearch
-{
-    /**
-     * 基站名称
-     */
-    public function searchStationNameAttr($query, $value, $data)
-    {
-        return $query->where('station_name', 'like', '%'. $value . '%');
-    }
-     /**
-     * 基站类型
-     */
-    public function searchStationTypeAttr($query, $value, $data)
-    {
-        return $query->where('station_type',$value);
-    }
-     /**
-     * 基站mac
-     */
-    public function searchStationMacAttr($query, $value, $data)
-    {
-        return $query->where('station_mac',$value);
-    }
-      /**
-     * 基站简码
-     */
-    public function searchStationCodeAttr($query, $value, $data)
-    {
-        return $query->where('station_code',$value);
-    }
-      /**
-     * 省
-     */
-    public function searchProvinceIdAttr($query, $value, $data)
-    {
-        return $query->where('province_id',$value);
-    }
-     /**
-     * 市
-     */
-    public function searchCityIdAttr($query, $value, $data)
-    {
-        return $query->where('city_id',$value);
-    }
-    /**
-     * 县
-     */
-    public function searchDistrictIdAttr($query, $value, $data)
-    {
-        return $query->where('district_id',$value);
-    }
-    /**
-     * 学校id
-     */
-    public function searchSchoolIdAttr($query, $value, $data)
-    {
-        return $query->where('school_id',$value);
-    }
-       /**
-     * 年级id
-     */
-    public function searchGradeIdAttr($query, $value, $data)
-    {
-        return $query->where('grade_id',$value);
-    }
-     /**
-     * 建筑id
-     */
-    public function searchBuildingIdAttr($query, $value, $data)
-    {
-        return $query->where('building_id',$value);
-    }
-     /**
-     * 楼层id
-     */
-    public function searchFloorIdAttr($query, $value, $data)
-    {
-        return $query->where('floor_id',$value);
-    }
-        /**
-     * 城市:省/市/区/
-     */
-    public function searchCitysAttr($query, $value, $data)
-    {
-        if (empty($value)) {
-            return $query;
-        }
-        return $query->where('province_id|city_id|district_id', 'in', $value);
-    }
-}

+ 0 - 15
catch/stations/module.json

@@ -1,15 +0,0 @@
-{
-    "name": "stations",
-    "alias": "stations",
-    "description": "基站管理模块",
-    "version": "1.0.0",
-    "keywords": [""],
-    "order": 0,
-    "services": [
-        "\\catchAdmin\\stations\\StationsService"
-    ],
-    "aliases": {},
-    "files": [],
-    "requires": [],
-    "enable": true
-}

+ 0 - 33
catch/stations/route.php

@@ -1,33 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | CatchAdmin [Just Like ~ ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2017~{$year} http://catchadmin.com All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
-// +----------------------------------------------------------------------
-// | Author: JaguarJack [ njphper@gmail.com ]
-// +----------------------------------------------------------------------
-
-// you should use `$router`
-$router->group(function () use ($router){
-	// station路由
-	$router->resource('station', '\catchAdmin\stations\controller\Station');
-	$router->post('kqstation/export', '\catchAdmin\stations\controller\Station@kqexport');//导出考勤基站
-	$router->post('dwstation/export', '\catchAdmin\stations\controller\DwStation@export');//导出定位基站
-	$router->post('socketstation/export', '\catchAdmin\stations\controller\IndoorStation@export');//导出定位基站
-	// 定位基站
-	$router->get('dwstation/getRangeData', '\catchAdmin\stations\controller\DwStation@rangeData');
-	$router->put('dwstation/updateStationConfig/:id', '\catchAdmin\stations\controller\DwStation@updateStationConfig');
-	$router->put('station/updateKqStationConfig/:id', '\catchAdmin\stations\controller\Station@updateKqStationConfig');
-	$router->put('station/sendIpConfig/:id', '\catchAdmin\stations\controller\Station@sendIpConfig');
-	$router->put('station/controlConfig/:id', '\catchAdmin\stations\controller\Station@controlConfig');
-	
-	$router->resource('dwstation', '\catchAdmin\stations\controller\DwStation');
-	// 室内基站
-	$router->put('indoorStation/updateLocation/:id', '\catchAdmin\stations\controller\IndoorStation@updateLocation');
-	$router->resource('indoorStation', '\catchAdmin\stations\controller\IndoorStation');
-
-	// stationHeartbeat路由
-	$router->resource('stationHeartbeat', '\catchAdmin\stations\controller\StationHeartbeat');
-})->middleware('auth');