public function insert_online_all_for_product_line($time_arr, $product_line, $type, $createdORclosed)
 {
     $tickets_line_arr = Bll_TicketBiz::get_instance()->get_count_online_by_product_line($time_arr['begin'], $time_arr['end'], $createdORclosed);
     if ($tickets_line_arr[$product_line]) {
         $count = count($tickets_line_arr[$product_line]);
     } else {
         $count = 0;
     }
     $input_arr = array('week' => $time_arr['week'], 'department' => 10, 'type_key' => $product_line . '_' . $type, 'type_value' => '0', 'count' => $count, 'updated_time' => $time_arr['current_time']);
     $insert_id = Bll_ReportWeekOnlineNewBiz::get_instance()->insert_count_data($input_arr);
     if (!$insert_id) {
         echo " insert_online_all_for_product_line data error ";
     }
     return $insert_id;
 }
    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);
    //!1=>代表closed线上bug
    if (!$count_pc_reason) {
        echo "insert count_id_pc reason data error";
    }
    $count_mobile_reason = Bll_ReportWeekOnlineNewBiz::get_instance()->insert_online_count_for_product_line($time_arr, 'mobile_web', 'reason', $reason_ids, 0);
    if (!$count_mobile_reason) {
        echo "insert count_id_mobile reason data error";
    }
    echo $week . "Count week ok\n";
}
echo date('c ') . " Count week online bugs ok \n";
}
$departments = Bll_DdCommonBiz::get_instance()->get_departments_new();
//get the department,eg:用户端,客户端
$tickets_all = array();
foreach ($departments as $depart) {
    $list = Bll_ReportGroupSelectedBiz::get_instance()->get_all_groups_by_department($depart->value);
    $inserted_group = array();
    foreach ($list as $value) {
        if (in_array($value->group_id, $inserted_group)) {
            //防止重复插入相同group id的数据
            continue;
        }
        $inserted_group[] = $value->group_id;
        $item = array();
        $item['department'] = $depart->value;
        $item['type_key'] = "group";
        $item['week'] = $week;
        $item['type_value'] = $value->group_id;
        $item['updated_time'] = date("Y-m-d H:i:s");
        //获取group下所有人的tickets数量
        $user_id_arr = Bll_UserGroupCustomBiz::get_instance()->get_group_members_by_id($value->group_id);
        if (!$user_id_arr) {
            continue;
        }
        $group_usernames = Bll_UserBiz::get_instance()->get_usernames_by_userids($user_id_arr);
        $tickets = Bll_TicketBiz::get_instance()->get_count_online_by_groups($begin, $end, $group_usernames, $depart->id);
        $item['count'] = count($tickets);
        Bll_ReportWeekOnlineNewBiz::get_instance()->insert_count_data($item);
    }
}
echo date('c ') . " Count week online bugs by group ok \n";