diff --git a/app/Caches/IndexCarouselList.php b/app/Caches/IndexCarouselList.php index 94ccde8c..0a216296 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 b6c69d67..5a8f380d 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 238c0d05..01719a4d 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 7cb627cf..008c8651 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 ab869db0..20aeb6ee 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 dfc4fa4f..2a635c52 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_category_id'; + return 'max_id:category'; } public function getContent($id = null) diff --git a/app/Caches/MaxChapterId.php b/app/Caches/MaxChapterId.php index e751dfe8..8b80793f 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_chapter_id'; + return 'max_id:chapter'; } public function getContent($id = null) diff --git a/app/Caches/MaxCourseId.php b/app/Caches/MaxCourseId.php index 6f8b350c..bfc0233d 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_course_id'; + return 'max_id:course'; } public function getContent($id = null) diff --git a/app/Caches/MaxHelpId.php b/app/Caches/MaxHelpId.php index ae43642d..af56d21c 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_help_id'; + return 'max_id:help'; } public function getContent($id = null) diff --git a/app/Caches/MaxImGroupId.php b/app/Caches/MaxImGroupId.php index 346206b4..ca2ab945 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_im_group_id'; + return 'max_id:im_group'; } public function getContent($id = null) diff --git a/app/Caches/MaxPackageId.php b/app/Caches/MaxPackageId.php index b5252a4c..845cbfd4 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_package_id'; + return 'max_id:package'; } public function getContent($id = null) diff --git a/app/Caches/MaxPageId.php b/app/Caches/MaxPageId.php index cfed90f3..d3f1a466 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_page_id'; + return 'max_id:page'; } public function getContent($id = null) diff --git a/app/Caches/MaxTopicId.php b/app/Caches/MaxTopicId.php index 3c739d7a..6a67fefa 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_topic_id'; + return 'max_id:topic'; } public function getContent($id = null) diff --git a/app/Caches/MaxUserId.php b/app/Caches/MaxUserId.php index 7109382b..4a48e522 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_user_id'; + return 'max_id:user'; } public function getContent($id = null) diff --git a/app/Http/Admin/Controllers/ImGroupController.php b/app/Http/Admin/Controllers/ImGroupController.php index e2ef3b02..7be26303 100644 --- a/app/Http/Admin/Controllers/ImGroupController.php +++ b/app/Http/Admin/Controllers/ImGroupController.php @@ -11,7 +11,7 @@ class ImGroupController extends Controller { /** - * @Get("/list", name="admin.im_group.list") + * @Get("/list", name="admin.group.list") */ public function listAction() { @@ -19,27 +19,43 @@ class ImGroupController extends Controller $pager = $groupService->getGroups(); + $this->view->pick('im/group/list'); + $this->view->setVar('pager', $pager); } /** - * @Get("/search", name="admin.im_group.search") + * @Get("/search", name="admin.group.search") */ public function searchAction() { - + $this->view->pick('im/group/search'); } /** - * @Get("/add", name="admin.im_group.add") + * @Get("/add", name="admin.group.add") */ public function addAction() { - + $this->view->pick('im/group/add'); } /** - * @Post("/create", name="admin.im_group.create") + * @Get("/{id:[0-9]+}/edit", name="admin.group.edit") + */ + public function editAction($id) + { + $groupService = new ImGroupService(); + + $group = $groupService->getGroup($id); + + $this->view->pick('im/group/edit'); + + $this->view->setVar('group', $group); + } + + /** + * @Post("/create", name="admin.group.create") */ public function createAction() { @@ -48,7 +64,7 @@ class ImGroupController extends Controller $group = $groupService->createGroup(); $location = $this->url->get([ - 'for' => 'admin.im_group.edit', + 'for' => 'admin.group.edit', 'id' => $group->id, ]); @@ -61,19 +77,7 @@ class ImGroupController extends Controller } /** - * @Get("/{id:[0-9]+}/edit", name="admin.im_group.edit") - */ - public function editAction($id) - { - $groupService = new ImGroupService(); - - $group = $groupService->getGroup($id); - - $this->view->setVar('group', $group); - } - - /** - * @Post("/{id:[0-9]+}/update", name="admin.im_group.update") + * @Post("/{id:[0-9]+}/update", name="admin.group.update") */ public function updateAction($id) { @@ -81,7 +85,7 @@ class ImGroupController extends Controller $groupService->updateGroup($id); - $location = $this->url->get(['for' => 'admin.im_group.list']); + $location = $this->url->get(['for' => 'admin.group.list']); $content = [ 'location' => $location, @@ -92,7 +96,7 @@ class ImGroupController extends Controller } /** - * @Post("/{id:[0-9]+}/delete", name="admin.im_group.delete") + * @Post("/{id:[0-9]+}/delete", name="admin.group.delete") */ public function deleteAction($id) { @@ -111,7 +115,7 @@ class ImGroupController extends Controller } /** - * @Post("/{id:[0-9]+}/restore", name="admin.im_group.restore") + * @Post("/{id:[0-9]+}/restore", name="admin.group.restore") */ public function restoreAction($id) { diff --git a/app/Http/Admin/Controllers/SettingController.php b/app/Http/Admin/Controllers/SettingController.php index 7bb8a890..a465d086 100644 --- a/app/Http/Admin/Controllers/SettingController.php +++ b/app/Http/Admin/Controllers/SettingController.php @@ -278,4 +278,34 @@ class SettingController extends Controller } } + /** + * @Route("/im", name="admin.setting.im") + */ + public function imAction() + { + $section = 'im'; + + $settingService = new SettingService(); + + if ($this->request->isPost()) { + + $data = $this->request->getPost(); + + $settingService->updateSectionSettings($section, $data); + + $content = [ + 'location' => $this->request->getHTTPReferer(), + 'msg' => '更新配置成功', + ]; + + return $this->jsonSuccess($content); + + } else { + + $im = $settingService->getSectionSettings($section); + + $this->view->setVar('im', $im); + } + } + } diff --git a/app/Http/Admin/Services/AuthNode.php b/app/Http/Admin/Services/AuthNode.php index a901a612..c30d4d0f 100644 --- a/app/Http/Admin/Services/AuthNode.php +++ b/app/Http/Admin/Services/AuthNode.php @@ -348,31 +348,31 @@ class AuthNode extends Service 'id' => '2-4-1', 'title' => '群组列表', 'type' => 'menu', - 'route' => 'admin.im_group.list', + 'route' => 'admin.group.list', ], [ 'id' => '2-4-2', 'title' => '搜索群组', 'type' => 'menu', - 'route' => 'admin.im_group.search', + 'route' => 'admin.group.search', ], [ 'id' => '2-4-3', 'title' => '添加群组', 'type' => 'menu', - 'route' => 'admin.im_group.add', + 'route' => 'admin.group.add', ], [ 'id' => '2-4-4', 'title' => '编辑群组', 'type' => 'button', - 'route' => 'admin.im_group.edit', + 'route' => 'admin.group.edit', ], [ 'id' => '2-4-5', 'title' => '删除群组', 'type' => 'button', - 'route' => 'admin.im_group.delete', + 'route' => 'admin.group.delete', ], ], ], @@ -700,7 +700,13 @@ class AuthNode extends Service 'title' => '会员设置', 'type' => 'menu', 'route' => 'admin.setting.vip', - ] + ], + [ + 'id' => '5-1-11', + 'title' => '微聊设置', + 'type' => 'menu', + 'route' => 'admin.setting.im', + ], ], ], ], diff --git a/app/Http/Admin/Services/Course.php b/app/Http/Admin/Services/Course.php index 67996c63..31a3fb3b 100644 --- a/app/Http/Admin/Services/Course.php +++ b/app/Http/Admin/Services/Course.php @@ -190,8 +190,6 @@ class Course extends Service $course->update($data); - $this->updateCourseGroup($course); - return $course; } @@ -357,15 +355,6 @@ class Course extends Service return $validator->checkCourse($id); } - protected function updateCourseGroup(CourseModel $course) - { - $courseRepo = new CourseRepo(); - - $imGroup = $courseRepo->findImGroup($course->id); - - $imGroup->update(['name' => $course->title]); - } - protected function rebuildCourseCache(CourseModel $course) { $cache = new CourseCache(); diff --git a/app/Http/Admin/Views/im_group/add.volt b/app/Http/Admin/Views/im/group/add.volt similarity index 92% rename from app/Http/Admin/Views/im_group/add.volt rename to app/Http/Admin/Views/im/group/add.volt index 99ed9f81..fd2cac5a 100644 --- a/app/Http/Admin/Views/im_group/add.volt +++ b/app/Http/Admin/Views/im/group/add.volt @@ -2,7 +2,7 @@ {% block content %} -