From 14aa88bfc6cb211083c0bfea43207645322bede6 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Fri, 13 Oct 2023 10:09:21 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E4=BD=93=E8=82=B2=E5=9C=BA=E9=A6=86?= =?UTF-8?q?=E5=90=84=E6=95=B0=E6=8D=AE=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/create_pass_all.php | 208 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 web/create_pass_all.php diff --git a/web/create_pass_all.php b/web/create_pass_all.php new file mode 100644 index 0000000..1c5fc2c --- /dev/null +++ b/web/create_pass_all.php @@ -0,0 +1,208 @@ + [ + 'name' => '体育场', + 'count' => '354670', + 'day' => '11822', + 'amplitude' => [ + 'min' => '-10640', + 'max' => '17733', + ] + ], + '210' => [ + 'name' => '体育馆', + 'count' => '380343', + 'day' => '12678', + 'amplitude' => [ + 'min' => '-11410', + 'max' => '19017', + ] + ], + '310' => [ + 'name' => '游泳馆', + 'count' => '114346', + 'day' => '3811', + 'amplitude' => [ + 'min' => '-3430', + 'max' => '5717', + ] + ], + '510' => [ + 'name' => '博物馆', + 'count' => '4018', + 'day' => '133', + 'amplitude' => [ + 'min' => '-120', + 'max' => '200', + ] + ] +]; +$monthNum = 6; + + +$returnData = []; +$returnDataAll = []; +foreach ($groupArr as $groupId => $val) { + + $groupName = $val['name']; + $count = $val['count']; + $day = $val['day']; + + # 月总数 + $sumFlowInNum = 0; + + for ($i = 1; $i <= $monthNum; $i++) { + + # 幅度 + $temp_count = rand($val['amplitude']['min'],$val['amplitude']['max']); + + if ($i == 1) { + # 减去假期 + $temp_day = $day * 7; + $temp_count = bcsub($temp_count,$temp_day); + } + + if ($i == 2) { + # 减去未满30 + $temp_day = $day * 2; + $temp_count = bcsub($temp_count,$temp_day); + } + + # 每月数量 + $flowInNum = bcadd($count,$temp_count); + + $sumFlowInNum = bcadd($sumFlowInNum,$flowInNum); + + $iStr = strlen($i) == 1 ? '0'.$i : $i; + + $statTime = "{$y}-{$iStr}-01T00:00:00.000+08:00"; + + $queryWhereAll = ['groupId' => $groupId,'granularity' => 'monthly','statTime' => $statTime,'date'=>'month']; + $queryAll = $dm->find('bt_passenger_flow_all',$queryWhereAll); + + if (!$queryAll) { + + $iArrAll = [ + 'groupId' => $groupId, + 'groupName' => $groupName, + 'flowInNum' => $flowInNum, + 'flowOutNum' => 0, + 'noRepeatInNum' => $flowInNum, + 'noRepeatOutNum' => 0, + 'holdValue' => 0, + 'netValue' => 0, + 'createTime' => strtotime("{$y}-{$iStr}-01 00:00:00") . "000", + 'updateTime' => strtotime("{$y}-{$iStr}-01 00:00:00") . "000", + 'statTime' => $statTime, + 'granularity' => 'monthly', + 'date' => 'month' + ]; + $dm->insert('bt_passenger_flow_all',$iArrAll); + $returnDataAll[] = $iArrAll; + } + + + + + $queryWhere = ['groupId' => $groupId,'granularity' => 'monthly','statTime' => $statTime]; + $query = $dm->find('bt_passenger_flow',$queryWhere); + if (!$query) { + + $iArr = [ + 'groupId' => $groupId, + 'groupName' => $groupName, + 'flowInNum' => $flowInNum, + 'flowOutNum' => 0, + 'noRepeatInNum' => $flowInNum, + 'noRepeatOutNum' => 0, + 'holdValue' => 0, + 'netValue' => 0, + 'createTime' => strtotime("{$y}-{$iStr}-01 00:00:00") . "000", + 'updateTime' => strtotime("{$y}-{$iStr}-01 00:00:00") . "000", + 'statTime' => $statTime, + 'granularity' => 'monthly' + ]; + + $dm->insert('bt_passenger_flow',$iArr); + $returnData[] = $iArr; + } + } + + + # 总的 + + $queryWhereSumAll = ['groupId' => $groupId,'granularity' => 'yearly','statTime' => ['>=',"{$y}-01-01T00:00:00.000+08:00"],'date' => 'year']; + $querySumAll = $dm->find('bt_passenger_flow_all',$queryWhereSumAll); + + if ($querySumAll) { + +// $iArrSumAll = [ +// 'groupId' => $groupId, +// 'groupName' => $groupName, +// 'flowOutNum' => 0, +// 'noRepeatOutNum' => 0, +// 'holdValue' => 0, +// 'netValue' => 0, +// 'flowInNum' => bcadd(0,$sumFlowInNum), +// 'noRepeatInNum' => bcadd(0,$sumFlowInNum), +// 'createTime' => strtotime("{$y}--01-01 00:00:00") . "000", +// 'updateTime' => strtotime("{$y}--01-01 00:00:00") . "000", +// 'statTime' => "{$y}-01-01T00:00:00.000+08:00", +// 'granularity' => 'yearly', +// 'date' => 'year' +// ]; +// $returnDataAll[] = $iArrSumAll; + + $updateAll = [ + 'flowInNum' => bcadd($querySumAll['flowInNum'],$sumFlowInNum), + 'noRepeatInNum' => bcadd($querySumAll['noRepeatInNum'],$sumFlowInNum), + ]; + + $dm->update('bt_passenger_flow_all',$updateAll,'"id" = ' . "'{$querySumAll['id']}'"); + } + + $queryWhereSum = ['groupId' => $groupId,'granularity' => 'yearly','statTime' => ['>=',"{$y}-01-01T00:00:00.000+08:00"]]; + $querySum = $dm->find('bt_passenger_flow',$queryWhereSum); + + if ($querySum) { + +// $iArrSum = [ +// 'groupId' => $groupId, +// 'groupName' => $groupName, +// 'flowOutNum' => 0, +// 'noRepeatOutNum' => 0, +// 'holdValue' => 0, +// 'netValue' => 0, +// 'flowInNum' => bcadd(0,$sumFlowInNum), +// 'noRepeatInNum' => bcadd(0,$sumFlowInNum), +// 'createTime' => strtotime("{$y}--01-01 00:00:00") . "000", +// 'updateTime' => strtotime("{$y}--01-01 00:00:00") . "000", +// 'statTime' => "{$y}-01-01T00:00:00.000+08:00", +// 'granularity' => 'yearly' +// ]; +// +// $returnData[] = $iArrSum; + $update = [ + 'flowInNum' => bcadd($querySum['flowInNum'],$sumFlowInNum), + 'noRepeatInNum' => bcadd($querySum['noRepeatInNum'],$sumFlowInNum), + ]; + + $dm->update('bt_passenger_flow',$update,'"id" = ' . "'{$querySum['id']}'"); + } +} + +//var_dump($returnData); +//var_dump($returnDataAll); +echo true; \ No newline at end of file From 3140a0a0729bc7b4111660f0b0702726c4c78308 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Fri, 13 Oct 2023 15:15:08 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E6=96=87=E5=8C=96=E7=AE=A1=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/create_bt_library_data.php | 158 +++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 web/create_bt_library_data.php diff --git a/web/create_bt_library_data.php b/web/create_bt_library_data.php new file mode 100644 index 0000000..24fd94c --- /dev/null +++ b/web/create_bt_library_data.php @@ -0,0 +1,158 @@ + [ + 'name' => '图书馆', + 'count' => $countBaz, + 'day' => round($countBaz / 30), + 'amplitude' => [ + 'min' => 0 - ($countBaz * 0.03), + 'max' => $countBaz * 0.05, + ] + ], + 'BAF055' => [ + 'name' => '文化馆', + 'count' => $countBaf, + 'day' => round($countBaf / 30), + 'amplitude' => [ + 'min' => 0 - ($countBaf * 0.03), + 'max' => $countBaf * 0.05, + ] + ], +]; + +$monthNum = 6; +$countBaz = [ + 'baz001' => ['incount' => 0, 'outcount' => 0], + 'BAF055' => ['incount' => 0, 'outcount' => 0] +]; + +for ($i = 1; $i <= $monthNum; $i++) { + + $str = strlen($i) == 1 ? '0' . $i : $i; + $incount = 0; + $outcount = 0; + + foreach ($data as $group_id => $item) { + + $name = $item['name']; + $count = $item['count']; + $day = $item['day']; + + # 幅度 + $temp_count = rand($item['amplitude']['min'],$item['amplitude']['max']); + + if ($i == 1) { + # 减去假期 + $temp_day = $day * 7; + $temp_count = bcsub($temp_count,$temp_day); + } + + if ($i == 2) { + # 减去未满30 + $temp_day = $day * 2; + $temp_count = bcsub($temp_count,$temp_day); + } + + # 每月数量 + $flowInNum = bcadd($count,$temp_count); + + $days = date('t', strtotime(2023 . '-' . $str . '-01')); + $start = date("Y-{$str}-01 ") ."00:00:00"; + $end = date("Y-{$str}-{$days} ") ."23:59:59"; + $queryWhere = ' "date" = ' . "'month'" . ' and "group_id" = ' . "'{$group_id}'" . ' and "create_time" >= ' . "'{$start}'" . ' and "create_time" <= ' . "'{$end}'" ; + $query = $dm->find('bt_library_data',$queryWhere); + + if (!$query) { + $insert_data = [ + 'group_id' => $group_id, + 'group_name' => $name, + 'incount' => $flowInNum, + 'outcount' => bcadd($flowInNum,rand(0, 10)), + 'date' => 'month', + 'create_time' => date("Y-{$str}-01 ") . "00:00:00", + 'last_incount' => 0, + 'last_outcount' => 0, + ]; + $dm->insert('bt_library_data', $insert_data); + + + # 当月总数 + $incount += $insert_data['incount']; + $outcount += $insert_data['outcount']; + + # 总年 + $countBaz[$group_id]['incount'] += $insert_data['incount']; + $countBaz[$group_id]['outcount'] += $insert_data['outcount']; + } + } + $queryWhere2 = ' "date" = ' . "'month'" . ' and "group_id" = ' . "'lib001'" . ' and "create_time" >= ' . "'{$start}'" . ' and "create_time" <= ' . "'{$end}'" ; + $query2 = $dm->find('bt_library_data',$queryWhere2); + if (!$query2) { + $lib001 = [ + 'group_id' => 'lib001', + 'group_name' => '文化', + 'incount' => $incount, + 'outcount' => $outcount, + 'date' => 'month', + 'create_time' => date("Y-{$str}-01 ") . "00:00:00", + 'last_incount' => 0, + 'last_outcount' => 0, + ]; + $dm->insert('bt_library_data', $lib001); + } +} + + + +// --------------- baz001 --------------- // +$queryWhereBaz = ['date' => 'year', 'group_id' => 'baz001', 'create_time' => ['>=',date("Y-01-01 ") ."00:00:00"]]; +$queryBaz = $dm->find("bt_library_data",$queryWhereBaz); + +if ($queryBaz) { + $baz001 = [ + 'incount' => bcadd($queryBaz['incount'],$countBaz['baz001']['incount']), + 'outcount' => bcadd($queryBaz['outcount'],$countBaz['baz001']['outcount']) + ]; + $dm->update('bt_library_data',$baz001,'"id" = ' . "'{$queryBaz['id']}'"); +} + +// --------------- BAF055 --------------- // +$queryWhereBaf = ['date' => 'year', 'group_id' => 'BAF055', 'create_time' => ['>=',date("Y-01-01 ") ."00:00:00"]]; +$queryBaf = $dm->find("bt_library_data",$queryWhereBaf); + +if ($queryBaf) { + + $BAF055 = [ + 'incount' => bcadd($queryBaf['incount'],$countBaz['BAF055']['incount']), + 'outcount' => bcadd($queryBaf['outcount'],$countBaz['BAF055']['outcount']) + ]; + $dm->update('bt_library_data',$BAF055,'"id" = ' . "'{$queryBaf['id']}'"); +} + +// --------------- lib001 --------------- // +$queryWhereLib = ['date' => 'year', 'group_id' => 'lib001', 'create_time' => ['>=',date("Y-01-01 ") ."00:00:00"]]; +$queryLib = $dm->find("bt_library_data",$queryWhereLib); +if ($queryLib) { + + $lib001 = [ + 'incount' => $baz001['incount'] + $BAF055['incount'], + 'outcount' => $baz001['outcount'] + $BAF055['outcount'] + ]; + $dm->update('bt_library_data',$lib001,'"id" = ' . "'{$queryLib['id']}'"); +} + +echo true; \ No newline at end of file From a4a6c2b2e4d03cd75dbb6f362a7f892b929e5abc Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Fri, 13 Oct 2023 16:13:27 +0800 Subject: [PATCH 03/13] 7 --- web/create_bt_library_data.php | 2 +- web/create_pass_all.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/create_bt_library_data.php b/web/create_bt_library_data.php index 24fd94c..658b89c 100644 --- a/web/create_bt_library_data.php +++ b/web/create_bt_library_data.php @@ -34,7 +34,7 @@ $data = [ ], ]; -$monthNum = 6; +$monthNum = 7; $countBaz = [ 'baz001' => ['incount' => 0, 'outcount' => 0], 'BAF055' => ['incount' => 0, 'outcount' => 0] diff --git a/web/create_pass_all.php b/web/create_pass_all.php index 1c5fc2c..2caeb8b 100644 --- a/web/create_pass_all.php +++ b/web/create_pass_all.php @@ -49,7 +49,7 @@ $groupArr = [ ] ] ]; -$monthNum = 6; +$monthNum = 7; $returnData = []; From ee8e2abca88fd4bb463d9bbfccec522abc13780b Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Fri, 13 Oct 2023 16:56:00 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/pass/Create.php | 30 ++++++++++++++++++- web/create_bt_library_data.php | 4 +-- web/create_pass_all.php | 4 +++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/source/application/api/controller/pass/Create.php b/source/application/api/controller/pass/Create.php index 9a88448..7ebcd57 100644 --- a/source/application/api/controller/pass/Create.php +++ b/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 diff --git a/web/create_bt_library_data.php b/web/create_bt_library_data.php index 658b89c..221bbc1 100644 --- a/web/create_bt_library_data.php +++ b/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' => [ diff --git a/web/create_pass_all.php b/web/create_pass_all.php index 2caeb8b..a5bd892 100644 --- a/web/create_pass_all.php +++ b/web/create_pass_all.php @@ -201,6 +201,10 @@ foreach ($groupArr as $groupId => $val) { $dm->update('bt_passenger_flow',$update,'"id" = ' . "'{$querySum['id']}'"); } + + echo "
";
+    var_dump($groupId);
+    var_dump($sumFlowInNum);
 }
 
 //var_dump($returnData);

