dao = $dao; } public function getList(array $where, $page, $limit) { $query = $this->dao->search($where)->with(['type' => function($query){ $query->field('feedback_category_id,cate_name'); }]); $count = $query->count(); $list = $query->page($page, $limit)->order("feedback_id desc")->withAttr('images',function($val){ return $val ? json_decode($val, true) : []; })->select(); return compact('count', 'list'); } public function get( $id) { $data = $this->dao->getWhere([$this->dao->getPk() => $id]); $type = app()->make(FeedBackCategoryRepository::class)->getWhere(['feedback_category_id' => $data['type']]); $parent = app()->make(FeedBackCategoryRepository::class)->getWhere(['feedback_category_id' => $type['pid']]); $data['type'] = $type['cate_name']; $data['category'] = $parent['cate_name']; return $data; } /** * @param $feedbackId * @param $userId * @param $content * @return int|string * @author 史晨 * @date 2026/3/17 14:15 * 回复反馈 */ public function reply($feedbackId, $userId, $content) { $insert = [ 'feedback_id' => $feedbackId, 'uid' => $userId, 'content' => $content, ]; return FeedbackReply::insert($insert); } }