public function handle_request_internal() { $req = APF::get_instance()->get_request(); $res = APF::get_instance()->get_response(); $params = $req->get_parameters(); $pro = $params['pro'] ? $params['pro'] : 0; $id = $params['cid'] ? $params['cid'] : 0; if (isset($params['edit_submit'])) { $comp_id = $params['comp_id']; $input_arr = array('name' => $params['comp_name'], 'owner' => $params['comp_owner'], 'is_disabled' => $params['disable'], 'is_deleted' => $params['delete']); $ret = Bll_DdComponentBiz::get_instance()->modify_component($comp_id, $input_arr); $url = Admin_CompViewController::build_uri() . "?pro=" . $pro; $res->redirect($url); } else { if ($id != 0 && $pro != 0) { $depart = Bll_DdCommonBiz::get_instance()->get_name_by_id($pro); $component = Bll_DdComponentBiz::get_instance()->get_component_by_id($id); } $all_users = Bll_UserBiz::get_instance()->get_all_valid_users(); $tmp_all = array(); foreach ($all_users as $key => $value) { $tmp_all[$key] = $value->user_name; } $all_users = json_encode($tmp_all); $req->set_attribute('depart', $depart); $req->set_attribute('pro', $pro); $req->set_attribute('component', $component); $req->set_attribute('all_users', $all_users); return 'Admin_CompEdit'; } }
public static function &get_instance() { if (!self::$instance) { self::$instance = new self(); } return self::$instance; }
public function handle_request_internal() { $req = APF::get_instance()->get_request(); $params = $req->get_parameters(); $department = $params['department']; $components = Bll_DdComponentBiz::get_instance()->get_components($department); return $components; }
public function handle_request_internal() { $req = APF::get_instance()->get_request(); $res = APF::get_instance()->get_response(); $params = $req->get_parameters(); $pro = $params['pro'] ? $params['pro'] : 1; $tab_info = array(1 => array('name' => 'DB-RT', 'click' => false), 2 => array('name' => 'SA-RT', 'click' => false)); $tab_info[$pro]['click'] = true; $depart_value_id = array('1' => '47', '2' => '48'); $pro_id = $depart_value_id[$pro]; $components = Bll_DdComponentBiz::get_instance()->get_components($pro_id); $time_arr = array(); for ($i = 5; $i >= 0; $i--) { if ($i == 0) { $time = strtotime('now'); } else { $time = strtotime('-' . $i . ' month'); } $begin = date('Y-m-01 00:00:00', $time); $end = date('Y-m-t 23:59:59', $time); $month = date('Y-m', $time); $time_arr[$month] = array('begin' => $begin, 'end' => $end); } $data_init = array(); foreach ($time_arr as $key => $row) { $tickets = Bll_TicketBiz::get_instance()->get_ticket_list_by_month($row['begin'], $row['end'], $pro_id); foreach ($tickets as $t_row) { $data_init[$t_row->component][$key][] = $t_row; } } $data_sec = array(); foreach ($time_arr as $time_key => $row) { $data_sec[$time_key]['month'] = $time_key; foreach ($components as $comp) { $data_sec[$time_key][$comp->name] = isset($data_init[$comp->name][$time_key]) ? count($data_init[$comp->name][$time_key]) : 0; } } $data = array(); foreach ($data_sec as $row) { $data[] = $row; } $req->set_attribute('tab_info', $tab_info); $req->set_attribute('data', $data); return 'Report_RtReport'; }
public function handle_request_internal() { $req = APF::get_instance()->get_request(); $res = APF::get_instance()->get_response(); $params = $req->get_parameters(); $pro = $params['pro'] ? $params['pro'] : 0; if (isset($params['add_submit'])) { $input_arr = array('department' => $params['department'], 'name' => $params['comp_name'], 'owner' => $params['comp_owner'], 'is_disabled' => $params['disable'], 'is_deleted' => $params['delete']); $ret = Bll_DdComponentBiz::get_instance()->add_by_admin($input_arr); $url = Admin_CompViewController::build_uri() . "?pro=" . $pro; $res->redirect($url); } else { $depart = Bll_DdCommonBiz::get_instance()->get_departments_new(); $req->set_attribute('depart', $depart); $req->set_attribute('pro', $pro); return 'Admin_CompAdd'; } }
public function handle_request_internal() { $req = APF::get_instance()->get_request(); $params = $req->get_parameters(); if ($params['department'] && $params['name'] && $params['owner']) { $department = $params['department']; $name = $params['name']; $owner = $params['owner']; $int = Bll_DdComponentBiz::get_instance()->add($department, $name, $owner); if ($int) { $req->set_attribute('suc', '增加成功!'); } else { $req->set_attribute('suc', '增加失败!'); } } $departments = Bll_DdCommonBiz::get_instance()->get_departments(); $req->set_attribute('departments', $departments); return 'Ddcomponent_Add'; }
//1=>新增线上bug if (!$count_mobile_created) { echo "insert count_id_mobile created data error"; } $count_pc_closed = Bll_ReportWeekOnlineNewBiz::get_instance()->insert_online_all_for_product_line($time_arr, 'pc', 'closed', 0); //!1=>已关闭线上bug if (!$count_pc_closed) { echo "insert count_id_pc closed data error"; } $count_mobile_closed = Bll_ReportWeekOnlineNewBiz::get_instance()->insert_online_all_for_product_line($time_arr, 'mobile_web', 'closed', 0); //!1=>已关闭线上bug if (!$count_mobile_closed) { echo "insert count_id_pc closed data error"; } //获取用户端的component $components = Bll_DdComponentBiz::get_instance()->get_components(51); //51=>用户端 $comp_id_value = array(); foreach ($components as $component) { $comp_id_value[$component->int] = $component->int; } $count_pc_component = Bll_ReportWeekOnlineNewBiz::get_instance()->insert_online_count_for_product_line($time_arr, 'pc', 'component', $comp_id_value, 1); //1=>新增线上bug if (!$count_pc_component) { echo "insert count_id_pc component data error"; } $count_mobile_component = Bll_ReportWeekOnlineNewBiz::get_instance()->insert_online_count_for_product_line($time_arr, 'mobile_web', 'component', $comp_id_value, 1); if (!$count_mobile_component) { echo "insert count_id_moblie resolution data error"; } $count_pc_reason = Bll_ReportWeekOnlineNewBiz::get_instance()->insert_online_count_for_product_line($time_arr, 'pc', 'reason', $reason_ids, 0);
protected function set_filter_fields() { $_rows = Bll_DdCommonBiz::get_instance()->get_departments_new(); $departments = array(); foreach ($_rows as $_row) { $departments[$_row->id] = $_row->name; } $_rows = Bll_DdCommonBiz::get_instance()->get_environments(); $environments = array(); foreach ($_rows as $_row) { $environments[$_row->id] = $_row->name; } $_rows = Bll_DdCommonBiz::get_instance()->get_reasons(); $reasons = array(); foreach ($_rows as $_row) { $reasons[$_row->id] = $_row->name; } $_rows = Bll_DdCommonBiz::get_instance()->get_resolutions(); $resolutions = array('0' => 'None'); foreach ($_rows as $_row) { $resolutions[$_row->id] = $_row->name; } $_rows = Bll_DdCommonBiz::get_instance()->get_prioritys(); $prioritys = array(); foreach ($_rows as $_row) { $prioritys[$_row->id] = $_row->name; } $_rows = Bll_DdComponentBiz::get_instance()->get_all_components(); $components = array(); foreach ($_rows as $_row) { $components[$_row->int] = $_row->name; } $_rows = Ticket_Status::get_all_status(); $statuses = array(); foreach ($_rows as $_row) { $statuses[$_row] = $_row; } $fields = array('assigned_qa' => array('type' => 'input', 'operates' => array('is', 'is not')), 'component' => array('type' => 'input', 'operates' => array('is', 'is not')), 'created_at' => array('type' => 'dateinput'), 'closed_at' => array('type' => 'dateinput'), 'department' => array('type' => 'checkbox', 'options' => $departments), 'environment' => array('type' => 'checkbox', 'options' => $environments), 'is_occasional' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No')), 'is_regression' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No')), 'keyword' => array('type' => 'input', 'operates' => array('ticket title', 'ticket description')), 'owner' => array('type' => 'input', 'operates' => array('is', 'is not')), 'person_liable' => array('type' => 'input', 'operates' => array('is', 'is not')), 'pmt_id' => array('type' => 'input', 'operates' => array('is', 'is not')), 'priority' => array('type' => 'checkbox', 'options' => $prioritys), 'reason' => array('type' => 'checkbox', 'options' => $reasons), 'reporter' => array('type' => 'input', 'operates' => array('is', 'is not')), 'resolution' => array('type' => 'checkbox', 'options' => $resolutions), 'status' => array('type' => 'checkbox', 'options' => $statuses), 'updated_at' => array('type' => 'dateinput'), 'reject' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No')), 'reopen' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No'))); $all_users = Bll_UserBiz::get_instance()->get_all_users(); $tmp_all = array(); foreach ($all_users as $key => $value) { $tmp_all[$key] = $value->whole_name; } $this->fields = $fields; }
$reso_id_value[$resolution->id] = $resolution->value; } $departments = Bll_DdCommonBiz::get_instance()->get_departments_new(); foreach ($departments as $depart) { //all counts $tickets_all = Bll_TicketBiz::get_instance()->get_count_online_by_month($begin, $end, 'all', $depart->id); if ($tickets_all) { $count = count($tickets_all); } else { $count = 0; } $current_time = date("Y-m-d H:i:s"); $input_arr = array('month' => $month, 'department' => $depart->value, 'type_key' => 'all', 'type_value' => '0', 'count' => $count, 'created_at' => $current_time); $count_id = Bll_ReportMonthOnlineBiz::get_instance()->insert_count_data($input_arr); //component counts $components = Bll_DdComponentBiz::get_instance()->get_components($depart->id); $comp_id_value = array(); foreach ($components as $component) { $comp_id_value[$component->int] = $component->value; } $tickets_component = array(); foreach ($tickets_all as $tickets_all_row) { if ($tickets_all_row->component) { $tickets_component[$comp_id_value[$tickets_all_row->component]][] = $tickets_all_row; } } foreach ($comp_id_value as $comp_v) { $count = isset($tickets_component[$comp_v]) ? count($tickets_component[$comp_v]) : 0; $input_arr = array('month' => $month, 'department' => $depart->value, 'type_key' => 'component', 'type_value' => $comp_v, 'count' => $count, 'created_at' => $current_time); $count_id = Bll_ReportMonthOnlineBiz::get_instance()->insert_count_data($input_arr); }
$input_arr = array("name" => "客户管理-销售资源"); } else { if ($com->name == "三网-客户管理CC中心") { $input_arr = array("name" => "CC中心"); } else { if ($com->name == "三网-其他") { $input_arr = array("name" => "其他"); } else { if ($com->name == "三网-客户管理佣金系统") { $input_arr = array("name" => "销售管理-销售业绩"); } else { if ($com->name == "三网-销售管理场景化") { $input_arr = array("name" => "客户管理-行动量"); } else { if ($com->name == "移动-场景化") { $input_arr = array("name" => "移动-场景化"); } } } } } } } } } } } } } Bll_DdComponentBiz::get_instance()->modify_component($com->int, $input_arr); }
public function process_solr_field($tickets) { $common_ids = array(); $component_ids = array(); foreach ($tickets as $ticket) { $common_ids[] = $ticket->priority; $common_ids[] = $ticket->emergency; $common_ids[] = $ticket->environment; $common_ids[] = $ticket->department; $common_ids[] = $ticket->resolution; $common_ids[] = $ticket->reason; $component_ids[] = $ticket->component; } $common_names = Bll_DdCommonBiz::get_instance()->get_names_by_ids($common_ids); $component_names = Bll_DdComponentBiz::get_instance()->get_names_by_ids($component_ids); foreach ($tickets as $ticket) { $ticket->priority = $common_names[$ticket->priority]; $ticket->emergency = $common_names[$ticket->emergency]; $ticket->environment = $common_names[$ticket->environment]; $ticket->department = $common_names[$ticket->department]; $ticket->component = $component_names[$ticket->component]; if ($ticket->resolution == 'Fixed') { $ticket->resolution = $ticket->resolution; } else { $ticket->resolution = $common_names[$ticket->resolution]; } $ticket->reason = $common_names[$ticket->reason]; } return $tickets; }
<?php apf_require_class('Bll_TicketBiz'); apf_require_class('Bll_ReportDayOnlineOwnerBiz'); apf_require_class('Bll_DdCommonBiz'); apf_require_class('Bll_UserBiz'); $owner = Bll_DdComponentBiz::get_instance()->get_all_blong('blongto'); $oneday = 86400 * 0; $whichday = strtotime('now') - $oneday; $begin = date('Y-m-d 00:00:00', $whichday); $end = date('Y-m-d 23:59:59', $whichday); $day = date('Y-m-d', $whichday); foreach ($owner as $key => $value) { $count = Bll_TicketBiz::get_instance()->get_count_by_function($begin, $end, $value); $owner[$key] = $count; } $user = array_keys($owner); $userName = Bll_UserBiz::get_instance()->get_chinesenames_by_ids($user); $input_arr = array(); foreach ($userName as $userid => $username) { $input_arr['day'] = $day; $input_arr['owner'] = $username; $input_arr['count'] = $owner[$userid] ? $owner[$userid] : 0; Bll_ReportDayOnlineOwnerBiz::get_instance()->insert_count_data($input_arr); }
protected function set_filter_fields() { $_rows = Bll_DdCommonBiz::get_instance()->get_departments_new(); $departments = array(); foreach ($_rows as $_row) { $departments[$_row->id] = $_row->name; } $this->request->set_attribute('departments', $departments); $_rows = Bll_DdCommonBiz::get_instance()->get_environments(); $environments = array(); foreach ($_rows as $_row) { $environments[$_row->id] = $_row->name; } $_rows = Bll_DdCommonBiz::get_instance()->get_reasons(); $reasons = array(); foreach ($_rows as $_row) { $reasons[$_row->id] = $_row->name; } $_rows = Bll_DdCommonBiz::get_instance()->get_resolutions(); $resolutions = array('0' => 'None'); foreach ($_rows as $_row) { $resolutions[$_row->id] = $_row->name; } $_rows = Bll_DdCommonBiz::get_instance()->get_prioritys(); $prioritys = array(); foreach ($_rows as $_row) { $prioritys[$_row->id] = $_row->name; } $_rows = Bll_DdComponentBiz::get_instance()->get_all_components(); $components = array(); foreach ($_rows as $_row) { $components[$_row->int] = $_row->name; } $_rows = Ticket_Status::get_all_status(); $statuses = array(); foreach ($_rows as $_row) { $statuses[$_row] = $_row; } $fields = array('assigned_qa' => array('type' => 'input', 'operates' => array('is', 'is not')), 'component' => array('type' => 'input', 'operates' => array('is', 'is not')), 'created_at' => array('type' => 'dateinput'), 'closed_at' => array('type' => 'dateinput'), 'department' => array('type' => 'checkbox', 'options' => $departments), 'environment' => array('type' => 'checkbox', 'options' => $environments), 'is_occasional' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No')), 'is_regression' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No')), 'keyword' => array('type' => 'input', 'operates' => array('ticket title', 'ticket description')), 'owner' => array('type' => 'input', 'operates' => array('is', 'is not')), 'person_liable' => array('type' => 'input', 'operates' => array('is', 'is not')), 'pmt_id' => array('type' => 'input', 'operates' => array('is', 'is not')), 'priority' => array('type' => 'checkbox', 'options' => $prioritys), 'reason' => array('type' => 'checkbox', 'options' => $reasons), 'reporter' => array('type' => 'input', 'operates' => array('is', 'is not')), 'resolution' => array('type' => 'checkbox', 'options' => $resolutions), 'status' => array('type' => 'checkbox', 'options' => $statuses), 'updated_at' => array('type' => 'dateinput'), 'reject' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No')), 'reopen' => array('type' => 'checkbox', 'options' => array('1' => 'Yes', '0' => 'No'))); $column = array('1' => array('id' => 'owner', 'value' => 'Owner', 'check' => '1'), '2' => array('id' => 'priority', 'value' => 'Priority', 'check' => '1'), '3' => array('id' => 'component', 'value' => 'Component', 'check' => '1'), '4' => array('id' => 'pmt_id', 'value' => 'PMT ID', 'check' => '1'), '5' => array('id' => 'environment', 'value' => 'Environment', 'check' => '1'), '6' => array('id' => 'created_at', 'value' => 'Created Time', 'check' => '1'), '7' => array('id' => 'updated_at', 'value' => 'Last Updated', 'check' => '1'), '8' => array('id' => 'status', 'value' => 'Status', 'check' => '1'), '9' => array('id' => 'assigned_qa', 'value' => 'Assigned QA', 'check' => '0'), '10' => array('id' => 'reporter', 'value' => 'Reporter', 'check' => '0'), '11' => array('id' => 'resolution', 'value' => 'Resolution', 'check' => '0'), '12' => array('id' => 'reason', 'value' => 'Reason', 'check' => '0'), '13' => array('id' => 'person_liable', 'value' => 'Person Liable', 'check' => '0'), '14' => array('id' => 'is_regression', 'value' => 'Is Regression', 'check' => '0'), '15' => array('id' => 'is_occasional', 'value' => 'Is Occasional', 'check' => '0'), '16' => array('id' => 'reason_detail', 'value' => 'Reason Detail', 'check' => '0'), '17' => array('id' => 'description', 'value' => 'Description', 'check' => '0')); $all_users = Bll_UserBiz::get_instance()->get_all_users(); $tmp_all = array(); foreach ($all_users as $key => $value) { $tmp_all[$key] = $value->whole_name; } $all_users = json_encode($tmp_all); $this->fields = $fields; $this->request->set_attribute('users', $all_users); $this->request->set_attribute('fields', $fields); $this->request->set_attribute('column', $column); }
public function handle_request_internal() { $req = APF::get_instance()->get_request(); $res = APF::get_instance()->get_response(); $ticket_id = $req->get_parameter('ticket_id'); $error = $req->get_parameter('error'); $user_id = $req->get_user_id(); $user_role = Bll_RoleBiz::get_instance()->get_user_role($user_id); $ticket = Bll_TicketBiz::get_instance()->get_detail($ticket_id); if (empty($ticket)) { $location = Home_IndexController::build_uri(); $res->redirect($location); } //custom_detail $custom_detail = Bll_TicketColumnDetailBiz::get_instance()->get_ticket_custom($ticket_id); $custom_all = Bll_TicketColumnDetailBiz::get_instance()->get_all_custom($ticket_id); $ticket_before_md5 = md5(json_encode($ticket)); $ticket->reporter = Bll_UserBiz::get_instance()->get_wholename_by_username($ticket->reporter); $ticket->owner = Bll_UserBiz::get_instance()->get_wholename_by_username($ticket->owner); $ticket->assigned_qa = Bll_UserBiz::get_instance()->get_wholename_by_username($ticket->assigned_qa); $ticket_log = Bll_TicketLogBiz::get_instance()->get_log($ticket_id); $ticket_cc_arr = Bll_TicketCcBiz::get_instance()->get_ticket_cc($ticket_id); $cc_tmp = array(); foreach ($ticket_cc_arr as $key => $ticket_cc) { if (Util_StringUtils::is_email($ticket_cc->cc_to)) { $cc_tmp[] = $ticket_cc->cc_to; } else { $cc_tmp[] = Bll_UserBiz::get_instance()->get_wholename_by_username($ticket_cc->cc_to); } } $ticket_cc_str = implode(";", $cc_tmp); $current_time = date("Y-m-d H:i:s"); $ticket_log_process = array(); foreach ($ticket_log as $key => $log) { if ($ticket_log[$key]->field == "component") { if (ctype_digit($ticket_log[$key]->oldvalue)) { $ticket_log[$key]->oldvalue = Bll_TicketBiz::get_instance()->get_component_name($ticket_log[$key]->oldvalue); } if (ctype_digit($ticket_log[$key]->newvalue)) { $ticket_log[$key]->newvalue = Bll_TicketBiz::get_instance()->get_component_name($ticket_log[$key]->newvalue); } } else { if ($ticket_log[$key]->field == "department") { if (ctype_digit($ticket_log[$key]->oldvalue)) { $ticket_log[$key]->oldvalue = Bll_TicketBiz::get_instance()->get_common_name($ticket_log[$key]->oldvalue); } if (ctype_digit($ticket_log[$key]->newvalue)) { $ticket_log[$key]->newvalue = Bll_TicketBiz::get_instance()->get_common_name($ticket_log[$key]->newvalue); } } else { if ($ticket_log[$key]->field == "ticket" && $ticket_log[$key]->oldvalue == "null") { $ticket_log[$key]->newvalue = "new"; } } } $ticket_log_process[$log->created_at][] = $log; } $log_time = array(); foreach ($ticket_log_process as $key => $log) { /* * within 24h show xxx hours ago * mt 24h lt 7days show xx days ago * mt 7days lt 30days show xx weeks ago * mt 30days show xx months ago * floor((strtotime($current_time)-strtotime($log->created_at))/86400) */ $second = floor(strtotime($current_time) - strtotime($key)); $minute = floor((strtotime($current_time) - strtotime($key)) / 60); $hour = floor((strtotime($current_time) - strtotime($key)) / 3600); $day = floor((strtotime($current_time) - strtotime($key)) / 86400); $week = floor((strtotime($current_time) - strtotime($key)) / 604800); $month = floor((strtotime($current_time) - strtotime($key)) / 2592000); if ($second < 60) { $log_time[$key] = $second . ' seconds ago '; } else { if ($minute < 60) { $log_time[$key] = $minute . ' minutes ago '; } else { if ($hour < 24) { $log_time[$key] = $hour . ' hours ago '; } else { if ($hour >= 24 && $hour < 168) { $log_time[$key] = $day . ' days ago '; } else { if ($hour >= 168 && $hour < 720) { $log_time[$key] = $week . ' weeks ago '; } else { if ($hour >= 720) { $log_time[$key] = $month . ' months ago '; } } } } } } } $parent = Bll_TicketRelationBiz::get_instance()->find_root_by_parent($ticket_id); if ($parent) { $parent_id = $parent->parent_ticket_id; } else { $parent_id = "0"; } $son = Bll_TicketRelationBiz::get_instance()->find_son_bugs_of_parent($ticket_id); if (empty($son)) { $son_id = "0"; } else { $son_id = $son[0]->ticket_id; } $ticket_status = Ticket_Status::get_status($ticket); $actions = $ticket_status->get_available_actions($user_role, $ticket->environment); $resolutions = Bll_DdCommonBiz::get_instance()->get_resolutions(); //start..... $all_users = Bll_UserBiz::get_instance()->get_all_valid_users(); $tmp_all = array(); foreach ($all_users as $key => $value) { $tmp_all[$key] = $value->whole_name; } $all_users = json_encode($tmp_all); $dev_users = Bll_UserBiz::get_instance()->get_dev_users(); $tmp_dev = array(); foreach ($dev_users as $key => $value) { $tmp_dev[$key] = $value->whole_name; } $dev_users = json_encode($tmp_dev); $qa_users = Bll_UserBiz::get_instance()->get_qa_users(); $admin_users = Bll_UserBiz::get_instance()->get_admins(); $qa_admin_users = array_merge($qa_users, $admin_users); $tmp_qa = array(); foreach ($qa_admin_users as $key => $value) { $tmp_qa[$key] = $value->whole_name; } $qa_admin_users = json_encode($tmp_qa); //end..... $reasons = Bll_DdCommonBiz::get_instance()->get_reasons(); $files = Bll_AttachmentBiz::get_instance()->get_file_by_ticket_id($ticket_id); if ($files) { foreach ($files as $file) { $file_link = Bll_AttachmentBiz::get_instance()->get_file_link_by_hash($file->fetch_hash); $file->fetch_hash = $file_link; } } $prioritys = Bll_DdCommonBiz::get_instance()->get_prioritys(); $emergencies = Bll_DdCommonBiz::get_instance()->get_emergencies(); $environments = Bll_DdCommonBiz::get_instance()->get_environments(); $departments = Bll_DdCommonBiz::get_instance()->get_departments_new(); $department_id = Bll_DdCommonBiz::get_instance()->get_department_id_by_name($ticket->department); $rel_components = Bll_DdComponentBiz::get_instance()->get_components($department_id->id); $req->set_attribute('user_id', $user_id); $req->set_attribute('files', $files); $req->set_attribute('prioritys', $prioritys); $req->set_attribute('emergencies', $emergencies); $req->set_attribute('departments', $departments); $req->set_attribute('rel_components', $rel_components); $req->set_attribute('environments', $environments); $req->set_attribute('reasons', $reasons); $req->set_attribute('resolutions', $resolutions); $req->set_attribute('ticket', $ticket); $req->set_attribute('ticket_cc_str', $ticket_cc_str); $req->set_attribute('ticket_logs', $ticket_log_process); $req->set_attribute('log_time', $log_time); $req->set_attribute('actions', $actions); $req->set_attribute('all_users', $all_users); $req->set_attribute('dev_users', $dev_users); $req->set_attribute('qa_admin_users', $qa_admin_users); $req->set_attribute('ticket_before_md5', $ticket_before_md5); $req->set_attribute('parent_id', $parent_id); $req->set_attribute('son_id', $son_id); $req->set_attribute('custom_detail', $custom_detail); $req->set_attribute('custom_all', $custom_all); if ($error) { $req->set_attribute('error', $error); } return 'Ticket_Detail'; }
public function handle_request_internal() { $req = APF::get_instance()->get_request(); $res = APF::get_instance()->get_response(); $params = $req->get_parameters(); $product = $params['pro'] ? $params['pro'] : 0; $tab_info = array(0 => array('name' => 'Overview', 'click' => false), 1 => array('name' => 'Anjuke', 'click' => false), 2 => array('name' => 'Aifang', 'click' => false), 3 => array('name' => 'Haozu', 'click' => false), 4 => array('name' => 'Jinpu', 'click' => false), 5 => array('name' => 'Mobile', 'click' => false), 6 => array('name' => 'Inc', 'click' => false)); $tab_info[$product]['click'] = true; $month_query = $params['form_month'] ? $params['form_month'] : date("Y-m", strtotime('now')); $depart_value_id = array('0' => '99', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6'); $pro_id = $depart_value_id[$product]; $begin = date('Y-m-01', strtotime('now')); $end = date('Y-m-t', strtotime('now')); $detail_url = Ticket_CustomQueryController::build_uri() . "?act=query&page_current=1&created_at[v][1][b]=" . $begin . "&created_at[v][1][e]=" . $end . "&environment[v][]=19&department[v][]=" . $pro_id . "&sort_by=resolution&sort_order=desc&sort_c=&sort_o=desc"; $departments = Bll_DdCommonBiz::get_instance()->get_departments(); $department = array(); foreach ($departments as $depart) { $department[$depart->value] = $depart->name; } //overview if ($product == 0) { $rows = 30 * count($department); $counts_all = Bll_ReportDayOnlineBiz::get_instance()->get_counts_by_date_all($rows, $product); //每个部门 $counts_all = array_reverse($counts_all); $count_day_sec = array(); foreach ($counts_all as $row) { $count_day_sec[$row->day][$department[$row->department]] = $row->count; } $count_day_all = array(); foreach ($count_day_sec as $key => $row) { $count_day_all[] = array_merge(array('date' => $key), $row); } //month_all //$rows_month = 12 * count($department); array_pop($department); //array_pop($department); //month_all $rows_month = 12 * count($department); $last_twelve_month = array(); for ($month = date('Y-m-d', strtotime('now')), $times = 12; $times > 0; $month = date('Y-m-d', strtotime('last month', strtotime($month))), --$times) { $last_twelve_month[] = date('Y-m', strtotime($month)); } $last_twelve_month = array_reverse($last_twelve_month); foreach ($last_twelve_month as $month) { foreach ($department as $key => $value) { $departc[] = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_month($month, 'all', $key); } $counts_month = $departc; } foreach ($counts_month as $value) { $temp[] = $value[0]; } $counts_month = $temp; //$counts_month = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_type('all', $rows_month, $product, 1); $count_month_sec = array(); foreach ($counts_month as $row) { $count_month_sec[$row->month][$department[$row->department]] = $row->count; } $count_month_all = array(); foreach ($count_month_sec as $key => $row) { $count = $row['Anjuke'] + $row['Aifang'] + $row['Haozu'] + $row['Jinpu'] + $row['Mobile'] + $row['Inc']; $count_month_all[] = array_merge(array('date' => $key, 'count' => $count), $row); } $depart_staff = array('1' => 'Inc', '2' => 'Anjuke', '3' => 'Aifang', '4' => 'Haozu', '5' => 'Jinpu', '6' => 'Mobile'); $m_begin = date('Y-m', strtotime('-7 month')); $m_end = date('Y-m', strtotime('now')); $tech_persons = Bll_ReportPersonCountBiz::get_instance()->get_counts_by_month($m_begin, $m_end); $tech_count = array(); foreach ($tech_persons as $row) { $tech_count[$row->month][$row->department] = $row->person_count; } $count_month_table = $count_month_all; rsort($count_month_table); $req->set_attribute('product', $product); $req->set_attribute('month_query', $month_query); $req->set_attribute('count_day_all', $count_day_all); $req->set_attribute('count_month_all', $count_month_all); $req->set_attribute('tab_info', $tab_info); $req->set_attribute('detail_url', ''); $req->set_attribute('tech_count', $tech_count); $req->set_attribute('count_month_table', $count_month_table); return 'Report_Online'; } //day_all $rows = 30; $counts_all = Bll_ReportDayOnlineBiz::get_instance()->get_counts_by_date_all($rows, $product); $counts_all = array_reverse($counts_all); $count_day_all = array(); foreach ($counts_all as $row) { $count_day_all[] = array('date' => $row->day, 'count' => $row->count); } //month_all $rows_month = 12; $counts_month = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_type('all', $rows_month, $product); $count_month_all = array(); foreach ($counts_month as $row) { $count_month_all[] = array('date' => $row->month, 'count' => $row->count); } $count_month_all = array_reverse($count_month_all); //group by component $counts_comps = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_month($month_query, 'component', $product); $counts_comp = array(); foreach ($counts_comps as $row) { $counts_comp[$row->type_value] = $row->count; } $components = Bll_DdComponentBiz::get_instance()->get_components($pro_id); $count_month_comp = array(); foreach ($components as $component) { $count_row = isset($counts_comp[$component->value]) ? $counts_comp[$component->value] : 0; $count_month_comp[] = array('date' => $component->name, 'count' => $count_row); } //group by resolution $counts_resos = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_month($month_query, 'resolution', $product); $counts_reso = array(); foreach ($counts_resos as $row) { $counts_reso[$row->type_value] = $row->count; } $resolutions = Bll_DdCommonBiz::get_instance()->get_resolutions(); $resolution = array(); foreach ($resolutions as $resolu) { $resolution[$resolu->value] = $resolu->name; } $count_month_reso = array(); foreach ($resolution as $r_value => $r_name) { $count_reso = isset($counts_reso[$r_value]) ? $counts_reso[$r_value] : 0; $count_month_reso[] = array('date' => $r_name, 'count' => $count_reso); } $req->set_attribute('product', $product); $req->set_attribute('month_query', $month_query); $req->set_attribute('count_day_all', $count_day_all); $req->set_attribute('count_month_all', $count_month_all); $req->set_attribute('count_month_comp', $count_month_comp); $req->set_attribute('count_month_reso', $count_month_reso); $req->set_attribute('tab_info', $tab_info); $req->set_attribute('detail_url', $detail_url); return 'Report_Online'; }
private function map_component($type_value, $department = 51) { $components = Bll_DdComponentBiz::get_instance()->get_components($department); foreach ($components as $key => $value) { if ($type_value == $value->int) { $type_value = $value->name; } else { if ($type_value == "179") { $type_value = "用户端-移动API"; } if ($type_value == "336") { $type_value = "用户端-微信"; } } } return $type_value; }
protected function get_results() { $q = $this->request->get_parameter('q'); $sort_by = @$this->request->get_parameter('sort_by'); $sort_by = empty($sort_by) ? 'id' : $sort_by; $this->sort = $sort_by; $sort_order = @$this->request->get_parameter('sort_order'); $sort_order = empty($sort_order) ? 'desc' : $sort_order; $this->group_order = $sort_order; $sort_c = @$this->request->get_parameter('sort_c'); $sort_c = empty($sort_c) ? 'id' : $sort_c; $this->sort_c = $sort_c; $sort_o = @$this->request->get_parameter('sort_o'); $sort_o = empty($sort_o) ? 'desc' : $sort_o; $this->sort_o = $sort_o; if ($sort_by != 'id') { if (!empty($sort_c)) { $sort = "{$sort_by} {$sort_order}, {$sort_c} {$sort_o}"; } else { $sort = "{$sort_by} {$sort_order}, id desc"; } } else { $sort = "{$sort_c} {$sort_o}"; } $rows = @intval($this->request->get_parameter('rows')); $rows = empty($rows) ? 100 : $rows; $current = $this->page_current; $start = @intval($rows * ($current - 1)); $params = $this->request->get_parameters(); $user_querys = array(); $fields = array_keys($this->fields); $user_inputs = array(); foreach ($fields as $field) { if (empty($params[$field])) { continue; } if (empty($params[$field]['v'])) { continue; } if ($field != 'component' && $field != 'created_at' && $field != 'closed_at' && $field != 'updated_at' && $params[$field]['v'][0] == '') { $user_inputs[$field]['t'] = $this->fields[$field]['type']; $user_inputs[$field]['o'] = $params[$field]['o']; $user_inputs[$field]['v'] = array(''); continue; } $user_inputs[$field]['t'] = $this->fields[$field]['type']; $user_inputs[$field]['o'] = $params[$field]['o']; $user_inputs[$field]['v'] = array(); $sub_querys = array(); foreach ($params[$field]['v'] as $v) { if (!is_array($v)) { $v = trim($v); } if ($v === '') { continue; } if ($this->fields[$field]['type'] == 'dateinput') { $v['b'] = trim($v['b']); $v['e'] = trim($v['e']); $_user_input = array(); $date_begin = '*'; $date_end = '*'; if ($v['b']) { $date_begin = strtotime($v['b']); if ($date_begin <= 0) { $date_begin = '*'; } $_user_input['b'] = $v['b']; } if ($v['e']) { $date_end = strtotime($v['e'] . ' 23:59:59'); if ($date_end <= 0) { $date_end = '*'; } $_user_input['e'] = $v['e']; } if ($date_begin == '*' && $date_end == '*') { continue; } $sub_querys[] = "{$field}:[{$date_begin} TO {$date_end}]"; $user_inputs[$field]['v'][] = $_user_input; } else { $user_inputs[$field]['v'][] = $v; if ($field == 'owner' || $field == 'assigned_qa' || $field == 'reporter') { $v_tmp = $v; $v = Bll_UserBiz::get_instance()->get_username_by_wholename($v); if (!$v) { $v = $v_tmp; } } else { if ($field == 'priority' || $field == 'environment' || $field == 'department' || $field == 'resolution' || $field == 'reason') { $v_tmp = $v; if ($v_tmp == '0') { $v = ""; } else { $v = Bll_DdCommonBiz::get_instance()->get_name_by_id($v_tmp); } } else { if ($field == 'component') { $v1 = Bll_DdComponentBiz::get_instance()->get_name_by_id($v['c']); $v2 = Bll_DdCommonBiz::get_instance()->get_name_by_id($v['d']); $sub_querys[] = "(department:\"{$v2}\" AND component:\"{$v1}\")"; continue; } else { if ($field == 'keyword') { if ($user_inputs[$field]['o'] == 'ticket title') { $sub_querys[] = "summary:({$v})"; } if ($user_inputs[$field]['o'] == 'ticket description') { $sub_querys[] = "description:({$v})"; } continue; } } } } $sub_querys[] = "{$field}:\"{$v}\""; } } if (empty($sub_querys)) { continue; } $sub_querys_str = "(" . join(' OR ', $sub_querys) . ")"; if ($params[$field]['o'] == 'is not') { $sub_querys_str = '-' . $sub_querys_str; } $user_querys[] = $sub_querys_str; } $q = join(" AND ", $user_querys); try { $solr = Util_SolrFactory::get_instance()->get_solr(); $results = $solr->search($q, array('wt' => 'json', 'sort' => $sort), $start, $rows); //处理新字段 if ($results) { $results['csv'] = $solr->search($q, array('wt' => 'json', 'sort' => $sort), 0, $results['numFound']); } } catch (Exception $e) { $this->page_status = 'solrexception'; $this->request->set_attribute('solrexception', $e->getMessage()); } $this->request->set_attribute('user_inputs', $user_inputs); $this->request->set_attribute('sort_by', $sort_by); $this->request->set_attribute('sort_order', $sort_order); $this->request->set_attribute('sort_c', $sort_c); $this->request->set_attribute('sort_o', $sort_o); return $results; }
public function handle_request_internal() { $req = APF::get_instance()->get_request(); $res = APF::get_instance()->get_response(); $params = $req->get_parameters(); $pro = $params['pro'] ? $params['pro'] : 'all'; $user_id = $req->get_user_id(); $departments = Bll_DdCommonBiz::get_instance()->get_departments_for_user_group(); $groups = Bll_UserGroupCustomBiz::get_instance()->get_all_groups(); $input_arr = array('type_key' => 'page', 'type_value' => 'onlinenew'); $return = " "; if (isset($params['group_id']) && !empty($params['group_id'])) { $input_arr['groups'] = explode("|", $params['group_id']); array_pop($input_arr['groups']); $return = Bll_ReportGroupSelectedBiz::get_instance()->insert_selected_group($input_arr); } if ($return == null || $return == " ") { $page_bind_groups = ""; } else { $page_bind_groups = Bll_ReportGroupSelectedBiz::get_instance()->get_group_ids_arr($input_arr); } foreach ($departments as $value) { if (intval($value->value) < 17 || intval($value->value) > 26) { $department[$value->value] = $value->name; } } $page_bind_groups_with_name = array(); foreach ($groups as $value) { $group[$value->department][] = array('name' => $value->group_name, 'id' => $value->id); if (!empty($page_bind_groups) || strlen($page_bind_groups[0]) > 0) { foreach ($page_bind_groups as $p) { if ($p == $value->id) { $temp = array(); $temp['id'] = $p; $temp['name'] = $value->group_name; array_push($page_bind_groups_with_name, $temp); } } } } $tab_info = array('all' => array('name' => 'ALL', 'click' => false), 'mobile' => array('name' => 'Mobile', 'click' => false), 'pc' => array('name' => 'Pc', 'click' => false)); $tab_info[$pro]['click'] = true; $req->set_attribute('tab_info', $tab_info); $req->set_attribute('department', $department); if ($group != null) { $req->set_attribute('group', $group); } $req->set_attribute('user_id', $user_id); if (!empty($page_bind_groups) || strlen($page_bind_groups[0]) > 0) { $req->set_attribute('page_bind_groups', $page_bind_groups); } if (!empty($page_bind_groups_with_name) || strlen($page_bind_groups_with_name) > 0) { $req->set_attribute('page_bind_groups_with_name', $page_bind_groups_with_name); } $req->set_attribute('department_id', $department_id); $product = $params['pro'] ? $params['pro'] : 0; $tab_info = APF::get_instance()->get_config('department'); /*$tab_info = array( 0 => array('name' => 'Overview', 'click' => false), 1 => array('name' => 'Anjuke', 'click' => false), 2 => array('name' => 'Aifang', 'click' => false), 3 => array('name' => 'Haozu', 'click' => false), 4 => array('name' => 'Jinpu', 'click' => false), 5 => array('name' => 'Mobile', 'click' => false), 6 => array('name' => 'Inc', 'click' => false) );*/ $tab_info[$product]['click'] = true; $month_query = $params['form_month'] ? $params['form_month'] : date("Y-m", strtotime('now')); $depart_value_id = array('0' => '99', '10' => '51', '11' => '52', '12' => '53', '13' => '54', '20' => '52', '5' => '100', '15' => '56', '24' => '75'); $pro_id = $depart_value_id[$product]; $begin = date('Y-m-01', strtotime('now')); $end = date('Y-m-t', strtotime('now')); $detail_url = Ticket_CustomQueryController::build_uri() . "?act=query&page_current=1&created_at[v][1][b]=" . $begin . "&created_at[v][1][e]=" . $end . "&environment[v][]=19&department[v][]=" . $pro_id . "&sort_by=resolution&sort_order=desc&sort_c=&sort_o=desc"; $departments = Bll_DdCommonBiz::get_instance()->get_departments_new(); $department = array(); foreach ($departments as $depart) { $department[$depart->value] = $depart->name; } //overview if ($product == 0) { $rows = 30 * count($department); $counts_all = Bll_ReportDayOnlineBiz::get_instance()->get_counts_by_date_all($rows, $product); //每个部门 $counts_all = array_reverse($counts_all); $count_day_sec = array(); $counts_all_temp = array(); /*$count =""; $day=""; foreach($counts_all as $row){ if ( in_array( $row->department,array('14','15','16','18','19') ) ){ $count = $count + $row->count; $day =$row->day; }else{ $counts_all_temp[] =$row; } } $count_day_sec[$day]['移动']=$count.""; foreach ($counts_all_temp as $row) { $count_day_sec[$row->day][$department[$row->department]] = $row->count; }*/ foreach ($counts_all as $row) { $count_day_sec[$row->day][$department[$row->department]] = $row->count; } foreach ($count_day_sec as $day => $ticketcnt) { $count = $ticketcnt['Mobile-broker'] + $ticketcnt['Mobile-jinpu'] + $ticketcnt['Mobile-xinfang'] + $ticketcnt['Mobile-haozu'] + $ticketcnt['Mobile-anjuke']; $count_day_sec[$day]['移动'] = $count; unset($count_day_sec[$day]['Mobile-broker']); unset($count_day_sec[$day]['Mobile-jinpu']); unset($count_day_sec[$day]['Mobile-xinfang']); unset($count_day_sec[$day]['Mobile-haozu']); unset($count_day_sec[$day]['Mobile-anjuke']); } $count_day_all = array(); foreach ($count_day_sec as $key => $row) { $count_day_all[] = array_merge(array('date' => $key), $row); } //$count_day_all[] = array_merge($count_day_all,$temparray); //month_all //$rows_month = 12 * count($department); //array_pop($department); //array_pop($department); //month_all $rows_month = 12 * count($department); $last_twelve_month = array(); for ($month = date('Y-m-d', strtotime('now')), $times = 12; $times > 0; $month = date('Y-m-d', strtotime('last month', strtotime($month))), --$times) { $last_twelve_month[] = date('Y-m', strtotime($month)); } $last_twelve_month = array_reverse($last_twelve_month); foreach ($last_twelve_month as $month) { foreach ($department as $key => $value) { $departc[] = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_month($month, 'all', $key); } $counts_month = $departc; } foreach ($counts_month as $value) { $temp[] = $value[0]; } $counts_month = $temp; /*$count_month_temp = array(); $count= 0; $month=""; foreach($counts_month as $row){ if ( in_array( $row->department,array('14','15','16','18','19') ) ){ $count = $count + $row->count; $month =$row->month; }else{ $count_month_temp[] =$row; } }*/ //$counts_month = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_type('all', $rows_month, $product, 1); $count_month_sec = array(); foreach ($counts_month as $row) { $count_month_sec[$row->month][$department[$row->department]] = $row->count; } array_shift($count_month_sec); foreach ($count_month_sec as $month => $ticketcnt) { $count = $ticketcnt['Mobile-broker'] + $ticketcnt['Mobile-jinpu'] + $ticketcnt['Mobile-xinfang'] + $ticketcnt['Mobile-haozu'] + $ticketcnt['Mobile-anjuke']; $count_month_sec[$month]['移动'] = $count; unset($count_month_sec[$month]['Mobile-broker']); unset($count_month_sec[$month]['Mobile-jinpu']); unset($count_month_sec[$month]['Mobile-xinfang']); unset($count_month_sec[$month]['Mobile-haozu']); unset($count_month_sec[$month]['Mobile-anjuke']); } //$count_month_sec[$month]['移动']=$count.""; $count_month_all = array(); foreach ($count_month_sec as $key => $row) { $count = $row['用户端'] + $row['开发商'] + $row['CRM'] + $row['客户端'] + $row['移动'] + $row['Inc.']; $count_month_all[] = array_merge(array('date' => $key, 'count' => $count), $row); } /*$depart_staff = array( '1' => 'Inc', '2' => 'Anjuke', '3' => 'Aifang', '4' => 'Haozu', '5' => 'Jinpu', '6' => 'Mobile' );*/ $m_begin = date('Y-m', strtotime('-7 month')); $m_end = date('Y-m', strtotime('now')); $tech_persons = Bll_ReportPersonCountBiz::get_instance()->get_counts_by_month($m_begin, $m_end); $tech_count = array(); foreach ($tech_persons as $row) { $tech_count[$row->month][$row->department] = $row->person_count; } $count_month_table = $count_month_all; rsort($count_month_table); array_pop($count_month_table); $req->set_attribute('product', $product); $req->set_attribute('month_query', $month_query); $req->set_attribute('count_day_all', $count_day_all); $req->set_attribute('count_month_all', $count_month_all); $req->set_attribute('tab_info', $tab_info); $req->set_attribute('detail_url', ''); $req->set_attribute('tech_count', $tech_count); $req->set_attribute('count_month_table', $count_month_table); return 'Newreport_OnlineNew'; } if ($product == 5) { $owner = Bll_ReportDayOnlineOwnerBiz::get_instance()->get_owner(); $rows = 30 * count($owner); $allowner = array(); foreach ($owner as $own) { $allowner[] = $own->owner; } $counts_all = Bll_ReportDayOnlineOwnerBiz::get_instance()->get_30day($rows); //$counts_all = array_reverse($data); $count_day_sec = array(); foreach ($counts_all as $row) { $count_day_sec[$row->day][$row->owner] = $row->count; } $count_day_all = array(); foreach ($count_day_sec as $key => $row) { $count_day_all[] = array_merge(array('date' => $key), $row); } $count_day_all = array_reverse($count_day_all); $req->set_attribute('product', $product); $req->set_attribute('month_query', $month_query); $req->set_attribute('count_day_all', $count_day_all); $req->set_attribute('tab_info', $tab_info); $req->set_attribute('allowner', $allowner); return 'Newreport_OnlineNew'; } if ($product == 15) { $rows = 30 * 5; $counts_all = Bll_ReportDayOnlineBiz::get_instance()->get_counts_mobile_by_date($rows, array(14, 15, 16, 18, 19)); $counts_all = array_reverse($counts_all); $count_day_sec = array(); $count_day_all = array(); $count_day_all_temp = array(); foreach ($counts_all as $row) { $count_day_sec[$row->day][$department[$row->department]] = $row->count; } foreach ($count_day_sec as $day => $ticketcnt) { $count_day_all[] = array('date' => $day, 'count' => array_sum($ticketcnt)); //$count_day_all_temp[$day] = array_sum($ticketcnt); } /* foreach($count_day_all_temp as $row){ $count_day_all[] = array('date' => $row->day, 'count' => $row->count); }*/ //month_all $rows_month = 12 * count($department); $last_twelve_month = array(); for ($month = date('Y-m-d', strtotime('now')), $times = 12; $times > 0; $month = date('Y-m-d', strtotime('last month', strtotime($month))), --$times) { $last_twelve_month[] = date('Y-m', strtotime($month)); } $last_twelve_month = array_reverse($last_twelve_month); foreach ($last_twelve_month as $month) { foreach ($department as $key => $value) { $departc[] = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_month($month, 'all', $key); } $counts_month = $departc; } foreach ($counts_month as $value) { $temp[] = $value[0]; } $counts_month = $temp; //$counts_month = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_type('all', $rows_month, $product, 1); $count_month_sec = array(); foreach ($counts_month as $row) { $count_month_sec[$row->month][$department[$row->department]] = $row->count; } array_shift($count_month_sec); foreach ($count_month_sec as $month => $ticketcnt) { $count = $ticketcnt['Mobile-broker'] + $ticketcnt['Mobile-jinpu'] + $ticketcnt['Mobile-xinfang'] + $ticketcnt['Mobile-haozu'] + $ticketcnt['Mobile-anjuke']; $count_month_sec[$month]['移动'] = $count; unset($count_month_sec[$month]['Mobile-broker']); unset($count_month_sec[$month]['Mobile-jinpu']); unset($count_month_sec[$month]['Mobile-xinfang']); unset($count_month_sec[$month]['Mobile-haozu']); unset($count_month_sec[$month]['Mobile-anjuke']); } /*foreach($counts_month as $row){ if ( in_array( $row->department,array('14','15','16','18','19') ) ){ $count = $count + $row->count; $month =$row->month; }else{ $count_month_temp[] =$row; } } foreach ($count_month_temp as $row) { $count_month_sec[$row->month][$department[$row->department]] = $row->count; } $m_begin = date('Y-m', strtotime('-7 month')); $m_end = date('Y-m', strtotime('now')); /*$rows_month = 12; $counts_month = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_type('all', $rows_month, array(14,15,16,18,19)); $count_month_all = array(); $counts_month_sec=array(); foreach($counts_month as $temp){ $counts_month_sec[$temp['month']][$temp['department']] =$temp; } */ $count_month_all = array(); $count_month_all_temp = array(); foreach ($count_month_sec as $key => $value) { $count_month_all_temp[$key] = array_slice($value, -1, 1); } foreach ($count_month_all_temp as $key => $value) { $count_month_all[] = array('date' => $key, 'count' => $value['移动']); } //$count_month_all = array_reverse($count_month_all); $count_month_table = $count_month_all; rsort($count_month_table); //array_pop($count_month_table); //group by resolution $counts_resos = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_month_mobile($month_query, 'resolution', array(14, 15, 16, 18, 19)); $counts_reso = array(); foreach ($counts_resos as $row) { $counts_reso[$row->type_value] = $row->count; } $resolutions = Bll_DdCommonBiz::get_instance()->get_resolutions(); $resolution = array(); foreach ($resolutions as $resolu) { $resolution[$resolu->value] = $resolu->name; } $count_month_reso = array(); foreach ($resolution as $r_value => $r_name) { $count_reso = isset($counts_reso[$r_value]) ? $counts_reso[$r_value] : 0; $count_month_reso[] = array('date' => $r_name, 'count' => $count_reso); } $req->set_attribute('product', $product); $req->set_attribute('month_query', $month_query); $req->set_attribute('count_day_all', $count_day_all); $req->set_attribute('count_month_all', $count_month_all); $req->set_attribute('tab_info', $tab_info); $req->set_attribute('detail_url', ''); $req->set_attribute('tech_count', $tech_count); $req->set_attribute('count_month_table', $count_month_table); $req->set_attribute('count_month_reso', $count_month_reso); return 'Newreport_OnlineNew'; } if ($page_bind_groups != "") { //day_all $department_id = intval(Bll_DdCommonBiz::get_instance()->get_department_id_by_value($product)); $count_day_all = array(); $days = $this->get_30Days(); $interval = $this->get_the_day(); $begin = $interval[0]; $end = $interval[1]; $tickets_all = Bll_TicketBiz::get_instance()->get_count_online_by_month($begin, $end, 'all', $department_id); for ($i = 29; $i >= 0; $i--) { $c = 0; foreach ($page_bind_groups as $group_id) { $group_user_names = $this->get_group_member_name($group_id); if (!empty($group_user_names)) { foreach ($tickets_all as $value) { if (in_array($value->owner, $group_user_names) && substr($value->created_at, 0, 10) == $days[$i]) { $c++; } } } } $count_day_all[] = array('date' => $days[$i], 'count' => $c); } //month_all $count_month_all = array(); $count_month_comp = array(); $count_month_reso = array(); $counts_comp = array(); $counts_reso = array(); $flag = 0; $months = $this->get_12Months(); for ($i = 11; $i >= 0; $i--) { $total = 0; $month_interval = $this->get_the_month($months[$i]); $begin = $month_interval[0]; $end = $month_interval[1]; $tickets_all = Bll_TicketBiz::get_instance()->get_count_online_by_month($begin, $end, 'all', $department_id); if ($month_query == $months[$i]) { $flag = 1; foreach ($page_bind_groups as $group_id) { $group_user_names = $this->get_group_member_name($group_id); if (!empty($group_user_names)) { foreach ($tickets_all as $value) { if (in_array($value->owner, $group_user_names)) { $total++; $counts_comp[$value->component] = isset($counts_comp[$value->component]) ? ++$counts_comp[$value->component] : 1; $counts_reso[$value->resolution] = isset($counts_reso[$value->resolution]) ? ++$counts_reso[$value->resolution] : 1; } } } } } else { foreach ($page_bind_groups as $group_id) { $group_user_names = $this->get_group_member_name($group_id); if (!empty($group_user_names)) { foreach ($tickets_all as $value) { if (in_array($value->owner, $group_user_names)) { $total++; } } } } } $count_month_all[] = array('date' => $months[$i], 'count' => $total); } if ($flag == 0) { $month_interval = $this->get_the_month($months[$i]); $begin = $month_interval[0]; $end = $month_interval[1]; $tickets_all = Bll_TicketBiz::get_instance()->get_count_online_by_month($begin, $end, 'all', $department_id); foreach ($page_bind_groups as $group_id) { $group_user_names = $this->get_group_member_name($group_id); if (!empty($group_user_names)) { foreach ($tickets_all as $value) { if (in_array($value->owner, $group_user_names)) { $counts_comp[$value->component] = isset($counts_comp[$value->component]) ? ++$counts_comp[$value->component] : 1; $counts_reso[$value->resolution] = isset($counts_reso[$value->resolution]) ? ++$counts_reso[$value->resolution] : 1; } } } } } $components = Bll_DdComponentBiz::get_instance()->get_components($pro_id); foreach ($components as $component) { $count_row = isset($counts_comp[$component->int]) ? $counts_comp[$component->int] : 0; $count_month_comp[] = array('date' => $component->name, 'count' => $count_row); } $resolutions = Bll_DdCommonBiz::get_instance()->get_resolutions(); $resolution = array(); foreach ($resolutions as $resolu) { $resolution[$resolu->id] = $resolu->name; } foreach ($resolution as $r_value => $r_name) { $count_reso = isset($counts_reso[$r_value]) ? $counts_reso[$r_value] : 0; $count_month_reso[] = array('date' => $r_name, 'count' => $count_reso); } } else { $rows = 30; $counts_all = Bll_ReportDayOnlineBiz::get_instance()->get_counts_by_date_all($rows, $product); $counts_all = array_reverse($counts_all); $count_day_all = array(); foreach ($counts_all as $row) { $count_day_all[] = array('date' => $row->day, 'count' => $row->count); } //month_all $rows_month = 12; $counts_month = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_type('all', $rows_month, $product); $count_month_all = array(); foreach ($counts_month as $row) { $count_month_all[] = array('date' => $row->month, 'count' => $row->count); } $count_month_all = array_reverse($count_month_all); //group by component $counts_comps = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_month($month_query, 'component', $product); $counts_comp = array(); foreach ($counts_comps as $row) { $counts_comp[$row->type_value] = $row->count; } $components = Bll_DdComponentBiz::get_instance()->get_components($pro_id); $count_month_comp = array(); foreach ($components as $component) { $count_row = isset($counts_comp[$component->value]) ? $counts_comp[$component->value] : 0; $count_month_comp[] = array('date' => $component->name, 'count' => $count_row); } //group by resolution $counts_resos = Bll_ReportMonthOnlineBiz::get_instance()->get_counts_by_month($month_query, 'resolution', $product); $counts_reso = array(); foreach ($counts_resos as $row) { $counts_reso[$row->type_value] = $row->count; } $resolutions = Bll_DdCommonBiz::get_instance()->get_resolutions(); $resolution = array(); foreach ($resolutions as $resolu) { $resolution[$resolu->value] = $resolu->name; } $count_month_reso = array(); foreach ($resolution as $r_value => $r_name) { $count_reso = isset($counts_reso[$r_value]) ? $counts_reso[$r_value] : 0; $count_month_reso[] = array('date' => $r_name, 'count' => $count_reso); } } $req->set_attribute('product', $product); $req->set_attribute('month_query', $month_query); $req->set_attribute('count_day_all', $count_day_all); $req->set_attribute('count_month_all', $count_month_all); $req->set_attribute('count_month_comp', $count_month_comp); $req->set_attribute('count_month_reso', $count_month_reso); $req->set_attribute('tab_info', $tab_info); $req->set_attribute('detail_url', $detail_url); return 'Newreport_OnlineNew'; }
public function handle_request_internal() { $req = APF::get_instance()->get_request(); $res = APF::get_instance()->get_response(); $params = $req->get_parameters(); $product = $params['pro'] ? $params['pro'] : 2; $userid = $req->get_user_id(); $role = Bll_RoleBiz::get_instance()->get_user_role($userid); if ($role != "admin" && $role != "root") { $status = "nopermit"; $this->request->set_attribute('status', $status); return 'Admin_CompView'; } if (isset($params['sort_save'])) { $new_sort = $params['comp_sort']; $components = Bll_DdComponentBiz::get_instance()->get_components($product); foreach ($components as $key => $row) { if ($row->sort != $new_sort[$key]) { $modify_id = $row->int; $input_arr = array('sort' => $new_sort[$key]); $res_id = Bll_DdComponentBiz::get_instance()->modify_component($modify_id, $input_arr); } } $url = Admin_CompViewController::build_uri() . "?pro=" . $product; $res->redirect($url); } else { $departments = Bll_DdCommonBiz::get_instance()->get_departments_new(); $depart_select = array(); foreach ($departments as $row) { $depart_select[$row->id] = array('name' => $row->name, 'click' => false); } $depart_select[$product]['click'] = true; $components = Bll_DdComponentBiz::get_instance()->get_components($product, 1); $req->set_attribute('pro', $product); $req->set_attribute('depart_select', $depart_select); $req->set_attribute('components', $components); return 'Admin_CompView'; } /*$user_id=$req->get_user_id(); $params=$req->get_parameters(); if($params['changerole_user_id']&&$params['new_role']){ $changerole_user_id=$params['changerole_user_id'];$new_role=$params['new_role']; $suc=Bll_UserRoleBiz::get_instance()->change_role($changerole_user_id, $new_role);//old:dev new:qa if($suc){ $req->set_attribute('suc', '修改成功!'); }else{ $req->set_attribute('suc', '修改失败!'); } } $user_info=Bll_UserBiz::get_instance()->get_userinfo_by_user_id($user_id); $role_name=Bll_RoleBiz::get_instance()->get_user_role($user_id); if($role_name=='admin'){ $dev_users=Bll_UserBiz::get_instance()->get_dev_users();//对象数组 $qa_users=Bll_UserBiz::get_instance()->get_qa_users();//对象数组 $req->set_attribute('admin', 'admin'); $req->set_attribute('dev_users', $dev_users);//对象数组 $req->set_attribute('qa_users', $qa_users);//对象数组 } $req->set_attribute('user_info', $user_info);//一个对象 return 'Admin_CompView';*/ }