From 84ab3fcc94766b7ea3077d1c2db5b55b407e939f Mon Sep 17 00:00:00 2001
From: wanghongjun <1445693971@qq,com>
Date: Fri, 13 Oct 2023 18:18:43 +0800
Subject: [PATCH 05/13] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=95=B0=E6=8D=AE?=
 =?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../application/api/controller/pass/Create.php   |  4 ++--
 source/application/common/logic/PassFlow.php     |  8 +++++++-
 web/create_bt_library_data.php                   | 16 ++++++++--------
 web/create_pass_all.php                          | 16 ++++++++--------
 4 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/source/application/api/controller/pass/Create.php b/source/application/api/controller/pass/Create.php
index 7ebcd57..13af68c 100644
--- a/source/application/api/controller/pass/Create.php
+++ b/source/application/api/controller/pass/Create.php
@@ -146,8 +146,8 @@ class Create extends Controller
                 ],
             ];
 
-            $val['flowInNum'] = bcadd($val['flowInNum'],$mergeData[$val['groupId']]['flowInNum']);
-            $val['noRepeatInNum'] = bcadd($val['noRepeatInNum'],$mergeData[$val['groupId']]['noRepeatInNum']);
+            $val['flowInNum'] = round($val['flowInNum']+$mergeData[$val['groupId']]['flowInNum']);
+            $val['noRepeatInNum'] = round($val['noRepeatInNum']+$mergeData[$val['groupId']]['noRepeatInNum']);
         }
     }
 
