$app($child); } /** * 首页 * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function main() { return view('main', ['version' => Base::getVersion()]); } /** * 接口文档 * @return \Illuminate\Http\RedirectResponse */ public function api() { return Redirect::to(Base::fillUrl('docs'), 301); } public function test(){ $list = Base::DBC2A(DB::table("project_log")->where('taskid',640)->orderBy('id','asc')->get()); $project = []; $task = []; foreach ($list as $item) { switch ($item['detail']){ case '添加任务': $project = Base::DBC2A(DB::table("project_lists")->where('id',$item['projectid'])->first()); $other = Base::string2array($item['other']); $task['createuser'] = $task['username'] = $item['username']; $task['title'] = $other['title']; $task['indate'] = $item['indate']; $task['sub_task'] = []; break; case '增加子任务': $other = Base::string2array($item['other']); $subtask = [ 'taskid' => 640, 'uname' => $task['username'], 'indate' => $other['subtask'][0]['time'], 'status' => $other['subtask'][0]['status'], 'detail' => $other['subtask'][0]['detail'] ]; $task['sub_task'][$other['subtask'][0]['detail']] = $subtask; break; case '修改子任务负责人': case '修改子任务': $other = Base::string2array($item['other']); $subtask = Base::string2array($other['subtask']); $old_subtask = Base::string2array($other['old_subtask']); if(array_key_exists($old_subtask['detail'],$task['sub_task'])){ $task['sub_task'][$old_subtask['id']] = $subtask[0]; unset($task['sub_task'][$old_subtask['detail']]); }else{ $task['sub_task'][$old_subtask['id']] = $subtask[0]; } break; case '标记已完成': $task['complete'] = 1; $task['completedate'] = $item['indate']; break; case '上传文件': if(!array_key_exists('files',$task)){ $task['files'] = []; } $task['files'][] = Base::string2array($item['other']); break; } } echo "
";
        var_dump($task);
    }
}