['title', 'task_role_id', 'type'], ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/18 14:50 */ public function lists(): array { return CreateTaskTemplate::where($this->searchWhere) ->field(['id', 'title', 'admin_id', 'task_role_id', 'type', 'stage_day_one', 'money', 'proportion_one', 'stage_day_two', 'proportion_two', 'money_two', 'stage_day_three', 'new_money_three', 'money_longtime', 'types', 'extend', 'recharge', 'content']) ->append(['admin_name']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->withAttr('admin_name', function ($value, $data) { return Admin::where('id', $data['admin_id'])->value('name'); }) ->select() ->toArray(); } /** * @notes 获取数量 * @return int * @author likeadmin * @date 2023/12/18 14:50 */ public function count(): int { return CreateTaskTemplate::where($this->searchWhere)->count(); } }