['project_id'], '%like%' => ['code', 'send_user', 'accept_user'], ]; } /** * @notes 获取项目管理--发文管理列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/03/07 17:15 */ public function lists(): array { $params = $this->request->get(); $condition = []; if (isset($params['start_date']) && $params['start_date'] != '' && isset($params['end_date']) && $params['end_date'] != '') { if (strtotime($params['end_date']) - strtotime($params['start_date']) >= 0) { $condition[] = ['send_date', 'between', [strtotime($params['start_date'] . ' 00:00:00'), strtotime($params['end_date'] . ' 23:59:59')]]; } } return ManageSendDoc::where($this->searchWhere)->where($condition) ->field(['id', 'project_id', 'code', 'abstract', 'send_date', 'send_company', 'send_user', 'accept_user', 'remark']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($data) { $project = ManageProject::field('project_name')->where('id', $data['project_id'])->findOrEmpty(); $data['project_name'] = $project['project_name']; $admin = Admin::where('id', 'in', [$data['send_user'], $data['accept_user']])->column('name', 'id'); $data['send_user_name'] = $admin[$data['send_user']] ?? ''; $data['accept_user_name'] = $admin[$data['accept_user']] ?? ''; }) ->toArray(); } /** * @notes 获取项目管理--发文管理数量 * @return int * @author likeadmin * @date 2024/03/07 17:15 */ public function count(): int { $params = $this->request->get(); $condition = []; if (isset($params['start_date']) && $params['start_date'] != '' && isset($params['end_date']) && $params['end_date'] != '') { if (strtotime($params['end_date']) - strtotime($params['start_date']) >= 0) { $condition[] = ['send_date', 'between', [strtotime($params['start_date'] . ' 00:00:00'), strtotime($params['end_date'] . ' 23:59:59')]]; } } return ManageSendDoc::where($this->searchWhere)->where($condition)->count(); } }