Browse Source

创建数据

master
wanghongjun 2 years ago
parent
commit
ee8e2abca8
  1. 30
      source/application/api/controller/pass/Create.php
  2. 4
      web/create_bt_library_data.php
  3. 4
      web/create_pass_all.php

30
source/application/api/controller/pass/Create.php

@ -58,6 +58,7 @@ class Create extends Controller
];
if ($query) {
$this->mergeYearlyData($insert_arr);
# 判断数据是否发生变化, 发生变化及更新
$queryUpdate = $dm->find('bt_passenger_flow',$insert_arr);
if (!$queryUpdate) {
@ -108,7 +109,7 @@ class Create extends Controller
];
if ($query) {
$this->mergeYearlyData($insert_arr);
$updateQuery = $dm->find('bt_passenger_flow_all',$insert_arr);
if (!$updateQuery) {
$dm->update('bt_passenger_flow_all',$insert_arr,['id' => $query['id']]);
@ -123,6 +124,33 @@ class Create extends Controller
return $this->renderSuccess();
}
protected function mergeYearlyData(&$val)
{
if ($val['granularity'] == 'yearly' && date("Y") == '2023') {
$mergeData = [
'110' => [
'flowInNum' => 0,
'noRepeatInNum' => 0,
],
'210' => [
'flowInNum' => 0,
'noRepeatInNum' => 0,
],
'310' => [
'flowInNum' => 0,
'noRepeatInNum' => 0,
],
'510' => [
'flowInNum' => 0,
'noRepeatInNum' => 0,
],
];
$val['flowInNum'] = bcadd($val['flowInNum'],$mergeData[$val['groupId']]['flowInNum']);
$val['noRepeatInNum'] = bcadd($val['noRepeatInNum'],$mergeData[$val['groupId']]['noRepeatInNum']);
}
}
/**
* 创建总客流统计数据
* @return array

4
web/create_bt_library_data.php

@ -10,8 +10,8 @@ $config = require_once __DIR__ . '../../source/application/database.php';
$dm = new Dm($config['connections']['dm']);
$countBaz = '200000';
$countBaf = '50000';
$countBaz = '376378';
$countBaf = '28100';
$data = [
'baz001' => [

4
web/create_pass_all.php

@ -201,6 +201,10 @@ foreach ($groupArr as $groupId => $val) {
$dm->update('bt_passenger_flow',$update,'"id" = ' . "'{$querySum['id']}'");
}
echo "<pre>";
var_dump($groupId);
var_dump($sumFlowInNum);
}
//var_dump($returnData);

Loading…
Cancel
Save