|
@@ -1287,7 +1287,7 @@ class Lampcontrol extends Base_Controller {
|
|
|
// }
|
|
|
|
|
|
$timezone = $this->Project_model->get_timezone_by_projectid($res['projectid']);
|
|
|
- $res["updatetime"] = date_change($res["updatetime"],8,$timezone['value']);
|
|
|
+ $res["updatetime"] = date_change($res["updatetime"],0,DEF_TIMEZONE);
|
|
|
|
|
|
$data = array(
|
|
|
"lamp_no" => $res["number"],
|
|
@@ -1333,34 +1333,62 @@ class Lampcontrol extends Base_Controller {
|
|
|
// $data['monthly_already_usage'] = round($res['monthly_already_usage'],2);
|
|
|
// }
|
|
|
|
|
|
+ exit(json_result('0000', $this->response['0000'], $data));
|
|
|
+ }elseif ($datatype == 'lamp_info_log') {
|
|
|
+ $fields = "lighteness,status as lampstatus,lampvoltage,lampcurrent,lamppower,lamptemper as temper";
|
|
|
+
|
|
|
+ $res = $this->Lamp_model->get_one(['id'=>$lamp_id],$fields);
|
|
|
+
|
|
|
+ exit(json_result('0000', $this->response['0000'], $data));
|
|
|
+ }elseif ($datatype == 'solar_info_log') {
|
|
|
+ $fields = "solarvoltage,solarcurrent,solarpower";
|
|
|
+
|
|
|
+ $res = $this->Lamp_model->get_one(['id'=>$lamp_id],$fields);
|
|
|
+
|
|
|
+ $res["updatetime"] = date_change($res["updatetime"],0,DEF_TIMEZONE);
|
|
|
+ exit(json_result('0000', $this->response['0000'], $data));
|
|
|
+ }elseif ($datatype == 'battery_info_log') {
|
|
|
+ // $fields = "battstatus,chargestage,battvoltage,chargecurrent,discharcurrent,chargepower,dischargepower,batttemper,electrictotal,electricleft,electricSOC,voltagedaymin,voltagedaymax,daychargeah,daydischarah,daychargemaxpow,daydischarmaxpow,daychargemincurrent,daycharmaxcurrent,daydischargemincurrent,daydischarmaxcurrent,daybattmintemper,daybattmaxtemper";
|
|
|
+ $fields = "*";
|
|
|
+
|
|
|
+ $res = $this->Lamp_model->get_one(['id'=>$lamp_id],$fields);
|
|
|
+
|
|
|
+ $res["updatetime"] = date_change($res["updatetime"],0,DEF_TIMEZONE);
|
|
|
+ exit(json_result('0000', $this->response['0000'], $data));
|
|
|
+ }elseif ($datatype == 'system_info_log') {
|
|
|
+ $fields = "sysvoltage,syscurrent,temper,updatetime,id,number as lampid";
|
|
|
+
|
|
|
+ $res = $this->Lamp_model->get_one(['id'=>$lamp_id],$fields);
|
|
|
+
|
|
|
+ $res["updatetime"] = date_change($res["updatetime"],0,DEF_TIMEZONE);
|
|
|
exit(json_result('0000', $this->response['0000'], $data));
|
|
|
}
|
|
|
- $table_map = array('system_info_log','lamp_info_log','solar_info_log','battery_info_log','electric_info_log','history_info_log');
|
|
|
- $table = in_array($datatype, $table_map) ? $datatype : 'system_info_log';
|
|
|
- $res = $this->Lamp_model->getForInfoLog($lamp_id, $table);
|
|
|
- $lampData = $this->Lamp_model->get_one(['id'=>$lamp_id],'projectid');
|
|
|
- $timezone = $this->Project_model->get_timezone_by_projectid($lampData['projectid']);
|
|
|
- if(!$res){
|
|
|
- exit(json_result('0000', $this->response['0006'], array()));
|
|
|
- }
|
|
|
- if ($table == 'battery_info_log') {
|
|
|
- if (isset($res['daydischargemincurrent'])) {
|
|
|
- $h = floor($res['daydischargemincurrent']/3600);
|
|
|
- $h = $h < 10 ? '0'.$h : $h;
|
|
|
- $i = intval($res['daydischargemincurrent']/60)%60;
|
|
|
- $i = $i < 10 ? '0'.$i : $i;
|
|
|
- $res['daydischargemincurrent'] = $h.':'.$i;
|
|
|
- }
|
|
|
- if (isset($res['daychargemincurrent'])) {
|
|
|
- $h = floor($res['daychargemincurrent']/3600);
|
|
|
- $h = $h < 10 ? '0'.$h : $h;
|
|
|
- $i = intval($res['daychargemincurrent']/60)%60;
|
|
|
- $i = $i < 10 ? '0'.$i : $i;
|
|
|
- $res['daychargemincurrent'] = $h.':'.$i;
|
|
|
- }
|
|
|
- }
|
|
|
- $res["updatetime"] = date_change($res["updatetime"],8,$timezone['value']);
|
|
|
- exit(json_result('0000', $this->response['0000'], $res));
|
|
|
+ // $table_map = array('system_info_log','lamp_info_log','solar_info_log','battery_info_log');
|
|
|
+ // $table = in_array($datatype, $table_map) ? $datatype : 'system_info_log';
|
|
|
+ // $res = $this->Lamp_model->getForInfoLog($lamp_id, $table);
|
|
|
+ // $lampData = $this->Lamp_model->get_one(['id'=>$lamp_id],'projectid');
|
|
|
+ // $timezone = $this->Project_model->get_timezone_by_projectid($lampData['projectid']);
|
|
|
+ // if(!$res){
|
|
|
+ // exit(json_result('0000', $this->response['0006'], array()));
|
|
|
+ // }
|
|
|
+ // if ($table == 'battery_info_log') {
|
|
|
+ // if (isset($res['daydischargemincurrent'])) {
|
|
|
+ // $h = floor($res['daydischargemincurrent']/3600);
|
|
|
+ // $h = $h < 10 ? '0'.$h : $h;
|
|
|
+ // $i = intval($res['daydischargemincurrent']/60)%60;
|
|
|
+ // $i = $i < 10 ? '0'.$i : $i;
|
|
|
+ // $res['daydischargemincurrent'] = $h.':'.$i;
|
|
|
+ // }
|
|
|
+ // if (isset($res['daychargemincurrent'])) {
|
|
|
+ // $h = floor($res['daychargemincurrent']/3600);
|
|
|
+ // $h = $h < 10 ? '0'.$h : $h;
|
|
|
+ // $i = intval($res['daychargemincurrent']/60)%60;
|
|
|
+ // $i = $i < 10 ? '0'.$i : $i;
|
|
|
+ // $res['daychargemincurrent'] = $h.':'.$i;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // $res["updatetime"] = date_change($res["updatetime"],8,$timezone['value']);
|
|
|
+ // exit(json_result('0000', $this->response['0000'], $res));
|
|
|
}
|
|
|
|
|
|
// 灯控历史数据
|