request->isPost()) { $ids = input('post.ids/a', []); if (empty($ids)) { $ids[] = input('post.id/d'); } FeedbackModel::deleteByIds($ids); Log::write(get_class().'Del', 'del', '涉及到的ID为:'.implode(',', $ids)); return $this->json(); } return $this->json(4001, '非法请求!'); } /** * 列表 * * @return View|Json * @throws Exception */ public function index() { if ($this->request->isPost()) { $page = input('page/d', 1); $limit = input('size/d', 20); $searchParams = input('searchParams', []); $search = []; if ($searchParams) { $searchParams = array_map('trim', $searchParams); if (isset($searchParams['user_keyword']) && !empty($searchParams['user_keyword'])) { $search[] = ['user_name|user_tel|user_email', 'like', '%'.$searchParams['user_keyword'].'%']; } unset($searchParams['user_keyword']); foreach ($searchParams as $key => $param) { if ($param) { $search[] = [$key, 'like', '%'.$param.'%']; } } } $items = FeedbackModel::findList($search, [], $page, $limit, function ($q) { return $q->with(['account'])->order('id', 'desc'); }); $items['list'] = $items['list']->each(function ($item) { if ($item->account) { $item->user_name = empty($item->user_name) ? ($item->account->nickname ?? '') : $item->user_name; $item->user_tel = empty($item->user_tel) ? ($item->account->mobile ?? '') : $item->user_tel; } }); return $this->json(0, '操作成功', $items); } return $this->view(); } }