예제 #1
0
 public static function &get_instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
예제 #2
0
 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' => 'All', 'click' => false, 'id' => 0),
                1 => array('name' => 'yonghudua', 'click' => false, 'id' => 2),
                2 => array('name' => 'Aifang', 'click' => false, 'id' => 3),
                3 => array('name' => 'Haozu', 'click' => false, 'id' => 4),
                4 => array('name' => 'Jinpu', 'click' => false, 'id' => 5),
                5 => array('name' => 'Mobile', 'click' => false, 'id' => 6),
                6 => array('name' => 'Inc', 'click' => false, 'id' => 1)
        );*/
     $tab_info = array(0 => array('name' => 'All', 'click' => false, 'id' => 0), 1 => array('name' => '用户端', 'click' => false, 'id' => 4), 2 => array('name' => '客户端', 'click' => false, 'id' => 2), 3 => array('name' => '开发商', 'click' => false, 'id' => 3), 5 => array('name' => '移动', 'click' => false, 'id' => 4), 6 => array('name' => 'Inc.', 'click' => false, 'id' => 1));
     $tab_info[$product]['click'] = true;
     $depart = $tab_info[$product]['id'];
     $month_query = $params['form_month'] ? $params['form_month'] : date("Y-m", strtotime('now'));
     $begin = date("Y-m-01 00:00:00", strtotime($month_query));
     $end = date("Y-m-t 23:59:59", strtotime($month_query));
     $bugs_online = Bll_TicketBiz::get_instance()->get_count_online_by_month($begin, $end, 'all');
     $bugs_offline = Bll_TicketBiz::get_instance()->get_count_offline_by_month($begin, $end, 'all');
     $online_sec = array();
     foreach ($bugs_online as $row) {
         $online_sec[$row->reporter][$row->priority][] = $row;
     }
     $offline_sec = array();
     foreach ($bugs_offline as $row) {
         $offline_sec[$row->reporter][$row->priority][] = $row;
     }
     if ($product == 5) {
         $persons = Bll_UsernewBiz::get_instance()->get_qa_staffs($depart, 34);
     } else {
         $persons = Bll_UsernewBiz::get_instance()->get_qa_staffs($depart);
     }
     $table_all_on = array('P1' => 0, 'P2' => 0, 'P3' => 0, 'P4' => 0, 'P5' => 0, 'all' => 0);
     $table_all_off = array('P1' => 0, 'P2' => 0, 'P3' => 0, 'P4' => 0, 'P5' => 0, 'all' => 0);
     $table_on_tmp = array();
     $table_off_tmp = array();
     $online_p_c = array();
     $offline_p_c = array();
     foreach ($persons as $row) {
         $tmp_on = array();
         $tmp_off = array();
         if (!empty($online_sec[$row->user_name])) {
             $tmp_on['person'] = $row->chinese_name;
             $tmp_on['P1'] = isset($online_sec[$row->user_name]['7']) ? count($online_sec[$row->user_name]['7']) : 0;
             $tmp_on['P2'] = isset($online_sec[$row->user_name]['8']) ? count($online_sec[$row->user_name]['8']) : 0;
             $tmp_on['P3'] = isset($online_sec[$row->user_name]['6']) ? count($online_sec[$row->user_name]['6']) : 0;
             $tmp_on['P4'] = isset($online_sec[$row->user_name]['9']) ? count($online_sec[$row->user_name]['9']) : 0;
             $tmp_on['P5'] = isset($online_sec[$row->user_name]['10']) ? count($online_sec[$row->user_name]['10']) : 0;
             $tmp_on['all'] = $tmp_on['P1'] + $tmp_on['P2'] + $tmp_on['P3'] + $tmp_on['P4'] + $tmp_on['P5'];
             $table_on_tmp[$row->user_name] = $tmp_on;
             $table_all_on['P1'] += $tmp_on['P1'];
             $table_all_on['P2'] += $tmp_on['P2'];
             $table_all_on['P3'] += $tmp_on['P3'];
             $table_all_on['P4'] += $tmp_on['P4'];
             $table_all_on['P5'] += $tmp_on['P5'];
             $table_all_on['all'] += $tmp_on['all'];
             $online_p_c[$row->user_name] = $tmp_on['all'];
         }
         if (!empty($offline_sec[$row->user_name])) {
             $tmp_off['person'] = $row->chinese_name;
             $tmp_off['P1'] = isset($offline_sec[$row->user_name]['7']) ? count($offline_sec[$row->user_name]['7']) : 0;
             $tmp_off['P2'] = isset($offline_sec[$row->user_name]['8']) ? count($offline_sec[$row->user_name]['8']) : 0;
             $tmp_off['P3'] = isset($offline_sec[$row->user_name]['6']) ? count($offline_sec[$row->user_name]['6']) : 0;
             $tmp_off['P4'] = isset($offline_sec[$row->user_name]['9']) ? count($offline_sec[$row->user_name]['9']) : 0;
             $tmp_off['P5'] = isset($offline_sec[$row->user_name]['10']) ? count($offline_sec[$row->user_name]['10']) : 0;
             $tmp_off['all'] = $tmp_off['P1'] + $tmp_off['P2'] + $tmp_off['P3'] + $tmp_off['P4'] + $tmp_off['P5'];
             $table_off_tmp[$row->user_name] = $tmp_off;
             $table_all_off['P1'] += $tmp_off['P1'];
             $table_all_off['P2'] += $tmp_off['P2'];
             $table_all_off['P3'] += $tmp_off['P3'];
             $table_all_off['P4'] += $tmp_off['P4'];
             $table_all_off['P5'] += $tmp_off['P5'];
             $table_all_off['all'] += $tmp_off['all'];
             $offline_p_c[$row->user_name] = $tmp_off['all'];
         }
     }
     arsort($online_p_c);
     arsort($offline_p_c);
     $table_on = array();
     $table_off = array();
     foreach ($online_p_c as $key => $row) {
         $table_on[] = $table_on_tmp[$key];
     }
     foreach ($offline_p_c as $key => $row) {
         $table_off[] = $table_off_tmp[$key];
     }
     $req->set_attribute('month_query', $month_query);
     $req->set_attribute('table_on', $table_on);
     $req->set_attribute('table_off', $table_off);
     $req->set_attribute('table_all_on', $table_all_on);
     $req->set_attribute('table_all_off', $table_all_off);
     $req->set_attribute('tab_info', $tab_info);
     return 'NewReport_QAStatis';
 }