diff --git a/source/application/common/logic/PassFlow.php b/source/application/common/logic/PassFlow.php
index 31c844c..e3c50b4 100644
--- a/source/application/common/logic/PassFlow.php
+++ b/source/application/common/logic/PassFlow.php
@@ -320,7 +320,13 @@ class PassFlow
             $mData = $dm->find('bt_library',['group_id' => 'lib001']);
             $returnData['day']['noRepeatInNum'] += isset($mData['today_incount']) ? $mData['today_incount'] : 0;
             $returnData['month']['noRepeatInNum'] += isset($mData['month_incount']) ? $mData['month_incount'] : 0;
-            $returnData['year']['noRepeatInNum'] += isset($mData['year_incount']) ? $mData['year_incount'] : 0;
+
+            $start = date("Y-01-01 00:00:00",time());
+            $end = date("Y-12-31 23:59:59",time());
+            $libraryDataYearWhere = ' "date" = ' . "'year'" . ' and "group_id" = ' . "'lib001'" . ' and "create_time" >= ' . "'{$start}'" . ' and "create_time" <= ' . "'{$end}'";
+            $libraryDataYear = $dm->find('bt_library_data',$libraryDataYearWhere);
+            $returnData['year']['noRepeatInNum'] += isset($libraryDataYear['incount']) ? $libraryDataYear['incount'] : 0;
+
 //            $returnData['sumYear']['noRepeatInNum'] += isset($mData['year_incount']) ? $mData['year_incount'] : 0;
             # 文化总年度
             $libraryData = $dm->find('bt_library_data',['group_id' => 'lib001','date' => 'year'],'SUM("incount") as NUM');
