mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-08-06 06:21:41 +08:00
整理分享功能
This commit is contained in:
parent
949a94ace9
commit
23e19cd279
@ -28,7 +28,7 @@ class ChapterTreeList extends Builder
|
|||||||
$list[] = [
|
$list[] = [
|
||||||
'id' => $chapter->id,
|
'id' => $chapter->id,
|
||||||
'title' => $chapter->title,
|
'title' => $chapter->title,
|
||||||
'priority' => $chapter->priority,
|
'model' => $chapter->model,
|
||||||
'children' => $this->handleChildren($chapter),
|
'children' => $this->handleChildren($chapter),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -64,6 +64,7 @@ class ChapterTreeList extends Builder
|
|||||||
$list[] = [
|
$list[] = [
|
||||||
'id' => $lesson->id,
|
'id' => $lesson->id,
|
||||||
'title' => $lesson->title,
|
'title' => $lesson->title,
|
||||||
|
'model' => $lesson->model,
|
||||||
'free' => $lesson->free,
|
'free' => $lesson->free,
|
||||||
'attrs' => $attrs,
|
'attrs' => $attrs,
|
||||||
];
|
];
|
||||||
|
@ -5,6 +5,7 @@ namespace App\Http\Web\Controllers;
|
|||||||
use App\Http\Web\Services\CourseQuery as CourseQueryService;
|
use App\Http\Web\Services\CourseQuery as CourseQueryService;
|
||||||
use App\Services\Frontend\Course\ChapterList as CourseChapterListService;
|
use App\Services\Frontend\Course\ChapterList as CourseChapterListService;
|
||||||
use App\Services\Frontend\Course\ConsultList as CourseConsultListService;
|
use App\Services\Frontend\Course\ConsultList as CourseConsultListService;
|
||||||
|
use App\Services\Frontend\Course\CourseBasic as CourseBasicService;
|
||||||
use App\Services\Frontend\Course\CourseInfo as CourseInfoService;
|
use App\Services\Frontend\Course\CourseInfo as CourseInfoService;
|
||||||
use App\Services\Frontend\Course\CourseList as CourseListService;
|
use App\Services\Frontend\Course\CourseList as CourseListService;
|
||||||
use App\Services\Frontend\Course\Favorite as CourseFavoriteService;
|
use App\Services\Frontend\Course\Favorite as CourseFavoriteService;
|
||||||
@ -58,7 +59,7 @@ class CourseController extends Controller
|
|||||||
$pager->target = 'course-list';
|
$pager->target = 'course-list';
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
$this->view->pick('course/list_pager');
|
$this->view->pick('course/ajax_pager');
|
||||||
$this->view->setVar('pager', $pager);
|
$this->view->setVar('pager', $pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,26 +76,44 @@ class CourseController extends Controller
|
|||||||
|
|
||||||
$course['category_paths'] = $service->handleCategoryPaths($course['category_id']);
|
$course['category_paths'] = $service->handleCategoryPaths($course['category_id']);
|
||||||
|
|
||||||
$service = new CourseChapterListService();
|
|
||||||
|
|
||||||
$chapters = $service->handle($id);
|
|
||||||
|
|
||||||
$service = new CourseTeacherListService();
|
|
||||||
|
|
||||||
$teachers = $service->handle($id);
|
|
||||||
|
|
||||||
$service = new RewardOptionList();
|
$service = new RewardOptionList();
|
||||||
|
|
||||||
$rewardOptions = $service->handle();
|
$rewards = $service->handle();
|
||||||
|
|
||||||
$this->siteSeo->prependTitle($course['title']);
|
$this->siteSeo->prependTitle($course['title']);
|
||||||
$this->siteSeo->setKeywords($course['keywords']);
|
$this->siteSeo->setKeywords($course['keywords']);
|
||||||
$this->siteSeo->setDescription($course['summary']);
|
$this->siteSeo->setDescription($course['summary']);
|
||||||
|
|
||||||
$this->view->setVar('course', $course);
|
$this->view->setVar('course', $course);
|
||||||
$this->view->setVar('chapters', $chapters);
|
$this->view->setVar('rewards', $rewards);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Get("/{id:[0-9]+}/teachers", name="web.course.teachers")
|
||||||
|
*/
|
||||||
|
public function teachersAction($id)
|
||||||
|
{
|
||||||
|
$service = new CourseTeacherListService();
|
||||||
|
|
||||||
|
$teachers = $service->handle($id);
|
||||||
|
|
||||||
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
|
$this->view->pick('course/ajax_teachers');
|
||||||
$this->view->setVar('teachers', $teachers);
|
$this->view->setVar('teachers', $teachers);
|
||||||
$this->view->setVar('reward_options', $rewardOptions);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Get("/{id:[0-9]+}/chapters", name="web.course.chapters")
|
||||||
|
*/
|
||||||
|
public function chaptersAction($id)
|
||||||
|
{
|
||||||
|
$service = new CourseChapterListService();
|
||||||
|
|
||||||
|
$chapters = $service->handle($id);
|
||||||
|
|
||||||
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
|
$this->view->pick('course/ajax_chapters');
|
||||||
|
$this->view->setVar('chapters', $chapters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,7 +126,7 @@ class CourseController extends Controller
|
|||||||
$packages = $service->handle($id);
|
$packages = $service->handle($id);
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
$this->view->pick('course/show_packages');
|
$this->view->pick('course/ajax_packages');
|
||||||
$this->view->setVar('packages', $packages);
|
$this->view->setVar('packages', $packages);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +142,7 @@ class CourseController extends Controller
|
|||||||
$pager->target = 'tab-consults';
|
$pager->target = 'tab-consults';
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
$this->view->pick('course/show_consults');
|
$this->view->pick('course/ajax_consults');
|
||||||
$this->view->setVar('pager', $pager);
|
$this->view->setVar('pager', $pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +158,7 @@ class CourseController extends Controller
|
|||||||
$pager->target = 'tab-reviews';
|
$pager->target = 'tab-reviews';
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
$this->view->pick('course/show_reviews');
|
$this->view->pick('course/ajax_reviews');
|
||||||
$this->view->setVar('pager', $pager);
|
$this->view->setVar('pager', $pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +172,7 @@ class CourseController extends Controller
|
|||||||
$courses = $service->handle($id);
|
$courses = $service->handle($id);
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
$this->view->pick('course/show_recommended');
|
$this->view->pick('course/ajax_recommended');
|
||||||
$this->view->setVar('courses', $courses);
|
$this->view->setVar('courses', $courses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +186,7 @@ class CourseController extends Controller
|
|||||||
$courses = $service->handle($id);
|
$courses = $service->handle($id);
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
$this->view->pick('course/show_related');
|
$this->view->pick('course/ajax_related');
|
||||||
$this->view->setVar('courses', $courses);
|
$this->view->setVar('courses', $courses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +200,7 @@ class CourseController extends Controller
|
|||||||
$topics = $service->handle($id);
|
$topics = $service->handle($id);
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
$this->view->pick('course/show_topics');
|
$this->view->pick('course/ajax_topics');
|
||||||
$this->view->setVar('topics', $topics);
|
$this->view->setVar('topics', $topics);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +209,7 @@ class CourseController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function ratingAction($id)
|
public function ratingAction($id)
|
||||||
{
|
{
|
||||||
$service = new CourseInfoService();
|
$service = new CourseBasicService();
|
||||||
|
|
||||||
$course = $service->handle($id);
|
$course = $service->handle($id);
|
||||||
|
|
||||||
|
@ -38,6 +38,33 @@ class ImController extends LayerController
|
|||||||
return $this->jsonSuccess(['data' => ['list' => $list]]);
|
return $this->jsonSuccess(['data' => ['list' => $list]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Get("/msgbox", name="web.im.msgbox")
|
||||||
|
*/
|
||||||
|
public function msgboxAction()
|
||||||
|
{
|
||||||
|
$service = new ImService();
|
||||||
|
|
||||||
|
$pager = $service->getSystemMessages();
|
||||||
|
|
||||||
|
$this->view->pick('im/msgbox');
|
||||||
|
$this->view->setVar('pager', $pager);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Get("/chatlog", name="web.im.chatlog")
|
||||||
|
*/
|
||||||
|
public function chatlogAction()
|
||||||
|
{
|
||||||
|
$service = new ImService();
|
||||||
|
|
||||||
|
$pager = $service->getChatMessages();
|
||||||
|
|
||||||
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
|
$this->view->pick('im/chatlog');
|
||||||
|
$this->view->setVar('pager', $pager);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Get("/msg/friend/unread", name="web.im.unread_friend_msg")
|
* @Get("/msg/friend/unread", name="web.im.unread_friend_msg")
|
||||||
*/
|
*/
|
||||||
@ -62,19 +89,6 @@ class ImController extends LayerController
|
|||||||
return $this->jsonSuccess(['count' => $count]);
|
return $this->jsonSuccess(['count' => $count]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Get("/msg/box", name="web.im.msg_box")
|
|
||||||
*/
|
|
||||||
public function messageBoxAction()
|
|
||||||
{
|
|
||||||
$service = new ImService();
|
|
||||||
|
|
||||||
$pager = $service->getSystemMessages();
|
|
||||||
|
|
||||||
$this->view->pick('im/msg_box');
|
|
||||||
$this->view->setVar('pager', $pager);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Get("/msg/sys", name="web.im.sys_msg")
|
* @Get("/msg/sys", name="web.im.sys_msg")
|
||||||
*/
|
*/
|
||||||
@ -114,20 +128,6 @@ class ImController extends LayerController
|
|||||||
return $this->jsonSuccess(['status' => $status]);
|
return $this->jsonSuccess(['status' => $status]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Get("/chat/log", name="web.im.chat_log")
|
|
||||||
*/
|
|
||||||
public function chatLogAction()
|
|
||||||
{
|
|
||||||
$service = new ImService();
|
|
||||||
|
|
||||||
$pager = $service->getChatMessages();
|
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
|
||||||
$this->view->pick('im/chat_log');
|
|
||||||
$this->view->setVar('pager', $pager);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Get("/chat/history", name="web.im.chat_history")
|
* @Get("/chat/history", name="web.im.chat_history")
|
||||||
*/
|
*/
|
||||||
|
@ -31,7 +31,7 @@ class TeacherController extends Controller
|
|||||||
$pager->target = 'teacher-list';
|
$pager->target = 'teacher-list';
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
$this->view->pick('teacher/list_pager');
|
$this->view->pick('teacher/ajax_pager');
|
||||||
$this->view->setVar('pager', $pager);
|
$this->view->setVar('pager', $pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,15 +29,14 @@ class TopicController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function coursesAction($id)
|
public function coursesAction($id)
|
||||||
{
|
{
|
||||||
$target = $this->request->get('target', 'trim', 'course-list');
|
|
||||||
|
|
||||||
$service = new TopicCourseListService();
|
$service = new TopicCourseListService();
|
||||||
|
|
||||||
$pager = $service->handle($id);
|
$pager = $service->handle($id);
|
||||||
$pager->items = kg_array_object($pager->items);
|
$pager->items = kg_array_object($pager->items);
|
||||||
$pager->target = $target;
|
$pager->target = 'course-list';
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
|
$this->view->pick('topic/ajax_courses');
|
||||||
$this->view->setVar('pager', $pager);
|
$this->view->setVar('pager', $pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ class UserController extends Controller
|
|||||||
$pager->target = 'tab-courses';
|
$pager->target = 'tab-courses';
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
|
$this->view->pick('user/ajax_courses');
|
||||||
$this->view->setVar('pager', $pager);
|
$this->view->setVar('pager', $pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +54,7 @@ class UserController extends Controller
|
|||||||
$pager->target = 'tab-favorites';
|
$pager->target = 'tab-favorites';
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
|
$this->view->pick('user/ajax_favorites');
|
||||||
$this->view->setVar('pager', $pager);
|
$this->view->setVar('pager', $pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +70,7 @@ class UserController extends Controller
|
|||||||
$pager->target = 'tab-friends';
|
$pager->target = 'tab-friends';
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
|
$this->view->pick('user/ajax_friends');
|
||||||
$this->view->setVar('pager', $pager);
|
$this->view->setVar('pager', $pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ class Im extends Service
|
|||||||
|
|
||||||
$groupRepo = new ImGroupRepo();
|
$groupRepo = new ImGroupRepo();
|
||||||
|
|
||||||
$users = $groupRepo->findGroupUsers($group->id);
|
$users = $groupRepo->findUsers($group->id);
|
||||||
|
|
||||||
if ($users->count() == 0) {
|
if ($users->count() == 0) {
|
||||||
return [];
|
return [];
|
||||||
@ -170,7 +170,7 @@ class Im extends Service
|
|||||||
|
|
||||||
$userRepo = new ImUserRepo();
|
$userRepo = new ImUserRepo();
|
||||||
|
|
||||||
$messages = $userRepo->findUnreadImFriendMessages($friend->id, $user->id);
|
$messages = $userRepo->findUnreadFriendMessages($friend->id, $user->id);
|
||||||
|
|
||||||
if ($messages->count() == 0) {
|
if ($messages->count() == 0) {
|
||||||
return;
|
return;
|
||||||
@ -212,7 +212,7 @@ class Im extends Service
|
|||||||
|
|
||||||
$userRepo = new ImUserRepo();
|
$userRepo = new ImUserRepo();
|
||||||
|
|
||||||
return $userRepo->countUnreadImSystemMessages($user->id);
|
return $userRepo->countUnreadSystemMessages($user->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSystemMessages()
|
public function getSystemMessages()
|
||||||
@ -306,7 +306,7 @@ class Im extends Service
|
|||||||
|
|
||||||
$userRepo = new ImUserRepo();
|
$userRepo = new ImUserRepo();
|
||||||
|
|
||||||
$chatGroups = $userRepo->findImGroups($user->id);
|
$chatGroups = $userRepo->findGroups($user->id);
|
||||||
|
|
||||||
if ($chatGroups->count() > 0) {
|
if ($chatGroups->count() > 0) {
|
||||||
foreach ($chatGroups as $group) {
|
foreach ($chatGroups as $group) {
|
||||||
@ -385,7 +385,7 @@ class Im extends Service
|
|||||||
|
|
||||||
$validator = new ImGroupUserValidator();
|
$validator = new ImGroupUserValidator();
|
||||||
|
|
||||||
$relation = $validator->checkGroupUser($user->id, $to['id']);
|
$relation = $validator->checkGroupUser($to['id'], $user->id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 被对方屏蔽,忽略消息
|
* 被对方屏蔽,忽略消息
|
||||||
@ -423,7 +423,7 @@ class Im extends Service
|
|||||||
|
|
||||||
$userRepo = new ImUserRepo();
|
$userRepo = new ImUserRepo();
|
||||||
|
|
||||||
$messages = $userRepo->findUnreadImSystemMessages($user->id);
|
$messages = $userRepo->findUnreadSystemMessages($user->id);
|
||||||
|
|
||||||
if ($messages->count() > 0) {
|
if ($messages->count() > 0) {
|
||||||
foreach ($messages as $message) {
|
foreach ($messages as $message) {
|
||||||
@ -506,7 +506,7 @@ class Im extends Service
|
|||||||
|
|
||||||
$userRepo = new ImUserRepo();
|
$userRepo = new ImUserRepo();
|
||||||
|
|
||||||
$friendUsers = $userRepo->findImFriendUsers($user->id);
|
$friendUsers = $userRepo->findFriendUsers($user->id);
|
||||||
|
|
||||||
if ($friendUsers->count() == 0) {
|
if ($friendUsers->count() == 0) {
|
||||||
return;
|
return;
|
||||||
@ -534,8 +534,8 @@ class Im extends Service
|
|||||||
{
|
{
|
||||||
$userRepo = new ImUserRepo();
|
$userRepo = new ImUserRepo();
|
||||||
|
|
||||||
$friendGroups = $userRepo->findImFriendGroups($user->id);
|
$friendGroups = $userRepo->findFriendGroups($user->id);
|
||||||
$friendUsers = $userRepo->findImFriendUsers($user->id);
|
$friendUsers = $userRepo->findFriendUsers($user->id);
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
|
|
||||||
@ -600,7 +600,7 @@ class Im extends Service
|
|||||||
{
|
{
|
||||||
$userRepo = new ImUserRepo();
|
$userRepo = new ImUserRepo();
|
||||||
|
|
||||||
$groups = $userRepo->findImGroups($user->id);
|
$groups = $userRepo->findGroups($user->id);
|
||||||
|
|
||||||
if ($groups->count() == 0) {
|
if ($groups->count() == 0) {
|
||||||
return [];
|
return [];
|
||||||
|
@ -127,7 +127,7 @@ Trait ImFriendTrait
|
|||||||
|
|
||||||
$itemType = ImSystemMessageModel::TYPE_FRIEND_REQUEST;
|
$itemType = ImSystemMessageModel::TYPE_FRIEND_REQUEST;
|
||||||
|
|
||||||
$message = $userRepo->findImSystemMessage($receiver->id, $itemType);
|
$message = $userRepo->findSystemMessage($receiver->id, $itemType);
|
||||||
|
|
||||||
if ($message) {
|
if ($message) {
|
||||||
$expired = time() - $message->create_time > 7 * 86400;
|
$expired = time() - $message->create_time > 7 * 86400;
|
||||||
|
@ -30,8 +30,8 @@ Trait ImGroupTrait
|
|||||||
$group = $validator->checkGroup($post['group_id']);
|
$group = $validator->checkGroup($post['group_id']);
|
||||||
$remark = $validator->checkRemark($post['remark']);
|
$remark = $validator->checkRemark($post['remark']);
|
||||||
|
|
||||||
$validator->checkIfJoined($user->id, $group->id);
|
$validator->checkIfJoined($group->id, $user->id);
|
||||||
$validator->checkIfBlocked($user->id, $group->id);
|
$validator->checkIfBlocked($group->id, $user->id);
|
||||||
|
|
||||||
$this->handleApplyGroupNotice($user, $group, $remark);
|
$this->handleApplyGroupNotice($user, $group, $remark);
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ Trait ImGroupTrait
|
|||||||
|
|
||||||
$groupUserRepo = new ImGroupUserRepo();
|
$groupUserRepo = new ImGroupUserRepo();
|
||||||
|
|
||||||
$groupUser = $groupUserRepo->findGroupUser($applicant->id, $group->id);
|
$groupUser = $groupUserRepo->findGroupUser($group->id, $applicant->id);
|
||||||
|
|
||||||
if (!$groupUser) {
|
if (!$groupUser) {
|
||||||
$groupUserModel = new ImGroupUserModel();
|
$groupUserModel = new ImGroupUserModel();
|
||||||
@ -130,7 +130,7 @@ Trait ImGroupTrait
|
|||||||
|
|
||||||
$itemType = ImSystemMessageModel::TYPE_GROUP_REQUEST;
|
$itemType = ImSystemMessageModel::TYPE_GROUP_REQUEST;
|
||||||
|
|
||||||
$message = $userRepo->findImSystemMessage($receiver->id, $itemType);
|
$message = $userRepo->findSystemMessage($receiver->id, $itemType);
|
||||||
|
|
||||||
if ($message) {
|
if ($message) {
|
||||||
$expired = time() - $message->create_time > 7 * 86400;
|
$expired = time() - $message->create_time > 7 * 86400;
|
||||||
@ -236,7 +236,7 @@ Trait ImGroupTrait
|
|||||||
{
|
{
|
||||||
$groupRepo = new ImGroupRepo();
|
$groupRepo = new ImGroupRepo();
|
||||||
|
|
||||||
$users = $groupRepo->findGroupUsers($group->id);
|
$users = $groupRepo->findUsers($group->id);
|
||||||
|
|
||||||
if ($users->count() == 0) {
|
if ($users->count() == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
|
|
||||||
{{ js_include('web/js/chapter.live.player.js') }}
|
{{ js_include('web/js/chapter.live.player.js') }}
|
||||||
{{ js_include('web/js/chapter.live.im.js') }}
|
{{ js_include('web/js/chapter.live.im.js') }}
|
||||||
|
{{ js_include('web/js/chapter.like.js') }}
|
||||||
{{ js_include('web/js/course.share.js') }}
|
{{ js_include('web/js/course.share.js') }}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -48,6 +48,7 @@
|
|||||||
{% block include_js %}
|
{% block include_js %}
|
||||||
|
|
||||||
{{ js_include('web/js/chapter.read.js') }}
|
{{ js_include('web/js/chapter.read.js') }}
|
||||||
|
{{ js_include('web/js/chapter.like.js') }}
|
||||||
{{ js_include('web/js/course.share.js') }}
|
{{ js_include('web/js/course.share.js') }}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -114,6 +114,7 @@
|
|||||||
{{ js_include('lib/jquery.min.js') }}
|
{{ js_include('lib/jquery.min.js') }}
|
||||||
{{ js_include('lib/jquery.danmu.min.js') }}
|
{{ js_include('lib/jquery.danmu.min.js') }}
|
||||||
{{ js_include('web/js/course.share.js') }}
|
{{ js_include('web/js/course.share.js') }}
|
||||||
|
{{ js_include('web/js/chapter.like.js') }}
|
||||||
{{ js_include('web/js/chapter.vod.player.js') }}
|
{{ js_include('web/js/chapter.vod.player.js') }}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -53,11 +53,11 @@
|
|||||||
<div class="layui-colla-content layui-show">
|
<div class="layui-colla-content layui-show">
|
||||||
<ul class="lesson-list">
|
<ul class="lesson-list">
|
||||||
{% for lesson in chapter.children %}
|
{% for lesson in chapter.children %}
|
||||||
{% if course.model == 'vod' %}
|
{% if lesson.model == 'vod' %}
|
||||||
<li class="lesson-item clearfix">{{ vod_lesson_info(lesson) }}</li>
|
<li class="lesson-item clearfix">{{ vod_lesson_info(lesson) }}</li>
|
||||||
{% elseif course.model == 'live' %}
|
{% elseif lesson.model == 'live' %}
|
||||||
<li class="lesson-item clearfix">{{ live_lesson_info(lesson) }}</li>
|
<li class="lesson-item clearfix">{{ live_lesson_info(lesson) }}</li>
|
||||||
{% elseif course.model == 'read' %}
|
{% elseif lesson.model == 'read' %}
|
||||||
<li class="lesson-item clearfix">{{ read_lesson_info(lesson) }}</li>
|
<li class="lesson-item clearfix">{{ read_lesson_info(lesson) }}</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
@ -13,7 +13,7 @@
|
|||||||
<div class="title">{{ item.question }}</div>
|
<div class="title">{{ item.question }}</div>
|
||||||
<div class="content">{{ item.answer }}</div>
|
<div class="content">{{ item.answer }}</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<span class="time">{{ date('Y-m-d H:i',item.create_time) }}</span>
|
<span class="time">{{ time_ago('Y-m-d',item.create_time) }}</span>
|
||||||
<a href="javascript:" class="like" title="点赞" data-url="{{ like_url }}">
|
<a href="javascript:" class="like" title="点赞" data-url="{{ like_url }}">
|
||||||
<i class="layui-icon layui-icon-praise icon-praise"></i>
|
<i class="layui-icon layui-icon-praise icon-praise"></i>
|
||||||
<em class="like-count">{{ item.like_count }}</em>
|
<em class="like-count">{{ item.like_count }}</em>
|
@ -8,7 +8,7 @@
|
|||||||
{% if pager.total_pages > 0 %}
|
{% if pager.total_pages > 0 %}
|
||||||
<div class="review-list">
|
<div class="review-list">
|
||||||
{% for item in pager.items %}
|
{% for item in pager.items %}
|
||||||
{% set user_url = url({'for':'web.user.show','id':item.id}) %}
|
{% set user_url = url({'for':'web.user.show','id':item.user.id}) %}
|
||||||
{% set like_url = url({'for':'web.review.like','id':item.id}) %}
|
{% set like_url = url({'for':'web.review.like','id':item.id}) %}
|
||||||
<div class="review-card clearfix">
|
<div class="review-card clearfix">
|
||||||
<div class="avatar">
|
<div class="avatar">
|
||||||
@ -21,7 +21,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="content">{{ item.content }}</div>
|
<div class="content">{{ item.content }}</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<span class="time">{{ date('Y-m-d H:i',item.create_time) }}</span>
|
<span class="time">{{ date('Y-m-d',item.create_time) }}</span>
|
||||||
<a href="javascript:" class="like" title="点赞" data-url="{{ like_url }}">
|
<a href="javascript:" class="like" title="点赞" data-url="{{ like_url }}">
|
||||||
<i class="layui-icon layui-icon-praise icon-praise"></i>
|
<i class="layui-icon layui-icon-praise icon-praise"></i>
|
||||||
<em class="like-count">{{ item.like_count }}</em>
|
<em class="like-count">{{ item.like_count }}</em>
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
<div class="layout-main clearfix">
|
<div class="layout-main clearfix">
|
||||||
|
|
||||||
|
{% set show_tab_chapters = course.lesson_count > 0 ? 1 : 0 %}
|
||||||
{% set show_tab_packages = course.package_count > 0 ? 1 : 0 %}
|
{% set show_tab_packages = course.package_count > 0 ? 1 : 0 %}
|
||||||
{% set show_tab_consults = course.consult_count > 0 ? 1 : 0 %}
|
{% set show_tab_consults = course.consult_count > 0 ? 1 : 0 %}
|
||||||
{% set show_tab_reviews = course.review_count > 0 ? 1 : 0 %}
|
{% set show_tab_reviews = course.review_count > 0 ? 1 : 0 %}
|
||||||
@ -29,24 +30,27 @@
|
|||||||
<div class="layui-tab layui-tab-brief course-tab">
|
<div class="layui-tab layui-tab-brief course-tab">
|
||||||
<ul class="layui-tab-title">
|
<ul class="layui-tab-title">
|
||||||
<li class="layui-this">详情</li>
|
<li class="layui-this">详情</li>
|
||||||
<li>目录</li>
|
{% if show_tab_chapters == 1 %}
|
||||||
|
<li>目录<span class="tab-count">{{ course.lesson_count }}</span></li>
|
||||||
|
{% endif %}
|
||||||
{% if show_tab_packages == 1 %}
|
{% if show_tab_packages == 1 %}
|
||||||
<li>套餐<span class="tab-count package-count">{{ course.package_count }}</span></li>
|
<li>套餐<span class="tab-count">{{ course.package_count }}</span></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if show_tab_consults == 1 %}
|
{% if show_tab_consults == 1 %}
|
||||||
<li>咨询<span class="tab-count consult-count">{{ course.consult_count }}</span></li>
|
<li>咨询<span class="tab-count">{{ course.consult_count }}</span></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if show_tab_reviews == 1 %}
|
{% if show_tab_reviews == 1 %}
|
||||||
<li>评价<span class="tab-count review-count">{{ course.review_count }}</span></li>
|
<li>评价<span class="tab-count">{{ course.review_count }}</span></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
<div class="layui-tab-content">
|
<div class="layui-tab-content">
|
||||||
<div class="layui-tab-item layui-show">
|
<div class="layui-tab-item layui-show">
|
||||||
<div class="course-details">{{ course.details }}</div>
|
<div class="course-details">{{ course.details }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-tab-item">
|
{% if show_tab_chapters == 1 %}
|
||||||
{{ partial('course/show_chapters') }}
|
{% set chapters_url = url({'for':'web.course.chapters','id':course.id}) %}
|
||||||
</div>
|
<div class="layui-tab-item" id="tab-chapters" data-url="{{ chapters_url }}"></div>
|
||||||
|
{% endif %}
|
||||||
{% if show_tab_packages == 1 %}
|
{% if show_tab_packages == 1 %}
|
||||||
{% set packages_url = url({'for':'web.course.packages','id':course.id}) %}
|
{% set packages_url = url({'for':'web.course.packages','id':course.id}) %}
|
||||||
<div class="layui-tab-item" id="tab-packages" data-url="{{ packages_url }}"></div>
|
<div class="layui-tab-item" id="tab-packages" data-url="{{ packages_url }}"></div>
|
||||||
@ -71,7 +75,10 @@
|
|||||||
|
|
||||||
<div class="layout-sidebar">
|
<div class="layout-sidebar">
|
||||||
{{ partial('course/show_order') }}
|
{{ partial('course/show_order') }}
|
||||||
{{ partial('course/show_teachers') }}
|
{% if show_sidebar_teachers %}
|
||||||
|
{% set teachers_url = url({'for':'web.course.teachers','id':course.id}) %}
|
||||||
|
<div class="sidebar" id="sidebar-teachers" data-url="{{ teachers_url }}"></div>
|
||||||
|
{% endif %}
|
||||||
{% if show_sidebar_topics %}
|
{% if show_sidebar_topics %}
|
||||||
{% set topics_url = url({'for':'web.course.topics','id':course.id}) %}
|
{% set topics_url = url({'for':'web.course.topics','id':course.id}) %}
|
||||||
<div class="sidebar" id="sidebar-topics" data-url="{{ topics_url }}"></div>
|
<div class="sidebar" id="sidebar-topics" data-url="{{ topics_url }}"></div>
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="share">
|
<div class="share">
|
||||||
<a href="javascript:" title="收藏" data-url="{{ favorite_url }}"><i class="layui-icon layui-icon-heart icon-heart"></i></a>
|
<a href="javascript:" title="收藏" data-url="{{ favorite_url }}"><i class="layui-icon layui-icon-star icon-star"></i></a>
|
||||||
<a href="javascript:" title="分享到微信" data-url="{{ qrcode_url }}"><i class="layui-icon layui-icon-login-wechat icon-wechat"></i></a>
|
<a href="javascript:" title="分享到微信" data-url="{{ qrcode_url }}"><i class="layui-icon layui-icon-login-wechat icon-wechat"></i></a>
|
||||||
<a href="javascript:" title="分享到QQ空间"><i class="layui-icon layui-icon-login-qq icon-qq"></i></a>
|
<a href="javascript:" title="分享到QQ空间"><i class="layui-icon layui-icon-login-qq icon-qq"></i></a>
|
||||||
<a href="javascript:" title="分享到微博"><i class="layui-icon layui-icon-login-weibo icon-weibo"></i></a>
|
<a href="javascript:" title="分享到微博"><i class="layui-icon layui-icon-login-weibo icon-weibo"></i></a>
|
||||||
|
@ -1,30 +1,19 @@
|
|||||||
{% if course.me.owned == 0 and course.market_price > 0 %}
|
{% if course.me.owned == 0 and course.market_price > 0 %}
|
||||||
<div class="sidebar-order wrap">
|
<div class="sidebar-order wrap">
|
||||||
<div class="order">
|
{% set order_url = url({'for':'web.order.confirm'},{'item_id':course.id,'item_type':'course'}) %}
|
||||||
{% set order_url = url({'for':'web.order.confirm'},{'item_id':course.id,'item_type':'course'}) %}
|
<a class="layui-btn layui-btn-fluid layui-bg-red btn-buy" href="javascript:" data-url="{{ order_url }}">立即购买</a>
|
||||||
<a class="layui-btn layui-btn-fluid layui-bg-red" href="{{ order_url }}">立即购买</a>
|
|
||||||
</div>
|
|
||||||
<div class="consult">
|
|
||||||
<a class="layui-btn layui-btn-fluid layui-bg-blue" href="javascript:">课程咨询</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% set rating_url = url({'for':'web.course.rating','id':course.id}) %}
|
|
||||||
|
|
||||||
<div class="sidebar-rating wrap">
|
|
||||||
<a class="layui-btn layui-btn-fluid layui-bg-green rating-btn" href="javascript:" data-url="{{ rating_url }}">课程评价</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if course.market_price == 0 %}
|
{% if course.market_price == 0 %}
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
<div class="layui-card-header">赞赏支持</div>
|
<div class="layui-card-header">赞赏支持</div>
|
||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<div class="sidebar-order">
|
<div class="sidebar-order">
|
||||||
{% for option in reward_options %}
|
{% for reward in rewards %}
|
||||||
{% set item_id = [course.id,option.id]|join('-') %}
|
{% set item_id = [course.id,reward.id]|join('-') %}
|
||||||
{% set order_url = url({'for':'web.order.confirm'},{'item_id':item_id,'item_type':'reward'}) %}
|
{% set order_url = url({'for':'web.order.confirm'},{'item_id':item_id,'item_type':'reward'}) %}
|
||||||
<a class="layui-btn layui-btn-xs reward-btn" href="{{ order_url }}">{{ option.title }}</a>
|
<a class="layui-btn layui-btn-xs btn-reward" href="javascript:" data-url="{{ order_url }}">{{ reward.title }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,13 +3,11 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div class="im-search-wrap">
|
<div class="im-search-wrap">
|
||||||
<div class="im-search">
|
<form class="layui-form im-search-form" method="get" action="{{ url({'for':'web.im.search'}) }}">
|
||||||
<form class="layui-form" method="get" action="{{ url({'for':'web.im.search'}) }}">
|
<input class="layui-input" type="text" name="query" placeholder="请输入关键字...">
|
||||||
<input class="layui-input" type="text" name="query" placeholder="请输入关键字...">
|
<button class="layui-hide" type="submit" lay-submit="true" lay-filter="im_search">搜索</button>
|
||||||
<button class="layui-hide" type="submit" lay-submit="true" lay-filter="im_search">搜索</button>
|
</form>
|
||||||
</form>
|
<div class="im-search-tab">
|
||||||
</div>
|
|
||||||
<div class="find-tab">
|
|
||||||
<div class="layui-tab layui-tab-brief user-tab">
|
<div class="layui-tab layui-tab-brief user-tab">
|
||||||
<ul class="layui-tab-title">
|
<ul class="layui-tab-title">
|
||||||
<li class="layui-this">成员</li>
|
<li class="layui-this">成员</li>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
{% for item in pager.items %}
|
{% for item in pager.items %}
|
||||||
<div class="layui-col-md2">
|
<div class="layui-col-md2">
|
||||||
<div class="user-card">
|
<div class="user-card">
|
||||||
{% if item.vip == 0 %}
|
{% if item.vip == 1 %}
|
||||||
<span class="vip">会员</span>
|
<span class="vip">会员</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="avatar">
|
<div class="avatar">
|
||||||
|
@ -2,16 +2,17 @@
|
|||||||
|
|
||||||
{% set item_type = item.item_type %}
|
{% set item_type = item.item_type %}
|
||||||
{% set item_info = item.item_info %}
|
{% set item_info = item.item_info %}
|
||||||
|
{% set sender = item_info.sender %}
|
||||||
|
{% set sender_url = url({'for':'web.user.show','id':sender.id}) %}
|
||||||
|
|
||||||
{% if item_type == '1' %}
|
{% if item_type == '1' %}
|
||||||
{% set sender = item_info.sender %}
|
|
||||||
{% set group = item_info.group %}
|
{% set group = item_info.group %}
|
||||||
{% set remark = item_info.remark ? '附言:' ~ item_info.remark : '' %}
|
{% set remark = item_info.remark ? '附言:' ~ item_info.remark : '' %}
|
||||||
<li data-id="{{ item.id }}">
|
<li data-id="{{ item.id }}">
|
||||||
<a href="#" target="_blank"><img src="{{ sender.avatar }}" class="layui-circle layim-msgbox-avatar"></a>
|
<a href="{{ sender_url }}" target="_blank"><img src="{{ sender.avatar }}" class="layui-circle layim-msgbox-avatar"></a>
|
||||||
<p class="layim-msgbox-user" data-id="{{ sender.id }}" data-name="{{ sender.name }}" data-avatar="{{ sender.avatar }}" data-group="{{ group.id }}">
|
<p class="layim-msgbox-user" data-id="{{ sender.id }}" data-name="{{ sender.name }}" data-avatar="{{ sender.avatar }}" data-group="{{ group.id }}">
|
||||||
<a href="#" target="_blank">{{ sender.name }}</a>
|
<a href="{{ sender_url }}" target="_blank">{{ sender.name }}</a>
|
||||||
<span>{{ date('Y-m-d H:i:s',item.create_time) }}</span>
|
<span>{{ item.create_time|time_ago }}</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="layim-msgbox-content">申请添加你为好友 <span>{{ remark }}</span></p>
|
<p class="layim-msgbox-content">申请添加你为好友 <span>{{ remark }}</span></p>
|
||||||
<p class="layim-msgbox-btn">
|
<p class="layim-msgbox-btn">
|
||||||
@ -27,19 +28,27 @@
|
|||||||
</li>
|
</li>
|
||||||
{% elseif item_type == '2' %}
|
{% elseif item_type == '2' %}
|
||||||
<li class="layim-msgbox-system">
|
<li class="layim-msgbox-system">
|
||||||
<p><em>系统:</em>{{ item_info.sender.name }} 接受了你的好友申请<span>{{ date('Y-m-d H:i:s',item.create_time) }}</span></p>
|
<p>
|
||||||
|
<em>系统:</em>
|
||||||
|
<a href="{{ sender_url }}" target="_blank">{{ sender.name }}</a>
|
||||||
|
接受了你的好友申请<span>{{ item.create_time|time_ago }}</span>
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
{% elseif item_type == '3' %}
|
{% elseif item_type == '3' %}
|
||||||
<li class="layim-msgbox-system">
|
<li class="layim-msgbox-system">
|
||||||
<p><em>系统:</em>{{ item_info.sender.name }} 拒绝了你的好友申请<span>{{ date('Y-m-d H:i:s',item.create_time) }}</span></p>
|
<p>
|
||||||
|
<em>系统:</em>
|
||||||
|
<a href="{{ sender_url }}" target="_blank">{{ sender.name }}</a>
|
||||||
|
拒绝了你的好友申请<span>{{ item.create_time|time_ago }}</span>
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
{% elseif item_type == '4' %}
|
{% elseif item_type == '4' %}
|
||||||
{% set remark = item_info.remark ? '附言:' ~ item_info.remark : '' %}
|
{% set remark = item_info.remark ? '附言:' ~ item_info.remark : '' %}
|
||||||
<li data-id="{{ item.id }}">
|
<li data-id="{{ item.id }}">
|
||||||
<a href="#" target="_blank"><img src="{{ item_info.sender.avatar }}" class="layui-circle layim-msgbox-avatar"></a>
|
<a href="{{ sender_url }}" target="_blank"><img src="{{ sender.avatar }}" class="layui-circle layim-msgbox-avatar"></a>
|
||||||
<p class="layim-msgbox-user">
|
<p class="layim-msgbox-user">
|
||||||
<a href="#" target="_blank">{{ item_info.sender.name }}</a>
|
<a href="{{ sender_url }}" target="_blank">{{ sender.name }}</a>
|
||||||
<span>{{ date('Y-m-d H:i:s',item.create_time) }}</span>
|
<span>{{ item.create_time|time_ago }}</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="layim-msgbox-content">申请加入群组 <span>{{ remark }}</span></p>
|
<p class="layim-msgbox-content">申请加入群组 <span>{{ remark }}</span></p>
|
||||||
<p class="layim-msgbox-btn">
|
<p class="layim-msgbox-btn">
|
||||||
@ -55,11 +64,19 @@
|
|||||||
</li>
|
</li>
|
||||||
{% elseif item_type == '5' %}
|
{% elseif item_type == '5' %}
|
||||||
<li class="layim-msgbox-system">
|
<li class="layim-msgbox-system">
|
||||||
<p><em>系统:</em>{{ item_info.sender.name }} 接受了你的入群申请<span>{{ date('Y-m-d H:i:s',item.create_time) }}</span></p>
|
<p>
|
||||||
|
<em>系统:</em>
|
||||||
|
<a href="{{ sender_url }}" target="_blank">{{ sender.name }}</a>
|
||||||
|
接受了你的入群申请<span>{{ item.create_time|time_ago }}</span>
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
{% elseif item_type == '6' %}
|
{% elseif item_type == '6' %}
|
||||||
<li class="layim-msgbox-system">
|
<li class="layim-msgbox-system">
|
||||||
<p><em>系统:</em>{{ item_info.sender.name }} 拒绝了你的入群申请<span>{{ date('Y-m-d H:i:s',item.create_time) }}</span></p>
|
<p>
|
||||||
|
<em>系统:</em>
|
||||||
|
<a href="{{ sender_url }}" target="_blank">{{ sender.name }}</a>
|
||||||
|
拒绝了你的入群申请<span>{{ item.create_time|time_ago }}</span>
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
{% for item in pager.items %}
|
{% for item in pager.items %}
|
||||||
<div class="layui-col-md2">
|
<div class="layui-col-md2">
|
||||||
<div class="user-card">
|
<div class="user-card">
|
||||||
{% if item.vip == 0 %}
|
{% if item.vip == 1 %}
|
||||||
<span class="vip">会员</span>
|
<span class="vip">会员</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="avatar">
|
<div class="avatar">
|
@ -228,6 +228,29 @@ function kg_human_number($number)
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化之前时间
|
||||||
|
*
|
||||||
|
* @param int $time
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function kg_time_ago($time)
|
||||||
|
{
|
||||||
|
$diff = time() - $time;
|
||||||
|
|
||||||
|
if ($diff > 7 * 86400) {
|
||||||
|
return date('Y-m-d', $time);
|
||||||
|
} elseif ($diff > 86400) {
|
||||||
|
return floor($diff / 86400) . '天前';
|
||||||
|
} elseif ($diff > 3600) {
|
||||||
|
return floor($diff / 3600) . '小时前';
|
||||||
|
} elseif ($diff > 60) {
|
||||||
|
return floor($diff / 60) . '分钟前';
|
||||||
|
} else {
|
||||||
|
return $diff . '秒前';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 播放时长
|
* 播放时长
|
||||||
*
|
*
|
||||||
|
@ -5,6 +5,7 @@ namespace App\Library\Paginator\Adapter;
|
|||||||
use App\Library\Paginator\Query;
|
use App\Library\Paginator\Query;
|
||||||
use Phalcon\Paginator\Adapter as PaginatorAdapter;
|
use Phalcon\Paginator\Adapter as PaginatorAdapter;
|
||||||
use Phalcon\Paginator\Exception as PaginatorException;
|
use Phalcon\Paginator\Exception as PaginatorException;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -65,7 +66,7 @@ class XunSearch extends PaginatorAdapter
|
|||||||
$this->params = $query->getParams();
|
$this->params = $query->getParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function paginate()
|
public function paginate(): stdClass
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var \XS $xs
|
* @var \XS $xs
|
||||||
@ -102,7 +103,7 @@ class XunSearch extends PaginatorAdapter
|
|||||||
|
|
||||||
$totalPages = ceil($totalCount / $limit);
|
$totalPages = ceil($totalCount / $limit);
|
||||||
|
|
||||||
$pager = new \stdClass();
|
$pager = new stdClass();
|
||||||
|
|
||||||
$pager->first = 1;
|
$pager->first = 1;
|
||||||
$pager->previous = $page > 1 ? $page - 1 : 1;
|
$pager->previous = $page > 1 ? $page - 1 : 1;
|
||||||
@ -120,7 +121,7 @@ class XunSearch extends PaginatorAdapter
|
|||||||
return $pager;
|
return $pager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPaginate()
|
public function getPaginate(): stdClass
|
||||||
{
|
{
|
||||||
return $this->paginate();
|
return $this->paginate();
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,13 @@ class Consult extends Model
|
|||||||
*/
|
*/
|
||||||
public $like_count;
|
public $like_count;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优先级
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $priority;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 私密标识
|
* 私密标识
|
||||||
*
|
*
|
||||||
|
@ -77,6 +77,13 @@ class Review extends Model
|
|||||||
*/
|
*/
|
||||||
public $like_count;
|
public $like_count;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 匿名标识
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $anonymous;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布标识
|
* 发布标识
|
||||||
*
|
*
|
||||||
|
@ -66,6 +66,10 @@ class Volt extends Provider
|
|||||||
return 'kg_human_number(' . $resolvedArgs . ')';
|
return 'kg_human_number(' . $resolvedArgs . ')';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$compiler->addFilter('time_ago', function ($resolvedArgs) {
|
||||||
|
return 'kg_time_ago(' . $resolvedArgs . ')';
|
||||||
|
});
|
||||||
|
|
||||||
return $volt;
|
return $volt;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ class Category extends Repository
|
|||||||
|
|
||||||
public function countChildCategories($categoryId)
|
public function countChildCategories($categoryId)
|
||||||
{
|
{
|
||||||
return CategoryModel::count([
|
return (int)CategoryModel::count([
|
||||||
'conditions' => 'parent_id = :parent_id: AND published = 1',
|
'conditions' => 'parent_id = :parent_id: AND published = 1',
|
||||||
'bind' => ['parent_id' => $categoryId],
|
'bind' => ['parent_id' => $categoryId],
|
||||||
]);
|
]);
|
||||||
@ -98,8 +98,7 @@ class Category extends Repository
|
|||||||
|
|
||||||
public function countCourses($categoryId)
|
public function countCourses($categoryId)
|
||||||
{
|
{
|
||||||
$phql = 'SELECT COUNT(*) AS total FROM %s cc JOIN %s c ON cc.course_id = c.id
|
$phql = 'SELECT COUNT(*) AS total FROM %s cc JOIN %s c ON cc.course_id = c.id WHERE cc.category_id = :category_id: AND c.published = 1';
|
||||||
WHERE cc.category_id = :category_id: AND c.published = 1 AND c.published = 1';
|
|
||||||
|
|
||||||
$phql = sprintf($phql, CourseCategoryModel::class, CourseModel::class);
|
$phql = sprintf($phql, CourseCategoryModel::class, CourseModel::class);
|
||||||
|
|
||||||
@ -107,7 +106,7 @@ class Category extends Repository
|
|||||||
|
|
||||||
$record = $this->modelsManager->executeQuery($phql, $bind)->getFirst();
|
$record = $this->modelsManager->executeQuery($phql, $bind)->getFirst();
|
||||||
|
|
||||||
return $record['total'];
|
return (int)$record['total'];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ class Chapter extends Repository
|
|||||||
|
|
||||||
public function maxChapterPriority($courseId)
|
public function maxChapterPriority($courseId)
|
||||||
{
|
{
|
||||||
return ChapterModel::maximum([
|
return (int)ChapterModel::maximum([
|
||||||
'column' => 'priority',
|
'column' => 'priority',
|
||||||
'conditions' => 'course_id = :course_id: AND parent_id = 0',
|
'conditions' => 'course_id = :course_id: AND parent_id = 0',
|
||||||
'bind' => ['course_id' => $courseId],
|
'bind' => ['course_id' => $courseId],
|
||||||
@ -130,7 +130,7 @@ class Chapter extends Repository
|
|||||||
|
|
||||||
public function maxLessonPriority($chapterId)
|
public function maxLessonPriority($chapterId)
|
||||||
{
|
{
|
||||||
return ChapterModel::maximum([
|
return (int)ChapterModel::maximum([
|
||||||
'column' => 'priority',
|
'column' => 'priority',
|
||||||
'conditions' => 'parent_id = :parent_id:',
|
'conditions' => 'parent_id = :parent_id:',
|
||||||
'bind' => ['parent_id' => $chapterId],
|
'bind' => ['parent_id' => $chapterId],
|
||||||
@ -139,7 +139,7 @@ class Chapter extends Repository
|
|||||||
|
|
||||||
public function countLessons($chapterId)
|
public function countLessons($chapterId)
|
||||||
{
|
{
|
||||||
return ChapterModel::count([
|
return (int)ChapterModel::count([
|
||||||
'conditions' => 'parent_id = :chapter_id: AND deleted = 0',
|
'conditions' => 'parent_id = :chapter_id: AND deleted = 0',
|
||||||
'bind' => ['chapter_id' => $chapterId],
|
'bind' => ['chapter_id' => $chapterId],
|
||||||
]);
|
]);
|
||||||
@ -147,7 +147,7 @@ class Chapter extends Repository
|
|||||||
|
|
||||||
public function countUsers($chapterId)
|
public function countUsers($chapterId)
|
||||||
{
|
{
|
||||||
return ChapterUserModel::count([
|
return (int)ChapterUserModel::count([
|
||||||
'conditions' => 'chapter_id = :chapter_id: AND deleted = 0',
|
'conditions' => 'chapter_id = :chapter_id: AND deleted = 0',
|
||||||
'bind' => ['chapter_id' => $chapterId],
|
'bind' => ['chapter_id' => $chapterId],
|
||||||
]);
|
]);
|
||||||
@ -155,7 +155,7 @@ class Chapter extends Repository
|
|||||||
|
|
||||||
public function countComments($chapterId)
|
public function countComments($chapterId)
|
||||||
{
|
{
|
||||||
return CommentModel::count([
|
return (int)CommentModel::count([
|
||||||
'conditions' => 'chapter_id = :chapter_id: AND deleted = 0',
|
'conditions' => 'chapter_id = :chapter_id: AND deleted = 0',
|
||||||
'bind' => ['chapter_id' => $chapterId],
|
'bind' => ['chapter_id' => $chapterId],
|
||||||
]);
|
]);
|
||||||
@ -163,7 +163,7 @@ class Chapter extends Repository
|
|||||||
|
|
||||||
public function countLikes($chapterId)
|
public function countLikes($chapterId)
|
||||||
{
|
{
|
||||||
return ChapterLikeModel::count([
|
return (int)ChapterLikeModel::count([
|
||||||
'conditions' => 'chapter_id = :chapter_id: AND deleted = 0',
|
'conditions' => 'chapter_id = :chapter_id: AND deleted = 0',
|
||||||
'bind' => ['chapter_id' => $chapterId],
|
'bind' => ['chapter_id' => $chapterId],
|
||||||
]);
|
]);
|
||||||
|
@ -87,9 +87,14 @@ class Comment extends Repository
|
|||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countComments()
|
||||||
|
{
|
||||||
|
return (int)CommentModel::count(['conditions' => 'deleted = 0']);
|
||||||
|
}
|
||||||
|
|
||||||
public function countReplies($commentId)
|
public function countReplies($commentId)
|
||||||
{
|
{
|
||||||
return CommentModel::count([
|
return (int)CommentModel::count([
|
||||||
'conditions' => 'parent_id = :parent_id: AND deleted = 0',
|
'conditions' => 'parent_id = :parent_id: AND deleted = 0',
|
||||||
'bind' => ['parent_id' => $commentId],
|
'bind' => ['parent_id' => $commentId],
|
||||||
]);
|
]);
|
||||||
@ -97,7 +102,7 @@ class Comment extends Repository
|
|||||||
|
|
||||||
public function countLikes($commentId)
|
public function countLikes($commentId)
|
||||||
{
|
{
|
||||||
return CommentLikeModel::count([
|
return (int)CommentLikeModel::count([
|
||||||
'conditions' => 'comment_id = :comment_id: AND deleted = 0',
|
'conditions' => 'comment_id = :comment_id: AND deleted = 0',
|
||||||
'bind' => ['comment_id' => $commentId],
|
'bind' => ['comment_id' => $commentId],
|
||||||
]);
|
]);
|
||||||
|
@ -45,6 +45,9 @@ class Consult extends Repository
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch ($sort) {
|
switch ($sort) {
|
||||||
|
case 'priority':
|
||||||
|
$orderBy = 'priority ASC, id DESC';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$orderBy = 'id DESC';
|
$orderBy = 'id DESC';
|
||||||
break;
|
break;
|
||||||
@ -83,9 +86,14 @@ class Consult extends Repository
|
|||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countConsults()
|
||||||
|
{
|
||||||
|
return (int)ConsultModel::count(['conditions' => 'deleted = 0']);
|
||||||
|
}
|
||||||
|
|
||||||
public function countLikes($consultId)
|
public function countLikes($consultId)
|
||||||
{
|
{
|
||||||
return ConsultLikeModel::count([
|
return (int)ConsultLikeModel::count([
|
||||||
'conditions' => 'consult_id = :consult_id: AND deleted = 0',
|
'conditions' => 'consult_id = :consult_id: AND deleted = 0',
|
||||||
'bind' => ['consult_id' => $consultId],
|
'bind' => ['consult_id' => $consultId],
|
||||||
]);
|
]);
|
||||||
|
@ -245,9 +245,14 @@ class Course extends Repository
|
|||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countCourses()
|
||||||
|
{
|
||||||
|
return (int)CourseModel::count(['conditions' => 'deleted = 0']);
|
||||||
|
}
|
||||||
|
|
||||||
public function countLessons($courseId)
|
public function countLessons($courseId)
|
||||||
{
|
{
|
||||||
return ChapterModel::count([
|
return (int)ChapterModel::count([
|
||||||
'conditions' => 'course_id = :course_id: AND parent_id > 0 AND deleted = 0',
|
'conditions' => 'course_id = :course_id: AND parent_id > 0 AND deleted = 0',
|
||||||
'bind' => ['course_id' => $courseId],
|
'bind' => ['course_id' => $courseId],
|
||||||
]);
|
]);
|
||||||
@ -255,7 +260,7 @@ class Course extends Repository
|
|||||||
|
|
||||||
public function countPackages($courseId)
|
public function countPackages($courseId)
|
||||||
{
|
{
|
||||||
return CoursePackageModel::count([
|
return (int)CoursePackageModel::count([
|
||||||
'conditions' => 'course_id = :course_id:',
|
'conditions' => 'course_id = :course_id:',
|
||||||
'bind' => ['course_id' => $courseId],
|
'bind' => ['course_id' => $courseId],
|
||||||
]);
|
]);
|
||||||
@ -263,7 +268,7 @@ class Course extends Repository
|
|||||||
|
|
||||||
public function countUsers($courseId)
|
public function countUsers($courseId)
|
||||||
{
|
{
|
||||||
return CourseUserModel::count([
|
return (int)CourseUserModel::count([
|
||||||
'conditions' => 'course_id = :course_id: AND deleted = 0',
|
'conditions' => 'course_id = :course_id: AND deleted = 0',
|
||||||
'bind' => ['course_id' => $courseId],
|
'bind' => ['course_id' => $courseId],
|
||||||
]);
|
]);
|
||||||
@ -271,7 +276,7 @@ class Course extends Repository
|
|||||||
|
|
||||||
public function countConsults($courseId)
|
public function countConsults($courseId)
|
||||||
{
|
{
|
||||||
return ConsultModel::count([
|
return (int)ConsultModel::count([
|
||||||
'conditions' => 'course_id = :course_id: AND published = 1',
|
'conditions' => 'course_id = :course_id: AND published = 1',
|
||||||
'bind' => ['course_id' => $courseId],
|
'bind' => ['course_id' => $courseId],
|
||||||
]);
|
]);
|
||||||
@ -279,7 +284,7 @@ class Course extends Repository
|
|||||||
|
|
||||||
public function countReviews($courseId)
|
public function countReviews($courseId)
|
||||||
{
|
{
|
||||||
return ReviewModel::count([
|
return (int)ReviewModel::count([
|
||||||
'conditions' => 'course_id = :course_id: AND published = 1',
|
'conditions' => 'course_id = :course_id: AND published = 1',
|
||||||
'bind' => ['course_id' => $courseId],
|
'bind' => ['course_id' => $courseId],
|
||||||
]);
|
]);
|
||||||
@ -287,7 +292,7 @@ class Course extends Repository
|
|||||||
|
|
||||||
public function countComments($courseId)
|
public function countComments($courseId)
|
||||||
{
|
{
|
||||||
return CommentModel::count([
|
return (int)CommentModel::count([
|
||||||
'conditions' => 'course_id = :course_id: AND published = 1',
|
'conditions' => 'course_id = :course_id: AND published = 1',
|
||||||
'bind' => ['course_id' => $courseId],
|
'bind' => ['course_id' => $courseId],
|
||||||
]);
|
]);
|
||||||
@ -295,15 +300,15 @@ class Course extends Repository
|
|||||||
|
|
||||||
public function countFavorites($courseId)
|
public function countFavorites($courseId)
|
||||||
{
|
{
|
||||||
return CourseFavoriteModel::count([
|
return (int)CourseFavoriteModel::count([
|
||||||
'conditions' => 'course_id = :course_id: AND published = 1',
|
'conditions' => 'course_id = :course_id: AND deleted = 0',
|
||||||
'bind' => ['course_id' => $courseId],
|
'bind' => ['course_id' => $courseId],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function averageRating($courseId)
|
public function averageRating($courseId)
|
||||||
{
|
{
|
||||||
return ReviewModel::average([
|
return (int)ReviewModel::average([
|
||||||
'column' => 'rating',
|
'column' => 'rating',
|
||||||
'conditions' => 'course_id = :course_id: AND published = 1',
|
'conditions' => 'course_id = :course_id: AND published = 1',
|
||||||
'bind' => ['course_id' => $courseId],
|
'bind' => ['course_id' => $courseId],
|
||||||
@ -318,11 +323,13 @@ class Course extends Repository
|
|||||||
|
|
||||||
$rows = $repo->findByCategoryIds($categoryIds);
|
$rows = $repo->findByCategoryIds($categoryIds);
|
||||||
|
|
||||||
if ($rows->count() == 0) {
|
$result = [];
|
||||||
return [];
|
|
||||||
|
if ($rows->count() > 0) {
|
||||||
|
$result = kg_array_column($rows->toArray(), 'course_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
return kg_array_column($rows->toArray(), 'course_id');
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTeacherCourseIds($teacherId)
|
protected function getTeacherCourseIds($teacherId)
|
||||||
@ -333,11 +340,13 @@ class Course extends Repository
|
|||||||
|
|
||||||
$rows = $repo->findByTeacherIds($teacherIds);
|
$rows = $repo->findByTeacherIds($teacherIds);
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
if ($rows->count() == 0) {
|
if ($rows->count() == 0) {
|
||||||
return [];
|
$result = kg_array_column($rows->toArray(), 'course_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
return kg_array_column($rows->toArray(), 'course_id');
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ class CourseCategory extends Repository
|
|||||||
* @param array $categoryIds
|
* @param array $categoryIds
|
||||||
* @return ResultsetInterface|Resultset|CourseCategoryModel[]
|
* @return ResultsetInterface|Resultset|CourseCategoryModel[]
|
||||||
*/
|
*/
|
||||||
public function findByCategoryIds(array $categoryIds)
|
public function findByCategoryIds($categoryIds)
|
||||||
{
|
{
|
||||||
return CourseCategoryModel::query()
|
return CourseCategoryModel::query()
|
||||||
->inWhere('category_id', $categoryIds)
|
->inWhere('category_id', $categoryIds)
|
||||||
@ -38,7 +38,7 @@ class CourseCategory extends Repository
|
|||||||
* @param array $courseIds
|
* @param array $courseIds
|
||||||
* @return ResultsetInterface|Resultset|CourseCategoryModel[]
|
* @return ResultsetInterface|Resultset|CourseCategoryModel[]
|
||||||
*/
|
*/
|
||||||
public function findByCourseIds(array $courseIds)
|
public function findByCourseIds($courseIds)
|
||||||
{
|
{
|
||||||
return CourseCategoryModel::query()
|
return CourseCategoryModel::query()
|
||||||
->inWhere('course_id', $courseIds)
|
->inWhere('course_id', $courseIds)
|
||||||
|
@ -136,7 +136,7 @@ class CourseUser extends Repository
|
|||||||
* @param array $teacherIds
|
* @param array $teacherIds
|
||||||
* @return ResultsetInterface|Resultset|CourseUserModel[]
|
* @return ResultsetInterface|Resultset|CourseUserModel[]
|
||||||
*/
|
*/
|
||||||
public function findByTeacherIds(array $teacherIds)
|
public function findByTeacherIds($teacherIds)
|
||||||
{
|
{
|
||||||
$roleType = CourseUserModel::ROLE_TEACHER;
|
$roleType = CourseUserModel::ROLE_TEACHER;
|
||||||
|
|
||||||
|
@ -121,4 +121,9 @@ class Danmu extends Repository
|
|||||||
return $query->execute();
|
return $query->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countDanmus()
|
||||||
|
{
|
||||||
|
return (int)DanmuModel::count(['conditions' => 'deleted = 0']);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -76,15 +76,22 @@ class ImFriendGroup extends Repository
|
|||||||
* @param int $groupId
|
* @param int $groupId
|
||||||
* @return ResultsetInterface|Resultset|UserModel[]
|
* @return ResultsetInterface|Resultset|UserModel[]
|
||||||
*/
|
*/
|
||||||
public function findGroupUsers($groupId)
|
public function findUsers($groupId)
|
||||||
{
|
{
|
||||||
return $this->modelsManager->createBuilder()
|
return $this->modelsManager->createBuilder()
|
||||||
->columns('u.*')
|
->columns('u.*')
|
||||||
->addFrom(UserModel::class, 'u')
|
->addFrom(UserModel::class, 'u')
|
||||||
->join(ImFriendUserModel::class, 'u.id = f.user_id', 'f')
|
->join(ImFriendUserModel::class, 'u.id = fu.user_id', 'fu')
|
||||||
->where('f.group_id = :group_id:', ['group_id' => $groupId])
|
->where('fu.group_id = :group_id:', ['group_id' => $groupId])
|
||||||
->andWhere('u.deleted = 0')
|
|
||||||
->getQuery()->execute();
|
->getQuery()->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countUsers($groupId)
|
||||||
|
{
|
||||||
|
return (int)ImFriendUserModel::count([
|
||||||
|
'conditions' => 'group_id = :group_id: AND blocked = 0',
|
||||||
|
'bind' => ['group_id' => $groupId],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,15 +79,27 @@ class ImGroup extends Repository
|
|||||||
* @param int $groupId
|
* @param int $groupId
|
||||||
* @return ResultsetInterface|Resultset|ImUserModel[]
|
* @return ResultsetInterface|Resultset|ImUserModel[]
|
||||||
*/
|
*/
|
||||||
public function findGroupUsers($groupId)
|
public function findUsers($groupId)
|
||||||
{
|
{
|
||||||
return $this->modelsManager->createBuilder()
|
return $this->modelsManager->createBuilder()
|
||||||
->columns('u.*')
|
->columns('u.*')
|
||||||
->addFrom(ImUserModel::class, 'u')
|
->addFrom(ImUserModel::class, 'u')
|
||||||
->join(ImGroupUserModel::class, 'u.id = gu.user_id', 'gu')
|
->join(ImGroupUserModel::class, 'u.id = gu.user_id', 'gu')
|
||||||
->where('gu.group_id = :group_id:', ['group_id' => $groupId])
|
->where('gu.group_id = :group_id:', ['group_id' => $groupId])
|
||||||
->andWhere('u.deleted = 0')
|
|
||||||
->getQuery()->execute();
|
->getQuery()->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countGroups()
|
||||||
|
{
|
||||||
|
return (int)ImGroupModel::count(['conditions' => 'deleted = 0']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countUsers($groupId)
|
||||||
|
{
|
||||||
|
return (int)ImGroupUserModel::count([
|
||||||
|
'conditions' => 'group_id = :group_id: AND blocked = 0',
|
||||||
|
'bind' => ['group_id' => $groupId],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,15 +9,15 @@ class ImGroupUser extends Repository
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $userId
|
|
||||||
* @param int $groupId
|
* @param int $groupId
|
||||||
|
* @param int $userId
|
||||||
* @return ImGroupUserModel|Model|bool
|
* @return ImGroupUserModel|Model|bool
|
||||||
*/
|
*/
|
||||||
public function findGroupUser($userId, $groupId)
|
public function findGroupUser($groupId, $userId)
|
||||||
{
|
{
|
||||||
return ImGroupUserModel::findFirst([
|
return ImGroupUserModel::findFirst([
|
||||||
'conditions' => 'user_id = ?1 AND group_id = ?2',
|
'conditions' => 'group_id = ?1 AND user_id = ?2',
|
||||||
'bind' => [1 => $userId, 2 => $groupId],
|
'bind' => [1 => $groupId, 2 => $userId],
|
||||||
'order' => 'id DESC',
|
'order' => 'id DESC',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,4 @@ class ImSystemMessage extends Repository
|
|||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findUserMessage($userId, $itemType)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ class ImUser extends Repository
|
|||||||
* @param int $userId
|
* @param int $userId
|
||||||
* @return ResultsetInterface|Resultset|ImFriendUserModel[]
|
* @return ResultsetInterface|Resultset|ImFriendUserModel[]
|
||||||
*/
|
*/
|
||||||
public function findImFriendUsers($userId)
|
public function findFriendUsers($userId)
|
||||||
{
|
{
|
||||||
return ImFriendUserModel::query()
|
return ImFriendUserModel::query()
|
||||||
->where('user_id = :user_id:', ['user_id' => $userId])
|
->where('user_id = :user_id:', ['user_id' => $userId])
|
||||||
@ -91,7 +91,7 @@ class ImUser extends Repository
|
|||||||
* @param int $userId
|
* @param int $userId
|
||||||
* @return ResultsetInterface|Resultset|ImFriendGroupModel[]
|
* @return ResultsetInterface|Resultset|ImFriendGroupModel[]
|
||||||
*/
|
*/
|
||||||
public function findImFriendGroups($userId)
|
public function findFriendGroups($userId)
|
||||||
{
|
{
|
||||||
return ImFriendGroupModel::query()
|
return ImFriendGroupModel::query()
|
||||||
->where('user_id = :user_id:', ['user_id' => $userId])
|
->where('user_id = :user_id:', ['user_id' => $userId])
|
||||||
@ -103,7 +103,7 @@ class ImUser extends Repository
|
|||||||
* @param int $userId
|
* @param int $userId
|
||||||
* @return ResultsetInterface|Resultset|ImGroupModel[]
|
* @return ResultsetInterface|Resultset|ImGroupModel[]
|
||||||
*/
|
*/
|
||||||
public function findImGroups($userId)
|
public function findGroups($userId)
|
||||||
{
|
{
|
||||||
return $this->modelsManager->createBuilder()
|
return $this->modelsManager->createBuilder()
|
||||||
->columns('g.*')
|
->columns('g.*')
|
||||||
@ -119,7 +119,7 @@ class ImUser extends Repository
|
|||||||
* @param int $userId
|
* @param int $userId
|
||||||
* @return ResultsetInterface|Resultset|ImFriendMessageModel[]
|
* @return ResultsetInterface|Resultset|ImFriendMessageModel[]
|
||||||
*/
|
*/
|
||||||
public function findUnreadImFriendMessages($friendId, $userId)
|
public function findUnreadFriendMessages($friendId, $userId)
|
||||||
{
|
{
|
||||||
return ImFriendMessageModel::find([
|
return ImFriendMessageModel::find([
|
||||||
'conditions' => 'sender_id = ?1 AND receiver_id = ?2 AND viewed = ?3',
|
'conditions' => 'sender_id = ?1 AND receiver_id = ?2 AND viewed = ?3',
|
||||||
@ -130,9 +130,9 @@ class ImUser extends Repository
|
|||||||
/**
|
/**
|
||||||
* @param int $userId
|
* @param int $userId
|
||||||
* @param int $itemType
|
* @param int $itemType
|
||||||
* @return Model|bool|ImSystemMessageModel
|
* @return ImSystemMessageModel|Model|bool
|
||||||
*/
|
*/
|
||||||
public function findImSystemMessage($userId, $itemType)
|
public function findSystemMessage($userId, $itemType)
|
||||||
{
|
{
|
||||||
return ImSystemMessageModel::findFirst([
|
return ImSystemMessageModel::findFirst([
|
||||||
'conditions' => 'receiver_id = ?1 AND item_type = ?2',
|
'conditions' => 'receiver_id = ?1 AND item_type = ?2',
|
||||||
@ -145,7 +145,7 @@ class ImUser extends Repository
|
|||||||
* @param int $userId
|
* @param int $userId
|
||||||
* @return ResultsetInterface|Resultset|ImFriendMessageModel[]
|
* @return ResultsetInterface|Resultset|ImFriendMessageModel[]
|
||||||
*/
|
*/
|
||||||
public function findUnreadImSystemMessages($userId)
|
public function findUnreadSystemMessages($userId)
|
||||||
{
|
{
|
||||||
return ImSystemMessageModel::find([
|
return ImSystemMessageModel::find([
|
||||||
'conditions' => 'receiver_id = ?1 AND viewed = ?2',
|
'conditions' => 'receiver_id = ?1 AND viewed = ?2',
|
||||||
@ -153,9 +153,9 @@ class ImUser extends Repository
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function countUnreadImSystemMessages($userId)
|
public function countUnreadSystemMessages($userId)
|
||||||
{
|
{
|
||||||
return ImSystemMessageModel::count([
|
return (int)ImSystemMessageModel::count([
|
||||||
'conditions' => 'receiver_id = ?1 AND viewed = ?2',
|
'conditions' => 'receiver_id = ?1 AND viewed = ?2',
|
||||||
'bind' => [1 => $userId, 2 => 0],
|
'bind' => [1 => $userId, 2 => 0],
|
||||||
]);
|
]);
|
||||||
|
@ -69,8 +69,8 @@ class Nav extends Repository
|
|||||||
|
|
||||||
public function countChildNavs($navId)
|
public function countChildNavs($navId)
|
||||||
{
|
{
|
||||||
return NavModel::count([
|
return (int)NavModel::count([
|
||||||
'conditions' => 'parent_id = :parent_id: AND published = 1 AND deleted = 0',
|
'conditions' => 'parent_id = :parent_id: AND published = 1',
|
||||||
'bind' => ['parent_id' => $navId],
|
'bind' => ['parent_id' => $navId],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ class Order extends Repository
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $orderId
|
* @param int $orderId
|
||||||
* @return ResultsetInterface|Resultset|OrderStatusModel[]
|
* @return ResultsetInterface|Resultset|OrderStatusModel[]
|
||||||
*/
|
*/
|
||||||
public function findStatusHistory($orderId)
|
public function findStatusHistory($orderId)
|
||||||
@ -202,4 +202,9 @@ class Order extends Repository
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countOrders()
|
||||||
|
{
|
||||||
|
return (int)OrderModel::count(['conditions' => 'deleted = 0']);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ class Package extends Repository
|
|||||||
|
|
||||||
public function countCourses($packageId)
|
public function countCourses($packageId)
|
||||||
{
|
{
|
||||||
return CoursePackageModel::count([
|
return (int)CoursePackageModel::count([
|
||||||
'conditions' => 'package_id = :package_id:',
|
'conditions' => 'package_id = :package_id:',
|
||||||
'bind' => ['package_id' => $packageId],
|
'bind' => ['package_id' => $packageId],
|
||||||
]);
|
]);
|
||||||
|
@ -36,7 +36,7 @@ class RefreshToken extends Repository
|
|||||||
|
|
||||||
public function countByUserId($userId)
|
public function countByUserId($userId)
|
||||||
{
|
{
|
||||||
return RefreshTokenModel::count([
|
return (int)RefreshTokenModel::count([
|
||||||
'conditions' => 'user_id = :user_id: AND deleted = 0',
|
'conditions' => 'user_id = :user_id: AND deleted = 0',
|
||||||
'bind' => ['user_id' => $userId],
|
'bind' => ['user_id' => $userId],
|
||||||
]);
|
]);
|
||||||
|
@ -106,6 +106,11 @@ class Review extends Repository
|
|||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countReviews()
|
||||||
|
{
|
||||||
|
return (int)ReviewModel::count(['conditions' => 'deleted = 0']);
|
||||||
|
}
|
||||||
|
|
||||||
public function countLikes($reviewId)
|
public function countLikes($reviewId)
|
||||||
{
|
{
|
||||||
return ReviewLikeModel::count([
|
return ReviewLikeModel::count([
|
||||||
|
@ -87,9 +87,14 @@ class Topic extends Repository
|
|||||||
->getQuery()->execute();
|
->getQuery()->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countTopics()
|
||||||
|
{
|
||||||
|
return (int)TopicModel::count(['conditions' => 'deleted = 0']);
|
||||||
|
}
|
||||||
|
|
||||||
public function countCourses($topicId)
|
public function countCourses($topicId)
|
||||||
{
|
{
|
||||||
return CourseTopicModel::count([
|
return (int)CourseTopicModel::count([
|
||||||
'conditions' => 'topic_id = :topic_id:',
|
'conditions' => 'topic_id = :topic_id:',
|
||||||
'bind' => ['topic_id' => $topicId],
|
'bind' => ['topic_id' => $topicId],
|
||||||
]);
|
]);
|
||||||
|
@ -111,4 +111,9 @@ class User extends Repository
|
|||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countUsers()
|
||||||
|
{
|
||||||
|
return (int)UserModel::count(['conditions' => 'deleted = 0']);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -180,8 +180,10 @@ class Chapter extends Validator
|
|||||||
|
|
||||||
$like = $repo->findChapterLike($chapterId, $userId);
|
$like = $repo->findChapterLike($chapterId, $userId);
|
||||||
|
|
||||||
if ($like && time() - $like->create_time > 5 * 60) {
|
if ($like) {
|
||||||
throw new BadRequestException('chapter.has_liked');
|
if ($like->deleted == 0 && time() - $like->create_time > 5 * 60) {
|
||||||
|
throw new BadRequestException('chapter.has_liked');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $like;
|
return $like;
|
||||||
|
@ -82,8 +82,10 @@ class Comment extends Validator
|
|||||||
|
|
||||||
$like = $repo->findCommentLike($chapterId, $userId);
|
$like = $repo->findCommentLike($chapterId, $userId);
|
||||||
|
|
||||||
if ($like && time() - $like->create_time > 5 * 60) {
|
if ($like) {
|
||||||
throw new BadRequestException('comment.has_liked');
|
if ($like->deleted == 0 && time() - $like->create_time > 5 * 60) {
|
||||||
|
throw new BadRequestException('comment.has_liked');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $like;
|
return $like;
|
||||||
|
@ -87,8 +87,10 @@ class Consult extends Validator
|
|||||||
|
|
||||||
$like = $repo->findConsultLike($chapterId, $userId);
|
$like = $repo->findConsultLike($chapterId, $userId);
|
||||||
|
|
||||||
if ($like && time() - $like->create_time > 5 * 60) {
|
if ($like) {
|
||||||
throw new BadRequestException('consult.has_liked');
|
if ($like->deleted == 0 && time() - $like->create_time > 5 * 60) {
|
||||||
|
throw new BadRequestException('consult.has_liked');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $like;
|
return $like;
|
||||||
|
@ -249,8 +249,10 @@ class Course extends Validator
|
|||||||
|
|
||||||
$favorite = $repo->findCourseFavorite($courseId, $userId);
|
$favorite = $repo->findCourseFavorite($courseId, $userId);
|
||||||
|
|
||||||
if ($favorite && time() - $favorite->create_time > 5 * 60) {
|
if ($favorite) {
|
||||||
throw new BadRequestException('course.has_favorited');
|
if ($favorite->deleted == 0 && time() - $favorite->create_time > 5 * 60) {
|
||||||
|
throw new BadRequestException('course.has_favorited');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $favorite;
|
return $favorite;
|
||||||
|
@ -35,11 +35,11 @@ class ImGroupUser extends Validator
|
|||||||
return $remark;
|
return $remark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkGroupUser($userId, $groupId)
|
public function checkGroupUser($groupId, $userId)
|
||||||
{
|
{
|
||||||
$repo = new ImGroupUserRepo();
|
$repo = new ImGroupUserRepo();
|
||||||
|
|
||||||
$record = $repo->findGroupUser($userId, $groupId);
|
$record = $repo->findGroupUser($groupId, $userId);
|
||||||
|
|
||||||
if (!$record) {
|
if (!$record) {
|
||||||
throw new BadRequestException('im_group_user.not_found');
|
throw new BadRequestException('im_group_user.not_found');
|
||||||
@ -48,22 +48,22 @@ class ImGroupUser extends Validator
|
|||||||
return $record;
|
return $record;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkIfJoined($userId, $groupId)
|
public function checkIfJoined($groupId, $userId)
|
||||||
{
|
{
|
||||||
$repo = new ImGroupUserRepo();
|
$repo = new ImGroupUserRepo();
|
||||||
|
|
||||||
$record = $repo->findGroupUser($userId, $groupId);
|
$record = $repo->findGroupUser($groupId, $userId);
|
||||||
|
|
||||||
if ($record && $record->blocked == 0) {
|
if ($record && $record->blocked == 0) {
|
||||||
throw new BadRequestException('im_group_user.has_joined');
|
throw new BadRequestException('im_group_user.has_joined');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkIfBlocked($userId, $groupId)
|
public function checkIfBlocked($groupId, $userId)
|
||||||
{
|
{
|
||||||
$repo = new ImGroupUserRepo();
|
$repo = new ImGroupUserRepo();
|
||||||
|
|
||||||
$record = $repo->findGroupUser($userId, $groupId);
|
$record = $repo->findGroupUser($groupId, $userId);
|
||||||
|
|
||||||
if ($record && $record->blocked == 1) {
|
if ($record && $record->blocked == 1) {
|
||||||
throw new BadRequestException('im_group_user.blocked');
|
throw new BadRequestException('im_group_user.blocked');
|
||||||
|
@ -71,8 +71,10 @@ class Review extends Validator
|
|||||||
|
|
||||||
$like = $repo->findReviewLike($reviewId, $userId);
|
$like = $repo->findReviewLike($reviewId, $userId);
|
||||||
|
|
||||||
if ($like && time() - $like->create_time > 5 * 60) {
|
if ($like) {
|
||||||
throw new BadRequestException('review.has_liked');
|
if ($like->deleted == 0 && time() - $like->create_time > 5 * 60) {
|
||||||
|
throw new BadRequestException('review.has_liked');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $like;
|
return $like;
|
||||||
|
@ -17,12 +17,12 @@ layui.define(['jquery', 'element', 'layer'], function (exports) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
helper.checkLogin = function () {
|
helper.checkLogin = function (callback) {
|
||||||
if (window.koogua.user.id === '0') {
|
if (window.koogua.user.id === '0') {
|
||||||
layer.msg('继续操作前请登录或者注册', {icon: 2, anim: 6});
|
layer.msg('继续操作前请先登录', {icon: 2, anim: 6});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
callback();
|
||||||
};
|
};
|
||||||
|
|
||||||
helper.getRequestId = function () {
|
helper.getRequestId = function () {
|
||||||
|
@ -720,11 +720,7 @@ body {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-order .order {
|
.sidebar-order .btn-reward {
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-order .reward-btn {
|
|
||||||
width: 84px;
|
width: 84px;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
}
|
}
|
||||||
@ -1013,7 +1009,6 @@ body {
|
|||||||
|
|
||||||
.cart-course-card .info {
|
.cart-course-card .info {
|
||||||
float: left;
|
float: left;
|
||||||
font-size: 12px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cart-course-card span {
|
.cart-course-card span {
|
||||||
@ -1421,10 +1416,14 @@ body {
|
|||||||
background-color: #f2f2f2;
|
background-color: #f2f2f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.im-search {
|
.im-search-form {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.im-search-tab .layui-tab-content {
|
||||||
|
min-height: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
.im-user-list .user-card {
|
.im-user-list .user-card {
|
||||||
height: 150px;
|
height: 150px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
29
public/static/web/js/chapter.like.js
Normal file
29
public/static/web/js/chapter.like.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
layui.use(['jquery', 'helper'], function () {
|
||||||
|
|
||||||
|
var $ = layui.jquery;
|
||||||
|
var helper = layui.helper;
|
||||||
|
|
||||||
|
$('.icon-praise').on('click', function () {
|
||||||
|
var $this = $(this);
|
||||||
|
var $likeCount = $this.next();
|
||||||
|
var likeCount = parseInt($likeCount.text());
|
||||||
|
helper.checkLogin(function () {
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: $this.parent().data('url'),
|
||||||
|
success: function () {
|
||||||
|
if ($this.hasClass('active')) {
|
||||||
|
$this.removeClass('active');
|
||||||
|
$likeCount.text(likeCount - 1);
|
||||||
|
likeCount -= 1;
|
||||||
|
} else {
|
||||||
|
$this.addClass('active');
|
||||||
|
$likeCount.text(likeCount + 1);
|
||||||
|
likeCount += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@ -1,7 +1,8 @@
|
|||||||
layui.use(['jquery', 'layer'], function () {
|
layui.use(['jquery', 'layer', 'helper'], function () {
|
||||||
|
|
||||||
var $ = layui.jquery;
|
var $ = layui.jquery;
|
||||||
var layer = layui.layer;
|
var layer = layui.layer;
|
||||||
|
var helper = layui.helper;
|
||||||
|
|
||||||
var myShare = {
|
var myShare = {
|
||||||
title: $('input[name="share.title"]').val(),
|
title: $('input[name="share.title"]').val(),
|
||||||
@ -10,39 +11,26 @@ layui.use(['jquery', 'layer'], function () {
|
|||||||
qrcode: $('input[name="share.qrcode"]').val()
|
qrcode: $('input[name="share.qrcode"]').val()
|
||||||
};
|
};
|
||||||
|
|
||||||
$('.icon-heart').on('click', function () {
|
|
||||||
var $this = $(this);
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: $this.parent().data('url'),
|
|
||||||
success: function () {
|
|
||||||
if ($this.hasClass('active')) {
|
|
||||||
$this.removeClass('active');
|
|
||||||
} else {
|
|
||||||
$this.addClass('active');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.icon-praise').on('click', function () {
|
$('.icon-praise').on('click', function () {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var $likeCount = $this.next();
|
var $likeCount = $this.next();
|
||||||
var likeCount = parseInt($likeCount.text());
|
var likeCount = parseInt($likeCount.text());
|
||||||
$.ajax({
|
helper.checkLogin(function () {
|
||||||
type: 'POST',
|
$.ajax({
|
||||||
url: $this.parent().data('url'),
|
type: 'POST',
|
||||||
success: function () {
|
url: $this.parent().data('url'),
|
||||||
if ($this.hasClass('active')) {
|
success: function () {
|
||||||
$this.removeClass('active');
|
if ($this.hasClass('active')) {
|
||||||
$likeCount.text(likeCount - 1);
|
$this.removeClass('active');
|
||||||
likeCount -= 1;
|
$likeCount.text(likeCount - 1);
|
||||||
} else {
|
likeCount -= 1;
|
||||||
$this.addClass('active');
|
} else {
|
||||||
$likeCount.text(likeCount + 1);
|
$this.addClass('active');
|
||||||
likeCount += 1;
|
$likeCount.text(likeCount + 1);
|
||||||
|
likeCount += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4,7 +4,40 @@ layui.use(['jquery', 'layer', 'helper'], function () {
|
|||||||
var layer = layui.layer;
|
var layer = layui.layer;
|
||||||
var helper = layui.helper;
|
var helper = layui.helper;
|
||||||
|
|
||||||
$('.rating-btn').on('click', function () {
|
$('.icon-star').on('click', function () {
|
||||||
|
var $this = $(this);
|
||||||
|
helper.checkLogin(function () {
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: $this.parent().data('url'),
|
||||||
|
success: function () {
|
||||||
|
if ($this.hasClass('layui-icon-star-fill')) {
|
||||||
|
$this.removeClass('layui-icon-star-fill');
|
||||||
|
$this.addClass('layui-icon-star');
|
||||||
|
} else {
|
||||||
|
$this.removeClass('layui-icon-star');
|
||||||
|
$this.addClass('layui-icon-star-fill');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.btn-reward').on('click', function () {
|
||||||
|
var url = $(this).data('url');
|
||||||
|
helper.checkLogin(function () {
|
||||||
|
window.location.href = url;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.btn-buy').on('click', function () {
|
||||||
|
var url = $(this).data('url');
|
||||||
|
helper.checkLogin(function () {
|
||||||
|
window.location.href = url;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.btn-rating').on('click', function () {
|
||||||
var url = $(this).data('url');
|
var url = $(this).data('url');
|
||||||
layer.open({
|
layer.open({
|
||||||
type: 2,
|
type: 2,
|
||||||
@ -18,23 +51,30 @@ layui.use(['jquery', 'layer', 'helper'], function () {
|
|||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var $likeCount = $this.next();
|
var $likeCount = $this.next();
|
||||||
var likeCount = parseInt($likeCount.text());
|
var likeCount = parseInt($likeCount.text());
|
||||||
$.ajax({
|
helper.checkLogin(function () {
|
||||||
type: 'POST',
|
$.ajax({
|
||||||
url: $this.parent().data('url'),
|
type: 'POST',
|
||||||
success: function () {
|
url: $this.parent().data('url'),
|
||||||
if ($this.hasClass('active')) {
|
success: function () {
|
||||||
$this.removeClass('active');
|
if ($this.hasClass('active')) {
|
||||||
$likeCount.text(likeCount - 1);
|
$this.removeClass('active');
|
||||||
likeCount -= 1;
|
$likeCount.text(likeCount - 1);
|
||||||
} else {
|
likeCount -= 1;
|
||||||
$this.addClass('active');
|
} else {
|
||||||
$likeCount.text(likeCount + 1);
|
$this.addClass('active');
|
||||||
likeCount += 1;
|
$likeCount.text(likeCount + 1);
|
||||||
|
likeCount += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if ($('#tab-chapters').length > 0) {
|
||||||
|
var $tabChapters = $('#tab-chapters');
|
||||||
|
helper.ajaxLoadHtml($tabChapters.data('url'), $tabChapters.attr('id'));
|
||||||
|
}
|
||||||
|
|
||||||
if ($('#tab-packages').length > 0) {
|
if ($('#tab-packages').length > 0) {
|
||||||
var $tabPackages = $('#tab-packages');
|
var $tabPackages = $('#tab-packages');
|
||||||
helper.ajaxLoadHtml($tabPackages.data('url'), $tabPackages.attr('id'));
|
helper.ajaxLoadHtml($tabPackages.data('url'), $tabPackages.attr('id'));
|
||||||
@ -50,6 +90,11 @@ layui.use(['jquery', 'layer', 'helper'], function () {
|
|||||||
helper.ajaxLoadHtml($tabReviews.data('url'), $tabReviews.attr('id'));
|
helper.ajaxLoadHtml($tabReviews.data('url'), $tabReviews.attr('id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($('#sidebar-teachers').length > 0) {
|
||||||
|
var $sdTeachers = $('#sidebar-teachers');
|
||||||
|
helper.ajaxLoadHtml($sdTeachers.data('url'), $sdTeachers.attr('id'));
|
||||||
|
}
|
||||||
|
|
||||||
if ($('#sidebar-topics').length > 0) {
|
if ($('#sidebar-topics').length > 0) {
|
||||||
var $sdTopics = $('#sidebar-topics');
|
var $sdTopics = $('#sidebar-topics');
|
||||||
helper.ajaxLoadHtml($sdTopics.data('url'), $sdTopics.attr('id'));
|
helper.ajaxLoadHtml($sdTopics.data('url'), $sdTopics.attr('id'));
|
||||||
|
@ -58,8 +58,8 @@ layui.use(['jquery', 'layim'], function () {
|
|||||||
},
|
},
|
||||||
maxLength: 1000,
|
maxLength: 1000,
|
||||||
find: '/im/find',
|
find: '/im/find',
|
||||||
msgbox: '/im/msg/box',
|
msgbox: '/im/msgbox',
|
||||||
chatLog: '/im/chat/log'
|
chatLog: '/im/chatlog'
|
||||||
});
|
});
|
||||||
|
|
||||||
layim.on('ready', function (options) {
|
layim.on('ready', function (options) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user