宝体数据调用接口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

112 lines
3.3 KiB

<?php
namespace app\api\controller\pass;
use app\api\controller\Controller;
use app\common\dm\Dm;
use app\common\exception\BaseException;
use app\common\logic\PassFlow;
use app\common\model\Pass;
use think\Db;
class Passcc extends Controller
{
public function test() {
echo 1111;
}
public function _initialize()
{
$type = $this->request->param('type');
if (!empty($type)) {
if (!preg_match('/^[1-2]$/',$type)) throw new BaseException(['msg' => 'type字段参数错误']);
}
}
/**
* 分时时间段接口 <首页-客流趋势>
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function allGroupTimeNum()
{
$granularity = $this->request->param('granularity');
$type = $this->request->param('type');
$res = PassFlow::allGroupTimeNum(['granularity' => $granularity, 'type' => $type]);
if (empty($res['code'])) return $this->renderError($res['msg']);
$data = $res['data'];
return $this->renderSuccess(compact('data'));
}
/**
* 总览总数据接口 <首页-中间部分总览>
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function allGroupNum()
{
$type = $this->request->param('type') ?: '';
$returnData = PassFlow::allGroupNum(null,['type' => $type]);
if (isset($returnData['code'])) return $this->renderError($returnData['msg']);
return $this->renderSuccess(compact('returnData'));
}
/**
* 查询最新客流统计组实时数据 <各场管实施实时进馆人数>
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function realTimeData()
{
$returnData = PassFlow::realTimeData();
return $this->renderSuccess(compact('returnData'));
}
/**
* 今日各场馆人数趋势
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function toDayGroupsEnterNum()
{
$type = $this->request->param('type') ?: '';
$data = PassFlow::toDayGroupsEnterNum(null,['type' => $type]);
if (isset($data['code'])) return $this->renderError($data['msg']);
return $this->renderSuccess(compact('data'));
}
/**
* 获取各统计组信息
* @return array
*/
public function getGroupData()
{
$dm = new Dm();
$data = $dm->select('bt_passenger_monitor_group','','"groupId","groupName","type"');
return $this->renderSuccess(compact('data'));
}
/**
* 24小时各场馆数据
* @return array
*/
public function getPassHoursData()
{
$type = $this->request->param('type') ?: '';
$data = PassFlow::getPassHoursData(null,['type' => $type]);
if (isset($data['code'])) return $this->renderError($data['msg']);
return $this->renderSuccess(compact('data'));
}
}