|
|
@@ -9037,6 +9037,11 @@ class Index extends Api{
|
|
|
}
|
|
|
//完成实物产量色令数及百分比->接口调用
|
|
|
public function wcsw(){
|
|
|
+ $redis=redis();
|
|
|
+ $redis_key = md5('wcsw_redis');
|
|
|
+ $redis_data = $redis->get($redis_key);
|
|
|
+ return $redis_data;
|
|
|
+ die;
|
|
|
$redis=redis();
|
|
|
// $redis_key = md5('wcsw_redis');
|
|
|
// $redis_key = md5('yssl_redis');
|
|
|
@@ -9402,61 +9407,50 @@ class Index extends Api{
|
|
|
DATE_FORMAT( db.RQ, '%Y-%m' ) AS 'rq',
|
|
|
ROUND(SUM( db.nnRotationSL )) AS 'nnRotationSL'
|
|
|
")
|
|
|
- ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
- // ->group('MONTH(db.RQ)')
|
|
|
+ ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
->group("DATE_FORMAT( db.RQ, '%Y-%m' )")
|
|
|
->select();
|
|
|
+
|
|
|
// 初始化数据
|
|
|
$list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
|
|
$currentYear = date("Y"); // 当前年份
|
|
|
$currentMonth = date("m"); // 当前月份
|
|
|
- $previousYear = (int)$currentYear - 1; // 前一年
|
|
|
- // 为前一年和当前年份创建数据数组,初始值为0
|
|
|
- $list['series'][0]['name'] = $previousYear . '年';
|
|
|
- $list['series'][0]['data'] = array_fill(0, 12, 0);
|
|
|
- $list['series'][1]['name'] = $currentYear . '年';
|
|
|
- $list['series'][1]['data'] = array_fill(0, $currentMonth, 0);
|
|
|
+ $previousYear = (int)$currentYear - 1; // 去年
|
|
|
+ $previousTwoYear = (int)$currentYear - 2; // 前年
|
|
|
+
|
|
|
+ // 为前年、去年和今年创建数据数组,初始值为0
|
|
|
+ $list['series'][0]['name'] = $previousTwoYear . '年';
|
|
|
+ $list['series'][0]['data'] = array_fill(0, 12, 0); // 前年初始化为0
|
|
|
+ $list['series'][1]['name'] = $previousYear . '年';
|
|
|
+ $list['series'][1]['data'] = array_fill(0, 12, 0); // 去年初始化为0
|
|
|
+ $list['series'][2]['name'] = $currentYear . '年';
|
|
|
+ $list['series'][2]['data'] = array_fill(0, $currentMonth, 0); // 今年初始化到当前月份为0
|
|
|
+
|
|
|
// 遍历查询结果
|
|
|
foreach ($sql_final as $v) {
|
|
|
// 获取年份和月份
|
|
|
$year = substr($v['rq'], 0, 4);
|
|
|
$month = substr($v['rq'], 5, 2);
|
|
|
|
|
|
- // 如果是前一年的数据
|
|
|
- if ($year == $previousYear) {
|
|
|
+ // 如果是前两年的数据
|
|
|
+ if ($year == $previousTwoYear) {
|
|
|
$list['series'][0]['data'][(int)$month - 1] = $v['nnRotationSL'];
|
|
|
}
|
|
|
- // 如果是当前年份的数据
|
|
|
- if ($year == $currentYear) {
|
|
|
+ // 如果是去年的数据
|
|
|
+ if ($year == $previousYear) {
|
|
|
$list['series'][1]['data'][(int)$month - 1] = $v['nnRotationSL'];
|
|
|
}
|
|
|
+ // 如果是今年的数据
|
|
|
+ if ($year == $currentYear) {
|
|
|
+ $list['series'][2]['data'][(int)$month - 1] = $v['nnRotationSL'];
|
|
|
+ }
|
|
|
}
|
|
|
- // 设置响应数据
|
|
|
+
|
|
|
$res['status'] = 0;
|
|
|
$res['msg'] = '';
|
|
|
$res['data'] = $list;
|
|
|
- // 将结果存储到Redis并返回
|
|
|
$redis->set($redis_key, json_encode($res));
|
|
|
return json_encode($res);
|
|
|
-// $i=0;
|
|
|
-// $j=0;
|
|
|
-// $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
|
|
|
-// foreach($sql_final as $v){
|
|
|
-// if($v['rq']>=date("Y-01")){
|
|
|
-// $list['series'][1]['name']=date("Y").'年';
|
|
|
-// $list['series'][1]['data'][$j]=$v['nnRotationSL'];
|
|
|
-// $j++;
|
|
|
-// }else{
|
|
|
-// $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
|
|
|
-// $list['series'][0]['data'][$i]=$v['nnRotationSL'];
|
|
|
-// $i++;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// $res['status']=0;
|
|
|
-// $res['msg']='';
|
|
|
-// $res['data']=$list;
|
|
|
-// $redis->set($redis_key, json_encode($res));
|
|
|
-// return json_encode($res);
|
|
|
}
|
|
|
//轮转机每月生产趋势 纸令->接口调用
|
|
|
public function lunzhuanzl(){
|
|
|
@@ -9504,7 +9498,7 @@ class Index extends Api{
|
|
|
DATE_FORMAT( db.RQ, '%Y-%m' ) AS 'rq',
|
|
|
ROUND(SUM( db.nFourColorSL )) AS 'nFourColorSL'
|
|
|
")
|
|
|
- ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
+ ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
// ->group('MONTH(db.RQ)')
|
|
|
->group("DATE_FORMAT( db.RQ, '%Y-%m' )")
|
|
|
->select();
|
|
|
@@ -9512,55 +9506,42 @@ class Index extends Api{
|
|
|
$list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
|
|
$currentYear = date("Y"); // 当前年份
|
|
|
$currentMonth = date("m"); // 当前月份
|
|
|
- $previousYear = (int)$currentYear - 1; // 前一年
|
|
|
- // 为前一年和当前年份创建数据数组,初始值为0
|
|
|
- $list['series'][0]['name'] = $previousYear . '年';
|
|
|
- $list['series'][0]['data'] = array_fill(0, 12, 0);
|
|
|
- $list['series'][1]['name'] = $currentYear . '年';
|
|
|
- $list['series'][1]['data'] = array_fill(0, $currentMonth, 0);
|
|
|
+ $previousYear = (int)$currentYear - 1; // 去年
|
|
|
+ $previousTwoYear = (int)$currentYear - 2; // 前年
|
|
|
+
|
|
|
+ // 为前年、去年和今年创建数据数组,初始值为0
|
|
|
+ $list['series'][0]['name'] = $previousTwoYear . '年';
|
|
|
+ $list['series'][0]['data'] = array_fill(0, 12, 0); // 前年初始化为0
|
|
|
+ $list['series'][1]['name'] = $previousYear . '年';
|
|
|
+ $list['series'][1]['data'] = array_fill(0, 12, 0); // 去年初始化为0
|
|
|
+ $list['series'][2]['name'] = $currentYear . '年';
|
|
|
+ $list['series'][2]['data'] = array_fill(0, $currentMonth, 0); // 今年初始化到当前月份为0
|
|
|
+
|
|
|
// 遍历查询结果
|
|
|
foreach ($sql_final as $v) {
|
|
|
// 获取年份和月份
|
|
|
$year = substr($v['rq'], 0, 4);
|
|
|
$month = substr($v['rq'], 5, 2);
|
|
|
|
|
|
- // 如果是前一年的数据
|
|
|
- if ($year == $previousYear) {
|
|
|
+ // 如果是前两年的数据
|
|
|
+ if ($year == $previousTwoYear) {
|
|
|
$list['series'][0]['data'][(int)$month - 1] = $v['nFourColorSL'];
|
|
|
}
|
|
|
- // 如果是当前年份的数据
|
|
|
- if ($year == $currentYear) {
|
|
|
+ // 如果是去年的数据
|
|
|
+ if ($year == $previousYear) {
|
|
|
$list['series'][1]['data'][(int)$month - 1] = $v['nFourColorSL'];
|
|
|
}
|
|
|
+ // 如果是今年的数据
|
|
|
+ if ($year == $currentYear) {
|
|
|
+ $list['series'][2]['data'][(int)$month - 1] = $v['nFourColorSL'];
|
|
|
+ }
|
|
|
}
|
|
|
- // 设置响应数据
|
|
|
+
|
|
|
$res['status'] = 0;
|
|
|
$res['msg'] = '';
|
|
|
$res['data'] = $list;
|
|
|
- // 将结果存储到Redis并返回
|
|
|
$redis->set($redis_key, json_encode($res));
|
|
|
return json_encode($res);
|
|
|
-
|
|
|
-// $i=0;
|
|
|
-// $j=0;
|
|
|
-// $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
|
|
|
-// foreach($sql_final as $v){
|
|
|
-// if($v['rq']>=$this->year_January()){
|
|
|
-// $list['series'][1]['name']=date("Y"). '年';
|
|
|
-// $list['series'][1]['data'][$j]=$v['nFourColorSL'];
|
|
|
-// $j++;
|
|
|
-// }else{
|
|
|
-// $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
|
|
|
-// $list['series'][0]['data'][$i]=$v['nFourColorSL'];
|
|
|
-// $i++;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// $res['status']=0;
|
|
|
-// $res['msg']='';
|
|
|
-// $res['data']=$list;
|
|
|
-// $redis->set($redis_key, json_encode($res));
|
|
|
-// // halt(json_decode($redis->get($redis_key),true));
|
|
|
-// return json_encode($res);
|
|
|
}
|
|
|
//四色机每月生产趋势 纸令->接口调用
|
|
|
public function sisejizl(){
|
|
|
@@ -9607,7 +9588,7 @@ class Index extends Api{
|
|
|
DATE_FORMAT( db.RQ, '%Y-%m' ) AS 'rq',
|
|
|
ROUND(SUM( db.nBBSL )) AS 'nBBSL'
|
|
|
")
|
|
|
- ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
+ ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
// ->group('MONTH(db.RQ)')
|
|
|
->group("DATE_FORMAT( db.RQ, '%Y-%m' )")
|
|
|
->select();
|
|
|
@@ -9615,54 +9596,42 @@ class Index extends Api{
|
|
|
$list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
|
|
$currentYear = date("Y"); // 当前年份
|
|
|
$currentMonth = date("m"); // 当前月份
|
|
|
- $previousYear = (int)$currentYear - 1; // 前一年
|
|
|
- // 为前一年和当前年份创建数据数组,初始值为0
|
|
|
- $list['series'][0]['name'] = $previousYear . '年';
|
|
|
- $list['series'][0]['data'] = array_fill(0, $currentMonth, 0);
|
|
|
- $list['series'][1]['name'] = $currentYear . '年';
|
|
|
- $list['series'][1]['data'] = array_fill(0, $currentMonth, 0);
|
|
|
+ $previousYear = (int)$currentYear - 1; // 去年
|
|
|
+ $previousTwoYear = (int)$currentYear - 2; // 前年
|
|
|
+
|
|
|
+ // 为前年、去年和今年创建数据数组,初始值为0
|
|
|
+ $list['series'][0]['name'] = $previousTwoYear . '年';
|
|
|
+ $list['series'][0]['data'] = array_fill(0, 12, 0); // 前年初始化为0
|
|
|
+ $list['series'][1]['name'] = $previousYear . '年';
|
|
|
+ $list['series'][1]['data'] = array_fill(0, 12, 0); // 去年初始化为0
|
|
|
+ $list['series'][2]['name'] = $currentYear . '年';
|
|
|
+ $list['series'][2]['data'] = array_fill(0, $currentMonth, 0); // 今年初始化到当前月份为0
|
|
|
+
|
|
|
// 遍历查询结果
|
|
|
foreach ($sql_final as $v) {
|
|
|
// 获取年份和月份
|
|
|
$year = substr($v['rq'], 0, 4);
|
|
|
$month = substr($v['rq'], 5, 2);
|
|
|
|
|
|
- // 如果是前一年的数据
|
|
|
- if ($year == $previousYear) {
|
|
|
+ // 如果是前两年的数据
|
|
|
+ if ($year == $previousTwoYear) {
|
|
|
$list['series'][0]['data'][(int)$month - 1] = $v['nBBSL'];
|
|
|
}
|
|
|
- // 如果是当前年份的数据
|
|
|
- if ($year == $currentYear) {
|
|
|
+ // 如果是去年的数据
|
|
|
+ if ($year == $previousYear) {
|
|
|
$list['series'][1]['data'][(int)$month - 1] = $v['nBBSL'];
|
|
|
}
|
|
|
+ // 如果是今年的数据
|
|
|
+ if ($year == $currentYear) {
|
|
|
+ $list['series'][2]['data'][(int)$month - 1] = $v['nBBSL'];
|
|
|
+ }
|
|
|
}
|
|
|
- // 设置响应数据
|
|
|
+
|
|
|
$res['status'] = 0;
|
|
|
$res['msg'] = '';
|
|
|
$res['data'] = $list;
|
|
|
- // 将结果存储到Redis并返回
|
|
|
$redis->set($redis_key, json_encode($res));
|
|
|
return json_encode($res);
|
|
|
-
|
|
|
-// $i=0;
|
|
|
-// $j=0;
|
|
|
-// $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
|
|
|
-// foreach($sql_final as $v){
|
|
|
-// if($v['rq']>=$this->year_January()){
|
|
|
-// $list['series'][1]['name']=date("Y"). '年';
|
|
|
-// $list['series'][1]['data'][$j]=$v['nBBSL'];
|
|
|
-// $j++;
|
|
|
-// }else{
|
|
|
-// $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
|
|
|
-// $list['series'][0]['data'][$i]=$v['nBBSL'];
|
|
|
-// $i++;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// $res['status']=0;
|
|
|
-// $res['msg']='';
|
|
|
-// $res['data']=$list;
|
|
|
-// $redis->set($redis_key, json_encode($res));
|
|
|
-// return json_encode($res);
|
|
|
}
|
|
|
//BB机每月生产趋势 纸令->接口调用
|
|
|
public function bbjzl(){
|
|
|
@@ -9720,7 +9689,7 @@ class Index extends Api{
|
|
|
DATE_FORMAT( db.RQ, '%Y-%m' ) AS 'rq',
|
|
|
ROUND(SUM( db.nnRotationSL )) AS 'nnRotationSL'
|
|
|
")
|
|
|
- ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
+ ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
// ->group('MONTH(db.RQ)')
|
|
|
->group("DATE_FORMAT( db.RQ, '%Y-%m' )")
|
|
|
->select();
|
|
|
@@ -9728,53 +9697,42 @@ class Index extends Api{
|
|
|
$list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
|
|
$currentYear = date("Y"); // 当前年份
|
|
|
$currentMonth = date("m"); // 当前月份
|
|
|
- $previousYear = (int)$currentYear - 1; // 前一年
|
|
|
- // 为前一年和当前年份创建数据数组,初始值为0
|
|
|
- $list['series'][0]['name'] = $previousYear . '年';
|
|
|
- $list['series'][0]['data'] = array_fill(0, $currentMonth, 0);
|
|
|
- $list['series'][1]['name'] = $currentYear . '年';
|
|
|
- $list['series'][1]['data'] = array_fill(0, $currentMonth, 0);
|
|
|
+ $previousYear = (int)$currentYear - 1; // 去年
|
|
|
+ $previousTwoYear = (int)$currentYear - 2; // 前年
|
|
|
+
|
|
|
+ // 为前年、去年和今年创建数据数组,初始值为0
|
|
|
+ $list['series'][0]['name'] = $previousTwoYear . '年';
|
|
|
+ $list['series'][0]['data'] = array_fill(0, 12, 0); // 前年初始化为0
|
|
|
+ $list['series'][1]['name'] = $previousYear . '年';
|
|
|
+ $list['series'][1]['data'] = array_fill(0, 12, 0); // 去年初始化为0
|
|
|
+ $list['series'][2]['name'] = $currentYear . '年';
|
|
|
+ $list['series'][2]['data'] = array_fill(0, $currentMonth, 0); // 今年初始化到当前月份为0
|
|
|
+
|
|
|
// 遍历查询结果
|
|
|
foreach ($sql_final as $v) {
|
|
|
// 获取年份和月份
|
|
|
$year = substr($v['rq'], 0, 4);
|
|
|
$month = substr($v['rq'], 5, 2);
|
|
|
|
|
|
- // 如果是前一年的数据
|
|
|
- if ($year == $previousYear) {
|
|
|
+ // 如果是前两年的数据
|
|
|
+ if ($year == $previousTwoYear) {
|
|
|
$list['series'][0]['data'][(int)$month - 1] = $v['nnRotationSL'];
|
|
|
}
|
|
|
- // 如果是当前年份的数据
|
|
|
- if ($year == $currentYear) {
|
|
|
+ // 如果是去年的数据
|
|
|
+ if ($year == $previousYear) {
|
|
|
$list['series'][1]['data'][(int)$month - 1] = $v['nnRotationSL'];
|
|
|
}
|
|
|
+ // 如果是今年的数据
|
|
|
+ if ($year == $currentYear) {
|
|
|
+ $list['series'][2]['data'][(int)$month - 1] = $v['nnRotationSL'];
|
|
|
+ }
|
|
|
}
|
|
|
- // 设置响应数据
|
|
|
+
|
|
|
$res['status'] = 0;
|
|
|
$res['msg'] = '';
|
|
|
$res['data'] = $list;
|
|
|
- // 将结果存储到Redis并返回
|
|
|
$redis->set($redis_key, json_encode($res));
|
|
|
return json_encode($res);
|
|
|
-// $i=0;
|
|
|
-// $j=0;
|
|
|
-// $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
|
|
|
-// foreach($sql_final as $v){
|
|
|
-// if($v['rq']>=$this->year_January()){
|
|
|
-// $list['series'][1]['name']=date("Y"). '年';
|
|
|
-// $list['series'][1]['data'][$j]=$v['nnRotationSL'];
|
|
|
-// $j++;
|
|
|
-// }else{
|
|
|
-// $list['series'][0]['name']= date("Y", strtotime("-1 year")).'年';
|
|
|
-// $list['series'][0]['data'][$i]=$v['nnRotationSL'];
|
|
|
-// $i++;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// $res['status']=0;
|
|
|
-// $res['msg']='';
|
|
|
-// $res['data']=$list;
|
|
|
-// $redis->set($redis_key, json_encode($res));
|
|
|
-// return json_encode($res);
|
|
|
}
|
|
|
//轮转机每月生产趋势 色令->接口调用
|
|
|
public function lunzhuan(){
|
|
|
@@ -9832,7 +9790,7 @@ class Index extends Api{
|
|
|
DATE_FORMAT( db.RQ, '%Y-%m' ) AS 'rq',
|
|
|
ROUND(SUM( db.nFourColorSL )) AS 'nFourColorSL'
|
|
|
")
|
|
|
- ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
+ ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
// ->group('MONTH(db.RQ)')
|
|
|
->group("DATE_FORMAT( db.RQ, '%Y-%m' )")
|
|
|
->select();
|
|
|
@@ -9840,55 +9798,42 @@ class Index extends Api{
|
|
|
$list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
|
|
$currentYear = date("Y"); // 当前年份
|
|
|
$currentMonth = date("m"); // 当前月份
|
|
|
- $previousYear = (int)$currentYear - 1; // 前一年
|
|
|
- // 为前一年和当前年份创建数据数组,初始值为0
|
|
|
- $list['series'][0]['name'] = $previousYear . '年';
|
|
|
- $list['series'][0]['data'] = array_fill(0, 12, 0);
|
|
|
- $list['series'][1]['name'] = $currentYear . '年';
|
|
|
- $list['series'][1]['data'] = array_fill(0, $currentMonth, 0);
|
|
|
+ $previousYear = (int)$currentYear - 1; // 去年
|
|
|
+ $previousTwoYear = (int)$currentYear - 2; // 前年
|
|
|
+
|
|
|
+ // 为前年、去年和今年创建数据数组,初始值为0
|
|
|
+ $list['series'][0]['name'] = $previousTwoYear . '年';
|
|
|
+ $list['series'][0]['data'] = array_fill(0, 12, 0); // 前年初始化为0
|
|
|
+ $list['series'][1]['name'] = $previousYear . '年';
|
|
|
+ $list['series'][1]['data'] = array_fill(0, 12, 0); // 去年初始化为0
|
|
|
+ $list['series'][2]['name'] = $currentYear . '年';
|
|
|
+ $list['series'][2]['data'] = array_fill(0, $currentMonth, 0); // 今年初始化到当前月份为0
|
|
|
+
|
|
|
// 遍历查询结果
|
|
|
foreach ($sql_final as $v) {
|
|
|
// 获取年份和月份
|
|
|
$year = substr($v['rq'], 0, 4);
|
|
|
$month = substr($v['rq'], 5, 2);
|
|
|
|
|
|
- // 如果是前一年的数据
|
|
|
- if ($year == $previousYear) {
|
|
|
+ // 如果是前两年的数据
|
|
|
+ if ($year == $previousTwoYear) {
|
|
|
$list['series'][0]['data'][(int)$month - 1] = $v['nFourColorSL'];
|
|
|
}
|
|
|
- // 如果是当前年份的数据
|
|
|
- if ($year == $currentYear) {
|
|
|
+ // 如果是去年的数据
|
|
|
+ if ($year == $previousYear) {
|
|
|
$list['series'][1]['data'][(int)$month - 1] = $v['nFourColorSL'];
|
|
|
}
|
|
|
+ // 如果是今年的数据
|
|
|
+ if ($year == $currentYear) {
|
|
|
+ $list['series'][2]['data'][(int)$month - 1] = $v['nFourColorSL'];
|
|
|
+ }
|
|
|
}
|
|
|
- // 设置响应数据
|
|
|
+
|
|
|
$res['status'] = 0;
|
|
|
$res['msg'] = '';
|
|
|
$res['data'] = $list;
|
|
|
- // 将结果存储到Redis并返回
|
|
|
$redis->set($redis_key, json_encode($res));
|
|
|
return json_encode($res);
|
|
|
-
|
|
|
-// $i=0;
|
|
|
-// $j=0;
|
|
|
-// $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
|
|
|
-// foreach($sql_final as $v){
|
|
|
-// if($v['rq']>=$this->year_January()){
|
|
|
-// $list['series'][1]['name']=date("Y").'年';
|
|
|
-// $list['series'][1]['data'][$j]=$v['nFourColorSL'];
|
|
|
-// $j++;
|
|
|
-// }else{
|
|
|
-// $list['series'][0]['name']= date("Y", strtotime("-1 year")).'年';
|
|
|
-// $list['series'][0]['data'][$i]=$v['nFourColorSL'];
|
|
|
-// $i++;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// $res['status']=0;
|
|
|
-// $res['msg']='';
|
|
|
-// $res['data']=$list;
|
|
|
-// $redis->set($redis_key, json_encode($res));
|
|
|
-// // halt(json_decode($redis->get($redis_key),true));
|
|
|
-// return json_encode($res);
|
|
|
}
|
|
|
//四色机每月生产趋势 色令->接口调用
|
|
|
public function siseji(){
|
|
|
@@ -9942,7 +9887,7 @@ class Index extends Api{
|
|
|
DATE_FORMAT( db.RQ, '%Y-%m' ) AS 'rq',
|
|
|
ROUND(SUM( db.nBBSL )) AS 'nBBSL'
|
|
|
")
|
|
|
- ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
+ ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
// ->group('MONTH(db.RQ)')
|
|
|
->group("DATE_FORMAT( db.RQ, '%Y-%m' )")
|
|
|
->order('db.RQ', 'asc')
|
|
|
@@ -9951,53 +9896,42 @@ class Index extends Api{
|
|
|
$list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
|
|
$currentYear = date("Y"); // 当前年份
|
|
|
$currentMonth = date("m"); // 当前月份
|
|
|
- $previousYear = (int)$currentYear - 1; // 前一年
|
|
|
- // 为前一年和当前年份创建数据数组,初始值为0
|
|
|
- $list['series'][0]['name'] = $previousYear . '年';
|
|
|
- $list['series'][0]['data'] = array_fill(0, $currentMonth, 0);
|
|
|
- $list['series'][1]['name'] = $currentYear . '年';
|
|
|
- $list['series'][1]['data'] = array_fill(0, $currentMonth, 0);
|
|
|
+ $previousYear = (int)$currentYear - 1; // 去年
|
|
|
+ $previousTwoYear = (int)$currentYear - 2; // 前年
|
|
|
+
|
|
|
+ // 为前年、去年和今年创建数据数组,初始值为0
|
|
|
+ $list['series'][0]['name'] = $previousTwoYear . '年';
|
|
|
+ $list['series'][0]['data'] = array_fill(0, 12, 0); // 前年初始化为0
|
|
|
+ $list['series'][1]['name'] = $previousYear . '年';
|
|
|
+ $list['series'][1]['data'] = array_fill(0, 12, 0); // 去年初始化为0
|
|
|
+ $list['series'][2]['name'] = $currentYear . '年';
|
|
|
+ $list['series'][2]['data'] = array_fill(0, $currentMonth, 0); // 今年初始化到当前月份为0
|
|
|
+
|
|
|
// 遍历查询结果
|
|
|
foreach ($sql_final as $v) {
|
|
|
// 获取年份和月份
|
|
|
$year = substr($v['rq'], 0, 4);
|
|
|
$month = substr($v['rq'], 5, 2);
|
|
|
|
|
|
- // 如果是前一年的数据
|
|
|
- if ($year == $previousYear) {
|
|
|
+ // 如果是前两年的数据
|
|
|
+ if ($year == $previousTwoYear) {
|
|
|
$list['series'][0]['data'][(int)$month - 1] = $v['nBBSL'];
|
|
|
}
|
|
|
- // 如果是当前年份的数据
|
|
|
- if ($year == $currentYear) {
|
|
|
+ // 如果是去年的数据
|
|
|
+ if ($year == $previousYear) {
|
|
|
$list['series'][1]['data'][(int)$month - 1] = $v['nBBSL'];
|
|
|
}
|
|
|
+ // 如果是今年的数据
|
|
|
+ if ($year == $currentYear) {
|
|
|
+ $list['series'][2]['data'][(int)$month - 1] = $v['nBBSL'];
|
|
|
+ }
|
|
|
}
|
|
|
- // 设置响应数据
|
|
|
+
|
|
|
$res['status'] = 0;
|
|
|
$res['msg'] = '';
|
|
|
$res['data'] = $list;
|
|
|
- // 将结果存储到Redis并返回
|
|
|
$redis->set($redis_key, json_encode($res));
|
|
|
return json_encode($res);
|
|
|
-// $i=0;
|
|
|
-// $j=0;
|
|
|
-// $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
|
|
|
-// foreach($sql_final as $v){
|
|
|
-// if($v['rq']>=$this->year_January()){
|
|
|
-// $list['series'][1]['name']=date("Y").'年';
|
|
|
-// $list['series'][1]['data'][$j]=$v['nBBSL'];
|
|
|
-// $j++;
|
|
|
-// }else{
|
|
|
-// $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
|
|
|
-// $list['series'][0]['data'][$i]=$v['nBBSL'];
|
|
|
-// $i++;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// $res['status']=0;
|
|
|
-// $res['msg']='';
|
|
|
-// $res['data']=$list;
|
|
|
-// $redis->set($redis_key, json_encode($res));
|
|
|
-// return json_encode($res);
|
|
|
}
|
|
|
//BB机每月生产趋势 色令->接口调用
|
|
|
public function bbj(){
|
|
|
@@ -11478,26 +11412,47 @@ class Index extends Api{
|
|
|
DATE_FORMAT(db.rq, '%Y-%m') as rq,
|
|
|
ROUND(SUM(db.纸令数总计), 0) AS jdzl
|
|
|
")
|
|
|
- ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
+ ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
->group("DATE_FORMAT(db.rq, '%Y-%m')")
|
|
|
->select();
|
|
|
- $i=0;
|
|
|
- $j=0;
|
|
|
- $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
|
|
|
- foreach($sql_final as $v){
|
|
|
- if($v['rq']>=$this->year_January()){
|
|
|
- $list['series'][1]['name']=date("Y").'年';
|
|
|
- $list['series'][1]['data'][$j]=$v['jdzl'];
|
|
|
- $j++;
|
|
|
- }else{
|
|
|
- $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
|
|
|
- $list['series'][0]['data'][$i]=$v['jdzl'];
|
|
|
- $i++;
|
|
|
+ // 初始化数据
|
|
|
+ $i = 0;
|
|
|
+ $j = 0;
|
|
|
+ $k = 0;
|
|
|
+ $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
|
|
+ $currentYear = date("Y"); // 当前年份
|
|
|
+ $previousYear = (int)$currentYear - 1; // 去年
|
|
|
+ $previousTwoYear = (int)$currentYear - 2; // 前年
|
|
|
+ // 为三年的数据创建数组,初始值为0
|
|
|
+ $list['series'][0]['name'] = $previousTwoYear . '年'; // 前年
|
|
|
+ $list['series'][0]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
|
|
|
+ $list['series'][1]['name'] = $previousYear . '年'; // 去年
|
|
|
+ $list['series'][1]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
|
|
|
+ $list['series'][2]['name'] = $currentYear . '年'; // 今年
|
|
|
+ $list['series'][2]['data'] = array_fill(0, (int)date("m"), 0); // 初始化到当前月份的数据
|
|
|
+
|
|
|
+ // 遍历查询结果并填充数据
|
|
|
+ foreach ($sql_final as $v) {
|
|
|
+ // 获取年份和月份
|
|
|
+ $year = substr($v['rq'], 0, 4);
|
|
|
+ $month = substr($v['rq'], 5, 2);
|
|
|
+
|
|
|
+ // 如果是前年数据
|
|
|
+ if ($year == $previousTwoYear) {
|
|
|
+ $list['series'][0]['data'][(int)$month - 1] = $v['jdzl'];
|
|
|
+ }
|
|
|
+ // 如果是去年数据
|
|
|
+ if ($year == $previousYear) {
|
|
|
+ $list['series'][1]['data'][(int)$month - 1] = $v['jdzl'];
|
|
|
+ }
|
|
|
+ // 如果是今年数据
|
|
|
+ if ($year == $currentYear) {
|
|
|
+ $list['series'][2]['data'][(int)$month - 1] = $v['jdzl'];
|
|
|
}
|
|
|
}
|
|
|
- $res['status']=0;
|
|
|
- $res['msg']='';
|
|
|
- $res['data']=$list;
|
|
|
+ $res['status'] = 0;
|
|
|
+ $res['msg'] = '';
|
|
|
+ $res['data'] = $list;
|
|
|
$redis->set($redis_key, json_encode($res));
|
|
|
return json_encode($res);
|
|
|
}
|
|
|
@@ -11772,7 +11727,7 @@ class Index extends Api{
|
|
|
DATE_FORMAT(db.rq, '%Y-%m') as rq,
|
|
|
ROUND(sum(db.纸令数总计), 0) as jzzl
|
|
|
")
|
|
|
- ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
+ ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
|
|
|
->group("DATE_FORMAT(db.rq, '%Y-%m')")
|
|
|
->select();
|
|
|
|
|
|
@@ -11786,24 +11741,48 @@ class Index extends Api{
|
|
|
$redis=redis();
|
|
|
$sql_final = json_decode($redis->get(md5('jzzl_redis')), true);
|
|
|
|
|
|
- $i=0;
|
|
|
- $j=0;
|
|
|
- $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
|
|
|
- foreach($sql_final as $v){
|
|
|
- if($v['rq']>=$this->year_January()){
|
|
|
- $list['series'][1]['name']=date("Y").'年';
|
|
|
- $list['series'][1]['data'][$j]=$v['jzzl'];
|
|
|
- $j++;
|
|
|
- }else{
|
|
|
- $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
|
|
|
- $list['series'][0]['data'][$i]=$v['jzzl'];
|
|
|
- $i++;
|
|
|
+ $i = 0;
|
|
|
+ $j = 0;
|
|
|
+ $k = 0;
|
|
|
+ $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
|
|
+
|
|
|
+ // 获取当前年份、去年和前年
|
|
|
+ $currentYear = date("Y"); // 当前年份
|
|
|
+ $previousYear = (int)$currentYear - 1; // 去年
|
|
|
+ $previousTwoYear = (int)$currentYear - 2; // 前年
|
|
|
+
|
|
|
+ // 初始化三年的数据
|
|
|
+ $list['series'][0]['name'] = $previousTwoYear . '年'; // 前年
|
|
|
+ $list['series'][0]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
|
|
|
+ $list['series'][1]['name'] = $previousYear . '年'; // 去年
|
|
|
+ $list['series'][1]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
|
|
|
+ $list['series'][2]['name'] = $currentYear . '年'; // 今年
|
|
|
+ $list['series'][2]['data'] = array_fill(0, (int)date("m"), 0); // 初始化到当前月份的数据
|
|
|
+
|
|
|
+ // 遍历查询结果并填充数据
|
|
|
+ foreach ($sql_final as $v) {
|
|
|
+ // 获取年份和月份
|
|
|
+ $year = substr($v['rq'], 0, 4);
|
|
|
+ $month = substr($v['rq'], 5, 2);
|
|
|
+
|
|
|
+ // 如果是前年数据
|
|
|
+ if ($year == $previousTwoYear) {
|
|
|
+ $list['series'][0]['data'][(int)$month - 1] = $v['jzzl'];
|
|
|
+ }
|
|
|
+ // 如果是去年数据
|
|
|
+ if ($year == $previousYear) {
|
|
|
+ $list['series'][1]['data'][(int)$month - 1] = $v['jzzl'];
|
|
|
+ }
|
|
|
+ // 如果是今年数据
|
|
|
+ if ($year == $currentYear) {
|
|
|
+ $list['series'][2]['data'][(int)$month - 1] = $v['jzzl'];
|
|
|
}
|
|
|
}
|
|
|
- $res['status']=0;
|
|
|
- $res['msg']='';
|
|
|
- $res['data']=$list;
|
|
|
+ $res['status'] = 0;
|
|
|
+ $res['msg'] = '';
|
|
|
+ $res['data'] = $list;
|
|
|
return json_encode($res);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//骑马纸令->缓存调用
|
|
|
@@ -12737,26 +12716,49 @@ class Index extends Api{
|
|
|
DATE_FORMAT(db.rq, '%Y-%m') as rq,
|
|
|
ROUND(sum(db.纸令数总计),0) as qmzl
|
|
|
")
|
|
|
- ->where("db.rq >= '{$this->qstart_time()}'AND db.rq <= '{$this->end_time()}' ")
|
|
|
+ ->where("db.rq >= '{$this->qianstart_time()}'AND db.rq <= '{$this->end_time()}' ")
|
|
|
->group("DATE_FORMAT(db.rq, '%Y-%m')")
|
|
|
->select();
|
|
|
- $i=0;
|
|
|
- $j=0;
|
|
|
- $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
|
|
|
- foreach($sql_final as $v){
|
|
|
- if($v['rq']>=$this->year_January()){
|
|
|
- $list['series'][1]['name']=date("Y").'年';
|
|
|
- $list['series'][1]['data'][$j]=$v['qmzl'];
|
|
|
- $j++;
|
|
|
- }else{
|
|
|
- $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
|
|
|
- $list['series'][0]['data'][$i]=$v['qmzl'];
|
|
|
- $i++;
|
|
|
+ // 初始化数据
|
|
|
+ $i = 0;
|
|
|
+ $j = 0;
|
|
|
+ $k = 0;
|
|
|
+ $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
|
|
+
|
|
|
+ $currentYear = date("Y"); // 当前年份
|
|
|
+ $previousYear = (int)$currentYear - 1; // 去年
|
|
|
+ $previousTwoYear = (int)$currentYear - 2; // 前年
|
|
|
+
|
|
|
+ // 为三年的数据创建数组,初始值为0
|
|
|
+ $list['series'][0]['name'] = $previousTwoYear . '年'; // 前年
|
|
|
+ $list['series'][0]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
|
|
|
+ $list['series'][1]['name'] = $previousYear . '年'; // 去年
|
|
|
+ $list['series'][1]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
|
|
|
+ $list['series'][2]['name'] = $currentYear . '年'; // 今年
|
|
|
+ $list['series'][2]['data'] = array_fill(0, (int)date("m"), 0); // 初始化到当前月份的数据
|
|
|
+
|
|
|
+ // 遍历查询结果并填充数据
|
|
|
+ foreach ($sql_final as $v) {
|
|
|
+ // 获取年份和月份
|
|
|
+ $year = substr($v['rq'], 0, 4);
|
|
|
+ $month = substr($v['rq'], 5, 2);
|
|
|
+
|
|
|
+ // 如果是前年数据
|
|
|
+ if ($year == $previousTwoYear) {
|
|
|
+ $list['series'][0]['data'][(int)$month - 1] = $v['qmzl'];
|
|
|
+ }
|
|
|
+ // 如果是去年数据
|
|
|
+ if ($year == $previousYear) {
|
|
|
+ $list['series'][1]['data'][(int)$month - 1] = $v['qmzl'];
|
|
|
+ }
|
|
|
+ // 如果是今年数据
|
|
|
+ if ($year == $currentYear) {
|
|
|
+ $list['series'][2]['data'][(int)$month - 1] = $v['qmzl'];
|
|
|
}
|
|
|
}
|
|
|
- $res['status']=0;
|
|
|
- $res['msg']='';
|
|
|
- $res['data']=$list;
|
|
|
+ $res['status'] = 0;
|
|
|
+ $res['msg'] = '';
|
|
|
+ $res['data'] = $list;
|
|
|
$redis->set($redis_key, json_encode($res));
|
|
|
return json_encode($res);
|
|
|
}
|
|
|
@@ -13204,27 +13206,50 @@ class Index extends Api{
|
|
|
DATE_FORMAT(db.rq, '%Y-%m') as rq,
|
|
|
ROUND(sum(db.总计册), 0) as jdcs
|
|
|
")
|
|
|
- ->where("db.RQ >= '{$this->qstart_time()}'
|
|
|
+ ->where("db.RQ >= '{$this->qianstart_time()}'
|
|
|
AND db.RQ <= '{$this->end_time()}' ")
|
|
|
->group("DATE_FORMAT(db.rq, '%Y-%m')")
|
|
|
->select();
|
|
|
- $i=0;
|
|
|
- $j=0;
|
|
|
- $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
|
|
|
- foreach($sql_final as $v){
|
|
|
- if($v['rq']>=$this->year_January()){
|
|
|
- $list['series'][1]['name']=date("Y").'年';
|
|
|
- $list['series'][1]['data'][$j]=$v['jdcs'];
|
|
|
- $j++;
|
|
|
- }else{
|
|
|
- $list['series'][0]['name']= date("Y", strtotime("-1 year")).'年';
|
|
|
- $list['series'][0]['data'][$i]=$v['jdcs'];
|
|
|
- $i++;
|
|
|
+ // 初始化数据
|
|
|
+ $i = 0;
|
|
|
+ $j = 0;
|
|
|
+ $k = 0;
|
|
|
+ $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
|
|
+
|
|
|
+ $currentYear = date("Y"); // 当前年份
|
|
|
+ $previousYear = (int)$currentYear - 1; // 去年
|
|
|
+ $previousTwoYear = (int)$currentYear - 2; // 前年
|
|
|
+
|
|
|
+ // 为三年的数据创建数组,初始值为0
|
|
|
+ $list['series'][0]['name'] = $previousTwoYear . '年'; // 前年
|
|
|
+ $list['series'][0]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
|
|
|
+ $list['series'][1]['name'] = $previousYear . '年'; // 去年
|
|
|
+ $list['series'][1]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
|
|
|
+ $list['series'][2]['name'] = $currentYear . '年'; // 今年
|
|
|
+ $list['series'][2]['data'] = array_fill(0, (int)date("m"), 0); // 初始化到当前月份的数据
|
|
|
+
|
|
|
+ // 遍历查询结果并填充数据
|
|
|
+ foreach ($sql_final as $v) {
|
|
|
+ // 获取年份和月份
|
|
|
+ $year = substr($v['rq'], 0, 4);
|
|
|
+ $month = substr($v['rq'], 5, 2);
|
|
|
+
|
|
|
+ // 如果是前年数据
|
|
|
+ if ($year == $previousTwoYear) {
|
|
|
+ $list['series'][0]['data'][(int)$month - 1] = $v['jdcs'];
|
|
|
+ }
|
|
|
+ // 如果是去年数据
|
|
|
+ if ($year == $previousYear) {
|
|
|
+ $list['series'][1]['data'][(int)$month - 1] = $v['jdcs'];
|
|
|
+ }
|
|
|
+ // 如果是今年数据
|
|
|
+ if ($year == $currentYear) {
|
|
|
+ $list['series'][2]['data'][(int)$month - 1] = $v['jdcs'];
|
|
|
}
|
|
|
}
|
|
|
- $res['status']=0;
|
|
|
- $res['msg']='';
|
|
|
- $res['data']=$list;
|
|
|
+ $res['status'] = 0;
|
|
|
+ $res['msg'] = '';
|
|
|
+ $res['data'] = $list;
|
|
|
$redis->set($redis_key, json_encode($res));
|
|
|
return json_encode($res);
|
|
|
}
|
|
|
@@ -13337,27 +13362,50 @@ class Index extends Api{
|
|
|
DATE_FORMAT(db.rq, '%Y-%m') as rq,
|
|
|
ROUND(sum(db.总计册), 0) as jzcs
|
|
|
")
|
|
|
- ->where("db.RQ >= '{$this->qstart_time()}'
|
|
|
+ ->where("db.RQ >= '{$this->qianstart_time()}'
|
|
|
AND db.RQ <= '{$this->end_time()}' ")
|
|
|
->group("DATE_FORMAT(db.rq, '%Y-%m')")
|
|
|
->select();
|
|
|
- $i=0;
|
|
|
- $j=0;
|
|
|
- $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
|
|
|
- foreach($sql_final as $v){
|
|
|
- if($v['rq']>=$this->year_January()){
|
|
|
- $list['series'][1]['name']= date("Y").'年';
|
|
|
- $list['series'][1]['data'][$j]=$v['jzcs'];
|
|
|
- $j++;
|
|
|
- }else{
|
|
|
- $list['series'][0]['name']= date("Y", strtotime("-1 year")).'年';
|
|
|
- $list['series'][0]['data'][$i]=$v['jzcs'];
|
|
|
- $i++;
|
|
|
+ // 初始化数据
|
|
|
+ $i = 0;
|
|
|
+ $j = 0;
|
|
|
+ $k = 0;
|
|
|
+ $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
|
|
+
|
|
|
+ $currentYear = date("Y"); // 当前年份
|
|
|
+ $previousYear = (int)$currentYear - 1; // 去年
|
|
|
+ $previousTwoYear = (int)$currentYear - 2; // 前年
|
|
|
+
|
|
|
+ // 为三年的数据创建数组,初始值为0
|
|
|
+ $list['series'][0]['name'] = $previousTwoYear . '年'; // 前年
|
|
|
+ $list['series'][0]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
|
|
|
+ $list['series'][1]['name'] = $previousYear . '年'; // 去年
|
|
|
+ $list['series'][1]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
|
|
|
+ $list['series'][2]['name'] = $currentYear . '年'; // 今年
|
|
|
+ $list['series'][2]['data'] = array_fill(0, (int)date("m"), 0); // 初始化到当前月份的数据
|
|
|
+
|
|
|
+ // 遍历查询结果并填充数据
|
|
|
+ foreach ($sql_final as $v) {
|
|
|
+ // 获取年份和月份
|
|
|
+ $year = substr($v['rq'], 0, 4);
|
|
|
+ $month = substr($v['rq'], 5, 2);
|
|
|
+
|
|
|
+ // 如果是前年数据
|
|
|
+ if ($year == $previousTwoYear) {
|
|
|
+ $list['series'][0]['data'][(int)$month - 1] = $v['jzcs'];
|
|
|
+ }
|
|
|
+ // 如果是去年数据
|
|
|
+ if ($year == $previousYear) {
|
|
|
+ $list['series'][1]['data'][(int)$month - 1] = $v['jzcs'];
|
|
|
+ }
|
|
|
+ // 如果是今年数据
|
|
|
+ if ($year == $currentYear) {
|
|
|
+ $list['series'][2]['data'][(int)$month - 1] = $v['jzcs'];
|
|
|
}
|
|
|
}
|
|
|
- $res['status']=0;
|
|
|
- $res['msg']='';
|
|
|
- $res['data']=$list;
|
|
|
+ $res['status'] = 0;
|
|
|
+ $res['msg'] = '';
|
|
|
+ $res['data'] = $list;
|
|
|
$redis->set($redis_key, json_encode($res));
|
|
|
return json_encode($res);
|
|
|
}
|
|
|
@@ -13686,26 +13734,49 @@ class Index extends Api{
|
|
|
DATE_FORMAT(db.rq, '%Y-%m') as rq,
|
|
|
ROUND(sum(db.总计册), 3) as qmcs
|
|
|
")
|
|
|
- ->where("db.rq >= '{$this->qstart_time()}'AND db.rq <= '{$this->end_time()}' ")
|
|
|
+ ->where("db.rq >= '{$this->qianstart_time()}'AND db.rq <= '{$this->end_time()}' ")
|
|
|
->group("DATE_FORMAT(db.rq, '%Y-%m')")
|
|
|
->select();
|
|
|
- $i=0;
|
|
|
- $j=0;
|
|
|
- $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
|
|
|
- foreach($sql_final as $v){
|
|
|
- if($v['rq']>=$this->year_January()){
|
|
|
- $list['series'][1]['name']=date("Y").'年';
|
|
|
- $list['series'][1]['data'][$j]=$v['qmcs'];
|
|
|
- $j++;
|
|
|
- }else{
|
|
|
- $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
|
|
|
- $list['series'][0]['data'][$i]=$v['qmcs'];
|
|
|
- $i++;
|
|
|
+ // 初始化数据
|
|
|
+ $i = 0;
|
|
|
+ $j = 0;
|
|
|
+ $k = 0;
|
|
|
+ $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
|
|
+
|
|
|
+ $currentYear = date("Y"); // 当前年份
|
|
|
+ $previousYear = (int)$currentYear - 1; // 去年
|
|
|
+ $previousTwoYear = (int)$currentYear - 2; // 前年
|
|
|
+
|
|
|
+ // 为三年的数据创建数组,初始值为0
|
|
|
+ $list['series'][0]['name'] = $previousTwoYear . '年'; // 前年
|
|
|
+ $list['series'][0]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
|
|
|
+ $list['series'][1]['name'] = $previousYear . '年'; // 去年
|
|
|
+ $list['series'][1]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
|
|
|
+ $list['series'][2]['name'] = $currentYear . '年'; // 今年
|
|
|
+ $list['series'][2]['data'] = array_fill(0, (int)date("m"), 0); // 初始化到当前月份的数据
|
|
|
+
|
|
|
+ // 遍历查询结果并填充数据
|
|
|
+ foreach ($sql_final as $v) {
|
|
|
+ // 获取年份和月份
|
|
|
+ $year = substr($v['rq'], 0, 4);
|
|
|
+ $month = substr($v['rq'], 5, 2);
|
|
|
+
|
|
|
+ // 如果是前年数据
|
|
|
+ if ($year == $previousTwoYear) {
|
|
|
+ $list['series'][0]['data'][(int)$month - 1] = $v['qmcs'];
|
|
|
+ }
|
|
|
+ // 如果是去年数据
|
|
|
+ if ($year == $previousYear) {
|
|
|
+ $list['series'][1]['data'][(int)$month - 1] = $v['qmcs'];
|
|
|
+ }
|
|
|
+ // 如果是今年数据
|
|
|
+ if ($year == $currentYear) {
|
|
|
+ $list['series'][2]['data'][(int)$month - 1] = $v['qmcs'];
|
|
|
}
|
|
|
}
|
|
|
- $res['status']=0;
|
|
|
- $res['msg']='';
|
|
|
- $res['data']=$list;
|
|
|
+ $res['status'] = 0;
|
|
|
+ $res['msg'] = '';
|
|
|
+ $res['data'] = $list;
|
|
|
$redis->set($redis_key, json_encode($res));
|
|
|
return json_encode($res);
|
|
|
}
|