|
|
@@ -38,14 +38,24 @@ class FeedbackRepository extends BaseRepository
|
|
38
|
38
|
|
|
39
|
39
|
public function getList(array $where, $page, $limit)
|
|
40
|
40
|
{
|
|
41
|
|
- $query = $this->dao->search($where)->with(['type' => function($query){
|
|
|
41
|
+ $query = $this->dao->search($where)->with(['type' => function ($query) {
|
|
42
|
42
|
$query->field('feedback_category_id,cate_name');
|
|
43
|
43
|
}]);
|
|
44
|
44
|
|
|
45
|
45
|
$count = $query->count();
|
|
46
|
|
- $list = $query->page($page, $limit)->order("feedback_id desc")->withAttr('images',function($val){
|
|
|
46
|
+ $list = $query->page($page, $limit)->order("feedback_id desc")->withAttr('images', function ($val) {
|
|
47
|
47
|
return $val ? json_decode($val, true) : [];
|
|
48
|
48
|
})->select();
|
|
|
49
|
+
|
|
|
50
|
+ foreach ($list as &$item) {
|
|
|
51
|
+ $userReply = Db::name('feedback_reply')
|
|
|
52
|
+ ->where(['feedback_id' => $item['feedback_id']])
|
|
|
53
|
+ ->where(['admin_read' => 0])
|
|
|
54
|
+ ->field('content,reply_time')
|
|
|
55
|
+ ->find();
|
|
|
56
|
+ $item['userReply'] = $userReply ? 1 : 0;
|
|
|
57
|
+ }
|
|
|
58
|
+
|
|
49
|
59
|
return compact('count', 'list');
|
|
50
|
60
|
}
|
|
51
|
61
|
|