Browse Source

接口调整

master
wanghongjun 3 years ago
parent
commit
890b460597
  1. 6
      source/application/api/controller/Controller.php
  2. 34
      source/application/api/controller/pass/Passcc.php

6
source/application/api/controller/Controller.php

@ -27,9 +27,9 @@ class Controller extends \think\Controller
public function _initialize() public function _initialize()
{ {
// 当前小程序id // 当前小程序id
$this->wxapp_id = $this->getWxappId(); // $this->wxapp_id = $this->getWxappId();
// 验证当前小程序状态 // // 验证当前小程序状态
$this->checkWxapp(); // $this->checkWxapp();
} }
/** /**

34
source/application/api/controller/passenger/PassengerFlow.php → source/application/api/controller/pass/Passcc.php

@ -1,24 +1,30 @@
<?php <?php
namespace app\api\controller\passenger; namespace app\api\controller\pass;
use app\api\controller\Controller; use app\api\controller\Controller;
use think\Db;
class PassengerFlow extends Controller class Passcc extends Controller
{ {
public function test() {
echo 1111;
}
/** /**
* 分时时间段接口 <首页-客流趋势> * 分时时间段接口 <首页-客流趋势>
* @return false|string * @return array
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function allGroupTimeNum($granularity) { public function allGroupTimeNum() {
$granularity = $this->request->param('granularity');
$granularity = $this->postData('granularity'); if (empty($granularity)) return $this->renderError('date参数不能为空');
if (empty($granularity)) $this->renderError('date参数不能为空');
$allTimeData = []; $allTimeData = [];
$groupsData = []; $groupsData = [];
@ -39,7 +45,8 @@ class PassengerFlow extends Controller
$groupsData = $data['groupsData']; $groupsData = $data['groupsData'];
} }
$this->renderSuccess(['allTimeData' => $allTimeData, 'groupsData' => $groupsData]); $data = ['allTimeData' => $allTimeData, 'groupsData' => $groupsData];
return $this->renderSuccess(compact('data'));
} }
/** /**
@ -98,7 +105,7 @@ class PassengerFlow extends Controller
/** /**
* 总览总数据接口 <首页-中间部分总览> * 总览总数据接口 <首页-中间部分总览>
* @return false|string * @return array
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
@ -123,12 +130,12 @@ class PassengerFlow extends Controller
$val['noRepeatInNum'] = formatNumber($val['noRepeatInNum']); $val['noRepeatInNum'] = formatNumber($val['noRepeatInNum']);
} }
$this->renderSuccess($returnData); return $this->renderSuccess(compact('returnData'));
} }
/** /**
* 查询最新客流统计组实时数据 <各场管实施实时进馆人数> * 查询最新客流统计组实时数据 <各场管实施实时进馆人数>
* @return false|string * @return array
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
@ -149,12 +156,12 @@ class PassengerFlow extends Controller
$val['proportion'] = (round($val['allEnter']/$sumAllEnter,2) * 100) ."%"; $val['proportion'] = (round($val['allEnter']/$sumAllEnter,2) * 100) ."%";
} }
$this->renderSuccess($returnData); return $this->renderSuccess(compact('returnData'));
} }
/** /**
* 今日各场馆人数趋势 * 今日各场馆人数趋势
* @return false|string * @return array
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
@ -174,7 +181,8 @@ class PassengerFlow extends Controller
if (!isset($returnData[$value['groupName']][$allTimeData[$date]])) $returnData[$value['groupName']][$date] = 0; if (!isset($returnData[$value['groupName']][$allTimeData[$date]])) $returnData[$value['groupName']][$date] = 0;
$returnData[$value['groupName']][$date] += $value['flowInNum']; $returnData[$value['groupName']][$date] += $value['flowInNum'];
} }
$this->renderSuccess($returnData);
return $this->renderSuccess(compact('returnData'));
} }
} }
Loading…
Cancel
Save