|
@@ -9,7 +9,6 @@ namespace App\Service;
|
|
*/
|
|
*/
|
|
class Service
|
|
class Service
|
|
{
|
|
{
|
|
-
|
|
|
|
public $log;
|
|
public $log;
|
|
public $total = 0;
|
|
public $total = 0;
|
|
|
|
|
|
@@ -30,7 +29,6 @@ class Service
|
|
return $data;
|
|
return $data;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
//抽象一个查询条件,省的每天写很多行
|
|
//抽象一个查询条件,省的每天写很多行
|
|
protected function is_exist_db($data, $word, $words, $db, $formula = '=', $type = '')
|
|
protected function is_exist_db($data, $word, $words, $db, $formula = '=', $type = '')
|
|
{
|
|
{
|
|
@@ -62,7 +60,6 @@ class Service
|
|
return $db;
|
|
return $db;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
//判断是否为空
|
|
//判断是否为空
|
|
protected function isEmpty($data, $word)
|
|
protected function isEmpty($data, $word)
|
|
{
|
|
{
|
|
@@ -70,7 +67,6 @@ class Service
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
//递归处理数据成子父级关系
|
|
//递归处理数据成子父级关系
|
|
public function makeTree($parentId, &$node)
|
|
public function makeTree($parentId, &$node)
|
|
{
|
|
{
|
|
@@ -102,7 +98,6 @@ class Service
|
|
return $data;
|
|
return $data;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
//根据编码规则获取每一级的code
|
|
//根据编码规则获取每一级的code
|
|
public function get_rule_code($code, $rule)
|
|
public function get_rule_code($code, $rule)
|
|
{
|
|
{
|
|
@@ -119,8 +114,6 @@ class Service
|
|
return $rules;
|
|
return $rules;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
function curlOpen($url, $config = array())
|
|
function curlOpen($url, $config = array())
|
|
{
|
|
{
|
|
$arr = array('post' => false,'referer' => $url,'cookie' => '', 'useragent' => 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; customie8)', 'timeout' => 100, 'return' => true, 'proxy' => '', 'userpwd' => '', 'nobody' => false,'header'=>array(),'gzip'=>true,'ssl'=>true,'isupfile'=>false,'returnheader'=>false,'request'=>'post');
|
|
$arr = array('post' => false,'referer' => $url,'cookie' => '', 'useragent' => 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; customie8)', 'timeout' => 100, 'return' => true, 'proxy' => '', 'userpwd' => '', 'nobody' => false,'header'=>array(),'gzip'=>true,'ssl'=>true,'isupfile'=>false,'returnheader'=>false,'request'=>'post');
|
|
@@ -232,4 +225,27 @@ class Service
|
|
|
|
|
|
return $result;
|
|
return $result;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //前端传来的时间转换为时间戳 关于时间段 2023-09-17T16:00:00.000Z
|
|
|
|
+ function changeDateToTimeStampAboutRange($time_range){
|
|
|
|
+ if(empty($time_range[0]) || empty($time_range[1])) return [];
|
|
|
|
+
|
|
|
|
+ // 创建一个 DateTime 对象并设置时区为 UTC
|
|
|
|
+ $dateTime = new \DateTime($time_range[0], new \DateTimeZone('UTC'));
|
|
|
|
+ $dateTime1 = new \DateTime($time_range[1], new \DateTimeZone('UTC'));
|
|
|
|
+
|
|
|
|
+ // 将时区设置为 PRC
|
|
|
|
+ $dateTime->setTimezone(new \DateTimeZone('Asia/Shanghai'));
|
|
|
|
+ $dateTime1->setTimezone(new \DateTimeZone('Asia/Shanghai'));
|
|
|
|
+
|
|
|
|
+ // 将日期时间格式化为特定格式
|
|
|
|
+ $formattedDate = $dateTime->format('Y-m-d');
|
|
|
|
+ $formattedDate1 = $dateTime1->format('Y-m-d');
|
|
|
|
+
|
|
|
|
+ $return = [];
|
|
|
|
+ $return[] = strtotime($formattedDate . " 00:00:00");
|
|
|
|
+ $return[] = strtotime($formattedDate1 . " 23:59:59");
|
|
|
|
+
|
|
|
|
+ return $return;
|
|
|
|
+ }
|
|
}
|
|
}
|