예제 #3
0
print_r($group_info[$name]);
print_r($subdepart_info[$name]);
$depart_p_i = array('1' => '1', '7' => '2', '8' => '3', '9' => '4');
$group_p_i = array('1' => '1', '3' => '2', '4' => '3', '5' => '4', '7' => '5', '8' => '6', '9' => '7', '10' => '8', '11' => '9', '12' => '10', '13' => '11', '14' => '12', '15' => '13', '16' => '14', '17' => '15', '18' => '16');
$subdepart_p_i = array('5' => '2', '160' => '2', '161' => '2', '162' => '2', '163' => '2', '164' => '2', '165' => '2', '167' => '2', '206' => '2', '207' => '2', '208' => '2', '212' => '2', '261' => '2', '262' => '2', '263' => '2', '264' => '2', '265' => '3', '266' => '2', '320' => '2', '321' => '2', '322' => '2', '323' => '24', '324' => '24', '325' => '24', '326' => '34', '327' => '2', '328' => '2', '329' => '2', '335' => '3', '416' => '2', '417' => '2');
$users = Bll_UsernewBiz::get_instance()->get_all_users();
foreach ($users as $user) {
    $input_arr = array();
    $username = strtolower(substr($user->email, 0, strpos($user->email, '@')));
    if (isset($depart_info[$username])) {
        $input_arr['department_id'] = $depart_p_i[$depart_info[$username]['tag_id']];
    }
    /*if (isset($group_info[$username])) {
      $input_arr['group_id'] = $group_p_i[$group_info[$username]['tag_id']];
      }*/
    if (isset($subdepart_info[$username])) {
        $pos = strpos($subdepart_info[$username]['position'], "质量保障");
        // var_dump($subdepart_info[$username]['department_id']);
        // print_r( $subdepart_info[$username]);echo "<br\>";
        if ($subdepart_info[$username]['department_id'] == 266 && $pos !== false) {
            var_dump('is is true');
            $input_arr['subdepart'] = 3;
        } else {
            $input_arr['subdepart'] = $subdepart_p_i[$subdepart_info[$username]['department_id']];
        }
    }
    if (!empty($input_arr)) {
        $update = Bll_UsernewBiz::get_instance()->modify_user($user->user_id, $input_arr);
    }
}
echo date('c ') . " Update staff info ok \n";