$proName[] = $value['name']; $proScore[] = $value['score']; } foreach ($data['complaints'] as $key => $value) { $comName[] = $value['name']; $comScore[] = $value['score']; } $data['provinces'] = implode(',', $proScore); $data['complaints'] = implode(',', $comScore); // foreach ($province as $key => $value) { // $data['provinceMap'][$key] = $value['name']; // } $data['provinceString'] = '"' . implode('","', $proName) . '"'; $data['provinceString2'] = '"' . implode('","', $comName) . '"'; // } $data['province'] = Info::getProvince(false); $data['complaintType'] = Info::getComplaintType('complaint_type', false); $data['questionType'][1] = Info::getQuestionType(1, 'question_type', true); $data['questionType'][2] = Info::getQuestionType(2, 'question_type', true); $data['questionType'][3] = Info::getQuestionType(3, 'question_type', true); $data['complaintLevel'] = Info::getComplaintLevel('complaint_level', false); $data['bussLine'] = Info::getBussLine('buss_type', false); // var_dump($data['bussLine']); //导出excel下载 if ($_GET['download'] == 1) { $downloadStr = array_to_string($data); //var_dump($data);exit; Common::exportExcel($downloadStr, 'black_list'); exit; } $page_html = Pagination::showPager("custom_analyze.php?class_name={$class_name}&user_name={$user_name}&start_date={$start_date}&end_date={$end_date}", $page_no, PAGE_SIZE, $row_count);
public static function complaintsAnalayzeType($param) { $flag = isset($param['flag']) ? $param['flag'] : 0; unset($param['flag']); $condition = array(); $year = date('Y'); $db = self::__instance(); if ($param['start_date']) { $year = substr($param['start_date'], 0, 4); $start = $param['start_date']; $condition["AND"]['month[>=]'] = strtotime($param['start_date'] . '-01'); $condition["AND"]['month[<]'] = strtotime($param['start_date'] . '-01 +1 month -1 day'); unset($param['start_date'], $param['end_date']); } $start = isset($start) ? $start : $year; if (empty($param)) { $param = array(); } foreach ($param as $key => $value) { $condition["AND"][$key] = $value; } $condition['GROUP'] = 'product_type'; $r = $db->select('co_complaints', 'sum(complaint_num) as num,product_type', $condition); $province = Info::getProvince(); foreach ($province as $key => $value) { $tmpProvince['province'][$value['id']] = 0; $tmpProvince['complaints'][$value['id']] = 0; } // var_dump($r); foreach ($r as $key => $value) { // if($flag) // $tmpProvince['province'][$value['province_id']] = 0; // else // $tmpProvince['province'][$value['province_id']] = $value['num']; $tmp['name'][$key] = $value['product_type']; $tmp['num'][$key] = round($value['num']); // $cos = $db->get('co_income','sum(province_income) as cos',array('province_id'=>$value['province_id']))['cos']/1000000; // if($cos) // $tmpProvince['complaints'][$value['province_id']] = $value['num']/$cos; // if($r[$key]['cos'] && $flag) // $tmpProvince['province'][$value['province_id']] = $value['num']/$r[$key]['cos']; } return $tmp; }