|
@@ -243,8 +243,10 @@ class Home extends Base_Controller {
|
|
|
$list = $this->db->query($query)->result_array();
|
|
|
if (empty($list)) exit(json_result('0000',$this->response['0000'],array('list'=>array())));
|
|
|
$temp = array();
|
|
|
+ $allDev = array_sum(array_column($list, 'total'));
|
|
|
foreach ($list as $key => $value) {
|
|
|
- $temp2 = array('name'=>$value['name'],'total'=>$value['total'],'onlineCount'=>0,'offlineCount'=>0,'faultCount'=>0);
|
|
|
+ $totalPer = empty($allDev) ? '0%' : round($value['total']/$allDev*100,2).'%';
|
|
|
+ $temp2 = array('name'=>$value['name'],'total'=>$value['total'],'onlineCount'=>0,'offlineCount'=>0,'faultCount'=>0,'totalPer'=>$totalPer);
|
|
|
$temp[$value['id']] = $temp2;
|
|
|
}
|
|
|
$companyArr = array_unique(array_column($list, 'id'));
|