|
@@ -147,6 +147,7 @@ class Lampcontrol extends Base_Controller {
|
|
$join[] = ['table'=>'company as C1', 'cond'=>'L.po = C1.id', 'type'=>'left'];
|
|
$join[] = ['table'=>'company as C1', 'cond'=>'L.po = C1.id', 'type'=>'left'];
|
|
$join[] = ['table'=>'company as C2', 'cond'=>'L.supplier = C2.id', 'type'=>'left'];
|
|
$join[] = ['table'=>'company as C2', 'cond'=>'L.supplier = C2.id', 'type'=>'left'];
|
|
$join[] = ['table'=>'company as C3', 'cond'=>'L.manu = C3.id', 'type'=>'left'];
|
|
$join[] = ['table'=>'company as C3', 'cond'=>'L.manu = C3.id', 'type'=>'left'];
|
|
|
|
+ $join[] = ['table'=>'model_info as MI', 'cond'=>'L.model = MI.id', 'type'=>'left'];
|
|
// $join[] = ['table'=>'(select t1.* from alarm_info_log t1, (select lampid, max(updatetime) as maxtime from alarm_info_log group by lampid) t2 where t1.lampid = t2.lampid and t1.updatetime = t2.maxtime) as AI', 'cond'=>'L.id = AI.lampid', 'type'=>'left'];
|
|
// $join[] = ['table'=>'(select t1.* from alarm_info_log t1, (select lampid, max(updatetime) as maxtime from alarm_info_log group by lampid) t2 where t1.lampid = t2.lampid and t1.updatetime = t2.maxtime) as AI', 'cond'=>'L.id = AI.lampid', 'type'=>'left'];
|
|
$join[] = ['table'=>'(select t1.* from warning_info_log t1, (select lampid, max(updatetime) as maxtime from warning_info_log group by lampid) t2 where t1.lampid = t2.lampid and t1.updatetime = t2.maxtime) as AI', 'cond'=>'L.id = AI.lampid', 'type'=>'left'];
|
|
$join[] = ['table'=>'(select t1.* from warning_info_log t1, (select lampid, max(updatetime) as maxtime from warning_info_log group by lampid) t2 where t1.lampid = t2.lampid and t1.updatetime = t2.maxtime) as AI', 'cond'=>'L.id = AI.lampid', 'type'=>'left'];
|
|
$join[] = ['table'=>'(select t1.* from history_info_log t1, (select lampid, max(updatetime) as maxtime from history_info_log group by lampid) t2 where t1.lampid = t2.lampid and t1.updatetime = t2.maxtime) as HI', 'cond'=>'L.id = HI.lampid', 'type'=>'left'];
|
|
$join[] = ['table'=>'(select t1.* from history_info_log t1, (select lampid, max(updatetime) as maxtime from history_info_log group by lampid) t2 where t1.lampid = t2.lampid and t1.updatetime = t2.maxtime) as HI', 'cond'=>'L.id = HI.lampid', 'type'=>'left'];
|
|
@@ -412,7 +413,9 @@ class Lampcontrol extends Base_Controller {
|
|
// unset($filter['page']);
|
|
// unset($filter['page']);
|
|
// unset($filter['count']);
|
|
// unset($filter['count']);
|
|
$countWheret1 = implode(' AND ', $countWhere);
|
|
$countWheret1 = implode(' AND ', $countWhere);
|
|
|
|
+ // var_dump($countWheret1);die;
|
|
$data['total_data']['install_num'] = $this->Lamp_model->get_count($countWheret1);
|
|
$data['total_data']['install_num'] = $this->Lamp_model->get_count($countWheret1);
|
|
|
|
+ // var_dump($data['total_data']['install_num']);die;
|
|
$countWheret = $countWhere;
|
|
$countWheret = $countWhere;
|
|
$countWheret[] = 'lighteness > 0';
|
|
$countWheret[] = 'lighteness > 0';
|
|
$countWheret[] = 'netstatus = 1';
|
|
$countWheret[] = 'netstatus = 1';
|
|
@@ -1506,10 +1509,17 @@ class Lampcontrol extends Base_Controller {
|
|
|
|
|
|
exit(json_result('0000', $this->response['0000'], $data));
|
|
exit(json_result('0000', $this->response['0000'], $data));
|
|
}elseif ($datatype == 'lamp_info_log') {
|
|
}elseif ($datatype == 'lamp_info_log') {
|
|
- $fields = "lighteness,lampvoltage,lampcurrent,lamppower,updatetime";
|
|
|
|
|
|
+ $fields = "lighteness,lampvoltage,lampcurrent,lamppower,updatetime,model";
|
|
|
|
|
|
$res = $this->Lamp_model->get_one(['id'=>$lamp_id],$fields);
|
|
$res = $this->Lamp_model->get_one(['id'=>$lamp_id],$fields);
|
|
$res["updatetime"] = date_change($res["updatetime"],0,DEF_TIMEZONE);
|
|
$res["updatetime"] = date_change($res["updatetime"],0,DEF_TIMEZONE);
|
|
|
|
+
|
|
|
|
+ if (!empty($res['model'])) {
|
|
|
|
+ $model = $this->db->query('select name from model_info where id = '.$res['model'])->row_array();
|
|
|
|
+ $res['model'] = empty($model['name']) ? '' : $model['name'];
|
|
|
|
+ }else{
|
|
|
|
+ $res['model'] = '';
|
|
|
|
+ }
|
|
exit(json_result('0000', $this->response['0000'], $res));
|
|
exit(json_result('0000', $this->response['0000'], $res));
|
|
}elseif ($datatype == 'solar_info_log') {
|
|
}elseif ($datatype == 'solar_info_log') {
|
|
$fields = "solarvoltage,solarcurrent,boardpower as solarpower,updatetime";
|
|
$fields = "solarvoltage,solarcurrent,boardpower as solarpower,updatetime";
|