|
|
@@ -956,7 +956,7 @@ class ChatService implements ChatServiceInterface
|
|
|
$result = ChatTopic::where(['chat_topics.id' => $data['id']])
|
|
|
->leftJoin('user', 'user.id', '=', 'chat_topics.user_id')
|
|
|
->leftJoin('chat_topic_class', 'chat_topic_class.id', '=', 'chat_topics.type')
|
|
|
- ->select('chat_topics.*', 'user.nickname', 'user.avatar', 'user.user_name','chat_topic_class.topicname')
|
|
|
+ ->select('chat_topics.*', 'user.nickname', 'user.avatar', 'user.user_name', 'chat_topic_class.topicname')
|
|
|
->first();
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
@@ -1179,13 +1179,13 @@ class ChatService implements ChatServiceInterface
|
|
|
->leftJoin('chat_topic_class', 'chat_topic_class.id', '=', 'chat_topics.type')
|
|
|
->where(['chat_groups_members.user_id' => $data['user_id']])
|
|
|
->when($data, function ($query) use ($data) {
|
|
|
- if(!empty($data['type'])){
|
|
|
+ if (!empty($data['type'])) {
|
|
|
$query->where(['chat_topics.type' => $data['type']]);
|
|
|
}
|
|
|
- if(!empty($data['title'])){
|
|
|
- $query->where('chat_topics.title','like','%'.$data['title'].'%');
|
|
|
+ if (!empty($data['title'])) {
|
|
|
+ $query->where('chat_topics.title', 'like', '%' . $data['title'] . '%');
|
|
|
}
|
|
|
- if(!empty($data['created_at'])){
|
|
|
+ if (!empty($data['created_at'])) {
|
|
|
$query->whereDate('chat_topics.created_at', $data['created_at']);
|
|
|
}
|
|
|
})
|
|
|
@@ -1198,14 +1198,14 @@ class ChatService implements ChatServiceInterface
|
|
|
'chat_topic_class.topicname',
|
|
|
)
|
|
|
->orderBy('chat_topics.created_at', 'desc');
|
|
|
- $total = $query->count();
|
|
|
- $list = $query->forPage($data['page'], $data['page_size'])->get();
|
|
|
- $result = [
|
|
|
- 'list' => $list,
|
|
|
- 'total' => $total,
|
|
|
- 'page' => intval($data['page']),
|
|
|
- 'page_size' => intval($data['page_size']),
|
|
|
- ];
|
|
|
+ $total = $query->count();
|
|
|
+ $list = $query->forPage($data['page'], $data['page_size'])->get();
|
|
|
+ $result = [
|
|
|
+ 'list' => $list,
|
|
|
+ 'total' => $total,
|
|
|
+ 'page' => intval($data['page']),
|
|
|
+ 'page_size' => intval($data['page_size']),
|
|
|
+ ];
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
}
|