This commit is contained in:
MeSHard
2025-12-01 11:19:23 +08:00
parent adc5fd81aa
commit b22d09bd39
4440 changed files with 815952 additions and 0 deletions

View File

@@ -0,0 +1,125 @@
<?php
namespace app\admin\controller\yq\alarm;
use app\admin\model\yq\base_config\Early;
use app\admin\model\yq\base_config\Perimeter;
use app\admin\model\yq\driver\Vehicle;
use app\common\controller\Backend;
use think\Db;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* E1-1报警管理
*
* @icon fa fa-circle-o
*/
class Alarm extends Backend
{
/**
* Alarm模型对象
* @var \app\admin\model\yq\alarm\Alarm
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\alarm\Alarm;
$this->assign('triggerTypeList',$this->model->getTriggerTypeList());
$this->assign('feedbackStatusList',$this->model->getFeedbackStatusList());
$this->assign('resStatusList',$this->model->getResStatusList());
$this->assign('resDepartmentList',$this->model->getResDepartmentList());
$this->assign('feedbackDepartmentList',$this->model->getFeedbackDepartmentList());
$this->assign('isResetList',$this->model->getIsResetList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$new_where = [];
$vehicleNo = input('vehicleNo');
if (!empty($vehicleNo) && isset($vehicleNo)) {
$new_where['license'] = ['=', $vehicleNo];
}
$list = $this->model
->where($where)
->where($new_where)
->order($sort, $order)
->paginate($limit);
$early_model = new Early();
foreach ($list as $key=>$row) {
$list[$key]['lv'] = $early_model->getLvList()[$row['lv']];
}
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
public function edit($ids = null)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if (false === $this->request->isPost()) {
$early_model = new Early();
$row['lv'] = $early_model->getLvList()[$row['lv']];
$row['perimeter'] = Perimeter::where('id',$row['perimeter'])->value('name');
$this->view->assign('row', $row);
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate);
}
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if (false === $result) {
$this->error(__('No rows were updated'));
}
$this->success();
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\yq\alarm;
use app\common\controller\Backend;
/**
* E1-3报警趋势年度管理
*
* @icon fa fa-circle-o
*/
class Trend extends Backend
{
/**
* Trend模型对象
* @var \app\admin\model\yq\alarm\Trend
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\alarm\Trend;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,34 @@
<?php
namespace app\admin\controller\yq\analysis;
use app\common\controller\Backend;
/**
* A2-1周界配置管理
*
* @icon fa fa-circle-o
*/
class Data extends Backend
{
/**
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,34 @@
<?php
namespace app\admin\controller\yq\analysis;
use app\common\controller\Backend;
/**
* A2-1周界配置管理
*
* @icon fa fa-circle-o
*/
class Vehicle extends Backend
{
/**
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\yq\base_config;
use app\common\controller\Backend;
/**
* 载货品类管理
*
* @icon fa fa-circle-o
*/
class Cargo extends Backend
{
/**
* Cargo模型对象
* @var \app\admin\model\yq\base_config\Cargo
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\base_config\Cargo;
$this->view->assign("statusList", $this->model->getStatusList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\yq\base_config;
use app\common\controller\Backend;
/**
* A3-1司机服务配置
*
* @icon fa fa-circle-o
*/
class Driver extends Backend
{
/**
* Driver模型对象
* @var \app\admin\model\yq\base_config\Driver
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\base_config\Driver;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,62 @@
<?php
namespace app\admin\controller\yq\base_config;
use app\common\controller\Backend;
/**
* A1-1预警处理配置管理
*
* @icon fa fa-circle-o
*/
class Early extends Backend
{
/**
* Early模型对象
* @var \app\admin\model\yq\base_config\Early
*/
protected $model = null;
protected $searchFields = 'early.id,early.name';
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\base_config\Early;
$this->assign('triggerTypeList',$this->model->getTriggerTypeList());
$this->assign('lvList',$this->model->getLvList());
$this->assign('departmentList',$this->model->getDepartmentList());
$this->assign('feedbackTimeList',$this->model->getFeedbackTimeList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->with('type')
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace app\admin\controller\yq\base_config;
use app\common\controller\Backend;
/**
* A1-2预警处理配置类型管理
*
* @icon fa fa-circle-o
*/
class EventType extends Backend
{
/**
* Event_type模型对象
* @var \app\admin\model\yq\base_config\EventType
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\base_config\EventType;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function json_index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result['rows']);
}
}

View File

@@ -0,0 +1,247 @@
<?php
namespace app\admin\controller\yq\base_config;
use app\common\controller\Backend;
use think\Db;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* A2-1周界配置管理
*
* @icon fa fa-circle-o
*/
class Perimeter extends Backend
{
/**
* Perimeter模型对象
* @var \app\admin\model\yq\base_config\Perimeter
*/
protected $model = null;
protected $searchFields = 'perimeter.id,perimeter.name';
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\base_config\Perimeter;
$this->assign('stopList', $this->model->getStopList());
$this->assign('banList', $this->model->getBanList());
$this->assign('hazardList', $this->model->getHazardList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
// 周界配置
public function config()
{
if ($this->request->isAjax() && $this->request->isPost()) {
$params = $this->request->post();
if (empty($params['info']) || empty($params['perimeter_id'])) {
$this->error('请先画区域~');
}
$info_arr = json_decode($params['info'], true);
$str = '';
foreach ($info_arr as $key => $value) {
$str .= $value['lng'] . ',' . $value['lat'] . ';';
}
$str = rtrim($str, ';');
// 112.18721,31.052017;112.179486,31.050105;112.176567,31.043561;112.175967,31.036354;112.176911,31.028705;112.17837,31.022527;112.183863,31.017525;112.186695,31.016422;112.193819,31.01576;112.202402,31.015686;112.211243,31.016569;112.220684,31.017893;112.228581,31.02032;112.231671,31.024145;112.233559,31.031426;112.233301,31.038781;112.235104,31.045105;112.23416,31.051944;112.226692,31.054664;112.21871,31.055988;112.209784,31.057679;112.203518,31.059958;112.197424,31.05937;112.190901,31.057679;112.186867,31.05187
halt($str);
$res = \app\admin\model\yq\base_config\Perimeter::update(['info' => $str, 'id' => $params['perimeter_id']]);
if ($res) {
$this->error('设置成功~');
} else {
$this->error('设置失败~');
}
}
if (!$this->model->get(input('ids'))) {
$this->error('数据不存在');
}
$res = $this->model->where('is_del', 1)->order('id')->select();
foreach ($res as $key => &$value) {
switch ($value['region_lv']) {
case 21:
$value['region_lv'] = 1;
break;
case 22:
$value['region_lv'] = 2;
break;
default :
$value['region_lv'] = 0;
break;
}
}
$this->assign('data', json_encode($res));
$this->assign('perimeter_id', input('ids'));
$this->view->engine->layout(false);
return $this->view->fetch();
}
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->with(['parent', 'typeo', 'typet'])
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
public function add()
{
if (false === $this->request->isPost()) {
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
if (!$params['region_lv'] || $params['region_lv'] == '') {
$this->error('请选择周界等级~');
}
if (!$params['region_type'] || $params['region_type'] == '') {
$this->error('请选择周界区域~');
}
if ($params['region_lv'] == 21) {
if (empty($params['pid'])) {
$this->error('当前为三级周界等级,请选择二级周界~');
}
if (empty($params['stop_vehicle']) && $params['stop_vehicle'] != 0) {
$this->error('当前为三级周界等级,请设置可停车辆数~');
}
if (empty($params['feasible_vehicle']) && $params['feasible_vehicle'] != 0) {
$this->error('当前为三级周界等级,请设置可行车辆数~');
}
if (empty($params['max_speed']) && $params['max_speed'] != 0) {
$this->error('当前为三级周界等级,请设置最大限速~');
}
}
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
$params[$this->dataLimitField] = $this->auth->id;
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException()->validate($validate);
}
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result === false) {
$this->error(__('No rows were inserted'));
}
$this->success();
}
public function edit($ids = null)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if (false === $this->request->isPost()) {
$this->view->assign('row', $row);
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
if (!$params['region_lv'] || $params['region_lv'] == '') {
$this->error('请选择周界等级~');
}
if (!$params['region_type'] || $params['region_type'] == '') {
$this->error('请选择周界区域~');
}
if ($params['region_lv'] == 21) {
if (empty($params['pid'])) {
$this->error('当前为三级周界等级,请选择二级周界~');
}
if (empty($params['stop_vehicle']) && $params['stop_vehicle'] != 0) {
$this->error('当前为三级周界等级,请设置可停车辆数~');
}
if (empty($params['feasible_vehicle']) && $params['feasible_vehicle'] != 0) {
$this->error('当前为三级周界等级,请设置可行车辆数~');
}
if (empty($params['max_speed']) && $params['max_speed'] != 0) {
$this->error('当前为三级周界等级,请设置最大限速~');
}
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate);
}
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if (false === $result) {
$this->error(__('No rows were updated'));
}
$this->success();
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace app\admin\controller\yq\base_config;
use app\common\controller\Backend;
use fast\Tree;
/**
* A2-2周界类型管理
*
* @icon fa fa-circle-o
*/
class PerimeterType extends Backend
{
/**
* Perimeter_type模型对象
* @var \app\admin\model\yq\base_config\PerimeterType
*/
protected $model = null;
protected $rulelist = [];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\base_config\PerimeterType;
// 必须将结果集转换为数组
$ruleList = \think\Db::name("perimeter_type")->order('sort DESC,id ASC')->select();
foreach ($ruleList as $k => &$v) {
$v['name'] = __($v['name']);
}
unset($v);
Tree::instance()->init($ruleList)->icon = ['&nbsp;&nbsp;&nbsp;&nbsp;', '&nbsp;&nbsp;&nbsp;&nbsp;', '&nbsp;&nbsp;&nbsp;&nbsp;'];
$this->rulelist = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
$ruledata = [0 => __('None')];
foreach ($this->rulelist as $k => &$v) {
$ruledata[$v['id']] = $v['name'];
unset($v['spacer']);
}
unset($v);
$this->view->assign('ruledata', $ruledata);
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function index()
{
if ($this->request->isAjax()) {
$list = $this->rulelist;
$total = count($this->rulelist);
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
// 联动获取周界等级
public function type()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
$new_where = [];
$new_where['is_del'] = ['=', 1];
$params = $this->request->param();
if (isset($params['pid']) && !empty($params['pid'])) {
$new_where['pid'] = ['=', $params['pid']];
} else {
$new_where['pid'] = ['=', 0];
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->where($where)
->where($new_where)
->order('sort', 'asc')
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
$data = [];
foreach ($result['rows'] as $k => $v) {
$data[] = [
'name' => $v['name'],
'value' => $v['id']
];
}
return json(['code' => 1, 'data' => $data]);
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\yq\call_number;
use app\common\controller\Backend;
/**
*
*
* @icon fa fa-circle-o
*/
class Shout extends Backend
{
/**
* Driver模型对象
* @var \app\admin\model\yq\base_config\Driver
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\base_config\Driver;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,38 @@
<?php
namespace app\admin\controller\yq\call_number;
use app\common\controller\Backend;
/**
*
*
* @icon fa fa-circle-o
*/
class ShoutLog extends Backend
{
/**
* Driver模型对象
* @var \app\admin\model\yq\base_config\Driver
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\base_config\Driver;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\yq\driver;
use app\common\controller\Backend;
/**
*
*
* @icon fa fa-circle-o
*/
class Certificates extends Backend
{
/**
* Certificates模型对象
* @var \app\admin\model\yq\driver\Certificates
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\driver\Certificates;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\yq\driver;
use app\common\controller\Backend;
/**
* 司机管理
*
* @icon fa fa-circle-o
*/
class Driver extends Backend
{
/**
* Driver模型对象
* @var \app\admin\model\yq\driver\Driver
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\driver\Driver;
$this->view->assign("statusList", $this->model->getStatusList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\yq\driver;
use app\common\controller\Backend;
/**
* 司机车辆绑定管理
*
* @icon fa fa-circle-o
*/
class Vehicle extends Backend
{
/**
* Vehicle模型对象
* @var \app\admin\model\yq\driver\Vehicle
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\driver\Vehicle;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,65 @@
<?php
namespace app\admin\controller\yq\electronic_waybill;
use app\admin\model\yq\driver\Vehicle;
use app\common\controller\Backend;
/**
* z_电子运单管理
*
* @icon fa fa-circle-o
*/
class Waybill extends Backend
{
/**
* Waybill模型对象
* @var \app\admin\model\yq\electronic_waybill\Waybill
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\electronic_waybill\Waybill;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$new_where = [];
$vehicleNo = input('vehicleNo');
if (!empty($vehicleNo) && isset($vehicleNo)) {
$driver_id = Vehicle::where('license','=',$vehicleNo)->value('driver_id');
$new_where['driverid'] = ['=', $driver_id];
}
$list = $this->model
->where($where)
->where($new_where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

View File

@@ -0,0 +1,84 @@
<?php
namespace app\admin\controller\yq\message;
use app\admin\model\yq\alarm\Alarm;
use app\admin\model\yq\driver\Vehicle;
use app\admin\model\yq\park\Park;
use app\common\controller\Backend;
/**
* 消息管理
*
* @icon fa fa-circle-o
*/
class Message extends Backend
{
/**
* Message模型对象
* @var \app\admin\model\yq\message\Message
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\message\Message;
$this->view->assign("statusList", $this->model->getStatusList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->with('driver')
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $key => $value) {
switch ($value['type']) {
case 1:
break;
$event_name = Alarm::where('id', $value['event_id'])->value('name');
case 2:
break;
case 3:
$info = Park::where('id', $value['event_id'])->find();
$event_name = $info['mission_text'];
break;
case 4:
break;
default:
$event_name = '';
break;
}
$value['event_name'] = $event_name;
}
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

View File

@@ -0,0 +1,160 @@
<?php
namespace app\admin\controller\yq\park;
use app\admin\model\yq\driver\Certificates;
use app\admin\model\yq\driver\Vehicle;
use app\admin\model\yq\message\Message;
use app\common\controller\Backend;
use think\Db;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* D1-1入园申请管理
*
* @icon fa fa-circle-o
*/
class Park extends Backend
{
/**
* Park模型对象
* @var \app\admin\model\yq\park\Park
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\park\Park;
$this->view->assign("statusList", $this->model->getStatusList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$new_where = [];
$vehicleNo = input('vehicleNo');
if (!empty($vehicleNo) && isset($vehicleNo)) {
$driver_id = Vehicle::where('license','=',$vehicleNo)->value('driver_id');
$new_where['reporter_id'] = ['=', $driver_id];
}
$list = $this->model
->where($where)
->where($new_where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
public function check($ids = null){
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if (false === $this->request->isPost()) {
// 有个请求
// $vehicle = \app\admin\model\yq\vehicle\Vehicle::where('vehicleNo',$row['tractor_license'])->find();
// $url = 'http://47.108.219.88:5000/api/httpserver/vehicleInfo?vehicleNo='.rawurlencode($vehicle['vehicleNo']).'&plateColor='.$vehicle['plateColor'];
// $header = array();
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
// curl_setopt($ch, CURLOPT_URL, $url);
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output = curl_exec($ch);
// curl_close($ch);
$output = "";
$json = json_decode($output,true);
if (empty($json['body'])){
$list = [
$row['vehicleNo'] = '',
$row['ownerName'] = '',
$row['businessScopeName'] = '',
$row['transCertificateCode'] = '',
$row['certificateEffdate'] = '',
$row['certificateExpdate'] = '',
$row['licenseIssueOrganCode'] = '',
];
}else{
$list = $json['body'];
}
$certificates = Certificates::where('cer_vehicle_no',$row['tractor_license'])->field('transport_pic,tractor_pic,driver_pic')->find();
if ($certificates){
$row = array_merge($row,$certificates);
}
$this->view->assign('row', $row);
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if($row['status'] != 0){
$this->error('申请已审批,请勿重复操作');
}
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate);
}
// 创建车辆消息
$driver = Vehicle::where('license',$row['tractor_license'])->where('is_del',1)->select();
if (!empty($driver)) {
foreach ($driver as $key=>$v) {
$arr[] = [
'driver_id' => $v['driver_id'],
'type'=>3,
'event_id'=>$ids,
'vehicle_no'=>$row['tractor_license'],
'status'=>1,
'create_time'=>time(),
];
}
(new Message)->saveAll($arr);
}
$result = $row->allowField(true)->save(['status' => $params['status']]);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if (false === $result) {
$this->error(__('No rows were updated'));
}
$this->success();
}
}

View File

@@ -0,0 +1,142 @@
<?php
namespace app\admin\controller\yq\perimeter;
use app\common\controller\Backend;
use think\Db;
/**
* A2-1周界配置管理
*
* @icon fa fa-circle-o
*/
class Enterprise extends Backend
{
/**
* Enterprise模型对象
* @var \app\admin\model\yq\perimeter\Enterprise
*/
protected $model = null;
/**
* 快速搜索字段
*/
protected $searchFields = 'id,name';
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\perimeter\Enterprise;
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if (false === $this->request->isPost()) {
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
// 如果设置了密码,使用 md5 加密
if (!empty($params['password'])) {
$params['password'] = md5($params['password']);
}
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
$params[$this->dataLimitField] = $this->auth->id;
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException()->validate($validate);
}
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (\think\exception\ValidateException|\think\exception\PDOException|\Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result === false) {
$this->error(__('No rows were inserted'));
}
$this->success();
}
/**
* 编辑
*
* @param $ids
* @return string
* @throws \think\db\exception\DbException
* @throws \think\Exception
*/
public function edit($ids = null)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if (false === $this->request->isPost()) {
// 编辑时不清空密码字段,如果密码已加密则不显示
if (!empty($row->password) && strlen($row->password) == 32) {
// 如果密码是32位md5值则清空显示不显示原始密码
$row->password = '';
}
$this->view->assign('row', $row);
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
// 如果设置了新密码,使用 md5 加密
if (!empty($params['password'])) {
$params['password'] = md5($params['password']);
} else {
// 如果没有设置密码,保持原密码不变
unset($params['password']);
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate);
}
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (\think\exception\ValidateException|\think\exception\PDOException|\Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if (false === $result) {
$this->error(__('No rows were updated'));
}
$this->success();
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace app\admin\controller\yq\perimeter;
use app\common\controller\Backend;
/**
* z_企业报警管理
*
* @icon fa fa-circle-o
*/
class EnterpriseAlarm extends Backend
{
/**
* Enterprise_alarm模型对象
* @var \app\admin\model\yq\perimeter\EnterpriseAlarm
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\perimeter\EnterpriseAlarm;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace app\admin\controller\yq\perimeter;
use app\common\controller\Backend;
/**
* H2-1查验记录管理
*
* @icon fa fa-circle-o
*/
class EnterpriseCheck extends Backend
{
/**
* Enterprise_check模型对象
* @var \app\admin\model\yq\perimeter\EnterpriseCheck
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\perimeter\EnterpriseCheck;
$this->view->assign("statusList", $this->model->getStatusList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->with(['perimeter','waybill'])
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace app\admin\controller\yq\perimeter;
use app\common\controller\Backend;
/**
* A2-1周界进出车辆日志管理
*
* @icon fa fa-circle-o
*/
class EnterpriseVehicle extends Backend
{
/**
* Enterprise_vehicle模型对象
* @var \app\admin\model\yq\perimeter\EnterpriseVehicle
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\perimeter\EnterpriseVehicle;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\yq\vehicle;
use app\common\controller\Backend;
/**
* z_企业车辆历史进出日志管理
*
* @icon fa fa-circle-o
*/
class LineLog extends Backend
{
/**
* LineLog模型对象
* @var \app\admin\model\yq\vehicle\LineLog
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\vehicle\LineLog;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\yq\vehicle;
use app\common\controller\Backend;
/**
* z_车辆记录管理
*
* @icon fa fa-circle-o
*/
class Log extends Backend
{
/**
* Log模型对象
* @var \app\admin\model\yq\vehicle\Log
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\vehicle\Log;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\yq\vehicle;
use app\common\controller\Backend;
/**
* z_园区车辆历史进出日志管理
*
* @icon fa fa-circle-o
*/
class ParkLineLog extends Backend
{
/**
* ParkLineLog模型对象
* @var \app\admin\model\yq\vehicle\ParkLineLog
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\vehicle\ParkLineLog;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@@ -0,0 +1,243 @@
<?php
namespace app\admin\controller\yq\vehicle;
use app\admin\model\yq\alarm\Alarm;
use app\admin\model\yq\base_config\Perimeter;
use app\common\controller\Backend;
use think\Db;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* G1-1车辆管理
*
* @icon fa fa-circle-o
*/
class Vehicle extends Backend
{
/**
* Vehicle模型对象
* @var \app\admin\model\yq\vehicle\Vehicle
*/
protected $model = null;
protected $childrenids = [];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\vehicle\Vehicle;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$new_where = [];
$perimeter_id = input('perimeter_id');
if (!empty($perimeter_id) && isset($perimeter_id)) {
if (empty($this->childrenids)) {
$ids = $perimeter_id;
} else {
$ids = $this->childrenids . ',' . $perimeter_id;
}
$new_where['perimeter_id'] = ['in', $ids];
}
$list = $this->model
->where($where)
->where($new_where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
/**
* 重置状态码
* @param $ids 车辆id
* @return void
* @throws \think\exception\DbException
*/
public function reset($ids = null)
{
$info = $this->model->get($ids);
Db::startTrans();
try {
Alarm::where('license', $info['vehicleNo'])->where('is_reset', 0)->update(['is_reset' => 1]);
$info->save(['qr_color' => 2]);
Db::commit();
$this->success('重置成功~');
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error('重置失败' . $e->getMessage());
}
}
/**
* 周界关联车辆信息
* @param $id 周界id
* @return void
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getChildrenData($id)
{
$list = Perimeter::where('pid', $id)->select();
if (empty($list)) {
return;
}
foreach ($list as $k => $v) {
$this->childrenids[] = $v['id'];
$list = Perimeter::where('pid', $v['id'])->select();
if (empty($list)) {
continue;
} else {
$this->getChildrenData($v['id']);
}
}
}
//车辆历史记录
public function vehicle_history()
{
if (input('reservation')) {
$table = 'vehicle_' . date('Ymd', strtotime(input('reservation')));
} else {
$table = 'vehicle_' . date('Ymd');
}
$map['vehicleNo'] = input('vehicleNo');
$list = Db::name($table)->where($map)->field('longitude,latitude')->select();
$coordinate = '';
if ($list) {
foreach ($list as $k => $v) {
$str = $this->getWgs84($v['longitude'] . ',' . $v['latitude']);
$coordinate .= $str['lon'] . ',' . $str['lat'] . ';';
}
$coordinate = substr($coordinate, 0, strlen($coordinate) - 1);
} else {
$coordinate = '106.964108,29.793287';//默认初始值
}
$res = array(
'code' => 200,
'data' => $coordinate,
);
return json($res);
}
public function vehicle_after_list()
{
$vehicleNo = input('vehicleNo');
$table = 'vehicle_' . date('Ymd', strtotime('-1 day'));
//企业列表
$perimeter_list = Perimeter::where(['region_type' => 6, 'is_del' => 1])->field('id,name,info')->select();
//每日车辆列表
$list = Db::name($table)->where(['vehicleNo' => $vehicleNo])->field('longitude,latitude,positionTime,v_carettime')->select();
$lists = array_unique($list, SORT_REGULAR);
$v_list = [];
foreach ($lists as $i => $o) {
$str = $this->getWgs84($o['longitude'] . ',' . $o['latitude']);
$point = [
'lng' => $str['lon'],
'lat' => $str['lat'],
];
foreach ($perimeter_list as $k => $v) {
if ($v['info'] != '') {
$lv = explode(';', $v['info']);
$lv_arr = [];
foreach ($lv as $lvK => $lvV) {
$ar = explode(',', $lvV);
$lv_arr[] = [
'lng' => $ar[0],
'lat' => $ar[1],
];
}
$lvs = $this->is_point_in_polygon($point, $lv_arr);
if ($lvs) {
$v['point'] = $point['lng'] . ',' . $point['lat'];
$v['positionTime'] = $o['positionTime'];
$v['v_carettime'] = $o['v_carettime'];
$v['vehicleNo'] = $vehicleNo;
$v_list[] = $v;
}
}
}
}
$res = array(
'code' => 0,
'count' => 0,
'data' => $v_list
);
return json($res);
}
public function getWgs84($par)
{
$result = array(); // 转换后的结果
$tokens = preg_split('/[\r\n]+/', $par);
foreach ($tokens as $token) {
if (false !== strpos($token, '=')) {
list($key, $value) = explode('=', $token, 2);
$result[$key] = $value;
} else
$result[] = $token;
}
foreach ($result as $k => $v) {
if ($v) {
$Varr = explode(',', $v);
$res = $this->bd_decrypt($Varr[0], $Varr[1]);
$arr = [
'lon' => number_format($res['gg_lon'], 6),
'lat' => number_format($res['gg_lat'], 6),
];
}
}
return $arr;
}
//BD-09(百度) 坐标转换成 GCJ-02(火星,高德) 坐标
//@param bd_lon 百度经度
//@param bd_lat 百度纬度
public function bd_decrypt($bd_lon, $bd_lat)
{
$x_pi = 3.14159265358979324 * 3000.0 / 180.0;
$x = $bd_lon - 0.0065;
$y = $bd_lat - 0.006;
$z = sqrt($x * $x + $y * $y) - 0.00002 * sin($y * $x_pi);
$theta = atan2($y, $x) - 0.000003 * cos($x * $x_pi);
$data['gg_lon'] = $z * cos($theta);
$data['gg_lat'] = $z * sin($theta);
return $data;
}
}

View File

@@ -0,0 +1,74 @@
<?php
namespace app\admin\controller\yq\vehicle;
use app\common\controller\Backend;
/**
* G2-1车辆黑名单管理
*
* @icon fa fa-circle-o
*/
class VehicleBlack extends Backend
{
/**
* VehicleBlack模型对象
* @var \app\admin\model\yq\vehicle\VehicleBlack
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\vehicle\VehicleBlack;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
if (input('vehicleNo')) {
$list = $this->model
->where($where)
->order($sort, $order)->where(['license'=>input('vehicleNo')])->paginate($limit);
} else {
$list= $this->model
->where($where)
->order($sort, $order)->group('license')->paginate($limit);
}
foreach ($list as $k=>&$v){
$v['is_search'] = input('vehicleNo') ? 0 : 1;
}
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
public function reset($ids = null)
{
$row = $this->model->get($ids);
$res = $this->model->where('license', $row['license'])->delete();
if ($res) {
$this->success('删除成功~');
}
$this->error('删除失败~');
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace app\admin\controller\yq\video_monitor;
use app\common\controller\Backend;
/**
* z_监控管理
*
* @icon fa fa-circle-o
*/
class Monitor extends Backend
{
/**
* Monitor模型对象
* @var \app\admin\model\yq\video_monitor\Monitor
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\yq\video_monitor\Monitor;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}