model = FeedbackModel::class; $this->selectField = ['id', 'user_id', 'content', 'images', 'reply', 'status', 'created_at', 'updated_at']; $this->queryField = ['user_id' => '=', 'status' => '=', 'content' => 'like']; $this->with = ['user']; } public function list(): array { $result = $this->getPageList(); foreach ($result['items'] as &$item) { $item['user_name'] = $item['user']['nick_name'] ?? ''; $item['user_phone'] = $item['user']['phone'] ?? ''; unset($item['user']); } unset($item); return $result; } /** * 回复反馈 */ public function reply(int $id, string $reply): mixed { if ($id <= 0) { $this->utils->errorThrow('参数错误'); } $reply = trim($reply); if ($reply === '') { $this->utils->errorThrow('请填写回复'); } return $this->save($id, [ 'reply' => mb_substr($reply, 0, 500), 'status' => FeedbackModel::STATUS_REPLIED, ]); } public function delete($ids): mixed { return $this->del(is_array($ids) ? $ids : [$ids]); } }