Exemplo n.º 1
0
Arquivo: Api.php Projeto: rgwybb/tars
 public function tasksUnread()
 {
     $operator = Flight::get('username');
     $pkg = new Pkg();
     $list = $pkg->getTaskByOperator($operator, array('hasRead' => 0));
     // 控制 Curl 请求错误
     $this->handleCurlError($pkg);
     if ($list) {
         $first = $list[0];
         $temp = array();
         foreach ($list as $row) {
             $temp[] = array('task_id' => $row['task_id'], 'product' => $row['product'], 'name' => $row['name'], 'op_type' => $row['op_type'], 'task_status' => $row['task_status'], 'task_num' => (int) $row['task_num'], 'success_num' => (int) $row['success_num'], 'fail_num' => (int) $row['fail_num']);
         }
         $list = $temp;
     }
     Flight::json($list);
 }