diff --git a/app/Caches/ImActiveGroupList.php b/app/Caches/ImActiveGroupList.php
new file mode 100644
index 00000000..2dd6eb60
--- /dev/null
+++ b/app/Caches/ImActiveGroupList.php
@@ -0,0 +1,83 @@
+lifetime;
+ }
+
+ public function getKey($id = null)
+ {
+ return 'im_active_group_list';
+ }
+
+ public function getContent($id = null)
+ {
+ $groups = $this->findGroups();
+
+ if (!$groups) return [];
+
+ $result = [];
+
+ foreach ($groups as $group) {
+ $result[] = [
+ 'id' => $group->id,
+ 'type' => $group->type,
+ 'name' => $group->name,
+ 'avatar' => $group->avatar,
+ 'about' => $group->about,
+ 'user_count' => $group->user_count,
+ 'msg_count' => $group->msg_count,
+ ];
+ }
+
+ return $result;
+ }
+
+ /**
+ * @param int $days
+ * @param int $limit
+ * @return ResultsetInterface|Resultset|UserModel[]
+ */
+ protected function findGroups($days = 7, $limit = 12)
+ {
+ $result = [];
+
+ $startTime = strtotime("-{$days} days");
+ $endTime = time();
+
+ $rows = ImMessageModel::query()
+ ->columns(['receiver_id', 'total_count' => 'count(receiver_id)'])
+ ->groupBy('receiver_id')
+ ->orderBy('total_count DESC')
+ ->where('receiver_type = :type:', ['type' => ImMessageModel::TYPE_GROUP])
+ ->betweenWhere('create_time', $startTime, $endTime)
+ ->limit($limit)
+ ->execute();
+
+ if ($rows->count() > 0) {
+
+ $ids = kg_array_column($rows->toArray(), 'receiver_id');
+
+ $groupRepo = new ImGroupRepo();
+
+ $result = $groupRepo->findByIds($ids);
+ }
+
+ return $result;
+ }
+
+}
diff --git a/app/Caches/ImActiveUserList.php b/app/Caches/ImActiveUserList.php
new file mode 100644
index 00000000..b0958fd7
--- /dev/null
+++ b/app/Caches/ImActiveUserList.php
@@ -0,0 +1,80 @@
+lifetime;
+ }
+
+ public function getKey($id = null)
+ {
+ return 'im_active_user_list';
+ }
+
+ public function getContent($id = null)
+ {
+ $users = $this->findUsers($id);
+
+ if (!$users) return [];
+
+ $result = [];
+
+ foreach ($users as $user) {
+ $result[] = [
+ 'id' => $user->id,
+ 'name' => $user->name,
+ 'avatar' => $user->avatar,
+ 'title' => $user->title,
+ 'about' => $user->about,
+ 'vip' => $user->vip,
+ ];
+ }
+
+ return $result;
+ }
+
+ /**
+ * @param int $days
+ * @param int $limit
+ * @return ResultsetInterface|Resultset|UserModel[]
+ */
+ protected function findUsers($days = 7, $limit = 12)
+ {
+ $result = [];
+
+ $startTime = strtotime("-{$days} days");
+ $endTime = time();
+
+ $rows = ImMessageModel::query()
+ ->columns(['sender_id', 'total_count' => 'count(sender_id)'])
+ ->groupBy('sender_id')
+ ->orderBy('total_count DESC')
+ ->betweenWhere('create_time', $startTime, $endTime)
+ ->limit($limit)
+ ->execute();
+
+ if ($rows->count() > 0) {
+
+ $ids = kg_array_column($rows->toArray(), 'sender_id');
+
+ $userRepo = new UserRepo();
+
+ $result = $userRepo->findByIds($ids);
+ }
+
+ return $result;
+ }
+
+}
diff --git a/app/Caches/ImNewGroupList.php b/app/Caches/ImNewGroupList.php
index ff819b97..7ab6d929 100644
--- a/app/Caches/ImNewGroupList.php
+++ b/app/Caches/ImNewGroupList.php
@@ -25,7 +25,7 @@ class ImNewGroupList extends Cache
{
$limit = 12;
- $groups = $this->findHotGroups($limit);
+ $groups = $this->findGroups($limit);
if ($groups->count() == 0) {
return [];
@@ -49,6 +49,8 @@ class ImNewGroupList extends Cache
'name' => $group->name,
'avatar' => $group->avatar,
'about' => $group->about,
+ 'user_count' => $group->user_count,
+ 'msg_count' => $group->msg_count,
];
}
@@ -59,11 +61,11 @@ class ImNewGroupList extends Cache
* @param int $limit
* @return ResultsetInterface|Resultset|ImGroupModel[]
*/
- public function findHotGroups($limit = 12)
+ public function findGroups($limit = 12)
{
return ImGroupModel::query()
- ->where('deleted = 0')
- ->orderBy('user_count DESC')
+ ->where('published = 1')
+ ->orderBy('id DESC')
->limit($limit)
->execute();
}
diff --git a/app/Caches/ImNewUserList.php b/app/Caches/ImNewUserList.php
index 46b4124d..894a84f1 100644
--- a/app/Caches/ImNewUserList.php
+++ b/app/Caches/ImNewUserList.php
@@ -25,7 +25,7 @@ class ImNewUserList extends Cache
{
$limit = 12;
- $users = $this->findHotUsers($limit);
+ $users = $this->findUsers($limit);
if ($users->count() == 0) {
return [];
@@ -47,6 +47,7 @@ class ImNewUserList extends Cache
'id' => $user->id,
'name' => $user->name,
'avatar' => $user->avatar,
+ 'title' => $user->title,
'about' => $user->about,
'vip' => $user->vip,
];
@@ -59,7 +60,7 @@ class ImNewUserList extends Cache
* @param int $limit
* @return ResultsetInterface|Resultset|UserModel[]
*/
- public function findHotUsers($limit = 12)
+ public function findUsers($limit = 12)
{
return UserModel::query()
->where('deleted = 0')
diff --git a/app/Caches/IndexCarouselList.php b/app/Caches/IndexCarouselList.php
index 0a216296..94ccde8c 100644
--- a/app/Caches/IndexCarouselList.php
+++ b/app/Caches/IndexCarouselList.php
@@ -18,7 +18,7 @@ class IndexCarouselList extends Cache
public function getKey($id = null)
{
- return 'index:carousel_list';
+ return 'index_carousel_list';
}
public function getContent($id = null)
diff --git a/app/Caches/IndexFreeCourseList.php b/app/Caches/IndexFreeCourseList.php
index 5a8f380d..b6c69d67 100644
--- a/app/Caches/IndexFreeCourseList.php
+++ b/app/Caches/IndexFreeCourseList.php
@@ -23,7 +23,7 @@ class IndexFreeCourseList extends Cache
public function getKey($id = null)
{
- return 'index:free_course_list';
+ return 'index_free_course_list';
}
public function getContent($id = null)
diff --git a/app/Caches/IndexLiveList.php b/app/Caches/IndexLiveList.php
index 01719a4d..238c0d05 100644
--- a/app/Caches/IndexLiveList.php
+++ b/app/Caches/IndexLiveList.php
@@ -22,7 +22,7 @@ class IndexLiveList extends Cache
public function getKey($id = null)
{
- return 'index:live_list';
+ return 'index_live_list';
}
public function getContent($id = null)
diff --git a/app/Caches/IndexNewCourseList.php b/app/Caches/IndexNewCourseList.php
index 008c8651..7cb627cf 100644
--- a/app/Caches/IndexNewCourseList.php
+++ b/app/Caches/IndexNewCourseList.php
@@ -23,7 +23,7 @@ class IndexNewCourseList extends Cache
public function getKey($id = null)
{
- return 'index:new_course_list';
+ return 'index_new_course_list';
}
public function getContent($id = null)
diff --git a/app/Caches/IndexVipCourseList.php b/app/Caches/IndexVipCourseList.php
index 20aeb6ee..ab869db0 100644
--- a/app/Caches/IndexVipCourseList.php
+++ b/app/Caches/IndexVipCourseList.php
@@ -23,7 +23,7 @@ class IndexVipCourseList extends Cache
public function getKey($id = null)
{
- return 'index:vip_course_list';
+ return 'index_vip_course_list';
}
public function getContent($id = null)
diff --git a/app/Caches/MaxCategoryId.php b/app/Caches/MaxCategoryId.php
index 2a635c52..dfc4fa4f 100644
--- a/app/Caches/MaxCategoryId.php
+++ b/app/Caches/MaxCategoryId.php
@@ -16,7 +16,7 @@ class MaxCategoryId extends Cache
public function getKey($id = null)
{
- return 'max_id:category';
+ return 'max_category_id';
}
public function getContent($id = null)
diff --git a/app/Caches/MaxChapterId.php b/app/Caches/MaxChapterId.php
index 8b80793f..e751dfe8 100644
--- a/app/Caches/MaxChapterId.php
+++ b/app/Caches/MaxChapterId.php
@@ -16,7 +16,7 @@ class MaxChapterId extends Cache
public function getKey($id = null)
{
- return 'max_id:chapter';
+ return 'max_chapter_id';
}
public function getContent($id = null)
diff --git a/app/Caches/MaxCourseId.php b/app/Caches/MaxCourseId.php
index bfc0233d..6f8b350c 100644
--- a/app/Caches/MaxCourseId.php
+++ b/app/Caches/MaxCourseId.php
@@ -16,7 +16,7 @@ class MaxCourseId extends Cache
public function getKey($id = null)
{
- return 'max_id:course';
+ return 'max_course_id';
}
public function getContent($id = null)
diff --git a/app/Caches/MaxHelpId.php b/app/Caches/MaxHelpId.php
index af56d21c..ae43642d 100644
--- a/app/Caches/MaxHelpId.php
+++ b/app/Caches/MaxHelpId.php
@@ -16,7 +16,7 @@ class MaxHelpId extends Cache
public function getKey($id = null)
{
- return 'max_id:help';
+ return 'max_help_id';
}
public function getContent($id = null)
diff --git a/app/Caches/MaxImGroupId.php b/app/Caches/MaxImGroupId.php
index ca2ab945..346206b4 100644
--- a/app/Caches/MaxImGroupId.php
+++ b/app/Caches/MaxImGroupId.php
@@ -16,7 +16,7 @@ class MaxImGroupId extends Cache
public function getKey($id = null)
{
- return 'max_id:im_group';
+ return 'max_im_group_id';
}
public function getContent($id = null)
diff --git a/app/Caches/MaxPackageId.php b/app/Caches/MaxPackageId.php
index 845cbfd4..b5252a4c 100644
--- a/app/Caches/MaxPackageId.php
+++ b/app/Caches/MaxPackageId.php
@@ -16,7 +16,7 @@ class MaxPackageId extends Cache
public function getKey($id = null)
{
- return 'max_id:package';
+ return 'max_package_id';
}
public function getContent($id = null)
diff --git a/app/Caches/MaxPageId.php b/app/Caches/MaxPageId.php
index d3f1a466..cfed90f3 100644
--- a/app/Caches/MaxPageId.php
+++ b/app/Caches/MaxPageId.php
@@ -16,7 +16,7 @@ class MaxPageId extends Cache
public function getKey($id = null)
{
- return 'max_id:page';
+ return 'max_page_id';
}
public function getContent($id = null)
diff --git a/app/Caches/MaxTopicId.php b/app/Caches/MaxTopicId.php
index 6a67fefa..3c739d7a 100644
--- a/app/Caches/MaxTopicId.php
+++ b/app/Caches/MaxTopicId.php
@@ -16,7 +16,7 @@ class MaxTopicId extends Cache
public function getKey($id = null)
{
- return 'max_id:topic';
+ return 'max_topic_id';
}
public function getContent($id = null)
diff --git a/app/Caches/MaxUserId.php b/app/Caches/MaxUserId.php
index 4a48e522..7109382b 100644
--- a/app/Caches/MaxUserId.php
+++ b/app/Caches/MaxUserId.php
@@ -16,7 +16,7 @@ class MaxUserId extends Cache
public function getKey($id = null)
{
- return 'max_id:user';
+ return 'max_user_id';
}
public function getContent($id = null)
diff --git a/app/Http/Admin/Views/order/show.volt b/app/Http/Admin/Views/order/show.volt
index d54cb9cc..12f567ce 100644
--- a/app/Http/Admin/Views/order/show.volt
+++ b/app/Http/Admin/Views/order/show.volt
@@ -9,7 +9,7 @@
-