123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- namespace App\Http\Controllers;
- use App\Module\Base;
- use Redirect;
- use DB;
- /**
- * 页面
- * Class IndexController
- * @package App\Http\Controllers
- */
- class IndexController extends Controller
- {
- public function __invoke($method, $action = '', $child = '')
- {
- $app = $method ? $method : 'main';
- if ($action) {
- $app .= "__" . $action;
- }
- if (!method_exists($this, $app)) {
- $app = 'main';
- }
- return $this->$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 "<pre>";
- var_dump($task);
- }
- }
|