quanwei
2025-10-28 36cacbaf78e510713002fcd5e3d61cece2e01421
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
 
namespace app\api\controller\plus\task;
 
use app\api\controller\Controller;
use app\api\model\settings\Setting as SettingModel;
use app\api\model\user\TaskLog as TaskLogModel;
 
/**
 * 任务中心控制器
 */
class Task extends Controller
{
    /**
     * 任务中心数据
     */
    public function index()
    {
        $user = $this->getUser();   // 用户信息
        //获取任务设置
        $data = (new TaskLogModel)->getTask($user);
        return $this->renderSuccess('', compact('data'));
    }
 
    /**
     * 完成日常任务
     */
    public function dayTask($task_type)
    {
        $user = $this->getUser();
        $data['task_type'] = $task_type;
        $data['user_id'] = $user['user_id'];
        event('UserTask', $data);
        return $this->renderSuccess('');
    }
 
}