['title', 'admin_id', 'money', 'type', 'status', 'content','company_id'], ]; } /** * @notes 获取任务模板列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/08/06 17:30 */ public function lists(): array { return TaskTemplate::where($this->searchWhere) ->with(['admin','data_type']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() ->append(['task_admin_name']) ->withAttr("task_admin_name", function ($value,$data) { if ($data['type'] == 35) { $extend = json_decode($data['extend'], true); $userName = User::where('id', $extend['shareholder']['user_id'])->value('nickname'); return $userName; } else { return ''; } }) ->toArray(); } /** * @notes 获取任务模板数量 * @return int * @author likeadmin * @date 2023/08/06 17:30 */ public function count(): int { return TaskTemplate::where($this->searchWhere)->count(); } }