Browse Source

图书馆脚本优化

master
wanghongjun 3 years ago
parent
commit
c5403d774f
  1. 21
      tasks/Lib.php

21
tasks/Lib.php

@ -25,7 +25,7 @@ class Lib extends Base
$requestData = [];
$allData = $this->getBaoAnLibData();
#$allData = $this->getBaoAnLibData();
$tempAllArr = [
'group_id' => 'lib001',
'group_name' => base64_encode('文化')
@ -45,15 +45,23 @@ class Lib extends Base
];
foreach ($row['data'] as $key => $value) {
foreach ($value as $k => $v) {
$field = $key."_".$k;
$tempArr[$field] = $v ?: 0;
if (!isset($tempAllArr[$field])) $tempAllArr[$field] = 0;
$tempAllArr[$field] += $tempArr[$field];
if (is_array($v)) {
foreach ($v as $numKey => $numVal) {
if (!isset($tempAllArr[$key][$k][$numKey])) $tempAllArr[$key][$k][$numKey] = 0;
$tempAllArr[$key][$k][$numKey] += $numVal;
}
$tempArr[$key][$k] = $v;
} else {
$field = $key."_".$k;
$tempArr[$field] = $v ?: 0;
if (!isset($tempAllArr[$field])) $tempAllArr[$field] = 0;
$tempAllArr[$field] += $tempArr[$field];
}
}
}
$requestData[] = $tempArr;
}
$requestData[] = $tempAllArr;
$requestData[] = $tempAllArr;
$requestRes = $this->request_create_data($requestData,'/api/library.pass/create',$config['host_path'],true);
@ -77,7 +85,6 @@ class Lib extends Base
foreach ($this->libCameraId as $value) {
$url = $this->libUrl . '&cameraid=' . $value['cameraId'];
$result = $this->curl_post($url);
var_dump($result);
$result = json_decode($result,true);
$data[] = [
'data' => $result,

Loading…
Cancel
Save