diff --git a/web/create_bt_library_data.php b/web/create_bt_library_data.php
index 221bbc1..970afbf 100644
--- a/web/create_bt_library_data.php
+++ b/web/create_bt_library_data.php
@@ -58,17 +58,17 @@ for ($i = 1; $i <= $monthNum; $i++) {
         if ($i == 1) {
             # 减去假期
             $temp_day = $day * 7;
-            $temp_count = bcsub($temp_count,$temp_day);
+            $temp_count = round($temp_count-$temp_day);
         }
 
         if ($i == 2) {
             # 减去未满30
             $temp_day = $day * 2;
-            $temp_count = bcsub($temp_count,$temp_day);
+            $temp_count = round($temp_count-$temp_day);
         }
 
         # 每月数量
-        $flowInNum = bcadd($count,$temp_count);
+        $flowInNum = round($count+$temp_count);
 
         $days = date('t', strtotime(2023 . '-' . $str . '-01'));
         $start = date("Y-{$str}-01 ") ."00:00:00";
@@ -81,7 +81,7 @@ for ($i = 1; $i <= $monthNum; $i++) {
                 'group_id'      => $group_id,
                 'group_name'    => $name,
                 'incount'       => $flowInNum,
-                'outcount'      => bcadd($flowInNum,rand(0, 10)),
+                'outcount'      => round($flowInNum+rand(0, 10)),
                 'date'          => 'month',
                 'create_time'   => date("Y-{$str}-01 ") . "00:00:00",
                 'last_incount'  => 0,
@@ -124,8 +124,8 @@ $queryBaz = $dm->find("bt_library_data",$queryWhereBaz);
 
 if ($queryBaz) {
     $baz001 = [
-        'incount' => bcadd($queryBaz['incount'],$countBaz['baz001']['incount']),
-        'outcount' => bcadd($queryBaz['outcount'],$countBaz['baz001']['outcount'])
+        'incount' => round($queryBaz['incount']+$countBaz['baz001']['incount']),
+        'outcount' => round($queryBaz['outcount']+$countBaz['baz001']['outcount'])
     ];
     $dm->update('bt_library_data',$baz001,'"id" = ' . "'{$queryBaz['id']}'");
 }
@@ -137,8 +137,8 @@ $queryBaf = $dm->find("bt_library_data",$queryWhereBaf);
 if ($queryBaf) {
 
     $BAF055 = [
-        'incount' => bcadd($queryBaf['incount'],$countBaz['BAF055']['incount']),
-        'outcount' => bcadd($queryBaf['outcount'],$countBaz['BAF055']['outcount'])
+        'incount' => round($queryBaf['incount']+$countBaz['BAF055']['incount']),
+        'outcount' => round($queryBaf['outcount']+$countBaz['BAF055']['outcount'])
     ];
     $dm->update('bt_library_data',$BAF055,'"id" = ' . "'{$queryBaf['id']}'");
 }
diff --git a/web/create_pass_all.php b/web/create_pass_all.php
index a5bd892..747099a 100644
--- a/web/create_pass_all.php
+++ b/web/create_pass_all.php
@@ -71,19 +71,19 @@ foreach ($groupArr as $groupId => $val) {
         if ($i == 1) {
             # 减去假期
             $temp_day = $day * 7;
-            $temp_count = bcsub($temp_count,$temp_day);
+            $temp_count = round($temp_count-$temp_day);
         }
 
         if ($i == 2) {
             # 减去未满30
             $temp_day = $day * 2;
-            $temp_count = bcsub($temp_count,$temp_day);
+            $temp_count = round($temp_count-$temp_day);
         }
 
         # 每月数量
-        $flowInNum = bcadd($count,$temp_count);
+        $flowInNum = round($count+$temp_count);
 
-        $sumFlowInNum = bcadd($sumFlowInNum,$flowInNum);
+        $sumFlowInNum = round($sumFlowInNum+$flowInNum);
 
         $iStr = strlen($i) == 1 ? '0'.$i : $i;
 
@@ -166,8 +166,8 @@ foreach ($groupArr as $groupId => $val) {
 //        $returnDataAll[] = $iArrSumAll;
 
         $updateAll = [
-            'flowInNum' => bcadd($querySumAll['flowInNum'],$sumFlowInNum),
-            'noRepeatInNum' => bcadd($querySumAll['noRepeatInNum'],$sumFlowInNum),
+            'flowInNum' => round($querySumAll['flowInNum']+$sumFlowInNum),
+            'noRepeatInNum' => round($querySumAll['noRepeatInNum']+$sumFlowInNum),
         ];
 
         $dm->update('bt_passenger_flow_all',$updateAll,'"id" = ' . "'{$querySumAll['id']}'");
@@ -195,8 +195,8 @@ foreach ($groupArr as $groupId => $val) {
 //
 //        $returnData[] = $iArrSum;
         $update = [
-            'flowInNum' => bcadd($querySum['flowInNum'],$sumFlowInNum),
-            'noRepeatInNum' => bcadd($querySum['noRepeatInNum'],$sumFlowInNum),
+            'flowInNum' => round($querySum['flowInNum']+$sumFlowInNum),
+            'noRepeatInNum' => round($querySum['noRepeatInNum']+$sumFlowInNum),
         ];
 
         $dm->update('bt_passenger_flow',$update,'"id" = ' . "'{$querySum['id']}'");

From db8816c1a2cac6b4848ce575ece11876b4bd3929 Mon Sep 17 00:00:00 2001
From: wanghongjun <1445693971@qq,com>
Date: Mon, 23 Oct 2023 15:22:30 +0800
Subject: [PATCH 06/13] =?UTF-8?q?=E5=87=8F=E5=8E=BB250=E4=B8=87=E8=99=9A?=
 =?UTF-8?q?=E6=8B=9F=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 web/handle_data.php | 242 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 242 insertions(+)
 create mode 100644 web/handle_data.php

diff --git a/web/handle_data.php b/web/handle_data.php
new file mode 100644
index 0000000..c5043d5
--- /dev/null
+++ b/web/handle_data.php
@@ -0,0 +1,242 @@
+
+$tyc = get_pass($dm,'210',$y,$monthNum); // 体育馆 <-- replace -->
+$yyg = get_pass($dm,'310',$y,$monthNum); // 游泳馆 <-- replace -->
+$bwg = get_pass($dm,'510',$y,$monthNum); // 劳务博物馆 <-- replace -->
+$tsg = get_lib($dm,'baz001',$y,$monthNum); // 图书馆 <-- replace -->
+$whg = get_lib($dm,'BAF055',$y,$monthNum); // 文化馆 <-- replace -->
+
+$allSum = $tyg + $tyc + $yyg + $bwg + $tsg + $whg;
+
+
+$tyHandleData = [
+    '110' => round($tyg/$allSum,4),
+    '210' => round($tyc/$allSum,4),
+    '310' => round($yyg/$allSum,4),
+    '510' => round($bwg/$allSum,4)
+];
+
+$whHandleData = [
+    'baz001' => round($tsg/$allSum,4),
+    'BAF055' => round($whg/$allSum,4)
+];
+
+# ---------------------------- 体育 ----------------------------- #
+
+foreach ($tyHandleData as $groupId => $rate) {
+
+    $tyYearSum = 0;
+
+    # 月度
+    for ($i = 1; $i <= $monthNum; $i++) {
+
+        $flowInNum = round($sumNum * $rate / $monthNum);
+
+        $tyYearSum += $flowInNum;
+
+        $iStr = strlen($i) == 1 ? '0'.$i : $i;
+
+        $statTime = "{$y}-{$iStr}-01T00:00:00.000+08:00";
+
+        $queryWhereAll = ['groupId' => $groupId,'granularity' => 'monthly','statTime' => $statTime,'date'=>'month'];
+        $queryAll = $dm->find('bt_passenger_flow_all',$queryWhereAll);
+        if ($queryAll) {
+
+            $upData = [
+                'flowInNum' => $queryAll['flowInNum'] - $flowInNum,
+                'noRepeatInNum' => $queryAll['noRepeatInNum'] - $flowInNum
+            ];
+            $dm->update('bt_passenger_flow_all',$upData,'"id" = ' . "'{$queryAll['id']}'");
+        }
+
+        $queryWhere = ['groupId' => $groupId,'granularity' => 'monthly','statTime' => $statTime];
+        $query = $dm->find('bt_passenger_flow',$queryWhere);
+
+        if ($query) {
+
+            $upData = [
+                'flowInNum' => $query['flowInNum'] - $flowInNum,
+                'noRepeatInNum' => $query['noRepeatInNum'] - $flowInNum
+            ];
+            $dm->update('bt_passenger_flow',$upData,'"id" = ' . "'{$query['id']}'");
+        }
+    }
+
+    # 年度
+    $queryWhereSumAll = ['groupId' => $groupId,'granularity' => 'yearly','statTime' => ['>=',"{$y}-01-01T00:00:00.000+08:00"],'date' => 'year'];
+    $querySumAll = $dm->find('bt_passenger_flow_all',$queryWhereSumAll);
+
+    if ($querySumAll) {
+        $updateAll = [
+            'flowInNum' => $querySumAll['flowInNum'] - $tyYearSum,
+            'noRepeatInNum' => $querySumAll['noRepeatInNum'] - $tyYearSum,
+        ];
+
+        $dm->update('bt_passenger_flow_all',$updateAll,'"id" = ' . "'{$querySumAll['id']}'");
+    }
+
+    $queryWhereSum = ['groupId' => $groupId,'granularity' => 'yearly','statTime' => ['>=',"{$y}-01-01T00:00:00.000+08:00"]];
+    $querySum = $dm->find('bt_passenger_flow',$queryWhereSum);
+
+    if ($querySum) {
+
+        $update = [
+            'flowInNum' => $querySum['flowInNum'] - $tyYearSum,
+            'noRepeatInNum' => $querySum['noRepeatInNum']- $tyYearSum,
+        ];
+
+        $dm->update('bt_passenger_flow',$update,'"id" = ' . "'{$querySum['id']}'");
+    }
+    echo $groupId;
+    echo "
"; + echo $tyYearSum; + echo "
"; + echo "----------------------------------"; + echo "
"; +} +echo "

体育结束....

"; +# ---------------------------- 体育end ----------------------------- # + +# ---------------------------- 文化 ----------------------------- # + +$whYearSum = [ + 'baz001' => 0, + 'BAF055' => 0, + 'lib001' => 0 +]; + +$whMonthRate = []; + +foreach ($whHandleData as $group_id => $whRate) { + + + $groupData = []; + $groupDataSumNum = 0; + for ($i = 1; $i <= $monthNum; $i++) { + + $str = strlen($i) == 1 ? '0' . $i : $i; + + $days = date('t', strtotime($y . '-' . $str . '-01')); + $start = date("{$y}-{$str}-01 ") ."00:00:00"; + $end = date("{$y}-{$str}-{$days} ") ."23:59:59"; + $queryWhere = ' "date" = ' . "'month'" . ' and "group_id" = ' . "'{$group_id}'" . ' and "create_time" >= ' . "'{$start}'" . ' and "create_time" <= ' . "'{$end}'"; + $query = $dm->find('bt_library_data', $queryWhere); + if ($query) { + $groupData[$i]['id'] = $query['id']; + $groupData[$i]['incount'] = $query['incount']; + $groupData[$i]['outcount'] = $query['outcount']; + $groupDataSumNum += $query['incount']; + } + } + + foreach ($groupData as &$item) { + $item['rate'] = round($item['incount']/$groupDataSumNum,4); + } + + $whMonthRate[$group_id] = $groupData; +} + +# 文化月度 +for ($i = 1; $i <= $monthNum; $i++) { + + $str = strlen($i) == 1 ? '0' . $i : $i; + + $libInCount = 0; + + $days = date('t', strtotime($y . '-' . $str . '-01')); + $start = date("{$y}-{$str}-01 ") ."00:00:00"; + $end = date("{$y}-{$str}-{$days} ") ."23:59:59"; + + foreach ($whHandleData as $group_id => $whRate) { + + $query = $whMonthRate[$group_id][$i]; + + if ($query) { + + $incount = round($sumNum * $whRate * $query['rate']); + + $libInCount += $incount; + $whYearSum[$group_id] += $incount; + + $upData = [ + 'incount' => $query['incount'] - $incount, + 'outcount' => $query['outcount'] - $incount, + ]; + + $dm->update('bt_library_data',$upData,'"id" = ' . "'{$query['id']}'"); + } + } + + $queryWhere2 = ' "date" = ' . "'month'" . ' and "group_id" = ' . "'lib001'" . ' and "create_time" >= ' . "'{$start}'" . ' and "create_time" <= ' . "'{$end}'" ; + $query2 = $dm->find('bt_library_data',$queryWhere2); + if ($query2) { + + $whYearSum['lib001'] += $libInCount; + + $lib001 = [ + 'incount' => $query2['incount'] - $libInCount, + 'outcount' => $query2['outcount'] - $libInCount + ]; + $dm->update('bt_library_data', $lib001,'"id" = ' . "'{$query2['id']}'"); + } +} + +# 文化年度 +foreach ($whYearSum as $group_id => $yearSumInCount) { + + $whQueryWhere = ['date' => 'year', 'group_id' => $group_id, 'create_time' => ['>=',date("Y-01-01 ") ."00:00:00"]]; + $whQuery = $dm->find("bt_library_data",$whQueryWhere); + + if ($whQuery) { + $baz001 = [ + 'incount' => $whQuery['incount'] - $yearSumInCount, + 'outcount' => $whQuery['outcount'] - $yearSumInCount + ]; + $dm->update('bt_library_data',$baz001,'"id" = ' . "'{$whQuery['id']}'"); + } + echo $group_id; + echo "
"; + echo $yearSumInCount; + echo "
"; + echo "----------------------------------"; + echo "
"; +} +echo "

文化结束....

"; + +# ---------------------------- 文化end ----------------------------- # + +function get_lib($dm,$group_id,$y,$month) { + $str = strlen($month) == 1 ? '0' . $month : $month; + $days = date('t', strtotime($y . '-' . $str . '-01')); + $start = date("{$y}-01-01 ") ."00:00:00"; + $end = date("{$y}-{$str}-{$days} ") ."23:59:59"; + + $whQueryWhere = ' "date" = ' . "'month'" . ' and "group_id" = ' . "'{$group_id}'" . ' and "create_time" >= ' . "'{$start}'" . ' and "create_time" <= ' . "'{$end}'" ; + $whQuery = $dm->find("bt_library_data",$whQueryWhere,'SUM("incount") as sum_incount'); + return $whQuery ? $whQuery['SUM_INCOUNT'] : 0; +} + +function get_pass($dm,$groupId,$y,$month) { + $str = strlen($month) == 1 ? '0' . $month : $month; + $days = date('t', strtotime($y . '-' . $str . '-01')); + $start = date("{$y}-01-01") ."T00:00:00.000+08:00"; + $end = date("{$y}-{$str}-{$days}") ."T23:59:59.000+08:00"; + $tyQueryWhere = ' "date" = ' . "'month'" . ' and "granularity" = ' . "'monthly'" . ' and "groupId" = ' . "'{$groupId}'" . ' and "statTime" >= ' . "'{$start}'" . ' and "statTime" <= ' . "'{$end}'" ; + $tyQuery = $dm->find("bt_passenger_flow_all",$tyQueryWhere,'SUM("flowInNum") as sum_incount'); + return $tyQuery ? $tyQuery['SUM_INCOUNT'] : 0; +} \ No newline at end of file From 809071423bb920b092d4711d1be44b33e4c21919 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Mon, 23 Oct 2023 15:24:31 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E5=87=8F=E5=8E=BB250=E4=B8=87=E8=99=9A?= =?UTF-8?q?=E6=8B=9F=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/handle_data.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/handle_data.php b/web/handle_data.php index c5043d5..bc360c3 100644 --- a/web/handle_data.php +++ b/web/handle_data.php @@ -5,8 +5,8 @@ require_once __DIR__ . '../../source/thinkphp/helper.php'; require_once __DIR__ . '../../source/thinkphp/library/think/Config.php'; require_once __DIR__ . '../../source/application/common.php'; $config = require_once __DIR__ . '../../source/application/database.php'; - - +# 不使用是关闭 第9行 +exit(); $dm = new Dm($config['connections']['dm']); $sumNum = 2500000; From 742de7d5ce5f3e0b9dd0b7f3578982bba87c3401 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Tue, 24 Oct 2023 09:54:23 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E6=96=B0=E7=BB=9F=E8=AE=A1=E7=BB=84?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/application/common/logic/PassFlow.php | 1 + 1 file changed, 1 insertion(+) diff --git a/source/application/common/logic/PassFlow.php b/source/application/common/logic/PassFlow.php index e3c50b4..b416cb5 100644 --- a/source/application/common/logic/PassFlow.php +++ b/source/application/common/logic/PassFlow.php @@ -371,6 +371,7 @@ class PassFlow $returnData = []; foreach ($data as $groupId => $val) { + if (!isset($groupThreshold[$groupId])) continue; $threshold = $groupThreshold[$groupId]; if (is_array($threshold)) { $interval = self::getIntervalType($val['holdValue'],$threshold['min'],$threshold['max']); From 351f18b9839a70df41bc50b5ca408521f01dafa3 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Tue, 7 Nov 2023 16:14:54 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E6=96=87=E5=8C=96=E9=A6=86=E5=B9=B4?= =?UTF-8?q?=E5=BA=A6=E6=80=BB=E6=95=B0=E6=8D=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/application/common/logic/PassFlow.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/application/common/logic/PassFlow.php b/source/application/common/logic/PassFlow.php index b416cb5..ac3d61c 100644 --- a/source/application/common/logic/PassFlow.php +++ b/source/application/common/logic/PassFlow.php @@ -526,6 +526,16 @@ class PassFlow return $data; } + protected static function getWhYearData($dm,$group_id) + { + $start = date("Y-01-01 ") ."00:00:00"; + $end = date("Y-12-31 ") ."23:59:59"; + $where = ' "date" = ' . "'year'" . ' and "group_id" = ' . "'{$group_id}'" + . ' and "create_time" >= ' . "'{$start}'" . ' and "create_time" <= ' . "'{$end}'"; + $libData = $dm->find('bt_library_data',$where,'incount'); + return $libData['incount'] ?: 0; + } + /** * 文化-博物-图书-数据接口 总计服务人数 * @return array @@ -542,7 +552,7 @@ class PassFlow $ts_res = $dm->find('bt_library',['group_id' => 'baz001']); $ts_today_incount = isset($ts_res['today_incount']) ? $ts_res['today_incount'] : 0; $ts_month_incount = isset($ts_res['month_incount']) ? $ts_res['month_incount'] : 0; - $ts_year_incount = isset($ts_res['year_incount']) ? $ts_res['year_incount'] : 0; + $ts_year_incount = self::getWhYearData($dm,'baz001'); # 劳务博物馆数据 $dateArr = ['day' => 'daily', 'month' => 'monthly', 'year' => 'yearly']; @@ -563,7 +573,7 @@ class PassFlow $wh_res = $dm->find('bt_library',['group_id' => 'BAF055']); $wh_today_incount = isset($wh_res['today_incount']) ? $wh_res['today_incount'] : 0; $wh_month_incount = isset($wh_res['month_incount']) ? $wh_res['month_incount'] : 0; - $wh_year_incount = isset($wh_res['year_incount']) ? $wh_res['year_incount'] : 0; + $wh_year_incount = self::getWhYearData($dm,'BAF055'); # 总年、月、日总数 $sum_today_incount = $ts_today_incount + $bw_today_incount + $wh_today_incount; From 9423ee36a2e3dc7728c67ee339a9408761f9ab21 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Tue, 23 Jan 2024 14:31:24 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=B9=B4=E5=90=84?= =?UTF-8?q?=E5=9C=BA=E9=A6=86=E7=BB=9F=E8=AE=A1=E6=95=B0=E6=8D=AE=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/pass/Statistics.php | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 source/application/api/controller/pass/Statistics.php diff --git a/source/application/api/controller/pass/Statistics.php b/source/application/api/controller/pass/Statistics.php new file mode 100644 index 0000000..7bb2bef --- /dev/null +++ b/source/application/api/controller/pass/Statistics.php @@ -0,0 +1,124 @@ +password)); + return $xtToken === $token; + } + + /** + * 获取年各场馆统计数据 + * @return array + */ + public function getYearVenueData() + { + $year = $this->request->param('year') ?: date('Y'); + $token = $this->request->param('token'); + if (!is_numeric($year)) return $this->renderError('请求失败'); + if (empty($token)) return $this->renderError('请求失败'); + if (!$this->validateToken($token)) return $this->renderError('请求验证不通过'); + + $dm = new Dm(); + + $start_time = "{$year}-01-01" . 'T00:00:00.000+08:00'; + $end_time = "{$year}-12-31" . 'T23:59:59.000+08:00'; + $yearWhere = '"date" =' . "'month'" + . ' and "granularity"=' . "'monthly'" + . ' and "statTime">=' . "'{$start_time}'" + . ' and "statTime"<=' . "'{$end_time}'"; + + # 体育馆 体育场 劳务博物馆 游泳场馆 + $tyData = []; + + $tyResult = $dm->select('bt_passenger_flow_all',$yearWhere,'"groupId","flowInNum","statTime"'); + foreach ($tyResult as $item) { + + $groupId = $item['groupId']; + $month = date("m", strtotime($item['statTime'])); + + if (!isset($tyData[$groupId]['sum_year'])) $tyData[$groupId]['sum_year'] = 0; + $tyData[$groupId]['sum_year'] += $item['flowInNum']; + + if (!isset($tyData[$groupId]['month'][$month])) $tyData[$groupId]['month'][$month] = 0; + $tyData[$groupId]['month'][$month] += $item['flowInNum']; + } + + $data = [ + 'yearDate' => $year, + 'dataResult' => [] + ]; + + foreach ($tyData as $groupId => $monthData) { + + + $getGroup = $dm->find('bt_passenger_monitor_group',' "groupId" = ' . "'{$groupId}'"); + $groupName = $getGroup['groupName'] ?: ''; + $tempData = [ + 'name' => $groupName, + 'year' => $monthData['sum_year'], + 'monthDate' => [] + ]; + + foreach ($monthData['month'] as $month => $value) { + $tempData['monthDate'][] = [ + 'month' => $month, + 'value' => $value + ]; + } + $data['dataResult'][] = $tempData; + } + + # 文化馆 图书馆 + $start_time = "{$year}-01-01 00:00:00"; + $end_time = "{$year}-12-31 23:59:59"; + $whWhere = '"date"=' . "'month'" + .' and "group_id"<>' . "'lib001'" + .' and "create_time">=' . "'{$start_time}'" + .' and "create_time"<=' . "'{$end_time}'"; + $whResult = $dm->select('bt_library_data',$whWhere,'"group_id","group_name","incount","create_time"'); + $whData = []; + $whGroupName = []; + + foreach ($whResult as $item) { + $groupId = $item['group_id']; + $month = date("m", strtotime($item['create_time'])); + $whGroupName[$groupId] = $item['group_name']; + + if (!isset($whData[$groupId]['sum_year'])) $whData[$groupId]['sum_year'] = 0; + $whData[$groupId]['sum_year'] += $item['incount']; + + if (!isset($whData[$groupId]['month'][$month])) $whData[$groupId]['month'][$month] = 0; + $whData[$groupId]['month'][$month] += $item['incount']; + } + + foreach ($whData as $groupId => $monthData) { + + $groupName = isset($whGroupName[$groupId]) ? $whGroupName[$groupId] : ''; + + $tempData = [ + 'name' => $groupName, + 'year' => $monthData['sum_year'], + 'monthDate' => [] + ]; + + foreach ($monthData['month'] as $month => $value) { + $tempData['monthDate'][] = [ + 'month' => $month, + 'value' => $value + ]; + } + $data['dataResult'][] = $tempData; + } + + return $this->renderSuccess($data); + } +} \ No newline at end of file From 77eb5456b1062d1fd4c85f7857bce564adfadade Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Tue, 23 Jan 2024 14:38:20 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=B9=B4=E5=90=84?= =?UTF-8?q?=E5=9C=BA=E9=A6=86=E7=BB=9F=E8=AE=A1=E6=95=B0=E6=8D=AE=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/application/api/controller/pass/Statistics.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/application/api/controller/pass/Statistics.php b/source/application/api/controller/pass/Statistics.php index 7bb2bef..b254667 100644 --- a/source/application/api/controller/pass/Statistics.php +++ b/source/application/api/controller/pass/Statistics.php @@ -10,7 +10,7 @@ class Statistics extends Controller private $password = 'batyg@2023'; - private function validateToken($token) { + protected function validateUserToken($token) { $xtToken = md5(base64_encode($this->password)); return $xtToken === $token; } @@ -25,7 +25,7 @@ class Statistics extends Controller $token = $this->request->param('token'); if (!is_numeric($year)) return $this->renderError('请求失败'); if (empty($token)) return $this->renderError('请求失败'); - if (!$this->validateToken($token)) return $this->renderError('请求验证不通过'); + if (!$this->validateUserToken($token)) return $this->renderError('请求验证不通过'); $dm = new Dm(); From 2c47c924a81aea14b4464421fdc199a258172474 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Tue, 23 Jan 2024 14:57:52 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=B9=B4=E5=90=84?= =?UTF-8?q?=E5=9C=BA=E9=A6=86=E7=BB=9F=E8=AE=A1=E6=95=B0=E6=8D=AE=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20=E6=9C=88=E4=BB=BD=E5=B7=B2key=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/application/api/controller/pass/Statistics.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/application/api/controller/pass/Statistics.php b/source/application/api/controller/pass/Statistics.php index b254667..f6f762c 100644 --- a/source/application/api/controller/pass/Statistics.php +++ b/source/application/api/controller/pass/Statistics.php @@ -67,7 +67,7 @@ class Statistics extends Controller 'year' => $monthData['sum_year'], 'monthDate' => [] ]; - + ksort($monthData['month']); foreach ($monthData['month'] as $month => $value) { $tempData['monthDate'][] = [ 'month' => $month, @@ -109,7 +109,7 @@ class Statistics extends Controller 'year' => $monthData['sum_year'], 'monthDate' => [] ]; - + ksort($monthData['month']); foreach ($monthData['month'] as $month => $value) { $tempData['monthDate'][] = [ 'month' => $month, From 10d1efb0d1d8b9e0854002cdd03c946e9224671c Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Tue, 23 Jan 2024 15:50:43 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=B5=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=B7=A6=E4=B8=8A=E8=A7=92=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=BA=20=E5=BD=93=E5=89=8D=E5=B9=B4=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/application/common/logic/PassFlow.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/application/common/logic/PassFlow.php b/source/application/common/logic/PassFlow.php index ac3d61c..14181d2 100644 --- a/source/application/common/logic/PassFlow.php +++ b/source/application/common/logic/PassFlow.php @@ -311,7 +311,8 @@ class PassFlow } #累计进馆人数 - $sumWhere = ' "granularity" = ' . "'yearly'" . ' and "date" = ' . "'year' {$paramWhere}"; + $sumWhere = ' "granularity" = ' . "'yearly'" . ' and "date" = ' . "'year' {$paramWhere}" + . ' and "statTime" >= ' . "'{$dateData['year']['start_time']}'" . ' and "statTime" <= ' . "'{$dateData['year']['end_time']}'"; $sumFind = $dm->find('bt_passenger_flow_all', $sumWhere,'SUM("flowInNum") as NUM'); $returnData['sumYear']['noRepeatInNum'] = isset($sumFind['NUM']) ? $sumFind['NUM'] : 0; @@ -329,8 +330,8 @@ class PassFlow // $returnData['sumYear']['noRepeatInNum'] += isset($mData['year_incount']) ? $mData['year_incount'] : 0; # 文化总年度 - $libraryData = $dm->find('bt_library_data',['group_id' => 'lib001','date' => 'year'],'SUM("incount") as NUM'); - $returnData['sumYear']['noRepeatInNum'] += isset($libraryData['NUM']) ? $libraryData['NUM'] : 0; + #$libraryData = $dm->find('bt_library_data',['group_id' => 'lib001','date' => 'year'],'SUM("incount") as NUM'); + $returnData['sumYear']['noRepeatInNum'] += isset($libraryDataYear['incount']) ? $libraryDataYear['incount'] : 0; $week_start = date("Y-m-d 00:00:00",strtotime('this week')); $week_end = date("Y-m-d 23:59:59",strtotime("-".(date("w") - 7) . "day")); $weekDateWhere = ' "group_id" =' . "'lib001'" . ' and "create_time" >= ' . "'{$week_start}'" . ' and "create_time" <= ' . "'{$week_end}'";