From 23af4010824a4311d1272c2c01416b3f1224b89a Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Tue, 8 Sep 2020 20:11:51 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=90=88=E5=B9=B6demo=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Desktop/Views/search/user.volt | 2 +- app/Library/Paginator/Query.php | 27 +++++++++++++++++-------- app/Validators/Category.php | 2 +- app/Validators/Nav.php | 12 +++++------ app/Validators/Order.php | 2 +- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/app/Http/Desktop/Views/search/user.volt b/app/Http/Desktop/Views/search/user.volt index d31265c2..6de1ec3e 100644 --- a/app/Http/Desktop/Views/search/user.volt +++ b/app/Http/Desktop/Views/search/user.volt @@ -26,7 +26,7 @@
{{ item.about }}
性别:{{ gender_info(item.gender) }} - 地区:{{ item.location }} + 地区:{{ item.area }}
diff --git a/app/Library/Paginator/Query.php b/app/Library/Paginator/Query.php index da05ed7a..6b00c357 100644 --- a/app/Library/Paginator/Query.php +++ b/app/Library/Paginator/Query.php @@ -3,6 +3,7 @@ namespace App\Library\Paginator; use Phalcon\Di; +use Phalcon\Filter; use Phalcon\Http\Request; class Query @@ -13,42 +14,52 @@ class Query */ protected $request; + /** + * @var Filter + */ + protected $filter; + public function __construct() { $this->request = Di::getDefault()->get('request'); + + $this->filter = Di::getDefault()->get('filter'); } public function getPage() { - $page = $this->request->get('page', 'int', 1); + $page = $this->request->getQuery('page', ['trim', 'int'], 1); - return $page > 1000 ? 1000 : $page; + return $page > 100 ? 100 : $page; } public function getLimit() { - $limit = $this->request->get('limit', 'int', 12); + $limit = $this->request->getQuery('limit', ['trim', 'int'], 12); return $limit > 100 ? 100 : $limit; } public function getSort() { - return $this->request->get('sort', 'trim', ''); + return $this->request->getQuery('sort', ['trim', 'string'], ''); } public function getBaseUrl() { - return $this->request->get('_url', 'trim', ''); + return $this->request->getQuery('_url', ['trim', 'string'], ''); } - public function getParams() + public function getParams(array $whitelist = []) { - $params = $this->request->get(); + $params = $this->request->getQuery(); if ($params) { foreach ($params as $key => $value) { - if (strlen($value) == 0) { + $value = $this->filter->sanitize($value, ['trim', 'string']); + if ($whitelist && !in_array($value, $whitelist)) { + unset($params[$key]); + } elseif (strlen($value) == 0) { unset($params[$key]); } } diff --git a/app/Validators/Category.php b/app/Validators/Category.php index c60ba738..ead79b30 100644 --- a/app/Validators/Category.php +++ b/app/Validators/Category.php @@ -72,7 +72,7 @@ class Category extends Validator { $list = CategoryModel::types(); - if (!isset($list[$type])) { + if (!array_key_exists($type, $list)) { throw new BadRequestException('category.invalid_type'); } diff --git a/app/Validators/Nav.php b/app/Validators/Nav.php index 1dba8b4e..763cf091 100644 --- a/app/Validators/Nav.php +++ b/app/Validators/Nav.php @@ -69,11 +69,11 @@ class Nav extends Validator { $value = $this->filter->sanitize($url, ['trim']); - $stageA = Text::startsWith($value, '/'); - $stageB = Text::startsWith($value, '#'); - $stageC = CommonValidator::url($value); + $case1 = Text::startsWith($value, '/'); + $case2 = Text::startsWith($value, '#'); + $case3 = CommonValidator::url($value); - if (!$stageA && !$stageB && !$stageC) { + if (!$case1 && !$case2 && !$case3) { throw new BadRequestException('nav.invalid_url'); } @@ -84,7 +84,7 @@ class Nav extends Validator { $list = NavModel::targetTypes(); - if (!isset($list[$target])) { + if (!array_key_exists($target, $list)) { throw new BadRequestException('nav.invalid_target'); } @@ -95,7 +95,7 @@ class Nav extends Validator { $list = NavModel::posTypes(); - if (!isset($list[$position])) { + if (!array_key_exists($position, $list)) { throw new BadRequestException('nav.invalid_position'); } diff --git a/app/Validators/Order.php b/app/Validators/Order.php index 638d2cd1..cdf4f45c 100644 --- a/app/Validators/Order.php +++ b/app/Validators/Order.php @@ -49,7 +49,7 @@ class Order extends Validator { $list = OrderModel::itemTypes(); - if (!isset($list[$itemType])) { + if (!array_key_exists($itemType, $list)) { throw new BadRequestException('order.invalid_item_type'); } From 1bf7449eed33677e7b0344bc98e2a21513eef7c0 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Wed, 9 Sep 2020 20:49:35 +0800 Subject: [PATCH 2/9] =?UTF-8?q?1.websocket=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=E4=B8=BB=E5=8A=A8=E5=8F=91=E6=B6=88=E6=81=AF=E7=BB=99=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=AB=AF=E4=BF=9D=E6=8C=81=E8=BF=9E=E6=8E=A5=202.?= =?UTF-8?q?=E7=BE=A4=E7=BB=84=E7=94=A8=E6=88=B7=E5=8F=AA=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E7=94=A8=E6=88=B7=EF=BC=8C=E5=87=8F=E5=B0=91?= =?UTF-8?q?=E4=BC=A0=E8=BE=93=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Desktop/Services/Im.php | 11 +++++++---- app/Http/Desktop/Views/chapter/live.volt | 5 ++--- app/Http/Desktop/Views/chapter/vod.volt | 3 +-- app/Http/Desktop/Views/search/user.volt | 2 +- .../js/{chapter.live.im.js => chapter.live.chat.js} | 7 ++++--- public/static/desktop/js/im.js | 7 ++++--- 6 files changed, 19 insertions(+), 16 deletions(-) rename public/static/desktop/js/{chapter.live.im.js => chapter.live.chat.js} (95%) diff --git a/app/Http/Desktop/Services/Im.php b/app/Http/Desktop/Services/Im.php index 3e848b1d..c5ebbe32 100644 --- a/app/Http/Desktop/Services/Im.php +++ b/app/Http/Desktop/Services/Im.php @@ -51,14 +51,18 @@ class Im extends Service $group = $validator->checkGroup($id); - $groupRepo = new ImGroupRepo(); + Gateway::$registerAddress = $this->getRegisterAddress(); - $users = $groupRepo->findUsers($group->id); + $userIds = Gateway::getUidListByGroup($this->getGroupName($group->id)); - if ($users->count() == 0) { + if (count($userIds) == 0) { return []; } + $userRepo = new ImUserRepo(); + + $users = $userRepo->findByIds($userIds); + $baseUrl = kg_cos_url(); $result = []; @@ -211,7 +215,6 @@ class Im extends Service 'name' => $user->name, 'avatar' => $user->avatar, ], - 'status' => $user->status == 'online' ? 'online' : 'offline', ]); Gateway::sendToUid($friendUser->friend_id, $content); } diff --git a/app/Http/Desktop/Views/chapter/live.volt b/app/Http/Desktop/Views/chapter/live.volt index 30403179..05831875 100644 --- a/app/Http/Desktop/Views/chapter/live.volt +++ b/app/Http/Desktop/Views/chapter/live.volt @@ -71,10 +71,9 @@ {% block include_js %} - - + {{ js_include('https://imgcache.qq.com/open/qcloud/video/vcplayer/TcPlayer-2.3.3.js', false) }} {{ js_include('desktop/js/chapter.live.player.js') }} - {{ js_include('desktop/js/chapter.live.im.js') }} + {{ js_include('desktop/js/chapter.live.chat.js') }} {{ js_include('desktop/js/chapter.action.js') }} {{ js_include('desktop/js/course.share.js') }} diff --git a/app/Http/Desktop/Views/chapter/vod.volt b/app/Http/Desktop/Views/chapter/vod.volt index d837c02f..706ef1a8 100644 --- a/app/Http/Desktop/Views/chapter/vod.volt +++ b/app/Http/Desktop/Views/chapter/vod.volt @@ -56,8 +56,7 @@ {% block include_js %} - - + {{ js_include('https://imgcache.qq.com/open/qcloud/video/vcplayer/TcPlayer-2.3.3.js', false) }} {{ js_include('desktop/js/course.share.js') }} {{ js_include('desktop/js/chapter.action.js') }} {{ js_include('desktop/js/chapter.vod.player.js') }} diff --git a/app/Http/Desktop/Views/search/user.volt b/app/Http/Desktop/Views/search/user.volt index 6de1ec3e..14b269de 100644 --- a/app/Http/Desktop/Views/search/user.volt +++ b/app/Http/Desktop/Views/search/user.volt @@ -4,7 +4,7 @@ {% elseif gender == 2 %} 女 {% else %} - 保密 + 密 {% endif %} {%- endmacro %} diff --git a/public/static/desktop/js/chapter.live.im.js b/public/static/desktop/js/chapter.live.chat.js similarity index 95% rename from public/static/desktop/js/chapter.live.im.js rename to public/static/desktop/js/chapter.live.chat.js index 834975cc..625dfc52 100644 --- a/public/static/desktop/js/chapter.live.im.js +++ b/public/static/desktop/js/chapter.live.chat.js @@ -11,6 +11,9 @@ layui.use(['jquery', 'form', 'helper'], function () { socket.onopen = function () { console.log('socket connect success'); + setInterval(function () { + socket.send('ping'); + }, 30000); }; socket.onclose = function () { @@ -24,9 +27,7 @@ layui.use(['jquery', 'form', 'helper'], function () { socket.onmessage = function (e) { var data = JSON.parse(e.data); console.log(data); - if (data.type === 'ping') { - socket.send('pong...'); - } else if (data.type === 'bind_user') { + if (data.type === 'bind_user') { bindUser(data.client_id); } else if (data.type === 'new_message') { showNewMessage(data); diff --git a/public/static/desktop/js/im.js b/public/static/desktop/js/im.js index 16cf1f06..dfafbd71 100644 --- a/public/static/desktop/js/im.js +++ b/public/static/desktop/js/im.js @@ -6,6 +6,9 @@ layui.use(['jquery', 'layim'], function () { socket.onopen = function () { console.log('socket connect success'); + setInterval(function () { + socket.send('ping'); + }, 30000); }; socket.onclose = function () { @@ -19,9 +22,7 @@ layui.use(['jquery', 'layim'], function () { socket.onmessage = function (e) { var data = JSON.parse(e.data); console.log(data); - if (data.type === 'ping') { - socket.send('pong...'); - } else if (data.type === 'bind_user') { + if (data.type === 'bind_user') { bindUser(data); refreshMessageBox(); } else if (data.type === 'new_group_user') { From 8c7453a9abe8a17473a66e83198faa474589d2e4 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Thu, 10 Sep 2020 21:18:56 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Tasks/CleanLogTask.php | 6 +- app/Console/Tasks/CleanSessionTask.php | 26 ---- app/Console/Tasks/CloseOrderTask.php | 1 - app/Console/Tasks/CloseTradeTask.php | 1 - app/Console/Tasks/CourseIndexTask.php | 15 +- app/Console/Tasks/DeliverTask.php | 1 - app/Console/Tasks/GroupIndexTask.php | 15 +- app/Console/Tasks/LiveNotifyTask.php | 35 ++--- app/Console/Tasks/MaintainTask.php | 146 ++---------------- app/Console/Tasks/RefundTask.php | 1 - app/Console/Tasks/RevokeVipTask.php | 1 - app/Console/Tasks/SiteMapTask.php | 4 +- app/Console/Tasks/SyncCourseIndexTask.php | 28 +--- app/Console/Tasks/SyncGroupIndexTask.php | 28 +--- app/Console/Tasks/SyncLearningTask.php | 32 +--- app/Console/Tasks/SyncUserIndexTask.php | 28 +--- app/Console/Tasks/Task.php | 28 +++- app/Console/Tasks/UnlockUserTask.php | 8 +- app/Console/Tasks/UpgradeTask.php | 127 +++++++++++++++ app/Console/Tasks/UserIndexTask.php | 15 +- app/Console/Tasks/VodEventTask.php | 1 - app/Http/Desktop/Controllers/Controller.php | 22 ++- .../Desktop/Controllers/SearchController.php | 6 +- app/Http/Desktop/Services/Im.php | 4 +- app/Http/Desktop/Services/Live.php | 8 +- app/Http/Desktop/Views/partials/js_vars.volt | 3 +- app/Library/Logger.php | 4 +- app/Services/Frontend/Search/Course.php | 7 +- app/Services/Frontend/Search/Group.php | 7 +- app/Services/Frontend/Search/Handler.php | 16 ++ app/Services/Frontend/Search/User.php | 7 +- app/Services/Service.php | 22 ++- config/config.default.php | 11 +- public/static/desktop/js/chapter.live.chat.js | 4 +- public/static/desktop/js/im.cs.js | 17 +- public/static/desktop/js/im.js | 5 +- websocket/start_business_worker.php | 2 +- websocket/start_gateway.php | 2 +- 38 files changed, 326 insertions(+), 368 deletions(-) create mode 100644 app/Console/Tasks/UpgradeTask.php create mode 100644 app/Services/Frontend/Search/Handler.php diff --git a/app/Console/Tasks/CleanLogTask.php b/app/Console/Tasks/CleanLogTask.php index 4e171edb..dc499431 100644 --- a/app/Console/Tasks/CleanLogTask.php +++ b/app/Console/Tasks/CleanLogTask.php @@ -2,8 +2,6 @@ namespace App\Console\Tasks; -use Phalcon\Cli\Task; - class CleanLogTask extends Task { @@ -165,9 +163,9 @@ class CleanLogTask extends Task if (strtotime($today) - strtotime($date) >= $keepDays * 86400) { $deleted = unlink($file); if ($deleted) { - echo "Delete {$file} success" . PHP_EOL; + echo "delete {$file} success" . PHP_EOL; } else { - echo "Delete {$file} failed" . PHP_EOL; + echo "delete {$file} failed" . PHP_EOL; } } } diff --git a/app/Console/Tasks/CleanSessionTask.php b/app/Console/Tasks/CleanSessionTask.php index 2be57e51..53b6f1f8 100644 --- a/app/Console/Tasks/CleanSessionTask.php +++ b/app/Console/Tasks/CleanSessionTask.php @@ -2,19 +2,13 @@ namespace App\Console\Tasks; -use App\Library\Cache\Backend\Redis as RedisCache; -use Phalcon\Cli\Task; -use Phalcon\Config; - class CleanSessionTask extends Task { public function mainAction() { $config = $this->getConfig(); - $cache = $this->getCache(); - $redis = $cache->getRedis(); $redis->select($config->path('session.db')); @@ -47,24 +41,4 @@ class CleanSessionTask extends Task return $cache->queryKeys('_PHCR', $limit); } - protected function getConfig() - { - /** - * @var Config $config - */ - $config = $this->getDI()->get('config'); - - return $config; - } - - protected function getCache() - { - /** - * @var RedisCache $cache - */ - $cache = $this->getDI()->get('cache'); - - return $cache; - } - } diff --git a/app/Console/Tasks/CloseOrderTask.php b/app/Console/Tasks/CloseOrderTask.php index b6818ba7..713d225c 100644 --- a/app/Console/Tasks/CloseOrderTask.php +++ b/app/Console/Tasks/CloseOrderTask.php @@ -3,7 +3,6 @@ namespace App\Console\Tasks; use App\Models\Order as OrderModel; -use Phalcon\Cli\Task; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; diff --git a/app/Console/Tasks/CloseTradeTask.php b/app/Console/Tasks/CloseTradeTask.php index 28665b6e..3918d40c 100644 --- a/app/Console/Tasks/CloseTradeTask.php +++ b/app/Console/Tasks/CloseTradeTask.php @@ -5,7 +5,6 @@ namespace App\Console\Tasks; use App\Models\Trade as TradeModel; use App\Services\Pay\Alipay as AlipayService; use App\Services\Pay\Wxpay as WxpayService; -use Phalcon\Cli\Task; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; diff --git a/app/Console/Tasks/CourseIndexTask.php b/app/Console/Tasks/CourseIndexTask.php index 050e50b5..23a148cc 100644 --- a/app/Console/Tasks/CourseIndexTask.php +++ b/app/Console/Tasks/CourseIndexTask.php @@ -5,7 +5,6 @@ namespace App\Console\Tasks; use App\Models\Course as CourseModel; use App\Services\Search\CourseDocument; use App\Services\Search\CourseSearcher; -use Phalcon\Cli\Task; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; @@ -24,7 +23,7 @@ class CourseIndexTask extends Task $query = $params[0] ?? null; if (!$query) { - exit("please special a query word" . PHP_EOL); + exit('please special a query word' . PHP_EOL); } $result = $this->searchCourses($query); @@ -61,11 +60,11 @@ class CourseIndexTask extends Task $index = $handler->getXS()->getIndex(); - echo "start clean index" . PHP_EOL; + echo 'start clean index' . PHP_EOL; $index->clean(); - echo "end clean index" . PHP_EOL; + echo 'end clean index' . PHP_EOL; } /** @@ -75,9 +74,7 @@ class CourseIndexTask extends Task { $courses = $this->findCourses(); - if ($courses->count() == 0) { - return; - } + if ($courses->count() == 0) return; $handler = new CourseSearcher(); @@ -85,7 +82,7 @@ class CourseIndexTask extends Task $index = $handler->getXS()->getIndex(); - echo "start rebuild index" . PHP_EOL; + echo 'start rebuild index' . PHP_EOL; $index->beginRebuild(); @@ -96,7 +93,7 @@ class CourseIndexTask extends Task $index->endRebuild(); - echo "end rebuild index" . PHP_EOL; + echo 'end rebuild index' . PHP_EOL; } /** diff --git a/app/Console/Tasks/DeliverTask.php b/app/Console/Tasks/DeliverTask.php index 5c39371d..a7ff11be 100644 --- a/app/Console/Tasks/DeliverTask.php +++ b/app/Console/Tasks/DeliverTask.php @@ -74,7 +74,6 @@ class DeliverTask extends Task $task->update(); $logger->info('Order Process Exception ' . kg_json_encode([ - 'line' => $e->getLine(), 'code' => $e->getCode(), 'message' => $e->getMessage(), 'task' => $task->toArray(), diff --git a/app/Console/Tasks/GroupIndexTask.php b/app/Console/Tasks/GroupIndexTask.php index 2cd79419..4e9c2918 100644 --- a/app/Console/Tasks/GroupIndexTask.php +++ b/app/Console/Tasks/GroupIndexTask.php @@ -5,7 +5,6 @@ namespace App\Console\Tasks; use App\Models\ImGroup as GroupModel; use App\Services\Search\GroupDocument; use App\Services\Search\GroupSearcher; -use Phalcon\Cli\Task; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; @@ -24,7 +23,7 @@ class GroupIndexTask extends Task $query = $params[0] ?? null; if (!$query) { - exit("please special a query word" . PHP_EOL); + exit('please special a query word' . PHP_EOL); } $result = $this->searchGroups($query); @@ -61,11 +60,11 @@ class GroupIndexTask extends Task $index = $handler->getXS()->getIndex(); - echo "start clean index" . PHP_EOL; + echo 'start clean index' . PHP_EOL; $index->clean(); - echo "end clean index" . PHP_EOL; + echo 'end clean index' . PHP_EOL; } /** @@ -75,9 +74,7 @@ class GroupIndexTask extends Task { $groups = $this->findGroups(); - if ($groups->count() == 0) { - return; - } + if ($groups->count() == 0) return; $handler = new GroupSearcher(); @@ -85,7 +82,7 @@ class GroupIndexTask extends Task $index = $handler->getXS()->getIndex(); - echo "start rebuild index" . PHP_EOL; + echo 'start rebuild index' . PHP_EOL; $index->beginRebuild(); @@ -96,7 +93,7 @@ class GroupIndexTask extends Task $index->endRebuild(); - echo "end rebuild index" . PHP_EOL; + echo 'end rebuild index' . PHP_EOL; } /** diff --git a/app/Console/Tasks/LiveNotifyTask.php b/app/Console/Tasks/LiveNotifyTask.php index b2f792c4..abd33a2a 100644 --- a/app/Console/Tasks/LiveNotifyTask.php +++ b/app/Console/Tasks/LiveNotifyTask.php @@ -2,54 +2,42 @@ namespace App\Console\Tasks; -use App\Library\Cache\Backend\Redis as RedisCache; use App\Models\CourseUser as CourseUserModel; use App\Repos\Chapter as ChapterRepo; use App\Services\LiveNotify as LiveNotifyService; use App\Services\Smser\Live as LiveSmser; -use Phalcon\Cli\Task; class LiveNotifyTask extends Task { - /** - * @var RedisCache - */ - protected $cache; - - /** - * @var \Redis - */ - protected $redis; - public function mainAction() { - $this->cache = $this->getDI()->get('cache'); + $cache = $this->getCache(); - $this->redis = $this->cache->getRedis(); + $redis = $cache->getRedis(); $service = new LiveNotifyService(); $key = $service->getNotifyKey(); - $chapterIds = $this->redis->sMembers($key); + $chapterIds = $redis->sMembers($key); if (!$chapterIds) return; $sentKey = $service->getSentNotifyKey(); - $sentChapterIds = $this->redis->sMembers($sentKey); + $sentChapterIds = $redis->sMembers($sentKey); foreach ($chapterIds as $chapterId) { if (!in_array($chapterId, $sentChapterIds)) { $this->sendNotification($chapterId); } else { - $this->redis->sAdd($sentKey, $chapterId); + $redis->sAdd($sentKey, $chapterId); } } - if ($this->redis->sCard($sentKey) == 1) { - $this->redis->expire($sentKey, 86400); + if ($redis->sCard($sentKey) == 1) { + $redis->expire($sentKey, 86400); } } @@ -74,9 +62,6 @@ class LiveNotifyTask extends Task protected function findTargetUserIds($courseId) { - /** - * 只给付费和vip用户发通知 - */ $sourceTypes = [ CourseUserModel::SOURCE_CHARGE, CourseUserModel::SOURCE_VIP, @@ -88,11 +73,11 @@ class LiveNotifyTask extends Task ->inWhere('source_type', $sourceTypes) ->execute(); - if ($rows->count() > 0) { - return kg_array_column($rows->toArray(), 'user_id'); + if ($rows->count() == 0) { + return []; } - return []; + return kg_array_column($rows->toArray(), 'user_id'); } } diff --git a/app/Console/Tasks/MaintainTask.php b/app/Console/Tasks/MaintainTask.php index f8b1d1e6..4b526448 100644 --- a/app/Console/Tasks/MaintainTask.php +++ b/app/Console/Tasks/MaintainTask.php @@ -2,149 +2,31 @@ namespace App\Console\Tasks; -use App\Caches\Setting as SettingCache; -use App\Library\Cache\Backend\Redis as RedisCache; -use App\Models\Setting as SettingModel; -use Phalcon\Cli\Task; -use Phalcon\Config; +use App\Caches\IndexFreeCourseList as IndexFreeCourseListCache; +use App\Caches\IndexNewCourseList as IndexNewCourseListCache; +use App\Caches\IndexVipCourseList as IndexVipCourseListCache; class MaintainTask extends Task { - public function mainAction() + public function rebuildIndexCourseCacheAction($params) { - $this->resetSettingAction(); - $this->resetAnnotationAction(); - $this->resetMetadataAction(); - $this->resetVoltAction(); - } + $section = $params[0] ?? null; - /** - * 重置设置 - * - * @command: php console.php maintain reset_setting - */ - public function resetSettingAction() - { - echo "start reset setting..." . PHP_EOL; - - $rows = SettingModel::query()->columns('section')->distinct(true)->execute(); - - foreach ($rows as $row) { - $cache = new SettingCache(); - $cache->rebuild($row->section); + if (!$section || $section == 'new_course') { + $cache = new IndexNewCourseListCache(); + $cache->rebuild(); } - echo "end reset setting..." . PHP_EOL; - } - - /** - * 重置注解 - * - * @command: php console.php maintain reset_annotation - */ - public function resetAnnotationAction() - { - $config = $this->getConfig(); - $cache = $this->getCache(); - $redis = $cache->getRedis(); - - $dbIndex = $config->path('annotation.db'); - $statsKey = $config->path('annotation.statsKey'); - - $redis->select($dbIndex); - - $keys = $redis->sMembers($statsKey); - - echo "start reset annotation..." . PHP_EOL; - - if (count($keys) > 0) { - - $keys = $this->handlePhKeys($keys); - - $redis->del(...$keys); - $redis->del($statsKey); + if (!$section || $section == 'free_course') { + $cache = new IndexFreeCourseListCache(); + $cache->rebuild(); } - echo "end reset annotation..." . PHP_EOL; - } - - /** - * 重置元数据 - * - * @command: php console.php maintain reset_metadata - */ - public function resetMetadataAction() - { - $config = $this->getConfig(); - $cache = $this->getCache(); - $redis = $cache->getRedis(); - - $dbIndex = $config->path('metadata.db'); - $statsKey = $config->path('metadata.statsKey'); - - $redis->select($dbIndex); - - $keys = $redis->sMembers($statsKey); - - echo "start reset metadata..." . PHP_EOL; - - if (count($keys) > 0) { - - $keys = $this->handlePhKeys($keys); - - $redis->del(...$keys); - $redis->del($statsKey); + if (!$section || $section == 'vip_course') { + $cache = new IndexVipCourseListCache(); + $cache->rebuild(); } - - echo "start reset metadata..." . PHP_EOL; - } - - /** - * 重置模板 - * - * @command: php console.php maintain reset_volt - */ - public function resetVoltAction() - { - echo "start reset volt..." . PHP_EOL; - - $dir = cache_path('volt'); - - foreach (scandir($dir) as $file) { - if (strpos($file, '.php')) { - unlink($dir . '/' . $file); - } - } - - echo "end reset volt..." . PHP_EOL; - } - - protected function getConfig() - { - /** - * @var Config $config - */ - $config = $this->getDI()->get('config'); - - return $config; - } - - protected function getCache() - { - /** - * @var RedisCache $cache - */ - $cache = $this->getDI()->get('cache'); - - return $cache; - } - - protected function handlePhKeys($keys) - { - return array_map(function ($key) { - return "_PHCR{$key}"; - }, $keys); } } diff --git a/app/Console/Tasks/RefundTask.php b/app/Console/Tasks/RefundTask.php index 0af0a715..434cfdfb 100644 --- a/app/Console/Tasks/RefundTask.php +++ b/app/Console/Tasks/RefundTask.php @@ -111,7 +111,6 @@ class RefundTask extends Task $task->update(); $logger->info('Refund Task Exception ' . kg_json_encode([ - 'line' => $e->getLine(), 'code' => $e->getCode(), 'message' => $e->getMessage(), 'task' => $task->toArray(), diff --git a/app/Console/Tasks/RevokeVipTask.php b/app/Console/Tasks/RevokeVipTask.php index 56a11e1d..58380c4b 100644 --- a/app/Console/Tasks/RevokeVipTask.php +++ b/app/Console/Tasks/RevokeVipTask.php @@ -3,7 +3,6 @@ namespace App\Console\Tasks; use App\Models\User as UserModel; -use Phalcon\Cli\Task; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; diff --git a/app/Console/Tasks/SiteMapTask.php b/app/Console/Tasks/SiteMapTask.php index b698b533..0d389e26 100644 --- a/app/Console/Tasks/SiteMapTask.php +++ b/app/Console/Tasks/SiteMapTask.php @@ -51,7 +51,7 @@ class SiteMapTask extends Task $settings = $service->getSectionSettings('site'); - return $settings['base_url'] ?? ''; + return $settings['url'] ?? ''; } protected function addIndex() @@ -62,7 +62,7 @@ class SiteMapTask extends Task protected function addCourses() { /** - * @var Resultset $courses + * @var Resultset|CourseModel[] $courses */ $courses = CourseModel::query()->where('published = 1')->execute(); diff --git a/app/Console/Tasks/SyncCourseIndexTask.php b/app/Console/Tasks/SyncCourseIndexTask.php index 8911734d..a3b9f8cc 100644 --- a/app/Console/Tasks/SyncCourseIndexTask.php +++ b/app/Console/Tasks/SyncCourseIndexTask.php @@ -2,7 +2,6 @@ namespace App\Console\Tasks; -use App\Library\Cache\Backend\Redis as RedisCache; use App\Repos\Course as CourseRepo; use App\Services\Search\CourseDocument; use App\Services\Search\CourseSearcher; @@ -11,30 +10,15 @@ use App\Services\Syncer\CourseIndex as CourseIndexSyncer; class SyncCourseIndexTask extends Task { - /** - * @var RedisCache - */ - protected $cache; - - /** - * @var \Redis - */ - protected $redis; - public function mainAction() { - $this->cache = $this->getDI()->get('cache'); + $cache = $this->getCache(); - $this->redis = $this->cache->getRedis(); + $redis = $cache->getRedis(); - $this->rebuild(); - } - - protected function rebuild() - { $key = $this->getSyncKey(); - $courseIds = $this->redis->sRandMember($key, 1000); + $courseIds = $redis->sRandMember($key, 1000); if (!$courseIds) return; @@ -42,9 +26,7 @@ class SyncCourseIndexTask extends Task $courses = $courseRepo->findByIds($courseIds); - if ($courses->count() == 0) { - return; - } + if ($courses->count() == 0) return; $document = new CourseDocument(); @@ -67,7 +49,7 @@ class SyncCourseIndexTask extends Task $index->closeBuffer(); - $this->redis->sRem($key, ...$courseIds); + $redis->sRem($key, ...$courseIds); } protected function getSyncKey() diff --git a/app/Console/Tasks/SyncGroupIndexTask.php b/app/Console/Tasks/SyncGroupIndexTask.php index ebb81e2f..2f33e9b6 100644 --- a/app/Console/Tasks/SyncGroupIndexTask.php +++ b/app/Console/Tasks/SyncGroupIndexTask.php @@ -2,7 +2,6 @@ namespace App\Console\Tasks; -use App\Library\Cache\Backend\Redis as RedisCache; use App\Repos\ImGroup as GroupRepo; use App\Services\Search\GroupDocument; use App\Services\Search\GroupSearcher; @@ -11,30 +10,15 @@ use App\Services\Syncer\GroupIndex as GroupIndexSyncer; class SyncGroupIndexTask extends Task { - /** - * @var RedisCache - */ - protected $cache; - - /** - * @var \Redis - */ - protected $redis; - public function mainAction() { - $this->cache = $this->getDI()->get('cache'); + $cache = $this->getCache(); - $this->redis = $this->cache->getRedis(); + $redis = $cache->getRedis(); - $this->rebuild(); - } - - protected function rebuild() - { $key = $this->getSyncKey(); - $groupIds = $this->redis->sRandMember($key, 1000); + $groupIds = $redis->sRandMember($key, 1000); if (!$groupIds) return; @@ -42,9 +26,7 @@ class SyncGroupIndexTask extends Task $groups = $groupRepo->findByIds($groupIds); - if ($groups->count() == 0) { - return; - } + if ($groups->count() == 0) return; $document = new GroupDocument(); @@ -67,7 +49,7 @@ class SyncGroupIndexTask extends Task $index->closeBuffer(); - $this->redis->sRem($key, ...$groupIds); + $redis->sRem($key, ...$groupIds); } protected function getSyncKey() diff --git a/app/Console/Tasks/SyncLearningTask.php b/app/Console/Tasks/SyncLearningTask.php index d44006c5..5c82b879 100644 --- a/app/Console/Tasks/SyncLearningTask.php +++ b/app/Console/Tasks/SyncLearningTask.php @@ -2,7 +2,6 @@ namespace App\Console\Tasks; -use App\Library\Cache\Backend\Redis as RedisCache; use App\Models\Course as CourseModel; use App\Models\Learning as LearningModel; use App\Repos\Chapter as ChapterRepo; @@ -11,32 +10,21 @@ use App\Repos\Course as CourseRepo; use App\Repos\CourseUser as CourseUserRepo; use App\Repos\Learning as LearningRepo; use App\Services\Syncer\Learning as LearningSyncer; -use Phalcon\Cli\Task; class SyncLearningTask extends Task { - /** - * @var RedisCache - */ - protected $cache; - - /** - * @var \Redis - */ - protected $redis; - public function mainAction() { - $this->cache = $this->getDI()->get('cache'); + $cache = $this->getCache(); - $this->redis = $this->cache->getRedis(); + $redis = $cache->getRedis(); $syncer = new LearningSyncer(); $syncKey = $syncer->getSyncKey(); - $requestIds = $this->redis->sMembers($syncKey); + $requestIds = $redis->sMembers($syncKey); if (!$requestIds) return; @@ -46,7 +34,7 @@ class SyncLearningTask extends Task $this->handleLearning($itemKey); - $this->redis->sRem($syncKey, $requestId); + $redis->sRem($syncKey, $requestId); } } @@ -153,15 +141,11 @@ class SyncLearningTask extends Task $courseLessons = $courseRepo->findLessons($learning->course_id); - if ($courseLessons->count() == 0) { - return; - } + if ($courseLessons->count() == 0) return; $userLearnings = $courseRepo->findUserLearnings($learning->course_id, $learning->user_id, $learning->plan_id); - if ($userLearnings->count() == 0) { - return; - } + if ($userLearnings->count() == 0) return; $consumedUserLearnings = []; @@ -171,9 +155,7 @@ class SyncLearningTask extends Task } } - if (count($consumedUserLearnings) == 0) { - return; - } + if (count($consumedUserLearnings) == 0) return; $duration = 0; diff --git a/app/Console/Tasks/SyncUserIndexTask.php b/app/Console/Tasks/SyncUserIndexTask.php index bd7c8aea..9ddb2fb4 100644 --- a/app/Console/Tasks/SyncUserIndexTask.php +++ b/app/Console/Tasks/SyncUserIndexTask.php @@ -2,7 +2,6 @@ namespace App\Console\Tasks; -use App\Library\Cache\Backend\Redis as RedisCache; use App\Repos\User as UserRepo; use App\Services\Search\UserDocument; use App\Services\Search\UserSearcher; @@ -11,30 +10,15 @@ use App\Services\Syncer\UserIndex as UserIndexSyncer; class SyncUserIndexTask extends Task { - /** - * @var RedisCache - */ - protected $cache; - - /** - * @var \Redis - */ - protected $redis; - public function mainAction() { - $this->cache = $this->getDI()->get('cache'); + $cache = $this->getCache(); - $this->redis = $this->cache->getRedis(); + $redis = $cache->getRedis(); - $this->rebuild(); - } - - protected function rebuild() - { $key = $this->getSyncKey(); - $userIds = $this->redis->sRandMember($key, 1000); + $userIds = $redis->sRandMember($key, 1000); if (!$userIds) return; @@ -42,9 +26,7 @@ class SyncUserIndexTask extends Task $users = $userRepo->findByIds($userIds); - if ($users->count() == 0) { - return; - } + if ($users->count() == 0) return; $document = new UserDocument(); @@ -67,7 +49,7 @@ class SyncUserIndexTask extends Task $index->closeBuffer(); - $this->redis->sRem($key, ...$userIds); + $redis->sRem($key, ...$userIds); } protected function getSyncKey() diff --git a/app/Console/Tasks/Task.php b/app/Console/Tasks/Task.php index dc875cd1..b2b8cc79 100644 --- a/app/Console/Tasks/Task.php +++ b/app/Console/Tasks/Task.php @@ -2,14 +2,38 @@ namespace App\Console\Tasks; -use App\Library\Logger; +use App\Library\Cache\Backend\Redis as RedisCache; +use App\Library\Logger as AppLogger; +use Phalcon\Config as PhConfig; +use Phalcon\Logger\Adapter\File as PhLogger; + class Task extends \Phalcon\Cli\Task { + /** + * @return PhConfig + */ + public function getConfig() + { + return $this->getDI()->get('config'); + } + + /** + * @return RedisCache + */ + public function getCache() + { + return $this->getDI()->get('cache'); + } + + /** + * @param null $channel + * @return PhLogger + */ public function getLogger($channel = null) { - $logger = new Logger(); + $logger = new AppLogger(); return $logger->getInstance($channel); } diff --git a/app/Console/Tasks/UnlockUserTask.php b/app/Console/Tasks/UnlockUserTask.php index 0f21f6a0..d499c8f8 100644 --- a/app/Console/Tasks/UnlockUserTask.php +++ b/app/Console/Tasks/UnlockUserTask.php @@ -3,7 +3,6 @@ namespace App\Console\Tasks; use App\Models\User as UserModel; -use Phalcon\Cli\Task; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; @@ -14,13 +13,10 @@ class UnlockUserTask extends Task { $users = $this->findUsers(); - if ($users->count() == 0) { - return; - } + if ($users->count() == 0) return; foreach ($users as $user) { - $user->locked = 0; - $user->update(); + $user->update(['locked' => 0]); } } diff --git a/app/Console/Tasks/UpgradeTask.php b/app/Console/Tasks/UpgradeTask.php new file mode 100644 index 00000000..913696b1 --- /dev/null +++ b/app/Console/Tasks/UpgradeTask.php @@ -0,0 +1,127 @@ +resetSettingAction(); + $this->resetAnnotationAction(); + $this->resetMetadataAction(); + $this->resetVoltAction(); + } + + /** + * 重置系统设置 + * + * @command: php console.php upgrade reset_setting + */ + public function resetSettingAction() + { + echo "start reset setting..." . PHP_EOL; + + $rows = SettingModel::query()->columns('section')->distinct(true)->execute(); + + foreach ($rows as $row) { + $cache = new SettingCache(); + $cache->rebuild($row->section); + } + + echo "end reset setting..." . PHP_EOL; + } + + /** + * 重置注解 + * + * @command: php console.php upgrade reset_annotation + */ + public function resetAnnotationAction() + { + $config = $this->getConfig(); + $cache = $this->getCache(); + $redis = $cache->getRedis(); + + $dbIndex = $config->path('annotation.db'); + $statsKey = $config->path('annotation.statsKey'); + + $redis->select($dbIndex); + + $keys = $redis->sMembers($statsKey); + + echo "start reset annotation..." . PHP_EOL; + + if (count($keys) > 0) { + + $keys = $this->handlePhKeys($keys); + + $redis->del(...$keys); + $redis->del($statsKey); + } + + echo "end reset annotation..." . PHP_EOL; + } + + /** + * 重置元数据 + * + * @command: php console.php upgrade reset_metadata + */ + public function resetMetadataAction() + { + $config = $this->getConfig(); + $cache = $this->getCache(); + $redis = $cache->getRedis(); + + $dbIndex = $config->path('metadata.db'); + $statsKey = $config->path('metadata.statsKey'); + + $redis->select($dbIndex); + + $keys = $redis->sMembers($statsKey); + + echo "start reset metadata..." . PHP_EOL; + + if (count($keys) > 0) { + + $keys = $this->handlePhKeys($keys); + + $redis->del(...$keys); + $redis->del($statsKey); + } + + echo "start reset metadata..." . PHP_EOL; + } + + /** + * 重置模板 + * + * @command: php console.php upgrade reset_volt + */ + public function resetVoltAction() + { + echo "start reset volt..." . PHP_EOL; + + $dir = cache_path('volt'); + + foreach (scandir($dir) as $file) { + if (strpos($file, '.php')) { + unlink($dir . '/' . $file); + } + } + + echo "end reset volt..." . PHP_EOL; + } + + protected function handlePhKeys($keys) + { + return array_map(function ($key) { + return "_PHCR{$key}"; + }, $keys); + } + +} diff --git a/app/Console/Tasks/UserIndexTask.php b/app/Console/Tasks/UserIndexTask.php index 3ec4ce51..6ce9c7d6 100644 --- a/app/Console/Tasks/UserIndexTask.php +++ b/app/Console/Tasks/UserIndexTask.php @@ -5,7 +5,6 @@ namespace App\Console\Tasks; use App\Models\User as UserModel; use App\Services\Search\UserDocument; use App\Services\Search\UserSearcher; -use Phalcon\Cli\Task; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; @@ -24,7 +23,7 @@ class UserIndexTask extends Task $query = $params[0] ?? null; if (!$query) { - exit("please special a query word" . PHP_EOL); + exit('please special a query word' . PHP_EOL); } $result = $this->searchUsers($query); @@ -61,11 +60,11 @@ class UserIndexTask extends Task $index = $handler->getXS()->getIndex(); - echo "start clean index" . PHP_EOL; + echo 'start clean index' . PHP_EOL; $index->clean(); - echo "end clean index" . PHP_EOL; + echo 'end clean index' . PHP_EOL; } /** @@ -75,9 +74,7 @@ class UserIndexTask extends Task { $users = $this->findUsers(); - if ($users->count() == 0) { - return; - } + if ($users->count() == 0) return; $handler = new UserSearcher(); @@ -85,7 +82,7 @@ class UserIndexTask extends Task $index = $handler->getXS()->getIndex(); - echo "start rebuild index" . PHP_EOL; + echo 'start rebuild index' . PHP_EOL; $index->beginRebuild(); @@ -96,7 +93,7 @@ class UserIndexTask extends Task $index->endRebuild(); - echo "end rebuild index" . PHP_EOL; + echo 'end rebuild index' . PHP_EOL; } /** diff --git a/app/Console/Tasks/VodEventTask.php b/app/Console/Tasks/VodEventTask.php index 07795c5b..c51e0c1d 100644 --- a/app/Console/Tasks/VodEventTask.php +++ b/app/Console/Tasks/VodEventTask.php @@ -6,7 +6,6 @@ use App\Models\Chapter as ChapterModel; use App\Repos\Chapter as ChapterRepo; use App\Services\CourseStat as CourseStatService; use App\Services\Vod as VodService; -use Phalcon\Cli\Task; class VodEventTask extends Task { diff --git a/app/Http/Desktop/Controllers/Controller.php b/app/Http/Desktop/Controllers/Controller.php index 287c3cb1..add4d228 100644 --- a/app/Http/Desktop/Controllers/Controller.php +++ b/app/Http/Desktop/Controllers/Controller.php @@ -10,6 +10,7 @@ use App\Models\User as UserModel; use App\Services\Auth\Desktop as DesktopAuth; use App\Traits\Response as ResponseTrait; use App\Traits\Security as SecurityTrait; +use Phalcon\Config; use Phalcon\Mvc\Dispatcher; class Controller extends \Phalcon\Mvc\Controller @@ -120,13 +121,32 @@ class Controller extends \Phalcon\Mvc\Controller { $cache = new SettingCache(); + $websocket = $this->getConfig()->get('websocket'); + + /** + * ssl通过nginx转发实现 + */ + if ($this->request->isSecure()) { + $websocket->connect_url = sprintf('wss://%s/wss', $this->request->getHttpHost()); + } else { + $websocket->connect_url = sprintf('ws://%s', $websocket->connect_address); + } + return [ 'main' => $cache->get('im.main'), 'cs' => $cache->get('im.cs'), - 'websocket' => $this->config->websocket, + 'websocket' => $websocket, ]; } + /** + * @return Config + */ + protected function getConfig() + { + return $this->getDI()->get('config'); + } + protected function checkSiteStatus() { if ($this->siteInfo['enabled'] == 0) { diff --git a/app/Http/Desktop/Controllers/SearchController.php b/app/Http/Desktop/Controllers/SearchController.php index de036304..c7a8b7b1 100644 --- a/app/Http/Desktop/Controllers/SearchController.php +++ b/app/Http/Desktop/Controllers/SearchController.php @@ -21,7 +21,7 @@ class SearchController extends Controller public function indexAction() { $query = $this->request->get('query', ['trim', 'string']); - $type = $this->request->get('type', ['trim'], 'course'); + $type = $this->request->get('type', ['trim', 'string'], 'course'); if (empty($query)) { return $this->response->redirect(['for' => 'desktop.course.list']); @@ -31,9 +31,9 @@ class SearchController extends Controller $service = $this->getSearchService($type); - $hotQueries = $service->hotQuery(); + $hotQueries = $service->getHotQuery(); - $relatedQueries = $service->relatedQuery($query); + $relatedQueries = $service->getRelatedQuery($query); $pager = $service->search(); diff --git a/app/Http/Desktop/Services/Im.php b/app/Http/Desktop/Services/Im.php index c5ebbe32..04a1caf7 100644 --- a/app/Http/Desktop/Services/Im.php +++ b/app/Http/Desktop/Services/Im.php @@ -341,9 +341,9 @@ class Im extends Service protected function getRegisterAddress() { - $config = $this->getDI()->get('config'); + $config = $this->getConfig(); - return $config->websocket->register_address; + return $config->path('websocket.register_address'); } } diff --git a/app/Http/Desktop/Services/Live.php b/app/Http/Desktop/Services/Live.php index c5ba0c10..0b43410f 100644 --- a/app/Http/Desktop/Services/Live.php +++ b/app/Http/Desktop/Services/Live.php @@ -15,7 +15,7 @@ class Live extends Service { $redis = $this->getRedis(); - $key = $this->getRedisListKey($id); + $key = $this->getRecentChatKey($id); $redis->expire($key, 3 * 3600); @@ -132,12 +132,12 @@ class Live extends Service protected function getRegisterAddress() { - $config = $this->getDI()->get('config'); + $config = $this->getConfig(); - return $config->websocket->register_address; + return $config->path('websocket.register_address'); } - protected function getRedisListKey($id) + protected function getRecentChatKey($id) { return "live_recent_chat:{$id}"; } diff --git a/app/Http/Desktop/Views/partials/js_vars.volt b/app/Http/Desktop/Views/partials/js_vars.volt index 0bf820b7..dcdd59e7 100644 --- a/app/Http/Desktop/Views/partials/js_vars.volt +++ b/app/Http/Desktop/Views/partials/js_vars.volt @@ -21,7 +21,8 @@ enabled: '{{ im_info.cs.enabled }}' }, websocket: { - url: '{{ im_info.websocket.url }}' + connect_url: '{{ im_info.websocket.connect_url }}', + ping_interval: '{{ im_info.websocket.ping_interval }}' } }; diff --git a/app/Library/Logger.php b/app/Library/Logger.php index 38824ecf..24b0202f 100644 --- a/app/Library/Logger.php +++ b/app/Library/Logger.php @@ -3,7 +3,7 @@ namespace App\Library; use Phalcon\Di; -use Phalcon\Logger as PhalconLogger; +use Phalcon\Logger as PhLogger; use Phalcon\Logger\Adapter\File as FileLogger; class Logger @@ -23,7 +23,7 @@ class Logger $path = log_path($filename); - $level = $config->env != ENV_DEV ? $config->log->level : PhalconLogger::DEBUG; + $level = $config->env != ENV_DEV ? $config->log->level : PhLogger::DEBUG; $logger = new FileLogger($path); diff --git a/app/Services/Frontend/Search/Course.php b/app/Services/Frontend/Search/Course.php index 3bba34c1..12907727 100644 --- a/app/Services/Frontend/Search/Course.php +++ b/app/Services/Frontend/Search/Course.php @@ -4,10 +4,9 @@ namespace App\Services\Frontend\Search; use App\Library\Paginator\Adapter\XunSearch as XunSearchPaginator; use App\Library\Paginator\Query as PagerQuery; -use App\Services\Frontend\Service as FrontendService; use App\Services\Search\CourseSearcher as CourseSearcherService; -class Course extends FrontendService +class Course extends Handler { public function search() @@ -33,14 +32,14 @@ class Course extends FrontendService return $this->handleCourses($pager); } - public function hotQuery($limit = 10, $type = 'total') + public function getHotQuery($limit = 10, $type = 'total') { $searcher = new CourseSearcherService(); return $searcher->getHotQuery($limit, $type); } - public function relatedQuery($query, $limit = 10) + public function getRelatedQuery($query, $limit = 10) { $searcher = new CourseSearcherService(); diff --git a/app/Services/Frontend/Search/Group.php b/app/Services/Frontend/Search/Group.php index 85ca0d7f..527cf362 100644 --- a/app/Services/Frontend/Search/Group.php +++ b/app/Services/Frontend/Search/Group.php @@ -4,10 +4,9 @@ namespace App\Services\Frontend\Search; use App\Library\Paginator\Adapter\XunSearch as XunSearchPaginator; use App\Library\Paginator\Query as PagerQuery; -use App\Services\Frontend\Service as FrontendService; use App\Services\Search\GroupSearcher as GroupSearcherService; -class Group extends FrontendService +class Group extends Handler { public function search() @@ -33,14 +32,14 @@ class Group extends FrontendService return $this->handleGroups($pager); } - public function hotQuery($limit = 10, $type = 'total') + public function getHotQuery($limit = 10, $type = 'total') { $searcher = new GroupSearcherService(); return $searcher->getHotQuery($limit, $type); } - public function relatedQuery($query, $limit = 10) + public function getRelatedQuery($query, $limit = 10) { $searcher = new GroupSearcherService(); diff --git a/app/Services/Frontend/Search/Handler.php b/app/Services/Frontend/Search/Handler.php new file mode 100644 index 00000000..1ea5e77f --- /dev/null +++ b/app/Services/Frontend/Search/Handler.php @@ -0,0 +1,16 @@ +handleUsers($pager); } - public function hotQuery($limit = 10, $type = 'total') + public function getHotQuery($limit = 10, $type = 'total') { $searcher = new UserSearcherService(); return $searcher->getHotQuery($limit, $type); } - public function relatedQuery($query, $limit = 10) + public function getRelatedQuery($query, $limit = 10) { $searcher = new UserSearcherService(); diff --git a/app/Services/Service.php b/app/Services/Service.php index 8604bbe5..0f1c3964 100644 --- a/app/Services/Service.php +++ b/app/Services/Service.php @@ -3,9 +3,11 @@ namespace App\Services; use App\Caches\Setting as SettingCache; +use App\Library\Cache\Backend\Redis as RedisCache; use App\Library\Logger as AppLogger; use App\Traits\Auth as AuthTrait; -use Phalcon\Logger\Adapter\File as FileLogger; +use Phalcon\Config as PhConfig; +use Phalcon\Logger\Adapter\File as PhLogger; use Phalcon\Mvc\User\Component; class Service extends Component @@ -13,11 +15,27 @@ class Service extends Component use AuthTrait; + /** + * @return PhConfig + */ + public function getConfig() + { + return $this->getDI()->get('config'); + } + + /** + * @return RedisCache + */ + public function getCache() + { + return $this->getDI()->get('cache'); + } + /** * 获取Logger * * @param string $channel - * @return FileLogger + * @return PhLogger */ public function getLogger($channel = null) { diff --git a/config/config.default.php b/config/config.default.php index a108f80a..8fd72d5e 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -163,12 +163,17 @@ $config['throttle']['lifetime'] = 60; $config['throttle']['rate_limit'] = 60; /** - * 客户端连接地址(外部可访问的ip或域名) + * 客户端ping服务端间隔(秒) */ -$config['websocket']['url'] = 'ws://127.0.0.1:8282'; +$config['websocket']['ping_interval'] = 50; /** - * gateway和worker注册地址(内部访问) + * 客户端连接地址(外部可访问的域名或ip),带端口号 + */ +$config['websocket']['connect_address'] = 'your_domain.com:8282'; + +/** + * gateway和worker注册地址,带端口号 */ $config['websocket']['register_address'] = '127.0.0.1:1238'; diff --git a/public/static/desktop/js/chapter.live.chat.js b/public/static/desktop/js/chapter.live.chat.js index 625dfc52..92376a41 100644 --- a/public/static/desktop/js/chapter.live.chat.js +++ b/public/static/desktop/js/chapter.live.chat.js @@ -3,7 +3,7 @@ layui.use(['jquery', 'form', 'helper'], function () { var $ = layui.jquery; var form = layui.form; var helper = layui.helper; - var socket = new WebSocket(window.im.websocket.url); + var socket = new WebSocket(window.im.websocket.connect_url); var bindUserUrl = $('input[name="bind_user_url"]').val(); var liveStatsUrl = $('input[name="live_stats_url"]').val(); var $chatContent = $('input[name=content]'); @@ -13,7 +13,7 @@ layui.use(['jquery', 'form', 'helper'], function () { console.log('socket connect success'); setInterval(function () { socket.send('ping'); - }, 30000); + }, 1000 * parseInt(window.im.websocket.ping_interval)); }; socket.onclose = function () { diff --git a/public/static/desktop/js/im.cs.js b/public/static/desktop/js/im.cs.js index e2c821ea..353490c5 100644 --- a/public/static/desktop/js/im.cs.js +++ b/public/static/desktop/js/im.cs.js @@ -16,10 +16,13 @@ layui.use(['jquery', 'layim'], function () { welcome: $('input[name="cs_user.welcome"]').val() }; - var socket = new WebSocket(window.im.websocket.url); + var socket = new WebSocket(window.im.websocket.connect_url); socket.onopen = function () { console.log('socket connect success'); + setInterval(function () { + socket.send('ping'); + }, 1000 * parseInt(window.im.websocket.ping_interval)); }; socket.onclose = function () { @@ -33,9 +36,7 @@ layui.use(['jquery', 'layim'], function () { socket.onmessage = function (e) { var data = JSON.parse(e.data); console.log(data); - if (data.type === 'ping') { - socket.send('pong...'); - } else if (data.type === 'bind_user') { + if (data.type === 'bind_user') { bindUser(data); } else if (data.type === 'show_chat_msg') { showChatMessage(data); @@ -48,18 +49,18 @@ layui.use(['jquery', 'layim'], function () { id: me.id, username: me.name, avatar: me.avatar, - status: 'online', + status: 'online' } }, brief: true, - maxLength: 1000, + maxLength: window.im.main.msg_max_length }); layim.chat({ id: csUser.id, name: csUser.name, avatar: csUser.avatar, - type: 'friend', + type: 'friend' }); layim.on('sendMessage', function (res) { @@ -95,7 +96,7 @@ layui.use(['jquery', 'layim'], function () { avatar: csUser.avatar, content: csUser.welcome, timestamp: new Date().getTime(), - type: 'friend', + type: 'friend' }); } diff --git a/public/static/desktop/js/im.js b/public/static/desktop/js/im.js index dfafbd71..e03d6c2f 100644 --- a/public/static/desktop/js/im.js +++ b/public/static/desktop/js/im.js @@ -2,13 +2,14 @@ layui.use(['jquery', 'layim'], function () { var $ = layui.jquery; var layim = layui.layim; - var socket = new WebSocket(window.im.websocket.url); + var socket = new WebSocket(window.im.websocket.connect_url); socket.onopen = function () { console.log('socket connect success'); setInterval(function () { socket.send('ping'); - }, 30000); + console.log('ping...'); + }, 1000 * parseInt(window.im.websocket.ping_interval)); }; socket.onclose = function () { diff --git a/websocket/start_business_worker.php b/websocket/start_business_worker.php index e0132056..0ae0c96d 100644 --- a/websocket/start_business_worker.php +++ b/websocket/start_business_worker.php @@ -23,7 +23,7 @@ require_once dirname(__DIR__) . '/vendor/autoload.php'; $worker = new BusinessWorker(); // worker名称 -$worker->name = 'ChatBusinessWorker'; +$worker->name = 'ImBusinessWorker'; // businessWorker进程数量 $worker->count = 4; diff --git a/websocket/start_gateway.php b/websocket/start_gateway.php index 313903b4..b2e2145f 100644 --- a/websocket/start_gateway.php +++ b/websocket/start_gateway.php @@ -23,7 +23,7 @@ require_once dirname(__DIR__) . '/vendor/autoload.php'; $gateway = new Gateway("websocket://0.0.0.0:8282"); // gateway名称,status方便查看 -$gateway->name = 'ChatGateway'; +$gateway->name = 'ImGateway'; // gateway进程数 $gateway->count = 4; From def5b3605abb3dcc99eb256c9d3b759e934d1a19 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Fri, 11 Sep 2020 20:00:31 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E5=88=87=E6=8D=A2"=E7=AE=80=E6=B4=81"=E5=92=8C=E2=80=9C?= =?UTF-8?q?=E4=B8=B0=E5=AF=8C=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Caches/IndexFreeCourseList.php | 4 +- app/Caches/IndexNewCourseList.php | 4 +- app/Caches/IndexSimpleFreeCourseList.php | 70 +++++++++++++++++++ app/Caches/IndexSimpleNewCourseList.php | 69 ++++++++++++++++++ app/Caches/IndexSimpleVipCourseList.php | 70 +++++++++++++++++++ app/Caches/IndexVipCourseList.php | 4 +- app/Http/Admin/Views/setting/site.volt | 7 ++ .../Desktop/Controllers/IndexController.php | 36 ++++++++-- app/Http/Desktop/Services/Index.php | 44 +++++++++--- .../Views/index/{index.volt => full.volt} | 0 app/Http/Desktop/Views/index/simple.volt | 60 ++++++++++++++++ bootstrap/ConsoleErrorHandler.php | 19 ++++- bootstrap/Kernel.php | 3 + .../20200827112717_insert_setting_data.php | 15 ++++ public/static/desktop/css/common.css | 4 ++ 15 files changed, 385 insertions(+), 24 deletions(-) create mode 100644 app/Caches/IndexSimpleFreeCourseList.php create mode 100644 app/Caches/IndexSimpleNewCourseList.php create mode 100644 app/Caches/IndexSimpleVipCourseList.php rename app/Http/Desktop/Views/index/{index.volt => full.volt} (100%) create mode 100644 app/Http/Desktop/Views/index/simple.volt diff --git a/app/Caches/IndexFreeCourseList.php b/app/Caches/IndexFreeCourseList.php index b6c69d67..2783b4ce 100644 --- a/app/Caches/IndexFreeCourseList.php +++ b/app/Caches/IndexFreeCourseList.php @@ -30,7 +30,7 @@ class IndexFreeCourseList extends Cache { $categoryLimit = 5; - $courseLimit = 10; + $courseLimit = 8; $categories = $this->findCategories($categoryLimit); @@ -100,7 +100,7 @@ class IndexFreeCourseList extends Cache * @param int $limit * @return ResultsetInterface|Resultset|CourseModel[] */ - protected function findCategoryCourses($categoryId, $limit = 10) + protected function findCategoryCourses($categoryId, $limit = 8) { $categoryService = new CategoryService(); diff --git a/app/Caches/IndexNewCourseList.php b/app/Caches/IndexNewCourseList.php index 7cb627cf..9a2a89b6 100644 --- a/app/Caches/IndexNewCourseList.php +++ b/app/Caches/IndexNewCourseList.php @@ -30,7 +30,7 @@ class IndexNewCourseList extends Cache { $categoryLimit = 5; - $courseLimit = 10; + $courseLimit = 8; $categories = $this->findCategories($categoryLimit); @@ -100,7 +100,7 @@ class IndexNewCourseList extends Cache * @param int $limit * @return ResultsetInterface|Resultset|CourseModel[] */ - protected function findCategoryCourses($categoryId, $limit = 10) + protected function findCategoryCourses($categoryId, $limit = 8) { $categoryService = new CategoryService(); diff --git a/app/Caches/IndexSimpleFreeCourseList.php b/app/Caches/IndexSimpleFreeCourseList.php new file mode 100644 index 00000000..a91174a4 --- /dev/null +++ b/app/Caches/IndexSimpleFreeCourseList.php @@ -0,0 +1,70 @@ +lifetime; + } + + public function getKey($id = null) + { + return 'index_simple_free_course_list'; + } + + public function getContent($id = null) + { + $limit = 8; + + $courses = $this->findCourses($limit); + + if ($courses->count() == 0) { + return []; + } + + $result = []; + + foreach ($courses as $course) { + $result[] = [ + 'id' => $course->id, + 'title' => $course->title, + 'cover' => $course->cover, + 'market_price' => $course->market_price, + 'vip_price' => $course->vip_price, + 'model' => $course->model, + 'level' => $course->level, + 'user_count' => $course->user_count, + 'lesson_count' => $course->lesson_count, + ]; + } + + return $result; + } + + /** + * @param int $limit + * @return ResultsetInterface|Resultset|CourseModel[] + */ + protected function findCourses($limit = 8) + { + return CourseModel::query() + ->where('published = 1') + ->andWhere('market_price = 0') + ->orderBy('score DESC') + ->limit($limit) + ->execute(); + } + +} diff --git a/app/Caches/IndexSimpleNewCourseList.php b/app/Caches/IndexSimpleNewCourseList.php new file mode 100644 index 00000000..4d9dcd89 --- /dev/null +++ b/app/Caches/IndexSimpleNewCourseList.php @@ -0,0 +1,69 @@ +lifetime; + } + + public function getKey($id = null) + { + return 'index_simple_new_course_list'; + } + + public function getContent($id = null) + { + $limit = 8; + + $courses = $this->findCourses($limit); + + if ($courses->count() == 0) { + return []; + } + + $result = []; + + foreach ($courses as $course) { + $result[] = [ + 'id' => $course->id, + 'title' => $course->title, + 'cover' => $course->cover, + 'market_price' => $course->market_price, + 'vip_price' => $course->vip_price, + 'model' => $course->model, + 'level' => $course->level, + 'user_count' => $course->user_count, + 'lesson_count' => $course->lesson_count, + ]; + } + + return $result; + } + + /** + * @param int $limit + * @return ResultsetInterface|Resultset|CourseModel[] + */ + protected function findCourses($limit = 8) + { + return CourseModel::query() + ->where('published = 1') + ->orderBy('id DESC') + ->limit($limit) + ->execute(); + } + +} diff --git a/app/Caches/IndexSimpleVipCourseList.php b/app/Caches/IndexSimpleVipCourseList.php new file mode 100644 index 00000000..bfb10e59 --- /dev/null +++ b/app/Caches/IndexSimpleVipCourseList.php @@ -0,0 +1,70 @@ +lifetime; + } + + public function getKey($id = null) + { + return 'index_simple_vip_course_list'; + } + + public function getContent($id = null) + { + $limit = 8; + + $courses = $this->findCourses($limit); + + if ($courses->count() == 0) { + return []; + } + + $result = []; + + foreach ($courses as $course) { + $result[] = [ + 'id' => $course->id, + 'title' => $course->title, + 'cover' => $course->cover, + 'market_price' => $course->market_price, + 'vip_price' => $course->vip_price, + 'model' => $course->model, + 'level' => $course->level, + 'user_count' => $course->user_count, + 'lesson_count' => $course->lesson_count, + ]; + } + + return $result; + } + + /** + * @param int $limit + * @return ResultsetInterface|Resultset|CourseModel[] + */ + protected function findCourses($limit = 8) + { + return CourseModel::query() + ->where('published = 1') + ->andWhere('vip_price >= 0') + ->orderBy('score DESC') + ->limit($limit) + ->execute(); + } + +} diff --git a/app/Caches/IndexVipCourseList.php b/app/Caches/IndexVipCourseList.php index ab869db0..36fe1d0a 100644 --- a/app/Caches/IndexVipCourseList.php +++ b/app/Caches/IndexVipCourseList.php @@ -30,7 +30,7 @@ class IndexVipCourseList extends Cache { $categoryLimit = 5; - $courseLimit = 10; + $courseLimit = 8; $categories = $this->findCategories($categoryLimit); @@ -100,7 +100,7 @@ class IndexVipCourseList extends Cache * @param int $limit * @return ResultsetInterface|Resultset|CourseModel[] */ - protected function findCategoryCourses($categoryId, $limit = 10) + protected function findCategoryCourses($categoryId, $limit = 8) { $categoryService = new CategoryService(); diff --git a/app/Http/Admin/Views/setting/site.volt b/app/Http/Admin/Views/setting/site.volt index a8e1ffb1..4443f487 100644 --- a/app/Http/Admin/Views/setting/site.volt +++ b/app/Http/Admin/Views/setting/site.volt @@ -23,6 +23,13 @@ +
+ +
+ + +
+
diff --git a/app/Http/Desktop/Controllers/IndexController.php b/app/Http/Desktop/Controllers/IndexController.php index 96324570..5fe3a0a5 100644 --- a/app/Http/Desktop/Controllers/IndexController.php +++ b/app/Http/Desktop/Controllers/IndexController.php @@ -15,13 +15,37 @@ class IndexController extends Controller $this->seo->setKeywords($this->siteInfo['keywords']); $this->seo->setDescription($this->siteInfo['description']); - $indexService = new IndexService(); + $template = $this->siteInfo['index_template'] ?? 'full'; - $this->view->setVar('lives', $indexService->getLives()); - $this->view->setVar('carousels', $indexService->getCarousels()); - $this->view->setVar('new_courses', $indexService->getNewCourses()); - $this->view->setVar('free_courses', $indexService->getFreeCourses()); - $this->view->setVar('vip_courses', $indexService->getVipCourses()); + if ($template == 'full') { + $this->fullIndex(); + } else { + $this->simpleIndex(); + } + } + + protected function fullIndex() + { + $service = new IndexService(); + + $this->view->pick('index/full'); + $this->view->setVar('lives', $service->getLives()); + $this->view->setVar('carousels', $service->getCarousels()); + $this->view->setVar('new_courses', $service->getNewCourses()); + $this->view->setVar('free_courses', $service->getFreeCourses()); + $this->view->setVar('vip_courses', $service->getVipCourses()); + } + + protected function simpleIndex() + { + $service = new IndexService(); + + $this->view->pick('index/simple'); + $this->view->setVar('lives', $service->getLives()); + $this->view->setVar('carousels', $service->getCarousels()); + $this->view->setVar('new_courses', $service->getSimpleNewCourses()); + $this->view->setVar('free_courses', $service->getSimpleFreeCourses()); + $this->view->setVar('vip_courses', $service->getSimpleVipCourses()); } } diff --git a/app/Http/Desktop/Services/Index.php b/app/Http/Desktop/Services/Index.php index 71e93eb2..b5b41615 100644 --- a/app/Http/Desktop/Services/Index.php +++ b/app/Http/Desktop/Services/Index.php @@ -2,11 +2,14 @@ namespace App\Http\Desktop\Services; -use App\Caches\IndexCarouselList as IndexCarouselListCache; -use App\Caches\IndexFreeCourseList as IndexFreeCourseListCache; -use App\Caches\IndexLiveList as IndexLiveListCache; -use App\Caches\IndexNewCourseList as IndexNewCourseListCache; -use App\Caches\IndexVipCourseList as IndexVipCourseListCache; +use App\Caches\IndexCarouselList; +use App\Caches\IndexFreeCourseList; +use App\Caches\IndexLiveList; +use App\Caches\IndexNewCourseList; +use App\Caches\IndexSimpleFreeCourseList; +use App\Caches\IndexSimpleNewCourseList; +use App\Caches\IndexSimpleVipCourseList; +use App\Caches\IndexVipCourseList; use App\Models\Carousel as CarouselModel; class Index extends Service @@ -14,7 +17,7 @@ class Index extends Service public function getCarousels() { - $cache = new IndexCarouselListCache(); + $cache = new IndexCarouselList(); /** * @var array $carousels @@ -53,14 +56,14 @@ class Index extends Service public function getLives() { - $cache = new IndexLiveListCache(); + $cache = new IndexLiveList(); return $cache->get(); } public function getNewCourses() { - $cache = new IndexNewCourseListCache(); + $cache = new IndexNewCourseList(); $courses = $cache->get(); @@ -69,7 +72,7 @@ class Index extends Service public function getFreeCourses() { - $cache = new IndexFreeCourseListCache(); + $cache = new IndexFreeCourseList(); $courses = $cache->get(); @@ -78,13 +81,34 @@ class Index extends Service public function getVipCourses() { - $cache = new IndexVipCourseListCache(); + $cache = new IndexVipCourseList(); $courses = $cache->get(); return $this->handleCategoryCourses($courses); } + public function getSimpleNewCourses() + { + $cache = new IndexSimpleNewCourseList(); + + return $cache->get(); + } + + public function getSimpleFreeCourses() + { + $cache = new IndexSimpleFreeCourseList(); + + return $cache->get(); + } + + public function getSimpleVipCourses() + { + $cache = new IndexSimpleVipCourseList(); + + return $cache->get(); + } + protected function handleCategoryCourses($items, $limit = 8) { if (count($items) == 0) { diff --git a/app/Http/Desktop/Views/index/index.volt b/app/Http/Desktop/Views/index/full.volt similarity index 100% rename from app/Http/Desktop/Views/index/index.volt rename to app/Http/Desktop/Views/index/full.volt diff --git a/app/Http/Desktop/Views/index/simple.volt b/app/Http/Desktop/Views/index/simple.volt new file mode 100644 index 00000000..f9353a1b --- /dev/null +++ b/app/Http/Desktop/Views/index/simple.volt @@ -0,0 +1,60 @@ +{% extends 'templates/main.volt' %} + +{% block content %} + + {{ partial('macros/course') }} + + {%- macro show_courses(courses) %} +
+
+ {% for course in courses %} +
+ {{ course_card(course) }} +
+ {% endfor %} +
+
+ {%- endmacro %} + + + +
+
新上课程
+
+ {{ show_courses(new_courses) }} +
+
+ +
+
免费课程
+
+ {{ show_courses(free_courses) }} +
+
+ +
+
会员课程
+
+ {{ show_courses(vip_courses) }} +
+
+ +{% endblock %} + +{% block include_js %} + + {{ js_include('desktop/js/index.js') }} + +{% endblock %} \ No newline at end of file diff --git a/bootstrap/ConsoleErrorHandler.php b/bootstrap/ConsoleErrorHandler.php index c159338a..c6a25826 100644 --- a/bootstrap/ConsoleErrorHandler.php +++ b/bootstrap/ConsoleErrorHandler.php @@ -3,6 +3,8 @@ namespace Bootstrap; use App\Library\Logger as AppLogger; +use Phalcon\Config as PhConfig; +use Phalcon\Logger\Adapter\File as PhLogger; use Phalcon\Mvc\User\Component; class ConsoleErrorHandler extends Component @@ -25,17 +27,30 @@ class ConsoleErrorHandler extends Component */ public function handleException($e) { - $content = sprintf('%s(%d): %s', $e->getFile(), $e->getLine(), $e->getMessage()); + $config = $this->getConfig(); $logger = $this->getLogger(); + $content = sprintf('%s(%d): %s', $e->getFile(), $e->getLine(), $e->getMessage()); + $logger->error($content); - if ($this->config->env == ENV_DEV) { + if ($config->get('env') == ENV_DEV) { echo $content; } } + /** + * @return PhConfig + */ + protected function getConfig() + { + return $this->getDI()->get('config'); + } + + /** + * @return PhLogger + */ protected function getLogger() { $logger = new AppLogger(); diff --git a/bootstrap/Kernel.php b/bootstrap/Kernel.php index 31bd9845..5e1bea07 100644 --- a/bootstrap/Kernel.php +++ b/bootstrap/Kernel.php @@ -24,6 +24,9 @@ abstract class Kernel */ protected $loader; + /** + * @var array + */ protected $configs = []; public function getApp() diff --git a/db/migrations/20200827112717_insert_setting_data.php b/db/migrations/20200827112717_insert_setting_data.php index f20635f1..ba5edecc 100644 --- a/db/migrations/20200827112717_insert_setting_data.php +++ b/db/migrations/20200827112717_insert_setting_data.php @@ -230,6 +230,16 @@ final class InsertSettingData extends AbstractMigration 'item_key' => 'enabled', 'item_value' => '1', ], + [ + 'section' => 'pay.wxpay', + 'item_key' => 'mp_app_id', + 'item_value' => '', + ], + [ + 'section' => 'pay.wxpay', + 'item_key' => 'mini_app_id', + 'item_value' => '', + ], [ 'section' => 'pay.wxpay', 'item_key' => 'app_id', @@ -300,6 +310,11 @@ final class InsertSettingData extends AbstractMigration 'item_key' => 'closed_tips', 'item_value' => '站点维护中,请稍后再访问。', ], + [ + 'section' => 'site', + 'item_key' => 'index_template', + 'item_value' => 'simple', + ], [ 'section' => 'site', 'item_key' => 'copyright', diff --git a/public/static/desktop/css/common.css b/public/static/desktop/css/common.css index 7454b7f8..9e44a1d9 100644 --- a/public/static/desktop/css/common.css +++ b/public/static/desktop/css/common.css @@ -202,6 +202,10 @@ body { line-height: 40px; } +.index-wrap { + padding-bottom: 15px; +} + .index-wrap .layui-tab { margin-bottom: 0; } From d9016669e35e9f5611a8924c5f85c0a303a3e622 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Sat, 12 Sep 2020 19:57:28 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Caches/Cache.php | 2 +- app/Caches/Counter.php | 2 +- app/Console/Tasks/CleanSessionTask.php | 2 +- app/Console/Tasks/LiveNotifyTask.php | 2 +- app/Console/Tasks/SyncCourseIndexTask.php | 2 +- app/Console/Tasks/SyncGroupIndexTask.php | 2 +- app/Console/Tasks/SyncLearningTask.php | 2 +- app/Console/Tasks/SyncUserIndexTask.php | 2 +- app/Console/Tasks/Task.php | 12 ++- app/Console/Tasks/UpgradeTask.php | 4 +- app/Http/Admin/Views/nav/edit.volt | 4 +- app/Http/Admin/Views/setting/pay_wxpay.volt | 8 +- app/Http/Admin/Views/setting/site.volt | 31 +++++-- .../Desktop/Controllers/ChapterController.php | 14 +++- app/Http/Desktop/Controllers/Controller.php | 8 +- .../Desktop/Controllers/LiveController.php | 12 +++ app/Http/Desktop/Services/Live.php | 28 +++---- app/Http/Desktop/Views/chapter/live.volt | 83 ++++--------------- .../Desktop/Views/chapter/live_active.volt | 80 ++++++++++++++++++ .../Desktop/Views/chapter/live_forbid.volt | 15 ++++ .../Desktop/Views/chapter/live_inactive.volt | 42 ++++++++++ app/Http/Desktop/Views/templates/main.volt | 4 +- app/Library/Helper.php | 8 +- app/Library/Logger.php | 8 +- app/Models/Chapter.php | 2 +- app/Services/Auth/Api.php | 13 +-- .../Frontend/Chapter/BasicInfoTrait.php | 2 + .../{Chapter => }/ChapterLiveTrait.php | 2 +- app/Services/Frontend/ChapterTrait.php | 21 +++++ .../Frontend/Teaching/LivePushUrl.php | 2 +- app/Services/LiveNotify.php | 8 +- app/Services/Pay/AlipayGateway.php | 12 +-- app/Services/Pay/WxpayGateway.php | 20 +++-- app/Services/Service.php | 12 ++- app/Services/Syncer/CourseIndex.php | 26 ++---- app/Services/Syncer/GroupIndex.php | 26 ++---- app/Services/Syncer/Learning.php | 34 +++----- app/Services/Syncer/UserIndex.php | 26 ++---- app/Services/Throttle.php | 15 ++-- app/Services/Verify.php | 2 +- app/Validators/Chapter.php | 39 +++++++++ app/Validators/ChapterLive.php | 11 +-- bootstrap/Helper.php | 28 ++++--- config/alipay/.gitignore | 2 + config/cert/alipay/.gitignore | 2 - config/cert/wxpay/.gitignore | 2 - config/wxpay/.gitignore | 2 + public/static/desktop/css/common.css | 28 +++++++ .../desktop/js/chapter.live.countdown.js | 32 +++++++ 49 files changed, 470 insertions(+), 276 deletions(-) create mode 100644 app/Http/Desktop/Views/chapter/live_active.volt create mode 100644 app/Http/Desktop/Views/chapter/live_forbid.volt create mode 100644 app/Http/Desktop/Views/chapter/live_inactive.volt rename app/Services/Frontend/{Chapter => }/ChapterLiveTrait.php (74%) create mode 100644 config/alipay/.gitignore delete mode 100644 config/cert/alipay/.gitignore delete mode 100644 config/cert/wxpay/.gitignore create mode 100644 config/wxpay/.gitignore create mode 100644 public/static/desktop/js/chapter.live.countdown.js diff --git a/app/Caches/Cache.php b/app/Caches/Cache.php index c832247c..f0b2cee4 100644 --- a/app/Caches/Cache.php +++ b/app/Caches/Cache.php @@ -15,7 +15,7 @@ abstract class Cache extends Component public function __construct() { - $this->cache = $this->getDI()->get('cache'); + $this->cache = $this->getDI()->getShared('cache'); } /** diff --git a/app/Caches/Counter.php b/app/Caches/Counter.php index 7c2dcbca..ad52c178 100644 --- a/app/Caches/Counter.php +++ b/app/Caches/Counter.php @@ -20,7 +20,7 @@ abstract class Counter extends Component public function __construct() { - $this->cache = $this->getDI()->get('cache'); + $this->cache = $this->getDI()->getShared('cache'); $this->redis = $this->cache->getRedis(); } diff --git a/app/Console/Tasks/CleanSessionTask.php b/app/Console/Tasks/CleanSessionTask.php index 53b6f1f8..fb27ddef 100644 --- a/app/Console/Tasks/CleanSessionTask.php +++ b/app/Console/Tasks/CleanSessionTask.php @@ -9,7 +9,7 @@ class CleanSessionTask extends Task { $config = $this->getConfig(); $cache = $this->getCache(); - $redis = $cache->getRedis(); + $redis = $this->getRedis(); $redis->select($config->path('session.db')); diff --git a/app/Console/Tasks/LiveNotifyTask.php b/app/Console/Tasks/LiveNotifyTask.php index abd33a2a..5dd5b542 100644 --- a/app/Console/Tasks/LiveNotifyTask.php +++ b/app/Console/Tasks/LiveNotifyTask.php @@ -14,7 +14,7 @@ class LiveNotifyTask extends Task { $cache = $this->getCache(); - $redis = $cache->getRedis(); + $redis = $this->getRedis(); $service = new LiveNotifyService(); diff --git a/app/Console/Tasks/SyncCourseIndexTask.php b/app/Console/Tasks/SyncCourseIndexTask.php index a3b9f8cc..abbe3b5b 100644 --- a/app/Console/Tasks/SyncCourseIndexTask.php +++ b/app/Console/Tasks/SyncCourseIndexTask.php @@ -14,7 +14,7 @@ class SyncCourseIndexTask extends Task { $cache = $this->getCache(); - $redis = $cache->getRedis(); + $redis = $this->getRedis(); $key = $this->getSyncKey(); diff --git a/app/Console/Tasks/SyncGroupIndexTask.php b/app/Console/Tasks/SyncGroupIndexTask.php index 2f33e9b6..65ead9a9 100644 --- a/app/Console/Tasks/SyncGroupIndexTask.php +++ b/app/Console/Tasks/SyncGroupIndexTask.php @@ -14,7 +14,7 @@ class SyncGroupIndexTask extends Task { $cache = $this->getCache(); - $redis = $cache->getRedis(); + $redis = $this->getRedis(); $key = $this->getSyncKey(); diff --git a/app/Console/Tasks/SyncLearningTask.php b/app/Console/Tasks/SyncLearningTask.php index 5c82b879..cac1e4dc 100644 --- a/app/Console/Tasks/SyncLearningTask.php +++ b/app/Console/Tasks/SyncLearningTask.php @@ -18,7 +18,7 @@ class SyncLearningTask extends Task { $cache = $this->getCache(); - $redis = $cache->getRedis(); + $redis = $this->getRedis(); $syncer = new LearningSyncer(); diff --git a/app/Console/Tasks/SyncUserIndexTask.php b/app/Console/Tasks/SyncUserIndexTask.php index 9ddb2fb4..b8cb5669 100644 --- a/app/Console/Tasks/SyncUserIndexTask.php +++ b/app/Console/Tasks/SyncUserIndexTask.php @@ -14,7 +14,7 @@ class SyncUserIndexTask extends Task { $cache = $this->getCache(); - $redis = $cache->getRedis(); + $redis = $this->getRedis(); $key = $this->getSyncKey(); diff --git a/app/Console/Tasks/Task.php b/app/Console/Tasks/Task.php index b2b8cc79..44f9e1d4 100644 --- a/app/Console/Tasks/Task.php +++ b/app/Console/Tasks/Task.php @@ -16,7 +16,7 @@ class Task extends \Phalcon\Cli\Task */ public function getConfig() { - return $this->getDI()->get('config'); + return $this->getDI()->getShared('config'); } /** @@ -24,7 +24,15 @@ class Task extends \Phalcon\Cli\Task */ public function getCache() { - return $this->getDI()->get('cache'); + return $this->getDI()->getShared('cache'); + } + + /** + * @return \Redis + */ + public function getRedis() + { + return $this->getCache()->getRedis(); } /** diff --git a/app/Console/Tasks/UpgradeTask.php b/app/Console/Tasks/UpgradeTask.php index 913696b1..a8600332 100644 --- a/app/Console/Tasks/UpgradeTask.php +++ b/app/Console/Tasks/UpgradeTask.php @@ -44,7 +44,7 @@ class UpgradeTask extends Task { $config = $this->getConfig(); $cache = $this->getCache(); - $redis = $cache->getRedis(); + $redis = $this->getRedis(); $dbIndex = $config->path('annotation.db'); $statsKey = $config->path('annotation.statsKey'); @@ -75,7 +75,7 @@ class UpgradeTask extends Task { $config = $this->getConfig(); $cache = $this->getCache(); - $redis = $cache->getRedis(); + $redis = $this->getRedis(); $dbIndex = $config->path('metadata.db'); $statsKey = $config->path('metadata.statsKey'); diff --git a/app/Http/Admin/Views/nav/edit.volt b/app/Http/Admin/Views/nav/edit.volt index cd970355..60ad58ad 100644 --- a/app/Http/Admin/Views/nav/edit.volt +++ b/app/Http/Admin/Views/nav/edit.volt @@ -27,8 +27,8 @@
- - + +
diff --git a/app/Http/Admin/Views/setting/pay_wxpay.volt b/app/Http/Admin/Views/setting/pay_wxpay.volt index 57cca245..3cea4cdd 100644 --- a/app/Http/Admin/Views/setting/pay_wxpay.volt +++ b/app/Http/Admin/Views/setting/pay_wxpay.volt @@ -7,19 +7,19 @@
- +
- +
- +
- +
diff --git a/app/Http/Admin/Views/setting/site.volt b/app/Http/Admin/Views/setting/site.volt index 4443f487..1b474648 100644 --- a/app/Http/Admin/Views/setting/site.volt +++ b/app/Http/Admin/Views/setting/site.volt @@ -2,7 +2,8 @@ {% block content %} - {% set closed_tips_display = site.enabled == 0 ? 'display:block' : 'display:none' %} + {% set closed_tips_display = site.status == 'closed' ? 'display:block' : 'display:none' %} + {% set analytics_script_display = site.analytics_enabled == 1 ? 'display:block' : 'display:none' %}
@@ -11,8 +12,8 @@
- - + +
@@ -89,9 +90,18 @@
- +
- + + +
+
+
+
+ +
+ +
@@ -117,7 +127,16 @@ form.on('radio(status)', function (data) { var block = $('#closed-tips-block'); - if (data.value === '0') { + if (data.value === 'closed') { + block.show(); + } else { + block.hide(); + } + }); + + form.on('radio(analytics_enabled)', function (data) { + var block = $('#analytics-script-block'); + if (data.value === '1') { block.show(); } else { block.hide(); diff --git a/app/Http/Desktop/Controllers/ChapterController.php b/app/Http/Desktop/Controllers/ChapterController.php index b575881a..03fbe309 100644 --- a/app/Http/Desktop/Controllers/ChapterController.php +++ b/app/Http/Desktop/Controllers/ChapterController.php @@ -2,6 +2,7 @@ namespace App\Http\Desktop\Controllers; +use App\Models\ChapterLive as LiveModel; use App\Models\Course as CourseModel; use App\Services\Frontend\Chapter\ChapterInfo as ChapterInfoService; use App\Services\Frontend\Chapter\ChapterLike as ChapterLikeService; @@ -38,12 +39,21 @@ class ChapterController extends Controller $catalog = $service->handle($chapter['course']['id']); $this->seo->prependTitle(['章节', $chapter['title'], $chapter['course']['title']]); - $this->seo->setDescription($chapter['summary']); + + if (!empty($chapter['summary'])) { + $this->seo->setDescription($chapter['summary']); + } if ($chapter['model'] == CourseModel::MODEL_VOD) { $this->view->pick('chapter/vod'); } elseif ($chapter['model'] == CourseModel::MODEL_LIVE) { - $this->view->pick('chapter/live'); + if ($chapter['status'] == LiveModel::STATUS_ACTIVE) { + $this->view->pick('chapter/live_active'); + } elseif ($chapter['status'] == LiveModel::STATUS_INACTIVE) { + $this->view->pick('chapter/live_inactive'); + } elseif ($chapter['status'] == LiveModel::STATUS_FORBID) { + $this->view->pick('chapter/live_forbid'); + } } elseif ($chapter['model'] == CourseModel::MODEL_READ) { $this->view->pick('chapter/read'); } diff --git a/app/Http/Desktop/Controllers/Controller.php b/app/Http/Desktop/Controllers/Controller.php index add4d228..d91cd7ca 100644 --- a/app/Http/Desktop/Controllers/Controller.php +++ b/app/Http/Desktop/Controllers/Controller.php @@ -60,7 +60,11 @@ class Controller extends \Phalcon\Mvc\Controller $this->checkCsrfToken(); } - $this->checkRateLimit(); + $config = $this->getConfig(); + + if ($config->path('throttle.enabled')) { + $this->checkRateLimit(); + } return true; } @@ -149,7 +153,7 @@ class Controller extends \Phalcon\Mvc\Controller protected function checkSiteStatus() { - if ($this->siteInfo['enabled'] == 0) { + if ($this->siteInfo['status'] == 'closed') { $this->dispatcher->forward([ 'controller' => 'error', 'action' => 'maintain', diff --git a/app/Http/Desktop/Controllers/LiveController.php b/app/Http/Desktop/Controllers/LiveController.php index dbfb011c..9ba31814 100644 --- a/app/Http/Desktop/Controllers/LiveController.php +++ b/app/Http/Desktop/Controllers/LiveController.php @@ -54,6 +54,18 @@ class LiveController extends Controller return $this->jsonSuccess($stats); } + /** + * @Get("/{id:[0-9]+}/status", name="desktop.live.status") + */ + public function statusAction($id) + { + $service = new LiveService(); + + $status = $service->getStatus($id); + + return $this->jsonSuccess(['status' => $status]); + } + /** * @Post("/{id:[0-9]+}/user/bind", name="desktop.live.bind_user") */ diff --git a/app/Http/Desktop/Services/Live.php b/app/Http/Desktop/Services/Live.php index 0b43410f..c6c7a1b7 100644 --- a/app/Http/Desktop/Services/Live.php +++ b/app/Http/Desktop/Services/Live.php @@ -2,7 +2,6 @@ namespace App\Http\Desktop\Services; -use App\Library\Cache\Backend\Redis as RedisCache; use App\Services\Frontend\ChapterTrait; use GatewayClient\Gateway; @@ -32,6 +31,13 @@ class Live extends Service return $result; } + public function getStatus($id) + { + $chapterLive = $this->checkChapterLive($id); + + return $chapterLive->status; + } + public function getStats($id) { $chapter = $this->checkChapter($id); @@ -84,7 +90,7 @@ class Live extends Service public function sendMessage($id) { - $chapter = $this->checkChapterCache($id); + $chapter = $this->checkChapter($id); $user = $this->getLoginUser(); @@ -114,7 +120,7 @@ class Live extends Service $redis = $this->getRedis(); - $key = $this->getRedisListKey($id); + $key = $this->getRecentChatKey($id); $redis->lPush($key, $encodeMessage); @@ -125,11 +131,6 @@ class Live extends Service return $message; } - protected function getGroupName($id) - { - return "live_{$id}"; - } - protected function getRegisterAddress() { $config = $this->getConfig(); @@ -139,17 +140,12 @@ class Live extends Service protected function getRecentChatKey($id) { - return "live_recent_chat:{$id}"; + return "chapter_recent_chat:{$id}"; } - protected function getRedis() + protected function getGroupName($id) { - /** - * @var RedisCache $cache - */ - $cache = $this->getDI()->get('cache'); - - return $cache->getRedis(); + return "chapter_{$id}"; } } diff --git a/app/Http/Desktop/Views/chapter/live.volt b/app/Http/Desktop/Views/chapter/live.volt index 05831875..b95476ee 100644 --- a/app/Http/Desktop/Views/chapter/live.volt +++ b/app/Http/Desktop/Views/chapter/live.volt @@ -2,79 +2,24 @@ {% block content %} - {% set full_chapter_url = full_url({'for':'desktop.chapter.show','id':chapter.id}) %} - {% set course_url = url({'for':'desktop.course.show','id':chapter.course.id}) %} - {% set learning_url = url({'for':'desktop.chapter.learning','id':chapter.id}) %} - {% set live_chats_url = url({'for':'desktop.live.chats','id':chapter.id}) %} - {% set live_stats_url = url({'for':'desktop.live.stats','id':chapter.id}) %} - {% set send_msg_url = url({'for':'desktop.live.send_msg','id':chapter.id}) %} - {% set bind_user_url = url({'for':'desktop.live.bind_user','id':chapter.id}) %} - {% set like_url = url({'for':'desktop.chapter.like','id':chapter.id}) %} - {% set qrcode_url = url({'for':'desktop.qrcode'},{'text':full_chapter_url}) %} - - - -
-
-
-
-
-
-
-
-
直播讨论
-
-
- - {% if auth_user.id > 0 %} - - {% else %} - - {% endif %} - - -
-
-
-
- -
- - - - - - -
- -
- - - - -
+ {% if chapter.status == 'active' %} + {{ partial('live/live_active') }} + {% elseif chapter.status == 'inactive' %} + {{ partial('live/live_inactive') }} + {% elseif chapter.status =='forbid' %} + {{ partial('live/live_forbid') }} + {% endif %} {% endblock %} {% block include_js %} - {{ js_include('https://imgcache.qq.com/open/qcloud/video/vcplayer/TcPlayer-2.3.3.js', false) }} - {{ js_include('desktop/js/chapter.live.player.js') }} - {{ js_include('desktop/js/chapter.live.chat.js') }} - {{ js_include('desktop/js/chapter.action.js') }} - {{ js_include('desktop/js/course.share.js') }} + {% if chapter.status == 'active' %} + {{ js_include('https://imgcache.qq.com/open/qcloud/video/vcplayer/TcPlayer-2.3.3.js', false) }} + {{ js_include('desktop/js/chapter.live.player.js') }} + {{ js_include('desktop/js/chapter.live.chat.js') }} + {{ js_include('desktop/js/chapter.action.js') }} + {{ js_include('desktop/js/course.share.js') }} + {% endif %} {% endblock %} \ No newline at end of file diff --git a/app/Http/Desktop/Views/chapter/live_active.volt b/app/Http/Desktop/Views/chapter/live_active.volt new file mode 100644 index 00000000..05831875 --- /dev/null +++ b/app/Http/Desktop/Views/chapter/live_active.volt @@ -0,0 +1,80 @@ +{% extends 'templates/main.volt' %} + +{% block content %} + + {% set full_chapter_url = full_url({'for':'desktop.chapter.show','id':chapter.id}) %} + {% set course_url = url({'for':'desktop.course.show','id':chapter.course.id}) %} + {% set learning_url = url({'for':'desktop.chapter.learning','id':chapter.id}) %} + {% set live_chats_url = url({'for':'desktop.live.chats','id':chapter.id}) %} + {% set live_stats_url = url({'for':'desktop.live.stats','id':chapter.id}) %} + {% set send_msg_url = url({'for':'desktop.live.send_msg','id':chapter.id}) %} + {% set bind_user_url = url({'for':'desktop.live.bind_user','id':chapter.id}) %} + {% set like_url = url({'for':'desktop.chapter.like','id':chapter.id}) %} + {% set qrcode_url = url({'for':'desktop.qrcode'},{'text':full_chapter_url}) %} + + + +
+
+
+
+
+
+
+
+
直播讨论
+
+
+
+ {% if auth_user.id > 0 %} + + {% else %} + + {% endif %} + +
+
+
+
+
+ +
+ + + + + + +
+ +
+ + + + +
+ +{% endblock %} + +{% block include_js %} + + {{ js_include('https://imgcache.qq.com/open/qcloud/video/vcplayer/TcPlayer-2.3.3.js', false) }} + {{ js_include('desktop/js/chapter.live.player.js') }} + {{ js_include('desktop/js/chapter.live.chat.js') }} + {{ js_include('desktop/js/chapter.action.js') }} + {{ js_include('desktop/js/course.share.js') }} + +{% endblock %} \ No newline at end of file diff --git a/app/Http/Desktop/Views/chapter/live_forbid.volt b/app/Http/Desktop/Views/chapter/live_forbid.volt new file mode 100644 index 00000000..4687a76b --- /dev/null +++ b/app/Http/Desktop/Views/chapter/live_forbid.volt @@ -0,0 +1,15 @@ +{% extends 'templates/main.volt' %} + +{% block content %} + + {% set course_url = url({'for':'desktop.course.show','id':chapter.course.id}) %} + + + +{% endblock %} \ No newline at end of file diff --git a/app/Http/Desktop/Views/chapter/live_inactive.volt b/app/Http/Desktop/Views/chapter/live_inactive.volt new file mode 100644 index 00000000..9b02f73b --- /dev/null +++ b/app/Http/Desktop/Views/chapter/live_inactive.volt @@ -0,0 +1,42 @@ +{% extends 'templates/main.volt' %} + +{% block content %} + + {% set course_url = url({'for':'desktop.course.show','id':chapter.course.id}) %} + {% set live_status_url = url({'for':'desktop.live.status','id':chapter.id}) %} + {% set show_countdown = time() < chapter.start_time ? 1 : 0 %} + + + + {% if show_countdown == 1 %} +
+
+
+
开播倒计时开始啦,敬请关注!
+
+ {% else %} +
+
+
直播已结束,谢谢关注!
+
+ {% endif %} + +
+ + + +
+ +{% endblock %} + +{% block include_js %} + + {{ js_include('desktop/js/chapter.live.countdown.js') }} + +{% endblock %} \ No newline at end of file diff --git a/app/Http/Desktop/Views/templates/main.volt b/app/Http/Desktop/Views/templates/main.volt index 6de3e4e1..ab3d66aa 100644 --- a/app/Http/Desktop/Views/templates/main.volt +++ b/app/Http/Desktop/Views/templates/main.volt @@ -36,8 +36,8 @@ {% block include_js %}{% endblock %} {% block inline_js %}{% endblock %} -{% if site_info.analytics %} - {{ site_info.analytics }} +{% if site_info.analytics_enabled == 1 %} + {{ site_info.analytics_script }} {% endif %} diff --git a/app/Library/Helper.php b/app/Library/Helper.php index 09b28cd5..be48cd45 100644 --- a/app/Library/Helper.php +++ b/app/Library/Helper.php @@ -4,6 +4,7 @@ use App\Caches\Setting as SettingCache; use App\Library\Validators\Common as CommonValidator; use App\Services\Storage as StorageService; use Koogua\Ip2Region\Searcher as Ip2RegionSearcher; +use Phalcon\Config; use Phalcon\Di; use Phalcon\Text; @@ -404,12 +405,15 @@ function kg_js_include($path, $local = true, $version = null) */ function kg_static_url($path, $local = true, $version = null) { + /** + * @var Config $config + */ $config = Di::getDefault()->getShared('config'); - $baseUri = rtrim($config->static_base_uri, '/'); + $baseUri = rtrim($config->get('static_base_uri'), '/'); $path = ltrim($path, '/'); $url = $local ? $baseUri . '/' . $path : $path; - $version = $version ? $version : $config->static_version; + $version = $version ? $version : $config->get('static_version'); if ($version) { $url .= '?v=' . $version; diff --git a/app/Library/Logger.php b/app/Library/Logger.php index 24b0202f..d3f411ad 100644 --- a/app/Library/Logger.php +++ b/app/Library/Logger.php @@ -2,6 +2,7 @@ namespace App\Library; +use Phalcon\Config; use Phalcon\Di; use Phalcon\Logger as PhLogger; use Phalcon\Logger\Adapter\File as FileLogger; @@ -15,7 +16,10 @@ class Logger */ public function getInstance($channel = null) { - $config = Di::getDefault()->get('config'); + /** + * @var Config $config + */ + $config = Di::getDefault()->getShared('config'); $channel = $channel ? $channel : 'common'; @@ -23,7 +27,7 @@ class Logger $path = log_path($filename); - $level = $config->env != ENV_DEV ? $config->log->level : PhLogger::DEBUG; + $level = $config->get('env') != ENV_DEV ? $config->path('log.level') : PhLogger::DEBUG; $logger = new FileLogger($path); diff --git a/app/Models/Chapter.php b/app/Models/Chapter.php index ca974deb..a6fa270c 100644 --- a/app/Models/Chapter.php +++ b/app/Models/Chapter.php @@ -21,7 +21,7 @@ class Chapter extends Model * 推流状态 */ const SS_ACTIVE = 'active'; // 活跃 - const SS_INACTIVE = 'inactive'; // 非活跃 + const SS_INACTIVE = 'inactive'; // 静默 const SS_FORBID = 'forbid'; // 禁播 /** diff --git a/app/Services/Auth/Api.php b/app/Services/Auth/Api.php index 4ccdd3f9..06afce50 100644 --- a/app/Services/Auth/Api.php +++ b/app/Services/Auth/Api.php @@ -19,7 +19,7 @@ class Api extends AuthService $config = $this->getConfig(); - $expireTime = time() + $config->jwt->lifetime; + $expireTime = time() + $config->path('jwt.lifetime'); $builder->expiresAt($expireTime); $builder->withClaim('user_id', $user->id); @@ -27,7 +27,7 @@ class Api extends AuthService $singer = new JwtSingerSha256(); - $key = new JwtSingerKey($config->jwt->key); + $key = new JwtSingerKey($config->path('jwt.key')); $token = $builder->getToken($singer, $key); @@ -51,7 +51,7 @@ class Api extends AuthService $token = $parser->parse($authToken); - $data = new JWTValidationData(time(), $config->jwt->leeway); + $data = new JWTValidationData(time(), $config->path('jwt.leeway')); if (!$token->validate($data)) { return null; @@ -59,7 +59,7 @@ class Api extends AuthService $singer = new JwtSingerSha256(); - if (!$token->verify($singer, $config->jwt->key)) { + if (!$token->verify($singer, $config->path('jwt.key'))) { return null; } @@ -76,9 +76,4 @@ class Api extends AuthService return trim(str_ireplace('Bearer', '', $authorization)); } - protected function getConfig() - { - return $this->getDI()->get('config'); - } - } diff --git a/app/Services/Frontend/Chapter/BasicInfoTrait.php b/app/Services/Frontend/Chapter/BasicInfoTrait.php index 803ccfd7..1d2b395e 100644 --- a/app/Services/Frontend/Chapter/BasicInfoTrait.php +++ b/app/Services/Frontend/Chapter/BasicInfoTrait.php @@ -6,6 +6,7 @@ use App\Models\Chapter as ChapterModel; use App\Models\Course as CourseModel; use App\Repos\Chapter as ChapterRepo; use App\Services\ChapterVod as ChapterVodService; +use App\Services\Frontend\ChapterLiveTrait; use App\Services\Live as LiveService; use WhichBrowser\Parser as BrowserParser; @@ -85,6 +86,7 @@ trait BasicInfoTrait 'play_urls' => $playUrls, 'start_time' => $live->start_time, 'end_time' => $live->end_time, + 'status' => $live->status, 'user_count' => $chapter->user_count, 'like_count' => $chapter->like_count, ]; diff --git a/app/Services/Frontend/Chapter/ChapterLiveTrait.php b/app/Services/Frontend/ChapterLiveTrait.php similarity index 74% rename from app/Services/Frontend/Chapter/ChapterLiveTrait.php rename to app/Services/Frontend/ChapterLiveTrait.php index af6a2e32..5f8cb0ec 100644 --- a/app/Services/Frontend/Chapter/ChapterLiveTrait.php +++ b/app/Services/Frontend/ChapterLiveTrait.php @@ -1,6 +1,6 @@ checkChapterVod($id); + } + + public function checkChapterLive($id) + { + $validator = new ChapterValidator(); + + return $validator->checkChapterLive($id); + } + + public function checkChapterRead($id) + { + $validator = new ChapterValidator(); + + return $validator->checkChapterRead($id); + } + public function checkChapter($id) { $validator = new ChapterValidator(); diff --git a/app/Services/Frontend/Teaching/LivePushUrl.php b/app/Services/Frontend/Teaching/LivePushUrl.php index a37d63be..4407941b 100644 --- a/app/Services/Frontend/Teaching/LivePushUrl.php +++ b/app/Services/Frontend/Teaching/LivePushUrl.php @@ -2,7 +2,7 @@ namespace App\Services\Frontend\Teaching; -use App\Services\Frontend\Chapter\ChapterLiveTrait; +use App\Services\Frontend\ChapterLiveTrait; use App\Services\Frontend\ChapterTrait; use App\Services\Frontend\Service as FrontendService; use App\Services\Live as LiveService; diff --git a/app/Services/LiveNotify.php b/app/Services/LiveNotify.php index 66136244..924c7136 100644 --- a/app/Services/LiveNotify.php +++ b/app/Services/LiveNotify.php @@ -2,7 +2,6 @@ namespace App\Services; -use App\Library\Cache\Backend\Redis as RedisCache; use App\Models\Chapter as ChapterModel; use App\Models\ChapterLive as ChapterLiveModel; use App\Repos\Chapter as ChapterRepo; @@ -129,12 +128,9 @@ class LiveNotify extends Service protected function sendBeginNotify(ChapterModel $chapter) { - /** - * @var RedisCache $cache - */ - $cache = $this->getDI()->get('cache'); + $cache = $this->getCache(); - $redis = $cache->getRedis(); + $redis = $this->getRedis(); $key = $this->getNotifyKey(); diff --git a/app/Services/Pay/AlipayGateway.php b/app/Services/Pay/AlipayGateway.php index a23d5f84..58b88400 100644 --- a/app/Services/Pay/AlipayGateway.php +++ b/app/Services/Pay/AlipayGateway.php @@ -41,11 +41,11 @@ class AlipayGateway extends Service */ public function getInstance() { - $config = $this->getDI()->get('config'); + $config = $this->getConfig(); - $level = $config->env == ENV_DEV ? 'debug' : 'info'; + $level = $config->get('env') == ENV_DEV ? 'debug' : 'info'; - $payConfig = [ + $options = [ 'app_id' => $this->settings['app_id'], 'ali_public_key' => $this->settings['public_key'], 'private_key' => $this->settings['private_key'], @@ -59,11 +59,11 @@ class AlipayGateway extends Service ], ]; - if ($config->env == ENV_DEV) { - $payConfig['mode'] = 'dev'; + if ($config->get('env') == ENV_DEV) { + $options['mode'] = 'dev'; } - return Pay::alipay($payConfig); + return Pay::alipay($options); } } diff --git a/app/Services/Pay/WxpayGateway.php b/app/Services/Pay/WxpayGateway.php index 8e06c588..cad58752 100644 --- a/app/Services/Pay/WxpayGateway.php +++ b/app/Services/Pay/WxpayGateway.php @@ -36,17 +36,19 @@ class WxpayGateway extends Service */ public function getInstance() { - $config = $this->getDI()->get('config'); + $config = $this->getConfig(); - $level = $config->env == ENV_DEV ? 'debug' : 'info'; + $level = $config->get('env') == ENV_DEV ? 'debug' : 'info'; - $payConfig = [ - 'app_id' => $this->settings['app_id'], + $options = [ + 'appid' => $this->settings['app_id'], // App AppId + 'app_id' => $this->settings['mp_app_id'], // 公众号 AppId + 'miniapp_id' => $this->settings['mini_app_id'], // 小程序 AppId 'mch_id' => $this->settings['mch_id'], 'key' => $this->settings['key'], 'notify_url' => $this->settings['notify_url'], - 'cert_client' => '', - 'cert_key' => '', + 'cert_client' => config_path('wxpay/client_cert.pem'), + 'cert_key' => config_path('wxpay/client_key.pem'), 'log' => [ 'file' => log_path('wxpay.log'), 'level' => $level, @@ -55,11 +57,11 @@ class WxpayGateway extends Service ], ]; - if ($config->env == ENV_DEV) { - $payConfig['mode'] = 'dev'; + if ($config->get('env') == ENV_DEV) { + $options['mode'] = 'dev'; } - return Pay::wechat($payConfig); + return Pay::wechat($options); } } diff --git a/app/Services/Service.php b/app/Services/Service.php index 0f1c3964..8f28c98a 100644 --- a/app/Services/Service.php +++ b/app/Services/Service.php @@ -20,7 +20,7 @@ class Service extends Component */ public function getConfig() { - return $this->getDI()->get('config'); + return $this->getDI()->getShared('config'); } /** @@ -28,7 +28,15 @@ class Service extends Component */ public function getCache() { - return $this->getDI()->get('cache'); + return $this->getDI()->getShared('cache'); + } + + /** + * @return \Redis + */ + public function getRedis() + { + return $this->getCache()->getRedis(); } /** diff --git a/app/Services/Syncer/CourseIndex.php b/app/Services/Syncer/CourseIndex.php index 7a411f95..acc987f9 100644 --- a/app/Services/Syncer/CourseIndex.php +++ b/app/Services/Syncer/CourseIndex.php @@ -2,42 +2,26 @@ namespace App\Services\Syncer; -use App\Library\Cache\Backend\Redis as RedisCache; use App\Services\Service; class CourseIndex extends Service { - /** - * @var RedisCache - */ - protected $cache; - - /** - * @var \Redis - */ - protected $redis; - /** * @var int */ protected $lifetime = 86400; - public function __construct() - { - $this->cache = $this->getDI()->get('cache'); - - $this->redis = $this->cache->getRedis(); - } - public function addItem($courseId) { + $redis = $this->getRedis(); + $key = $this->getSyncKey(); - $this->redis->sAdd($key, $courseId); + $redis->sAdd($key, $courseId); - if ($this->redis->sCard($key) == 1) { - $this->redis->expire($key, $this->lifetime); + if ($redis->sCard($key) == 1) { + $redis->expire($key, $this->lifetime); } } diff --git a/app/Services/Syncer/GroupIndex.php b/app/Services/Syncer/GroupIndex.php index 53f9206f..3a4ff35e 100644 --- a/app/Services/Syncer/GroupIndex.php +++ b/app/Services/Syncer/GroupIndex.php @@ -2,42 +2,26 @@ namespace App\Services\Syncer; -use App\Library\Cache\Backend\Redis as RedisCache; use App\Services\Service; class GroupIndex extends Service { - /** - * @var RedisCache - */ - protected $cache; - - /** - * @var \Redis - */ - protected $redis; - /** * @var int */ protected $lifetime = 86400; - public function __construct() - { - $this->cache = $this->getDI()->get('cache'); - - $this->redis = $this->cache->getRedis(); - } - public function addItem($groupId) { + $redis = $this->getRedis(); + $key = $this->getSyncKey(); - $this->redis->sAdd($key, $groupId); + $redis->sAdd($key, $groupId); - if ($this->redis->sCard($key) == 1) { - $this->redis->expire($key, $this->lifetime); + if ($redis->sCard($key) == 1) { + $redis->expire($key, $this->lifetime); } } diff --git a/app/Services/Syncer/Learning.php b/app/Services/Syncer/Learning.php index bc4fa432..bc294dc0 100644 --- a/app/Services/Syncer/Learning.php +++ b/app/Services/Syncer/Learning.php @@ -2,7 +2,6 @@ namespace App\Services\Syncer; -use App\Library\Cache\Backend\Redis as RedisCache; use App\Models\Learning as LearningModel; use App\Services\Service; use App\Traits\Client as ClientTrait; @@ -12,40 +11,27 @@ class Learning extends Service use ClientTrait; - /** - * @var RedisCache - */ - protected $cache; - - /** - * @var \Redis - */ - protected $redis; - /** * @var int */ protected $lifetime = 86400; - public function __construct() - { - $this->cache = $this->getDI()->get('cache'); - - $this->redis = $this->cache->getRedis(); - } - /** * @param LearningModel $learning * @param int $interval */ public function addItem(LearningModel $learning, $interval = 10) { + $cache = $this->getCache(); + + $redis = $this->getRedis(); + $itemKey = $this->getItemKey($learning->request_id); /** * @var LearningModel $cacheLearning */ - $cacheLearning = $this->cache->get($itemKey); + $cacheLearning = $cache->get($itemKey); if (!$cacheLearning) { @@ -54,7 +40,7 @@ class Learning extends Service $learning->duration = $interval; $learning->active_time = time(); - $this->cache->save($itemKey, $learning, $this->lifetime); + $cache->save($itemKey, $learning, $this->lifetime); } else { @@ -62,15 +48,15 @@ class Learning extends Service $cacheLearning->position = $learning->position; $cacheLearning->active_time = time(); - $this->cache->save($itemKey, $cacheLearning, $this->lifetime); + $cache->save($itemKey, $cacheLearning, $this->lifetime); } $key = $this->getSyncKey(); - $this->redis->sAdd($key, $learning->request_id); + $redis->sAdd($key, $learning->request_id); - if ($this->redis->sCard($key) == 1) { - $this->redis->expire($key, $this->lifetime); + if ($redis->sCard($key) == 1) { + $redis->expire($key, $this->lifetime); } } diff --git a/app/Services/Syncer/UserIndex.php b/app/Services/Syncer/UserIndex.php index ef39fd0d..fb45032c 100644 --- a/app/Services/Syncer/UserIndex.php +++ b/app/Services/Syncer/UserIndex.php @@ -2,42 +2,26 @@ namespace App\Services\Syncer; -use App\Library\Cache\Backend\Redis as RedisCache; use App\Services\Service; class UserIndex extends Service { - /** - * @var RedisCache - */ - protected $cache; - - /** - * @var \Redis - */ - protected $redis; - /** * @var int */ protected $lifetime = 86400; - public function __construct() - { - $this->cache = $this->getDI()->get('cache'); - - $this->redis = $this->cache->getRedis(); - } - public function addItem($userId) { + $redis = $this->getRedis(); + $key = $this->getSyncKey(); - $this->redis->sAdd($key, $userId); + $redis->sAdd($key, $userId); - if ($this->redis->sCard($key) == 1) { - $this->redis->expire($key, $this->lifetime); + if ($redis->sCard($key) == 1) { + $redis->expire($key, $this->lifetime); } } diff --git a/app/Services/Throttle.php b/app/Services/Throttle.php index 1ba76b37..1d0d0e33 100644 --- a/app/Services/Throttle.php +++ b/app/Services/Throttle.php @@ -2,23 +2,18 @@ namespace App\Services; -use Phalcon\Cache\Backend\Redis as RedisCache; - class Throttle extends Service { public function checkRateLimit() { - $config = $this->getDI()->get('config'); + $config = $this->getConfig(); - if ($config->throttle->enabled == false) { + if ($config->path('throttle.enabled') == false) { return true; } - /** - * @var RedisCache $cache - */ - $cache = $this->getDI()->get('cache'); + $cache = $this->getCache(); $sign = $this->getRequestSignature(); @@ -27,13 +22,13 @@ class Throttle extends Service $rateLimit = $cache->get($cacheKey); if ($rateLimit) { - if ($rateLimit >= $config->throttle->rate_limit) { + if ($rateLimit >= $config->path('throttle.rate_limit')) { return false; } else { $cache->increment($cacheKey, 1); } } else { - $cache->save($cacheKey, 1, $config->throttle->lifetime); + $cache->save($cacheKey, 1, $config->path('throttle.lifetime')); } return true; diff --git a/app/Services/Verify.php b/app/Services/Verify.php index ee5775f2..171e636b 100644 --- a/app/Services/Verify.php +++ b/app/Services/Verify.php @@ -15,7 +15,7 @@ class Verify extends Service public function __construct() { - $this->cache = $this->getDI()->get('cache'); + $this->cache = $this->getCache(); } public function getSmsCode($phone, $lifetime = 300) diff --git a/app/Validators/Chapter.php b/app/Validators/Chapter.php index 800c9268..788084e7 100644 --- a/app/Validators/Chapter.php +++ b/app/Validators/Chapter.php @@ -43,6 +43,45 @@ class Chapter extends Validator return $chapter; } + public function checkChapterVod($id) + { + $chapterRepo = new ChapterRepo(); + + $chapterVod = $chapterRepo->findChapterVod($id); + + if (!$chapterVod) { + throw new BadRequestException('chapter.vod_not_found'); + } + + return $chapterVod; + } + + public function checkChapterLive($id) + { + $chapterRepo = new ChapterRepo(); + + $chapterLive = $chapterRepo->findChapterLive($id); + + if (!$chapterLive) { + throw new BadRequestException('chapter.live_not_found'); + } + + return $chapterLive; + } + + public function checkChapterRead($id) + { + $chapterRepo = new ChapterRepo(); + + $chapterRead = $chapterRepo->findChapterRead($id); + + if (!$chapterRead) { + throw new BadRequestException('chapter.read_not_found'); + } + + return $chapterRead; + } + public function checkChapter($id) { $chapterRepo = new ChapterRepo(); diff --git a/app/Validators/ChapterLive.php b/app/Validators/ChapterLive.php index 3c272fd8..8b6c1c3b 100644 --- a/app/Validators/ChapterLive.php +++ b/app/Validators/ChapterLive.php @@ -28,22 +28,19 @@ class ChapterLive extends Validator public function checkTimeRange($startTime, $endTime) { - $startTimeStamp = strtotime($startTime); - $endTimeStamp = strtotime($endTime); - - if ($startTimeStamp < time()) { + if ($startTime < time()) { throw new BadRequestException('chapter_live.start_lt_now'); } - if ($endTimeStamp < time()) { + if ($startTime < time()) { throw new BadRequestException('chapter_live.end_lt_now'); } - if ($startTimeStamp >= $endTimeStamp) { + if ($startTime >= $endTime) { throw new BadRequestException('chapter_live.start_gt_end'); } - if ($endTimeStamp - $startTimeStamp > 3 * 3600) { + if ($endTime - $startTime > 3 * 3600) { throw new BadRequestException('chapter_live.time_too_long'); } } diff --git a/bootstrap/Helper.php b/bootstrap/Helper.php index 6fca6bf2..42b8fdde 100644 --- a/bootstrap/Helper.php +++ b/bootstrap/Helper.php @@ -12,7 +12,7 @@ define('ENV_PRO', 'pro'); */ function root_path($path = '') { - return dirname(__DIR__) . ($path ? "/{$path}" : ''); + return dirname(__DIR__) . trim_path($path); } /** @@ -23,7 +23,7 @@ function root_path($path = '') */ function app_path($path = '') { - return root_path('app') . ($path ? "/{$path}" : ''); + return root_path('app') . trim_path($path); } /** @@ -34,7 +34,7 @@ function app_path($path = '') */ function bootstrap_path($path = '') { - return root_path('bootstrap') . ($path ? "/{$path}" : ''); + return root_path('bootstrap') . trim_path($path); } /** @@ -45,7 +45,7 @@ function bootstrap_path($path = '') */ function config_path($path = '') { - return root_path('config') . ($path ? "/{$path}" : ''); + return root_path('config') . trim_path($path); } /** @@ -56,7 +56,7 @@ function config_path($path = '') */ function storage_path($path = '') { - return root_path('storage') . ($path ? "/{$path}" : ''); + return root_path('storage') . trim_path($path); } /** @@ -67,7 +67,7 @@ function storage_path($path = '') */ function vendor_path($path = '') { - return root_path('vendor') . ($path ? "/{$path}" : ''); + return root_path('vendor') . trim_path($path); } /** @@ -78,7 +78,7 @@ function vendor_path($path = '') */ function public_path($path = '') { - return root_path('public') . ($path ? "/{$path}" : ''); + return root_path('public') . trim_path($path); } /** @@ -89,7 +89,7 @@ function public_path($path = '') */ function cache_path($path = '') { - return storage_path('cache') . ($path ? "/{$path}" : ''); + return storage_path('cache') . trim_path($path); } /** @@ -100,7 +100,7 @@ function cache_path($path = '') */ function log_path($path = '') { - return storage_path('log') . ($path ? "/{$path}" : ''); + return storage_path('log') . trim_path($path); } /** @@ -111,18 +111,20 @@ function log_path($path = '') */ function tmp_path($path = '') { - return storage_path('tmp') . ($path ? "/{$path}" : ''); + return storage_path('tmp') . trim_path($path); } /** * Rtrim slash * - * @param string $str + * @param string $path * @return string */ -function rtrim_slash($str) +function trim_path($path) { - return rtrim($str, '/'); + $path = trim($path, '/'); + + return $path ? "/{$path}" : ''; } /** diff --git a/config/alipay/.gitignore b/config/alipay/.gitignore new file mode 100644 index 00000000..cf57c3b0 --- /dev/null +++ b/config/alipay/.gitignore @@ -0,0 +1,2 @@ +.gitignore +!.gitignore \ No newline at end of file diff --git a/config/cert/alipay/.gitignore b/config/cert/alipay/.gitignore deleted file mode 100644 index c96a04f0..00000000 --- a/config/cert/alipay/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/config/cert/wxpay/.gitignore b/config/cert/wxpay/.gitignore deleted file mode 100644 index c96a04f0..00000000 --- a/config/cert/wxpay/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/config/wxpay/.gitignore b/config/wxpay/.gitignore new file mode 100644 index 00000000..cf57c3b0 --- /dev/null +++ b/config/wxpay/.gitignore @@ -0,0 +1,2 @@ +.gitignore +!.gitignore \ No newline at end of file diff --git a/public/static/desktop/css/common.css b/public/static/desktop/css/common.css index 9e44a1d9..a73789de 100644 --- a/public/static/desktop/css/common.css +++ b/public/static/desktop/css/common.css @@ -909,6 +909,34 @@ body { color: #666; } +.countdown { + color: #666; + margin-top: 50px; + text-align: center; +} + +.countdown .icon { + margin-bottom: 10px; +} + +.countdown .icon .layui-icon { + font-size: 150px; +} + +.countdown .tips { + font-size: 18px; + margin: 20px 0; +} + +.countdown .timer { + font-size: 32px; +} + +.countdown .timer span { + color: green; + padding: 10px; +} + .player-wrap { position: relative; width: 760px; diff --git a/public/static/desktop/js/chapter.live.countdown.js b/public/static/desktop/js/chapter.live.countdown.js new file mode 100644 index 00000000..2c2c8078 --- /dev/null +++ b/public/static/desktop/js/chapter.live.countdown.js @@ -0,0 +1,32 @@ +layui.use(['jquery', 'util'], function () { + + var $ = layui.jquery; + var util = layui.util; + + var endTime = $('input[name="countdown.end_time"]').val(); + var serverTime = $('input[name="countdown.server_time"]').val(); + var liveStatusUrl = $('input[name="live.status_url"]').val(); + + util.countdown(1000 * parseInt(endTime), 1000 * parseInt(serverTime), function (date, serverTime, timer) { + var items = [ + {date: date[0], label: '天'}, + {date: date[1], label: '时'}, + {date: date[2], label: '分'}, + {date: date[3], label: '秒'} + ]; + var html = ''; + layui.each(items, function (index, item) { + html += '' + item.date + '' + item.label; + }); + $('.countdown > .timer').html(html); + }); + + setInterval(function () { + $.get(liveStatusUrl, function (res) { + if (res.status === 1) { + window.location.reload(); + } + }); + }, 30000); + +}); \ No newline at end of file From 502fbe9583e6c6a95cd7c2990404af075256d2c3 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Sun, 13 Sep 2020 18:19:20 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E6=B5=8B=E8=AF=95=E5=BE=AE=E4=BF=A1=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ourseCatalog.php => CourseChapterList.php} | 2 +- ...ourseCatalog.php => CourseChapterList.php} | 8 ++-- .../Admin/Controllers/ChapterController.php | 6 +-- .../Admin/Controllers/PublicController.php | 2 +- .../Admin/Controllers/SettingController.php | 8 ++-- .../Admin/Controllers/StudentController.php | 2 +- app/Http/Admin/Controllers/TestController.php | 14 +++--- app/Http/Admin/Controllers/VodController.php | 4 +- app/Http/Admin/Services/Chapter.php | 2 +- app/Http/Admin/Services/PayTest.php | 45 +++++++++++++++++-- app/Http/Admin/Views/setting/pay_wxpay.volt | 13 +++--- .../Desktop/Controllers/AccountController.php | 6 +-- .../Desktop/Controllers/ChapterController.php | 8 ++-- .../Desktop/Controllers/CourseController.php | 4 +- app/Http/Desktop/Controllers/ImController.php | 10 ++--- .../Desktop/Controllers/LiveController.php | 14 ------ app/Http/Desktop/Controllers/MyController.php | 2 +- .../Desktop/Controllers/OrderController.php | 10 ++--- .../Desktop/Controllers/PublicController.php | 2 +- .../Desktop/Controllers/RefundController.php | 6 +-- .../Desktop/Controllers/TradeController.php | 2 +- .../Desktop/Controllers/VipController.php | 2 +- app/Http/Desktop/Services/Im.php | 12 ++--- app/Http/Desktop/Services/ImGroupTrait.php | 4 +- app/Http/Desktop/Services/Live.php | 2 +- .../Desktop/Views/chapter/live_inactive.volt | 22 ++++----- app/Listeners/Pay.php | 1 - app/Models/ChapterLive.php | 4 +- app/Services/Frontend/Course/ChapterList.php | 4 +- .../Frontend/Teaching/LivePushUrl.php | 2 +- app/Services/LiveNotify.php | 10 ++--- app/Services/Pay/Alipay.php | 8 +++- app/Services/Pay/Wxpay.php | 8 +++- app/Services/Pay/WxpayGateway.php | 4 +- public/static/desktop/css/common.css | 5 ++- 35 files changed, 147 insertions(+), 111 deletions(-) rename app/Builders/{CourseCatalog.php => CourseChapterList.php} (98%) rename app/Caches/{CourseCatalog.php => CourseChapterList.php} (62%) diff --git a/app/Builders/CourseCatalog.php b/app/Builders/CourseChapterList.php similarity index 98% rename from app/Builders/CourseCatalog.php rename to app/Builders/CourseChapterList.php index 5415dae2..bd544a4b 100644 --- a/app/Builders/CourseCatalog.php +++ b/app/Builders/CourseChapterList.php @@ -7,7 +7,7 @@ use App\Models\Course as CourseModel; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; -class CourseCatalog extends Builder +class CourseChapterList extends Builder { /** diff --git a/app/Caches/CourseCatalog.php b/app/Caches/CourseChapterList.php similarity index 62% rename from app/Caches/CourseCatalog.php rename to app/Caches/CourseChapterList.php index 687a50ab..512dec28 100644 --- a/app/Caches/CourseCatalog.php +++ b/app/Caches/CourseChapterList.php @@ -2,9 +2,9 @@ namespace App\Caches; -use App\Builders\CourseCatalog as CourseCatalogBuilder; +use App\Builders\CourseChapterList as CourseChapterListBuilder; -class CourseCatalog extends Cache +class CourseChapterList extends Cache { protected $lifetime = 7 * 86400; @@ -16,12 +16,12 @@ class CourseCatalog extends Cache public function getKey($id = null) { - return "course_catalog:{$id}"; + return "course_chapter_list:{$id}"; } public function getContent($id = null) { - $builder = new CourseCatalogBuilder(); + $builder = new CourseChapterListBuilder(); $list = $builder->handle($id); diff --git a/app/Http/Admin/Controllers/ChapterController.php b/app/Http/Admin/Controllers/ChapterController.php index bbef2879..43418d73 100644 --- a/app/Http/Admin/Controllers/ChapterController.php +++ b/app/Http/Admin/Controllers/ChapterController.php @@ -35,9 +35,9 @@ class ChapterController extends Controller */ public function addAction() { - $courseId = $this->request->getQuery('course_id'); - $parentId = $this->request->getQuery('parent_id'); - $type = $this->request->getQuery('type'); + $courseId = $this->request->getQuery('course_id', 'int'); + $parentId = $this->request->getQuery('parent_id', 'int'); + $type = $this->request->getQuery('type', 'string', 'chapter'); $courseService = new CourseService(); diff --git a/app/Http/Admin/Controllers/PublicController.php b/app/Http/Admin/Controllers/PublicController.php index 5e0a1ab4..e5b84bbc 100644 --- a/app/Http/Admin/Controllers/PublicController.php +++ b/app/Http/Admin/Controllers/PublicController.php @@ -43,7 +43,7 @@ class PublicController extends \Phalcon\Mvc\Controller */ public function ip2regionAction() { - $ip = $this->request->getQuery('ip', 'trim'); + $ip = $this->request->getQuery('ip', 'string'); $region = kg_ip2region($ip); diff --git a/app/Http/Admin/Controllers/SettingController.php b/app/Http/Admin/Controllers/SettingController.php index 1531065b..e3dfc8f3 100644 --- a/app/Http/Admin/Controllers/SettingController.php +++ b/app/Http/Admin/Controllers/SettingController.php @@ -121,7 +121,7 @@ class SettingController extends Controller if ($this->request->isPost()) { - $section = $this->request->getPost('section'); + $section = $this->request->getPost('section', 'string'); $data = $this->request->getPost(); @@ -150,7 +150,7 @@ class SettingController extends Controller if ($this->request->isPost()) { - $section = $this->request->getPost('section'); + $section = $this->request->getPost('section', 'string'); $data = $this->request->getPost(); @@ -257,7 +257,7 @@ class SettingController extends Controller if ($this->request->isPost()) { - $data = $this->request->getPost('vip'); + $data = $this->request->getPost('vip', 'string'); $settingService->updateVipSettings($data); @@ -280,7 +280,7 @@ class SettingController extends Controller if ($this->request->isPost()) { - $section = $this->request->getPost('section'); + $section = $this->request->getPost('section', 'string'); $data = $this->request->getPost(); diff --git a/app/Http/Admin/Controllers/StudentController.php b/app/Http/Admin/Controllers/StudentController.php index 5ef6e5d2..9b2707fb 100644 --- a/app/Http/Admin/Controllers/StudentController.php +++ b/app/Http/Admin/Controllers/StudentController.php @@ -84,7 +84,7 @@ class StudentController extends Controller */ public function editAction() { - $relationId = $this->request->getQuery('relation_id'); + $relationId = $this->request->getQuery('relation_id', 'int'); $studentService = new StudentService(); diff --git a/app/Http/Admin/Controllers/TestController.php b/app/Http/Admin/Controllers/TestController.php index fa017431..61f56222 100644 --- a/app/Http/Admin/Controllers/TestController.php +++ b/app/Http/Admin/Controllers/TestController.php @@ -60,7 +60,7 @@ class TestController extends Controller */ public function livePushAction() { - $streamName = $this->request->getQuery('stream'); + $streamName = $this->request->getQuery('stream', 'string'); $liveService = new LiveService(); @@ -102,7 +102,7 @@ class TestController extends Controller */ public function smserAction() { - $phone = $this->request->getPost('phone'); + $phone = $this->request->getPost('phone', 'string'); $smserService = new TestSmserService(); @@ -120,7 +120,7 @@ class TestController extends Controller */ public function mailerAction() { - $email = $this->request->getPost('email'); + $email = $this->request->getPost('email', 'string'); $mailerService = new TestMailerService(); @@ -166,7 +166,7 @@ class TestController extends Controller $this->db->begin(); - $order = $alipayTestService->createOrder(); + $order = $alipayTestService->createAlipayOrder(); $trade = $alipayTestService->createTrade($order); $qrcode = $alipayTestService->scan($trade); @@ -190,7 +190,7 @@ class TestController extends Controller $this->db->begin(); - $order = $wxpayTestService->createOrder(); + $order = $wxpayTestService->createWxpayOrder(); $trade = $wxpayTestService->createTrade($order); $qrcode = $wxpayTestService->scan($trade); @@ -210,7 +210,7 @@ class TestController extends Controller */ public function alipayStatusAction() { - $sn = $this->request->getQuery('sn'); + $sn = $this->request->getQuery('sn', 'string'); $alipayTestService = new AlipayTestService(); @@ -224,7 +224,7 @@ class TestController extends Controller */ public function wxpayStatusAction() { - $sn = $this->request->getQuery('sn'); + $sn = $this->request->getQuery('sn', 'string'); $wxpayTestService = new WxpayTestService(); diff --git a/app/Http/Admin/Controllers/VodController.php b/app/Http/Admin/Controllers/VodController.php index 72f4c35f..f319a578 100644 --- a/app/Http/Admin/Controllers/VodController.php +++ b/app/Http/Admin/Controllers/VodController.php @@ -28,8 +28,8 @@ class VodController extends Controller */ public function playerAction() { - $chapterId = $this->request->getQuery('chapter_id'); - $playUrl = $this->request->getQuery('play_url'); + $chapterId = $this->request->getQuery('chapter_id', 'int'); + $playUrl = $this->request->getQuery('play_url', 'string'); $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); $this->view->pick('public/vod_player'); diff --git a/app/Http/Admin/Services/Chapter.php b/app/Http/Admin/Services/Chapter.php index 6071a2f4..11d94fb6 100644 --- a/app/Http/Admin/Services/Chapter.php +++ b/app/Http/Admin/Services/Chapter.php @@ -3,7 +3,7 @@ namespace App\Http\Admin\Services; use App\Caches\Chapter as ChapterCache; -use App\Caches\CourseCatalog as CourseCatalogCache; +use App\Caches\CourseChapterList as CourseCatalogCache; use App\Models\Chapter as ChapterModel; use App\Models\ChapterLive as ChapterLiveModel; use App\Models\ChapterRead as ChapterReadModel; diff --git a/app/Http/Admin/Services/PayTest.php b/app/Http/Admin/Services/PayTest.php index 6aa3134d..ea563b0c 100644 --- a/app/Http/Admin/Services/PayTest.php +++ b/app/Http/Admin/Services/PayTest.php @@ -15,11 +15,11 @@ abstract class PayTest extends Service protected $channel; /** - * 创建订单 + * 创建支付宝订单 * * @return OrderModel */ - public function createOrder() + public function createAlipayOrder() { /** * @var AdminAuth $auth @@ -30,8 +30,45 @@ abstract class PayTest extends Service $order = new OrderModel(); - $order->subject = '测试 - 支付测试0.01元'; - $order->amount = 0.01; + $order->subject = '测试 - 支付测试3.01元'; + $order->amount = 3.01; + $order->owner_id = $authUser['id']; + $order->item_type = OrderModel::ITEM_TEST; + + $order->create(); + + return $order; + } + + /** + * 创建微信订单 + * + * @return OrderModel + */ + public function createWxpayOrder() + { + /** + * @var AdminAuth $auth + */ + $auth = $this->getDI()->get('auth'); + + $authUser = $auth->getAuthInfo(); + + $config = $this->getConfig(); + + $order = new OrderModel(); + + /** + * 微信沙箱环境金额不能自定义,只能是测试用例值(沙吊的不行) + */ + if ($config->get('env') == ENV_DEV) { + $order->subject = '测试 - 支付测试3.01元'; + $order->amount = 3.01; + } else { + $order->subject = '测试 - 支付测试0.01元'; + $order->amount = 0.01; + } + $order->owner_id = $authUser['id']; $order->item_type = OrderModel::ITEM_TEST; diff --git a/app/Http/Admin/Views/setting/pay_wxpay.volt b/app/Http/Admin/Views/setting/pay_wxpay.volt index 3cea4cdd..aec88276 100644 --- a/app/Http/Admin/Views/setting/pay_wxpay.volt +++ b/app/Http/Admin/Views/setting/pay_wxpay.volt @@ -9,17 +9,17 @@
- +
- +
- +
@@ -40,6 +40,9 @@
+{% set subject = config.get('env') == 'dev' ? '支付测试3.01元' : '支付测试0.01元' %} +{% set total_amount = config.get('env') == 'dev' ? 3.01 : 0.01 %} +
支付测试 @@ -47,13 +50,13 @@
- +
- +
diff --git a/app/Http/Desktop/Controllers/AccountController.php b/app/Http/Desktop/Controllers/AccountController.php index 65790af7..7b0749b9 100644 --- a/app/Http/Desktop/Controllers/AccountController.php +++ b/app/Http/Desktop/Controllers/AccountController.php @@ -43,7 +43,7 @@ class AccountController extends Controller $service->register(); - $returnUrl = $this->request->getPost('return_url'); + $returnUrl = $this->request->getPost('return_url', 'string'); $content = [ 'location' => $returnUrl ?: '/', @@ -81,7 +81,7 @@ class AccountController extends Controller $service->loginByPassword(); - $returnUrl = $this->request->getPost('return_url'); + $returnUrl = $this->request->getPost('return_url', 'string'); $location = $returnUrl ?: $this->url->get(['for' => 'desktop.index']); @@ -99,7 +99,7 @@ class AccountController extends Controller $service->loginByVerify(); - $returnUrl = $this->request->getPost('return_url'); + $returnUrl = $this->request->getPost('return_url', 'string'); $location = $returnUrl ?: $this->url->get(['for' => 'desktop.index']); diff --git a/app/Http/Desktop/Controllers/ChapterController.php b/app/Http/Desktop/Controllers/ChapterController.php index 03fbe309..3438fa7b 100644 --- a/app/Http/Desktop/Controllers/ChapterController.php +++ b/app/Http/Desktop/Controllers/ChapterController.php @@ -8,7 +8,7 @@ use App\Services\Frontend\Chapter\ChapterInfo as ChapterInfoService; use App\Services\Frontend\Chapter\ChapterLike as ChapterLikeService; use App\Services\Frontend\Chapter\DanmuList as ChapterDanmuListService; use App\Services\Frontend\Chapter\Learning as ChapterLearningService; -use App\Services\Frontend\Course\ChapterList as CourseCatalogService; +use App\Services\Frontend\Course\ChapterList as CourseChapterListService; /** * @RoutePrefix("/chapter") @@ -34,7 +34,7 @@ class ChapterController extends Controller ]); } - $service = new CourseCatalogService(); + $service = new CourseChapterListService(); $catalog = $service->handle($chapter['course']['id']); @@ -46,6 +46,8 @@ class ChapterController extends Controller if ($chapter['model'] == CourseModel::MODEL_VOD) { $this->view->pick('chapter/vod'); + } elseif ($chapter['model'] == CourseModel::MODEL_READ) { + $this->view->pick('chapter/read'); } elseif ($chapter['model'] == CourseModel::MODEL_LIVE) { if ($chapter['status'] == LiveModel::STATUS_ACTIVE) { $this->view->pick('chapter/live_active'); @@ -54,8 +56,6 @@ class ChapterController extends Controller } elseif ($chapter['status'] == LiveModel::STATUS_FORBID) { $this->view->pick('chapter/live_forbid'); } - } elseif ($chapter['model'] == CourseModel::MODEL_READ) { - $this->view->pick('chapter/read'); } $this->view->setVar('chapter', $chapter); diff --git a/app/Http/Desktop/Controllers/CourseController.php b/app/Http/Desktop/Controllers/CourseController.php index 06019814..6639b18f 100644 --- a/app/Http/Desktop/Controllers/CourseController.php +++ b/app/Http/Desktop/Controllers/CourseController.php @@ -3,7 +3,7 @@ namespace App\Http\Desktop\Controllers; use App\Http\Desktop\Services\CourseQuery as CourseQueryService; -use App\Services\Frontend\Course\ChapterList as CourseCatalogService; +use App\Services\Frontend\Course\ChapterList as CourseChapterListService; use App\Services\Frontend\Course\ConsultList as CourseConsultListService; use App\Services\Frontend\Course\CourseInfo as CourseInfoService; use App\Services\Frontend\Course\CourseList as CourseListService; @@ -72,7 +72,7 @@ class CourseController extends Controller $course = $service->handle($id); - $service = new CourseCatalogService(); + $service = new CourseChapterListService(); $chapters = $service->handle($id); diff --git a/app/Http/Desktop/Controllers/ImController.php b/app/Http/Desktop/Controllers/ImController.php index fe1b27c0..90d4f2bb 100644 --- a/app/Http/Desktop/Controllers/ImController.php +++ b/app/Http/Desktop/Controllers/ImController.php @@ -113,7 +113,7 @@ class ImController extends Controller { $service = new ImService(); - $id = $this->request->getQuery('id'); + $id = $this->request->getQuery('id', 'int'); $service->pullUnreadFriendMessages($id); @@ -197,8 +197,8 @@ class ImController extends Controller */ public function sendChatMessageAction() { - $from = $this->request->getPost('from'); - $to = $this->request->getPost('to'); + $from = $this->request->getPost('from', 'string'); + $to = $this->request->getPost('to', 'string'); $service = new ImService(); @@ -212,8 +212,8 @@ class ImController extends Controller */ public function sendCsMessageAction() { - $from = $this->request->getPost('from'); - $to = $this->request->getPost('to'); + $from = $this->request->getPost('from', 'string'); + $to = $this->request->getPost('to', 'string'); $service = new ImService(); diff --git a/app/Http/Desktop/Controllers/LiveController.php b/app/Http/Desktop/Controllers/LiveController.php index 9ba31814..0a1625c7 100644 --- a/app/Http/Desktop/Controllers/LiveController.php +++ b/app/Http/Desktop/Controllers/LiveController.php @@ -14,20 +14,6 @@ class LiveController extends Controller use ResponseTrait; - /** - * @Get("/{id:[0-9]+}/preview", name="desktop.live.preview") - */ - public function previewAction($id) - { - $service = new LiveService(); - - $stats = $service->getStats($id); - - $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - $this->view->pick('chapter/live_stats'); - $this->view->setVar('stats', $stats); - } - /** * @Get("/{id:[0-9]+}/chats", name="desktop.live.chats") */ diff --git a/app/Http/Desktop/Controllers/MyController.php b/app/Http/Desktop/Controllers/MyController.php index 8334d646..b89579ff 100644 --- a/app/Http/Desktop/Controllers/MyController.php +++ b/app/Http/Desktop/Controllers/MyController.php @@ -151,7 +151,7 @@ class MyController extends Controller */ public function groupsAction() { - $scope = $this->request->getQuery('scope', 'trim', 'joined'); + $scope = $this->request->getQuery('scope', 'string', 'joined'); $service = new MyGroupListService(); diff --git a/app/Http/Desktop/Controllers/OrderController.php b/app/Http/Desktop/Controllers/OrderController.php index 8e2c066d..2ffb375c 100644 --- a/app/Http/Desktop/Controllers/OrderController.php +++ b/app/Http/Desktop/Controllers/OrderController.php @@ -20,7 +20,7 @@ class OrderController extends Controller */ public function infoAction() { - $sn = $this->request->getQuery('sn'); + $sn = $this->request->getQuery('sn', 'string'); $service = new OrderInfoService(); @@ -35,8 +35,8 @@ class OrderController extends Controller */ public function confirmAction() { - $itemId = $this->request->getQuery('item_id'); - $itemType = $this->request->getQuery('item_type'); + $itemId = $this->request->getQuery('item_id', 'int'); + $itemType = $this->request->getQuery('item_type', 'int'); $service = new OrderConfirmService(); @@ -64,7 +64,7 @@ class OrderController extends Controller */ public function payAction() { - $sn = $this->request->getQuery('sn'); + $sn = $this->request->getQuery('sn', 'string'); $service = new OrderInfoService(); @@ -82,7 +82,7 @@ class OrderController extends Controller */ public function cancelAction() { - $sn = $this->request->getPost('sn'); + $sn = $this->request->getPost('sn', 'string'); $service = new OrderCancelService(); diff --git a/app/Http/Desktop/Controllers/PublicController.php b/app/Http/Desktop/Controllers/PublicController.php index b838cc5b..a56a8db7 100644 --- a/app/Http/Desktop/Controllers/PublicController.php +++ b/app/Http/Desktop/Controllers/PublicController.php @@ -49,7 +49,7 @@ class PublicController extends \Phalcon\Mvc\Controller */ public function qrcodeAction() { - $text = $this->request->getQuery('text'); + $text = $this->request->getQuery('text', 'string'); $level = $this->request->getQuery('level', 'int', 0); $size = $this->request->getQuery('size', 'int', 5); diff --git a/app/Http/Desktop/Controllers/RefundController.php b/app/Http/Desktop/Controllers/RefundController.php index cec1661e..adcca003 100644 --- a/app/Http/Desktop/Controllers/RefundController.php +++ b/app/Http/Desktop/Controllers/RefundController.php @@ -20,7 +20,7 @@ class RefundController extends Controller */ public function confirmAction() { - $sn = $this->request->getQuery('sn'); + $sn = $this->request->getQuery('sn', 'string'); $service = new OrderInfoService(); @@ -57,7 +57,7 @@ class RefundController extends Controller */ public function infoAction() { - $sn = $this->request->getQuery('sn'); + $sn = $this->request->getQuery('sn', 'string'); $service = new RefundInfoService(); @@ -72,7 +72,7 @@ class RefundController extends Controller */ public function cancelAction() { - $sn = $this->request->getPost('sn'); + $sn = $this->request->getPost('sn', 'string'); $service = new RefundCancelService(); diff --git a/app/Http/Desktop/Controllers/TradeController.php b/app/Http/Desktop/Controllers/TradeController.php index 29af171c..046c87f6 100644 --- a/app/Http/Desktop/Controllers/TradeController.php +++ b/app/Http/Desktop/Controllers/TradeController.php @@ -28,7 +28,7 @@ class TradeController extends Controller */ public function statusAction() { - $sn = $this->request->getQuery('sn'); + $sn = $this->request->getQuery('sn', 'string'); $service = new TradeInfoService(); diff --git a/app/Http/Desktop/Controllers/VipController.php b/app/Http/Desktop/Controllers/VipController.php index 9b991744..78ad9028 100644 --- a/app/Http/Desktop/Controllers/VipController.php +++ b/app/Http/Desktop/Controllers/VipController.php @@ -32,7 +32,7 @@ class VipController extends Controller */ public function coursesAction() { - $type = $this->request->getQuery('type', 'trim', 'discount'); + $type = $this->request->getQuery('type', 'string', 'discount'); $service = new VipCourseListService(); diff --git a/app/Http/Desktop/Services/Im.php b/app/Http/Desktop/Services/Im.php index 04a1caf7..c1aed7df 100644 --- a/app/Http/Desktop/Services/Im.php +++ b/app/Http/Desktop/Services/Im.php @@ -45,7 +45,7 @@ class Im extends Service public function getGroupUsers() { - $id = $this->request->getQuery('id'); + $id = $this->request->getQuery('id', 'int'); $validator = new ImGroupValidator(); @@ -82,7 +82,7 @@ class Im extends Service public function getFriendStatus() { - $id = $this->request->getQuery('id'); + $id = $this->request->getQuery('id', 'int'); $validator = new ImUserValidator(); @@ -106,7 +106,7 @@ class Im extends Service $user = $this->getImUser($loginUser->id); - $clientId = $this->request->getPost('client_id'); + $clientId = $this->request->getPost('client_id', 'string'); Gateway::$registerAddress = $this->getRegisterAddress(); @@ -131,7 +131,7 @@ class Im extends Service $user = $this->getImUser($loginUser->id); - $status = $this->request->getPost('status'); + $status = $this->request->getPost('status', 'string'); $validator = new ImUserValidator(); @@ -148,7 +148,7 @@ class Im extends Service $user = $this->getImUser($loginUser->id); - $sign = $this->request->getPost('sign'); + $sign = $this->request->getPost('sign', 'string'); $validator = new ImUserValidator(); @@ -165,7 +165,7 @@ class Im extends Service $user = $this->getImUser($loginUser->id); - $skin = $this->request->getPost('skin'); + $skin = $this->request->getPost('skin', 'string'); $validator = new ImUserValidator(); diff --git a/app/Http/Desktop/Services/ImGroupTrait.php b/app/Http/Desktop/Services/ImGroupTrait.php index 60cdd3c9..c4439b64 100644 --- a/app/Http/Desktop/Services/ImGroupTrait.php +++ b/app/Http/Desktop/Services/ImGroupTrait.php @@ -41,7 +41,7 @@ Trait ImGroupTrait $user = $this->getImUser($loginUser->id); - $noticeId = $this->request->getPost('notice_id'); + $noticeId = $this->request->getPost('notice_id', 'int'); $validator = new ImNoticeValidator(); @@ -96,7 +96,7 @@ Trait ImGroupTrait $user = $this->getImUser($loginUser->id); - $noticeId = $this->request->getPost('notice_id'); + $noticeId = $this->request->getPost('notice_id', 'int'); $validator = new ImNoticeValidator(); diff --git a/app/Http/Desktop/Services/Live.php b/app/Http/Desktop/Services/Live.php index c6c7a1b7..ed4ecb97 100644 --- a/app/Http/Desktop/Services/Live.php +++ b/app/Http/Desktop/Services/Live.php @@ -59,7 +59,7 @@ class Live extends Service public function bindUser($id) { - $clientId = $this->request->getPost('client_id'); + $clientId = $this->request->getPost('client_id', 'string'); $chapter = $this->checkChapter($id); diff --git a/app/Http/Desktop/Views/chapter/live_inactive.volt b/app/Http/Desktop/Views/chapter/live_inactive.volt index 9b02f73b..18de57bf 100644 --- a/app/Http/Desktop/Views/chapter/live_inactive.volt +++ b/app/Http/Desktop/Views/chapter/live_inactive.volt @@ -2,27 +2,23 @@ {% block content %} - {% set course_url = url({'for':'desktop.course.show','id':chapter.course.id}) %} {% set live_status_url = url({'for':'desktop.live.status','id':chapter.id}) %} - {% set show_countdown = time() < chapter.start_time ? 1 : 0 %} - - - {% if show_countdown == 1 %} + {% if time() < chapter.start_time %}
-
开播倒计时开始啦,敬请关注!
+
直播倒计时开始啦,敬请关注!
+
+ {% elseif chapter.start_time < time() and chapter.end_time > time() %} +
+
+
+
直播时间到了,主播去哪了?
{% else %}
-
+
直播已结束,谢谢关注!
{% endif %} diff --git a/app/Listeners/Pay.php b/app/Listeners/Pay.php index 4c1d7fd3..2ee624a8 100644 --- a/app/Listeners/Pay.php +++ b/app/Listeners/Pay.php @@ -69,7 +69,6 @@ class Pay extends Listener $this->db->rollback(); $this->logger->error('After Pay Event Error ' . kg_json_encode([ - 'line' => $e->getLine(), 'code' => $e->getCode(), 'message' => $e->getMessage(), ])); diff --git a/app/Models/ChapterLive.php b/app/Models/ChapterLive.php index 50823c39..d7c587d1 100644 --- a/app/Models/ChapterLive.php +++ b/app/Models/ChapterLive.php @@ -9,7 +9,7 @@ class ChapterLive extends Model * 状态类型 */ const STATUS_ACTIVE = 1; // 活跃 - const STATUS_INACTIVE = 2; // 非活跃 + const STATUS_INACTIVE = 2; // 静默 const STATUS_FORBID = 3; // 禁播 /** @@ -82,6 +82,8 @@ class ChapterLive extends Model public function beforeCreate() { + $this->status = self::STATUS_INACTIVE; + $this->create_time = time(); } diff --git a/app/Services/Frontend/Course/ChapterList.php b/app/Services/Frontend/Course/ChapterList.php index b4eaa074..bc6c15dc 100644 --- a/app/Services/Frontend/Course/ChapterList.php +++ b/app/Services/Frontend/Course/ChapterList.php @@ -2,7 +2,7 @@ namespace App\Services\Frontend\Course; -use App\Caches\CourseCatalog as CourseCatalogCache; +use App\Caches\CourseChapterList as CourseChapterListCache; use App\Models\Course as CourseModel; use App\Models\User as UserModel; use App\Repos\Course as CourseRepo; @@ -27,7 +27,7 @@ class ChapterList extends FrontendService protected function getChapters(CourseModel $course, UserModel $user) { - $cache = new CourseCatalogCache(); + $cache = new CourseChapterListCache(); $chapters = $cache->get($course->id); diff --git a/app/Services/Frontend/Teaching/LivePushUrl.php b/app/Services/Frontend/Teaching/LivePushUrl.php index 4407941b..ba615992 100644 --- a/app/Services/Frontend/Teaching/LivePushUrl.php +++ b/app/Services/Frontend/Teaching/LivePushUrl.php @@ -15,7 +15,7 @@ class LivePushUrl extends FrontendService public function handle() { - $chapterId = $this->request->getQuery('chapter_id'); + $chapterId = $this->request->getQuery('chapter_id', 'int'); $chapter = $this->checkChapter($chapterId); diff --git a/app/Services/LiveNotify.php b/app/Services/LiveNotify.php index 924c7136..2501cdc4 100644 --- a/app/Services/LiveNotify.php +++ b/app/Services/LiveNotify.php @@ -11,9 +11,9 @@ class LiveNotify extends Service public function handle() { - $time = $this->request->getPost('t'); - $sign = $this->request->getPost('sign'); - $action = $this->request->getQuery('action'); + $time = $this->request->getPost('t', 'int'); + $sign = $this->request->getPost('sign', 'string'); + $action = $this->request->getQuery('action', 'string'); if (!$this->checkSign($sign, $time)) { return false; @@ -57,7 +57,7 @@ class LiveNotify extends Service */ protected function handleStreamBegin() { - $streamId = $this->request->getPost('stream_id'); + $streamId = $this->request->getPost('stream_id', 'string'); $chapter = $this->getChapter($streamId); @@ -83,7 +83,7 @@ class LiveNotify extends Service */ protected function handleStreamEnd() { - $streamId = $this->request->getPost('stream_id'); + $streamId = $this->request->getPost('stream_id', 'string'); $chapter = $this->getChapter($streamId); diff --git a/app/Services/Pay/Alipay.php b/app/Services/Pay/Alipay.php index f9dd7145..23194ad5 100644 --- a/app/Services/Pay/Alipay.php +++ b/app/Services/Pay/Alipay.php @@ -129,7 +129,13 @@ class Alipay extends PayService $this->eventsManager->fire('pay:afterPay', $this, $trade); - return $this->gateway->success(); + $trade = $tradeRepo->findById($trade->id); + + if ($trade->status == TradeModel::STATUS_FINISHED) { + return $this->gateway->success(); + } + + return false; } /** diff --git a/app/Services/Pay/Wxpay.php b/app/Services/Pay/Wxpay.php index 45f76307..157dc656 100644 --- a/app/Services/Pay/Wxpay.php +++ b/app/Services/Pay/Wxpay.php @@ -131,7 +131,13 @@ class Wxpay extends PayService $this->eventsManager->fire('pay:afterPay', $this, $trade); - return $this->gateway->success(); + $trade = $tradeRepo->findById($trade->id); + + if ($trade->status == TradeModel::STATUS_FINISHED) { + return $this->gateway->success(); + } + + return false; } /** diff --git a/app/Services/Pay/WxpayGateway.php b/app/Services/Pay/WxpayGateway.php index cad58752..17aa8fe8 100644 --- a/app/Services/Pay/WxpayGateway.php +++ b/app/Services/Pay/WxpayGateway.php @@ -47,8 +47,8 @@ class WxpayGateway extends Service 'mch_id' => $this->settings['mch_id'], 'key' => $this->settings['key'], 'notify_url' => $this->settings['notify_url'], - 'cert_client' => config_path('wxpay/client_cert.pem'), - 'cert_key' => config_path('wxpay/client_key.pem'), + 'cert_client' => config_path('wxpay/apiclient_cert.pem'), + 'cert_key' => config_path('wxpay/apiclient_key.pem'), 'log' => [ 'file' => log_path('wxpay.log'), 'level' => $level, diff --git a/public/static/desktop/css/common.css b/public/static/desktop/css/common.css index a73789de..b8a830d6 100644 --- a/public/static/desktop/css/common.css +++ b/public/static/desktop/css/common.css @@ -911,7 +911,7 @@ body { .countdown { color: #666; - margin-top: 50px; + margin-top: 30px; text-align: center; } @@ -924,7 +924,7 @@ body { } .countdown .tips { - font-size: 18px; + font-size: 16px; margin: 20px 0; } @@ -934,6 +934,7 @@ body { .countdown .timer span { color: green; + font-size: 36px; padding: 10px; } From 504e8e0171c692c08d22d5109581137c6c92d3e4 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Mon, 14 Sep 2020 20:25:35 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E6=B5=8B=E8=AF=95=E5=BE=AE=E4=BF=A1=E9=80=80=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 + README.md | 10 +- app/Http/Admin/Controllers/TestController.php | 2 - .../Admin/Controllers/TradeController.php | 9 +- app/Http/Admin/Services/Trade.php | 2 +- app/Http/Admin/Views/order/macro.volt | 10 +- app/Http/Admin/Views/order/user_info.volt | 4 +- app/Http/Admin/Views/public/live_player.volt | 92 ++++++++----------- app/Http/Admin/Views/refund/search.volt | 1 + app/Http/Admin/Views/refund/show.volt | 2 +- app/Http/Admin/Views/setting/live_notify.volt | 2 +- app/Http/Admin/Views/setting/live_pull.volt | 2 +- app/Http/Admin/Views/setting/live_push.volt | 2 +- app/Http/Admin/Views/setting/site.volt | 4 +- app/Http/Admin/Views/setting/vod.volt | 14 +-- app/Http/Admin/Views/trade/macro.volt | 4 +- app/Http/Admin/Views/trade/show.volt | 8 +- app/Http/Desktop/Controllers/Controller.php | 3 +- .../Desktop/Controllers/IndexController.php | 2 +- app/Http/Desktop/Controllers/MyController.php | 8 +- .../Desktop/Controllers/OrderController.php | 13 +++ .../Controllers/TeachingController.php | 13 +++ app/Http/Desktop/Views/course/consults.volt | 2 +- app/Http/Desktop/Views/course/reviews.volt | 2 +- app/Http/Desktop/Views/order/confirm.volt | 10 +- .../Frontend/Chapter/BasicInfoTrait.php | 9 +- app/Services/Frontend/CourseTrait.php | 14 ++- app/Services/Live.php | 10 +- app/Services/Pay/Alipay.php | 4 + app/Services/Pay/Wxpay.php | 4 + app/Services/Vod.php | 4 +- config/alipay/{.gitignore => .gitkeep} | 0 config/wxpay/.gitignore | 2 - config/wxpay/.gitkeep | 0 .../20200827112717_insert_setting_data.php | 6 +- .../static/desktop/js/chapter.live.player.js | 44 +++------ .../static/desktop/js/chapter.vod.player.js | 8 +- scheduler.php | 6 ++ 38 files changed, 170 insertions(+), 164 deletions(-) rename config/alipay/{.gitignore => .gitkeep} (100%) delete mode 100644 config/wxpay/.gitignore create mode 100644 config/wxpay/.gitkeep diff --git a/.gitignore b/.gitignore index c1687295..2f894c4f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ /config/xs.course.ini /config/xs.group.ini /config/xs.user.ini +/config/alipay/*.crt +/config/wxpay/*.pem /public/robots.txt /public/sitemap.xml *KgTest* diff --git a/README.md b/README.md index 1a478c4f..09a2268b 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ 都有些什么功能?我也不想写一大堆,自己体验吧! -帐号:100015@163.com / 123456 (前后台通用) - -PS:**系统后台已禁止提交并隐藏私人配置** - - [前台演示](https://ctc.koogua.com) - [后台演示](https://ctc.koogua.com/admin) +帐号:100015@163.com / 123456 (前后台通用) + +PS:**管理后台已禁止提交并隐藏私人配置** + #### 项目组件 - 后台框架:[phalcon 3.4.5](https://phalcon.io) @@ -37,7 +37,7 @@ PS:**系统后台已禁止提交并隐藏私人配置** #### 会推出商业服务吗? - 如果不符合您对“开源”的认知,请移步其它同类产品,毕竟同类“免费”产品也很多。 -- 如果“开源”版本不能满足您的需求,或者您希望有更好的支持,商业服务是不错的选择。 +- 如果使用协议不能满足您的需求,或者您希望有更好的支持,商业服务是不错的选择。 我们为用户提供的服务包括: diff --git a/app/Http/Admin/Controllers/TestController.php b/app/Http/Admin/Controllers/TestController.php index 61f56222..d363e8e3 100644 --- a/app/Http/Admin/Controllers/TestController.php +++ b/app/Http/Admin/Controllers/TestController.php @@ -11,7 +11,6 @@ use App\Services\Mailer\Test as TestMailerService; use App\Services\MyStorage as StorageService; use App\Services\Smser\Test as TestSmserService; use App\Services\Vod as VodService; -use Phalcon\Mvc\View; /** * @RoutePrefix("/admin/test") @@ -92,7 +91,6 @@ class TestController extends Controller $pullUrls = $liveService->getPullUrls('test'); - $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); $this->view->pick('public/live_player'); $this->view->setVar('pull_urls', $pullUrls); } diff --git a/app/Http/Admin/Controllers/TradeController.php b/app/Http/Admin/Controllers/TradeController.php index 0eb539ce..b4781320 100644 --- a/app/Http/Admin/Controllers/TradeController.php +++ b/app/Http/Admin/Controllers/TradeController.php @@ -70,13 +70,16 @@ class TradeController extends Controller { $tradeService = new TradeService(); - $tradeService->refundTrade($id); + $refund = $tradeService->refundTrade($id); - $location = $this->request->getHTTPReferer(); + $location = $this->url->get([ + 'for' => 'admin.refund.show', + 'id' => $refund->id, + ]); $content = [ 'location' => $location, - 'msg' => '申请退款成功,请到退款管理中审核确认', + 'msg' => '申请退款成功', ]; return $this->jsonSuccess($content); diff --git a/app/Http/Admin/Services/Trade.php b/app/Http/Admin/Services/Trade.php index b471c9c0..7205ce6c 100644 --- a/app/Http/Admin/Services/Trade.php +++ b/app/Http/Admin/Services/Trade.php @@ -101,7 +101,7 @@ class Trade extends Service $refund->create(); - return $trade; + return $refund; } protected function findOrFail($id) diff --git a/app/Http/Admin/Views/order/macro.volt b/app/Http/Admin/Views/order/macro.volt index 4fcbf361..f6ef13a7 100644 --- a/app/Http/Admin/Views/order/macro.volt +++ b/app/Http/Admin/Views/order/macro.volt @@ -1,12 +1,12 @@ {%- macro item_info(order) %} - {% if order.item_type == '1' %} + {% if order.item_type == 1 %} {% set course = order.item_info['course'] %}

课程名称:{{ course['title'] }}

市场价格:{{ '¥%0.2f'|format(course['market_price']) }},会员价格:{{ '¥%0.2f'|format(course['vip_price']) }}

学习期限:{{ date('Y-m-d H:i:s',course['study_expiry_time']) }},退款期限:{{ date('Y-m-d H:i:s',course['refund_expiry_time']) }}

- {% elseif order.item_type == '2' %} + {% elseif order.item_type == 2 %} {% set courses = order.item_info['courses'] %} {% for course in courses %}
@@ -15,20 +15,20 @@

学习期限:{{ date('Y-m-d H:i:s',course['study_expiry_time']) }},退款期限:{{ date('Y-m-d H:i:s',course['refund_expiry_time']) }}

{% endfor %} - {% elseif order.item_type == '3' %} + {% elseif order.item_type == 3 %} {% set course = order.item_info['course'] %} {% set reward = order.item_info['reward'] %}

商品名称:{{ order.subject }}

商品价格:{{ '¥%0.2f'|format(order.amount) }}

- {% elseif order.item_type == '4' %} + {% elseif order.item_type == 4 %} {% set vip = order.item_info['vip'] %}

商品名称:{{ order.subject }}

商品价格:{{ '¥%0.2f'|format(order.amount) }}

- {% elseif order.item_type == '99' %} + {% elseif order.item_type == 99 %}

商品名称:{{ order.subject }}

商品价格:{{ '¥%0.2f'|format(order.amount) }}

diff --git a/app/Http/Admin/Views/order/user_info.volt b/app/Http/Admin/Views/order/user_info.volt index e5fcfc92..822b7e25 100644 --- a/app/Http/Admin/Views/order/user_info.volt +++ b/app/Http/Admin/Views/order/user_info.volt @@ -12,7 +12,7 @@ {{ user.id }} {{ user.name }} - {% if account.phone %} {{ account.phone }} {% else %} 未知 {% endif %} - {% if account.email %} {{ account.email }} {% else %} 未知 {% endif %} + {{ account.phone }} + {{ account.email }} \ No newline at end of file diff --git a/app/Http/Admin/Views/public/live_player.volt b/app/Http/Admin/Views/public/live_player.volt index 8bb5f7b8..a6d3f352 100644 --- a/app/Http/Admin/Views/public/live_player.volt +++ b/app/Http/Admin/Views/public/live_player.volt @@ -1,70 +1,58 @@ - - - - - - 视频直播 - +{% extends 'templates/main.volt' %} + +{% block content %} + +
+ +{% endblock %} + +{% block inline_css %} + - - -
- - - - if (playUrls.rtmp && playUrls.rtmp.od) { - options.rtmp = playUrls.rtmp.od; - } + - +{% endblock %} \ No newline at end of file diff --git a/app/Http/Admin/Views/refund/search.volt b/app/Http/Admin/Views/refund/search.volt index 73489a4b..0db3df64 100644 --- a/app/Http/Admin/Views/refund/search.volt +++ b/app/Http/Admin/Views/refund/search.volt @@ -26,6 +26,7 @@ +
diff --git a/app/Http/Admin/Views/refund/show.volt b/app/Http/Admin/Views/refund/show.volt index fbaaaa9e..48ddd254 100644 --- a/app/Http/Admin/Views/refund/show.volt +++ b/app/Http/Admin/Views/refund/show.volt @@ -39,7 +39,7 @@
- {% if refund.status == 'pending' %} + {% if refund.status == 1 %}
审核退款 diff --git a/app/Http/Admin/Views/setting/live_notify.volt b/app/Http/Admin/Views/setting/live_notify.volt index ae93063d..bb973c3f 100644 --- a/app/Http/Admin/Views/setting/live_notify.volt +++ b/app/Http/Admin/Views/setting/live_notify.volt @@ -40,7 +40,7 @@
- +
\ No newline at end of file diff --git a/app/Http/Admin/Views/setting/live_pull.volt b/app/Http/Admin/Views/setting/live_pull.volt index 3dd4ec32..7990554a 100644 --- a/app/Http/Admin/Views/setting/live_pull.volt +++ b/app/Http/Admin/Views/setting/live_pull.volt @@ -97,7 +97,7 @@
- +
diff --git a/app/Http/Admin/Views/setting/live_push.volt b/app/Http/Admin/Views/setting/live_push.volt index 3c1955c3..6eaeb1b2 100644 --- a/app/Http/Admin/Views/setting/live_push.volt +++ b/app/Http/Admin/Views/setting/live_push.volt @@ -39,7 +39,7 @@
- +
diff --git a/app/Http/Admin/Views/setting/site.volt b/app/Http/Admin/Views/setting/site.volt index 1b474648..3f994ab2 100644 --- a/app/Http/Admin/Views/setting/site.volt +++ b/app/Http/Admin/Views/setting/site.volt @@ -27,8 +27,8 @@
- - + +
diff --git a/app/Http/Admin/Views/setting/vod.volt b/app/Http/Admin/Views/setting/vod.volt index c173a3ae..bf2ba42d 100644 --- a/app/Http/Admin/Views/setting/vod.volt +++ b/app/Http/Admin/Views/setting/vod.volt @@ -3,7 +3,7 @@ {% block content %} {% set storage_region_display = vod.storage_type == 'fixed' ? 'display:block' : 'display:none' %} - {% set watermark_template_display = vod.watermark_enabled == 1 ? 'display:block' : 'display:none' %} + {% set wmk_tpl_display = vod.wmk_enabled == 1 ? 'display:block' : 'display:none' %} {% set key_anti_display = vod.key_anti_enabled == 1 ? 'display:block': 'display:none' %}
@@ -45,15 +45,15 @@
- - + +
-
+
- +
@@ -145,8 +145,8 @@ } }); - form.on('radio(watermark_enabled)', function (data) { - var block = $('#watermark-template-block'); + form.on('radio(wmk_enabled)', function (data) { + var block = $('#wmk-tpl-block'); if (data.value === '1') { block.show(); } else { diff --git a/app/Http/Admin/Views/trade/macro.volt b/app/Http/Admin/Views/trade/macro.volt index 3f5ecf2a..df25e586 100644 --- a/app/Http/Admin/Views/trade/macro.volt +++ b/app/Http/Admin/Views/trade/macro.volt @@ -1,7 +1,7 @@ {%- macro channel_type(value) %} - {% if value == '1' %} + {% if value == 1 %} 支付宝 - {% elseif value == '2' %} + {% elseif value == 2 %} 微信 {% endif %} {%- endmacro %} diff --git a/app/Http/Admin/Views/trade/show.volt b/app/Http/Admin/Views/trade/show.volt index 06aa8fc4..d544e590 100644 --- a/app/Http/Admin/Views/trade/show.volt +++ b/app/Http/Admin/Views/trade/show.volt @@ -12,7 +12,7 @@ {% set trade_refund_url = url({'for':'admin.trade.refund','id':trade.id}) %}
- {% if trade.status == 'finished' %} + {% if trade.status == 2 %} {% endif %} @@ -38,7 +38,7 @@ {{ item.sn }} {{ '¥%0.2f'|format(item.amount) }} {{ substr(item.apply_note,0,15) }} - {{ refund_status(item) }} + {{ refund_status(item.status) }} {{ date('Y-m-d H:i:s',item.create_time) }} 详情 @@ -80,8 +80,8 @@ success: function (res) { layer.msg(res.msg, {icon: 1}); setTimeout(function () { - window.location.reload(); - }, 1500); + window.location.href = res.location; + }, 3000); }, error: function (xhr) { var json = JSON.parse(xhr.responseText); diff --git a/app/Http/Desktop/Controllers/Controller.php b/app/Http/Desktop/Controllers/Controller.php index d91cd7ca..1dc53690 100644 --- a/app/Http/Desktop/Controllers/Controller.php +++ b/app/Http/Desktop/Controllers/Controller.php @@ -53,6 +53,8 @@ class Controller extends \Phalcon\Mvc\Controller { $this->siteInfo = $this->getSiteInfo(); + $this->authUser = $this->getAuthUser(); + $this->checkSiteStatus(); if ($this->isNotSafeRequest()) { @@ -73,7 +75,6 @@ class Controller extends \Phalcon\Mvc\Controller { $this->seo = $this->getSeo(); $this->navs = $this->getNavs(); - $this->authUser = $this->getAuthUser(); $this->appInfo = $this->getAppInfo(); $this->imInfo = $this->getImInfo(); diff --git a/app/Http/Desktop/Controllers/IndexController.php b/app/Http/Desktop/Controllers/IndexController.php index 5fe3a0a5..86511974 100644 --- a/app/Http/Desktop/Controllers/IndexController.php +++ b/app/Http/Desktop/Controllers/IndexController.php @@ -15,7 +15,7 @@ class IndexController extends Controller $this->seo->setKeywords($this->siteInfo['keywords']); $this->seo->setDescription($this->siteInfo['description']); - $template = $this->siteInfo['index_template'] ?? 'full'; + $template = $this->siteInfo['index_tpl'] ?? 'full'; if ($template == 'full') { $this->fullIndex(); diff --git a/app/Http/Desktop/Controllers/MyController.php b/app/Http/Desktop/Controllers/MyController.php index b89579ff..0b9f37d5 100644 --- a/app/Http/Desktop/Controllers/MyController.php +++ b/app/Http/Desktop/Controllers/MyController.php @@ -13,6 +13,7 @@ use App\Services\Frontend\My\ProfileInfo as ProfileInfoService; use App\Services\Frontend\My\ProfileUpdate as ProfileUpdateService; use App\Services\Frontend\My\RefundList as MyRefundListService; use App\Services\Frontend\My\ReviewList as MyReviewListService; +use Phalcon\Mvc\Dispatcher; /** * @RoutePrefix("/my") @@ -20,13 +21,16 @@ use App\Services\Frontend\My\ReviewList as MyReviewListService; class MyController extends Controller { - public function initialize() + public function beforeExecuteRoute(Dispatcher $dispatcher) { - parent::initialize(); + parent::beforeExecuteRoute($dispatcher); if ($this->authUser->id == 0) { $this->response->redirect(['for' => 'desktop.account.login']); + return false; } + + return true; } /** diff --git a/app/Http/Desktop/Controllers/OrderController.php b/app/Http/Desktop/Controllers/OrderController.php index 2ffb375c..ab7adb81 100644 --- a/app/Http/Desktop/Controllers/OrderController.php +++ b/app/Http/Desktop/Controllers/OrderController.php @@ -7,6 +7,7 @@ use App\Services\Frontend\Order\OrderCancel as OrderCancelService; use App\Services\Frontend\Order\OrderConfirm as OrderConfirmService; use App\Services\Frontend\Order\OrderCreate as OrderCreateService; use App\Services\Frontend\Order\OrderInfo as OrderInfoService; +use Phalcon\Mvc\Dispatcher; use Phalcon\Mvc\View; /** @@ -15,6 +16,18 @@ use Phalcon\Mvc\View; class OrderController extends Controller { + public function beforeExecuteRoute(Dispatcher $dispatcher) + { + parent::beforeExecuteRoute($dispatcher); + + if ($this->authUser->id == 0) { + $this->response->redirect(['for' => 'desktop.account.login']); + return false; + } + + return true; + } + /** * @Get("/info", name="desktop.order.info") */ diff --git a/app/Http/Desktop/Controllers/TeachingController.php b/app/Http/Desktop/Controllers/TeachingController.php index c29bab8a..d2eb9382 100644 --- a/app/Http/Desktop/Controllers/TeachingController.php +++ b/app/Http/Desktop/Controllers/TeachingController.php @@ -7,6 +7,7 @@ use App\Services\Frontend\Teaching\ConsultList as ConsultListService; use App\Services\Frontend\Teaching\CourseList as CourseListService; use App\Services\Frontend\Teaching\LiveList as LiveListService; use App\Services\Frontend\Teaching\LivePushUrl as LivePushUrlService; +use Phalcon\Mvc\Dispatcher; /** @@ -15,6 +16,18 @@ use App\Services\Frontend\Teaching\LivePushUrl as LivePushUrlService; class TeachingController extends Controller { + public function beforeExecuteRoute(Dispatcher $dispatcher) + { + parent::beforeExecuteRoute($dispatcher); + + if ($this->authUser->id == 0) { + $this->response->redirect(['for' => 'desktop.account.login']); + return false; + } + + return true; + } + /** * @Get("/", name="desktop.teaching.index") */ diff --git a/app/Http/Desktop/Views/course/consults.volt b/app/Http/Desktop/Views/course/consults.volt index 23226cf0..9b465d04 100644 --- a/app/Http/Desktop/Views/course/consults.volt +++ b/app/Http/Desktop/Views/course/consults.volt @@ -8,7 +8,7 @@
diff --git a/app/Http/Desktop/Views/course/reviews.volt b/app/Http/Desktop/Views/course/reviews.volt index 0378990e..012c9a09 100644 --- a/app/Http/Desktop/Views/course/reviews.volt +++ b/app/Http/Desktop/Views/course/reviews.volt @@ -8,7 +8,7 @@
diff --git a/app/Http/Desktop/Views/order/confirm.volt b/app/Http/Desktop/Views/order/confirm.volt index 4fd7d9fe..4f38b4f9 100644 --- a/app/Http/Desktop/Views/order/confirm.volt +++ b/app/Http/Desktop/Views/order/confirm.volt @@ -48,7 +48,7 @@ {% set vip = item_info.vip %}
- 会员服务 + 会员服务

会员服务

@@ -64,17 +64,17 @@
- {% if confirm.item_type == 'course' %} + {% if confirm.item_type == 1 %} {% set course = confirm.item_info.course %} {{ cart_course_card(course, auth_user) }} - {% elseif confirm.item_type == 'package' %} + {% elseif confirm.item_type == 2 %} {% set package = confirm.item_info.package %} {% for course in package.courses %} {{ cart_course_card(course, auth_user) }} {% endfor %} - {% elseif confirm.item_type == 'reward' %} + {% elseif confirm.item_type == 3 %} {{ cart_reward_card(confirm.item_info) }} - {% elseif confirm.item_type == 'vip' %} + {% elseif confirm.item_type == 4 %} {{ cart_vip_card(confirm.item_info) }} {% endif %}
diff --git a/app/Services/Frontend/Chapter/BasicInfoTrait.php b/app/Services/Frontend/Chapter/BasicInfoTrait.php index 1d2b395e..39140bb3 100644 --- a/app/Services/Frontend/Chapter/BasicInfoTrait.php +++ b/app/Services/Frontend/Chapter/BasicInfoTrait.php @@ -8,7 +8,6 @@ use App\Repos\Chapter as ChapterRepo; use App\Services\ChapterVod as ChapterVodService; use App\Services\Frontend\ChapterLiveTrait; use App\Services\Live as LiveService; -use WhichBrowser\Parser as BrowserParser; trait BasicInfoTrait { @@ -62,17 +61,11 @@ trait BasicInfoTrait protected function formatChapterLive(ChapterModel $chapter) { - $headers = getallheaders(); - - $browserParser = new BrowserParser($headers); - $liveService = new LiveService(); $stream = $this->getStreamName($chapter->id); - $format = $browserParser->isType('desktop') ? 'flv' : 'hls'; - - $playUrls = $liveService->getPullUrls($stream, $format); + $playUrls = $liveService->getPullUrls($stream); $chapterRepo = new ChapterRepo(); diff --git a/app/Services/Frontend/CourseTrait.php b/app/Services/Frontend/CourseTrait.php index 28e896a3..bd25889d 100644 --- a/app/Services/Frontend/CourseTrait.php +++ b/app/Services/Frontend/CourseTrait.php @@ -63,18 +63,22 @@ trait CourseTrait $this->ownedCourse = true; - } elseif ($courseUser) { + } elseif ($courseUser && $courseUser->role_type == CourseUserModel::ROLE_TEACHER) { + + $this->ownedCourse = true; + + } elseif ($courseUser && $courseUser->role_type == CourseUserModel::ROLE_STUDENT) { $sourceTypes = [ CourseUserModel::SOURCE_CHARGE, CourseUserModel::SOURCE_IMPORT, ]; - $caseA = $courseUser->deleted == 0; - $caseB = $courseUser->expiry_time > time(); - $caseC = in_array($courseUser->source_type, $sourceTypes); + $case1 = $courseUser->deleted == 0; + $case2 = $courseUser->expiry_time > time(); + $case3 = in_array($courseUser->source_type, $sourceTypes); - if ($caseA && $caseB && $caseC) { + if ($case1 && $case2 && $case3) { $this->ownedCourse = true; } } diff --git a/app/Services/Live.php b/app/Services/Live.php index d9cfc1c4..ac400181 100644 --- a/app/Services/Live.php +++ b/app/Services/Live.php @@ -58,7 +58,7 @@ class Live extends Service $params = json_encode([ 'DomainName' => $this->settings['push']['domain'], - 'AppName' => $appName ?: 'live', + 'AppName' => $appName, 'StreamName' => $streamName, ]); @@ -102,7 +102,7 @@ class Live extends Service $params = json_encode([ 'DomainName' => $this->settings['push']['domain'], - 'AppName' => $appName ?: 'live', + 'AppName' => $appName, 'StreamName' => $streamName, 'Reason' => $reason, ]); @@ -146,7 +146,7 @@ class Live extends Service $params = json_encode([ 'DomainName' => $this->settings['push']['domain'], - 'AppName' => $appName ?: 'live', + 'AppName' => $appName, 'StreamName' => $streamName, ]); @@ -183,8 +183,6 @@ class Live extends Service */ function getPushUrl($streamName, $appName = 'live') { - $appName = $appName ?: 'live'; - $authEnabled = $this->settings['push']['auth_enabled']; $authKey = $this->settings['push']['auth_key']; $expireTime = $this->settings['push']['auth_delta'] + time(); @@ -207,8 +205,6 @@ class Live extends Service */ public function getPullUrls($streamName, $appName = 'live') { - $appName = $appName ?: 'live'; - $protocol = $this->settings['pull']['protocol']; $domain = $this->settings['pull']['domain']; $authEnabled = $this->settings['pull']['auth_enabled']; diff --git a/app/Services/Pay/Alipay.php b/app/Services/Pay/Alipay.php index 23194ad5..14fad063 100644 --- a/app/Services/Pay/Alipay.php +++ b/app/Services/Pay/Alipay.php @@ -121,6 +121,10 @@ class Alipay extends PayService return false; } + if ($trade->status == TradeModel::STATUS_FINISHED) { + return $this->gateway->success(); + } + if ($trade->status != TradeModel::STATUS_PENDING) { return false; } diff --git a/app/Services/Pay/Wxpay.php b/app/Services/Pay/Wxpay.php index 157dc656..53640ad9 100644 --- a/app/Services/Pay/Wxpay.php +++ b/app/Services/Pay/Wxpay.php @@ -123,6 +123,10 @@ class Wxpay extends PayService return false; } + if ($trade->status == TradeModel::STATUS_FINISHED) { + return $this->gateway->success(); + } + if ($trade->status != TradeModel::STATUS_PENDING) { return false; } diff --git a/app/Services/Vod.php b/app/Services/Vod.php index a9c456e7..526dc6df 100644 --- a/app/Services/Vod.php +++ b/app/Services/Vod.php @@ -574,8 +574,8 @@ class Vod extends Service { $result = null; - if ($this->settings['watermark_enabled'] && $this->settings['watermark_template'] > 0) { - $result = (int)$this->settings['watermark_template']; + if ($this->settings['wmk_enabled'] && $this->settings['wmk_tpl_id'] > 0) { + $result = (int)$this->settings['wmk_tpl_id']; } return $result; diff --git a/config/alipay/.gitignore b/config/alipay/.gitkeep similarity index 100% rename from config/alipay/.gitignore rename to config/alipay/.gitkeep diff --git a/config/wxpay/.gitignore b/config/wxpay/.gitignore deleted file mode 100644 index cf57c3b0..00000000 --- a/config/wxpay/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.gitignore -!.gitignore \ No newline at end of file diff --git a/config/wxpay/.gitkeep b/config/wxpay/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/db/migrations/20200827112717_insert_setting_data.php b/db/migrations/20200827112717_insert_setting_data.php index ba5edecc..d90bf093 100644 --- a/db/migrations/20200827112717_insert_setting_data.php +++ b/db/migrations/20200827112717_insert_setting_data.php @@ -312,7 +312,7 @@ final class InsertSettingData extends AbstractMigration ], [ 'section' => 'site', - 'item_key' => 'index_template', + 'item_key' => 'index_tpl', 'item_value' => 'simple', ], [ @@ -407,12 +407,12 @@ final class InsertSettingData extends AbstractMigration ], [ 'section' => 'vod', - 'item_key' => 'watermark_enabled', + 'item_key' => 'wmk_enabled', 'item_value' => '1', ], [ 'section' => 'vod', - 'item_key' => 'watermark_template', + 'item_key' => 'wmk_tpl_id', 'item_value' => '462027', ], [ diff --git a/public/static/desktop/js/chapter.live.player.js b/public/static/desktop/js/chapter.live.player.js index 3425ae35..87c2bb84 100644 --- a/public/static/desktop/js/chapter.live.player.js +++ b/public/static/desktop/js/chapter.live.player.js @@ -20,41 +20,19 @@ layui.use(['jquery', 'helper'], function () { height: 428 }; - if (playUrls.rtmp && playUrls.rtmp.od) { - options.rtmp = playUrls.rtmp.od; - } + var formats = ['rtmp', 'flv', 'm3u8']; + var rates = ['od', 'hd', 'sd']; - if (playUrls.rtmp && playUrls.rtmp.hd) { - options.rtmp_hd = playUrls.rtmp.hd; - } + $.each(formats, function (i, format) { + $.each(rates, function (k, rate) { + if (playUrls.hasOwnProperty(format) && playUrls[format].hasOwnProperty(rate)) { + var key = k === 0 ? format : format + '_' + rate; + options[key] = playUrls[format][rate]; + } + }); + }); - if (playUrls.rtmp && playUrls.rtmp.sd) { - options.rtmp_sd = playUrls.rtmp.sd; - } - - if (playUrls.flv && playUrls.flv.od) { - options.flv = playUrls.flv.od; - } - - if (playUrls.flv && playUrls.flv.hd) { - options.flv_hd = playUrls.flv.hd; - } - - if (playUrls.flv && playUrls.flv.sd) { - options.flv_sd = playUrls.flv.sd; - } - - if (playUrls.m3u8 && playUrls.m3u8.od) { - options.m3u8 = playUrls.m3u8.od; - } - - if (playUrls.m3u8 && playUrls.m3u8.hd) { - options.m3u8_hd = playUrls.m3u8.hd; - } - - if (playUrls.m3u8 && playUrls.m3u8.sd) { - options.m3u8_sd = playUrls.m3u8.sd; - } + console.log(options); options.listener = function (msg) { if (msg.type === 'play') { diff --git a/public/static/desktop/js/chapter.vod.player.js b/public/static/desktop/js/chapter.vod.player.js index de8fa6f7..03dadd7a 100644 --- a/public/static/desktop/js/chapter.vod.player.js +++ b/public/static/desktop/js/chapter.vod.player.js @@ -5,7 +5,7 @@ layui.use(['jquery', 'helper'], function () { var interval = null; var intervalTime = 15000; - var userId = window.koogua.user.id; + var userId = window.user.id; var requestId = helper.getRequestId(); var chapterId = $('input[name="chapter.id"]').val(); var planId = $('input[name="chapter.plan_id"]').val(); @@ -19,15 +19,15 @@ layui.use(['jquery', 'helper'], function () { height: 428 }; - if (playUrls.od) { + if (playUrls.hasOwnProperty('od')) { options.m3u8 = playUrls.od.url; } - if (playUrls.hd) { + if (playUrls.hasOwnProperty('hd')) { options.m3u8_hd = playUrls.hd.url; } - if (playUrls.sd) { + if (playUrls.hasOwnProperty('sd')) { options.m3u8_sd = playUrls.sd.url; } diff --git a/scheduler.php b/scheduler.php index 05c5e4ab..d99cfc46 100644 --- a/scheduler.php +++ b/scheduler.php @@ -34,6 +34,12 @@ $scheduler->php($script, $bin, ['--task' => 'refund', '--action' => 'main']) $scheduler->php($script, $bin, ['--task' => 'sync_course_index', '--action' => 'main']) ->hourly(11); +$scheduler->php($script, $bin, ['--task' => 'sync_group_index', '--action' => 'main']) + ->hourly(17); + +$scheduler->php($script, $bin, ['--task' => 'sync_user_index', '--action' => 'main']) + ->hourly(23); + $scheduler->php($script, $bin, ['--task' => 'clean_log', '--action' => 'main']) ->daily(3, 3); From 970f2b8903e8d8f1fe9bdcb2f9bae674d248f63c Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Tue, 15 Sep 2020 20:01:37 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=9B=B4=E6=96=B0composer=E5=8C=85?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E5=89=8D=E5=8F=B0=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +- .../Desktop/Controllers/CourseController.php | 2 +- .../Desktop/Views/course/show_catalog.volt | 18 +- app/Http/Desktop/Views/course/show_meta.volt | 96 ++++--- app/Http/Desktop/Views/vip/index.volt | 4 +- app/Services/Frontend/Chapter/ChapterInfo.php | 3 + app/Services/Frontend/Consult/ConsultLike.php | 1 + .../{Favorite.php => CourseFavorite.php} | 4 +- app/Services/Frontend/Review/ReviewLike.php | 1 + composer.json | 12 +- composer.lock | 244 +++++++++--------- public/static/desktop/css/common.css | 15 +- public/static/desktop/js/vip.js | 7 + 13 files changed, 239 insertions(+), 178 deletions(-) rename app/Services/Frontend/Course/{Favorite.php => CourseFavorite.php} (97%) diff --git a/README.md b/README.md index 09a2268b..eadac14f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ - [前台演示](https://ctc.koogua.com) - [后台演示](https://ctc.koogua.com/admin) -帐号:100015@163.com / 123456 (前后台通用) +> 帐号:100015@163.com / 123456 (前后台通用) PS:**管理后台已禁止提交并隐藏私人配置** @@ -19,7 +19,7 @@ PS:**管理后台已禁止提交并隐藏私人配置** - 前端框架:[layui 2.5.6](https://layui.com), [layim 3.9.5](https://www.layui.com/layim)(已授权) - 全文检索:[xunsearch 1.4.9](http://www.xunsearch.com) - 即时通讯:[workerman 3.5.22](https://workerman.net) -- 其它依赖:[php7.3](https://php.net), [mysql5.7](https://mysql.com), [redis5.0](https://redis.io) +- 基础依赖:[php7.3](https://php.net), [mysql5.7](https://mysql.com), [redis5.0](https://redis.io) #### 使用协议 @@ -56,7 +56,7 @@ PS:**管理后台已禁止提交并隐藏私人配置** #### 通过这个项目能学到什么? 1. 项目规划,phalcon实战,缓存,JWT,即时通讯,全文检索 -2. docker操作,docker服务编排,supervisor,devops +2. docker,supervisor,devops 3. git,linux,php,mysql,redis,nginx #### 开发计划 @@ -73,7 +73,7 @@ PS:**管理后台已禁止提交并隐藏私人配置** #### 加入我们 -这是我的创业项目,个人能力和精力有限,要兼顾产品规划以及开发,还要处理除报税记账之外的所有琐碎事情。 -目前在南山科技园某个众创空间,希望有能独挡一面的**深圳前端同学**加入我们。 +这是我的创业项目,个人能力和精力有限,要兼顾产品规划以及开发,还要处理很多琐碎事情。 +目前在南山科技园某个众创空间,希望有 **深圳前端同学** 加入我们。 联系邮箱:76632555@qq.com diff --git a/app/Http/Desktop/Controllers/CourseController.php b/app/Http/Desktop/Controllers/CourseController.php index 6639b18f..75dd8aca 100644 --- a/app/Http/Desktop/Controllers/CourseController.php +++ b/app/Http/Desktop/Controllers/CourseController.php @@ -5,9 +5,9 @@ namespace App\Http\Desktop\Controllers; use App\Http\Desktop\Services\CourseQuery as CourseQueryService; use App\Services\Frontend\Course\ChapterList as CourseChapterListService; use App\Services\Frontend\Course\ConsultList as CourseConsultListService; +use App\Services\Frontend\Course\CourseFavorite as CourseFavoriteService; use App\Services\Frontend\Course\CourseInfo as CourseInfoService; use App\Services\Frontend\Course\CourseList as CourseListService; -use App\Services\Frontend\Course\Favorite as CourseFavoriteService; use App\Services\Frontend\Course\PackageList as CoursePackageListService; use App\Services\Frontend\Course\RecommendedList as CourseRecommendedListService; use App\Services\Frontend\Course\RelatedList as CourseRelatedListService; diff --git a/app/Http/Desktop/Views/course/show_catalog.volt b/app/Http/Desktop/Views/course/show_catalog.volt index 790a8b61..eb1539a5 100644 --- a/app/Http/Desktop/Views/course/show_catalog.volt +++ b/app/Http/Desktop/Views/course/show_catalog.volt @@ -27,7 +27,7 @@ {% if lesson.me.duration > 0 %} {% endif %} - {{ date('m月d日',lesson.attrs.start_time) }} {{ date('H:i',lesson.attrs.start_time) }}~{{ date('H:i',lesson.attrs.end_time) }} {{ over_flag }} + {{ live_status_info(lesson) }} {%- endmacro %} @@ -46,6 +46,16 @@ {%- endmacro %} +{%- macro live_status_info(lesson) %} + {% if lesson.attrs.stream.status == 'active' %} + {{ date('m月d日 H:i',lesson.attrs.start_time) }} 直播中 + {% elseif lesson.attrs.start_time > time() %} + {{ date('m月d日 H:i',lesson.attrs.start_time) }} 倒计时 + {% elseif lesson.attrs.end_time < time() %} + {{ date('m月d日 H:i',lesson.attrs.start_time) }} 已结束 + {% endif %} +{%- endmacro %} +
{% for chapter in chapters %}
@@ -53,11 +63,11 @@
    {% for lesson in chapter.children %} - {% if lesson.model == '1' %} + {% if lesson.model == 1 %}
  • {{ vod_lesson_info(lesson) }}
  • - {% elseif lesson.model == '2' %} + {% elseif lesson.model == 2 %}
  • {{ live_lesson_info(lesson) }}
  • - {% elseif lesson.model == '3' %} + {% elseif lesson.model == 3 %}
  • {{ read_lesson_info(lesson) }}
  • {% endif %} {% endfor %} diff --git a/app/Http/Desktop/Views/course/show_meta.volt b/app/Http/Desktop/Views/course/show_meta.volt index 45d73bdf..201dc99b 100644 --- a/app/Http/Desktop/Views/course/show_meta.volt +++ b/app/Http/Desktop/Views/course/show_meta.volt @@ -1,40 +1,72 @@ +{%- macro vod_meta_info(course) %} +

    + 课程时长{{ course.attrs.duration|duration }} +

    + {{ meta_expiry_info(course) }} + {{ meta_price_info(course) }} + {{ meta_stats_info(course) }} +{%- endmacro %} + +{%- macro live_meta_info(course) %} +

    + 直播时间{{ course.attrs.start_date }} ~ {{ course.attrs.end_date }} +

    + {{ meta_expiry_info(course) }} + {{ meta_price_info(course) }} + {{ meta_stats_info(course) }} +{%- endmacro %} + +{%- macro read_meta_info(course) %} +

    + 课程时长{{ course.attrs.duration|duration }} +

    + {{ meta_expiry_info(course) }} + {{ meta_price_info(course) }} + {{ meta_stats_info(course) }} +{%- endmacro %} + +{%- macro meta_expiry_info(course) %} +

    + 学习期限{{ course.study_expiry }}个月 + 退款期限{{ course.refund_expiry }}天 +

    +{%- endmacro %} + +{%- macro meta_price_info(course) %} +

    + {% if course.market_price > 0 %} + 市场价格{{ '¥%0.2f'|format(course.market_price) }} + {% else %} + 市场价格免费 + {% endif %} + {% if course.vip_price > 0 %} + 会员价格{{ '¥%0.2f'|format(course.vip_price) }} + {% else %} + 会员价格免费 + {% endif %} +

    +{%- endmacro %} + +{%- macro meta_stats_info(course) %} +

    + 难度级别{{ level_info(course.level) }} + 学习人次{{ course.user_count }} + 综合评分{{ "%0.1f"|format(course.ratings.rating) }} +

    +{%- endmacro %} +
    - {{ course.title|e }} + {{ course.title }}
    - {% if course.model == '1' %} -

    - 课程时长{{ course.attrs.duration|duration }} -

    - {% elseif course.model == '2' %} -

    - 直播时间{{ course.attrs.start_date }} ~ {{ course.attrs.end_date }} -

    + {% if course.model == 1 %} + {{ vod_meta_info(course) }} + {% elseif course.model == 2 %} + {{ live_meta_info(course) }} + {% elseif course.model == 3 %} + {{ read_meta_info(course) }} {% endif %} - {% if course.market_price > 0 %} -

    - 学习期限{{ course.study_expiry }}个月 - 退款期限{{ course.refund_expiry }}天 -

    - {% endif %} -

    - {% if course.market_price > 0 %} - 市场价格{{ '¥%0.2f'|format(course.market_price) }} - {% else %} - 市场价格免费 - {% endif %} - {% if course.vip_price > 0 %} - 会员价格{{ '¥%0.2f'|format(course.vip_price) }} - {% else %} - 会员价格免费 - {% endif %} -

    -

    - 难度级别{{ level_info(course.level) }} - 学习人次{{ course.user_count }} - 综合评分{{ "%0.1f"|format(course.ratings.rating) }} -

    diff --git a/app/Http/Desktop/Views/vip/index.volt b/app/Http/Desktop/Views/vip/index.volt index 28772032..75ca387a 100644 --- a/app/Http/Desktop/Views/vip/index.volt +++ b/app/Http/Desktop/Views/vip/index.volt @@ -23,7 +23,9 @@

    {{ option.title }}
    ¥{{ option.price }}
    - +
    + +
    {% endfor %} diff --git a/app/Services/Frontend/Chapter/ChapterInfo.php b/app/Services/Frontend/Chapter/ChapterInfo.php index 7f3c15f2..fc8c8246 100644 --- a/app/Services/Frontend/Chapter/ChapterInfo.php +++ b/app/Services/Frontend/Chapter/ChapterInfo.php @@ -147,18 +147,21 @@ class ChapterInfo extends FrontendService protected function incrUserCourseCount(UserModel $user) { $user->course_count += 1; + $user->update(); } protected function incrCourseUserCount(CourseModel $course) { $course->user_count += 1; + $course->update(); } protected function incrChapterUserCount(ChapterModel $chapter) { $chapter->user_count += 1; + $chapter->update(); } diff --git a/app/Services/Frontend/Consult/ConsultLike.php b/app/Services/Frontend/Consult/ConsultLike.php index d2e53032..ed4d99ad 100644 --- a/app/Services/Frontend/Consult/ConsultLike.php +++ b/app/Services/Frontend/Consult/ConsultLike.php @@ -64,6 +64,7 @@ class ConsultLike extends FrontendService protected function incrLikeCount(ConsultModel $consult) { $consult->like_count += 1; + $consult->update(); } diff --git a/app/Services/Frontend/Course/Favorite.php b/app/Services/Frontend/Course/CourseFavorite.php similarity index 97% rename from app/Services/Frontend/Course/Favorite.php rename to app/Services/Frontend/Course/CourseFavorite.php index ae33ed5a..9623589b 100644 --- a/app/Services/Frontend/Course/Favorite.php +++ b/app/Services/Frontend/Course/CourseFavorite.php @@ -10,7 +10,7 @@ use App\Services\Frontend\CourseTrait; use App\Services\Frontend\Service as FrontendService; use App\Validators\UserLimit as UserLimitValidator; -class Favorite extends FrontendService +class CourseFavorite extends FrontendService { use CourseTrait; @@ -66,6 +66,7 @@ class Favorite extends FrontendService protected function incrCourseFavoriteCount(CourseModel $course) { $course->favorite_count += 1; + $course->update(); } @@ -80,6 +81,7 @@ class Favorite extends FrontendService protected function incrUserFavoriteCount(UserModel $user) { $user->favorite_count += 1; + $user->update(); } diff --git a/app/Services/Frontend/Review/ReviewLike.php b/app/Services/Frontend/Review/ReviewLike.php index 9e15644e..6240390c 100644 --- a/app/Services/Frontend/Review/ReviewLike.php +++ b/app/Services/Frontend/Review/ReviewLike.php @@ -64,6 +64,7 @@ class ReviewLike extends FrontendService protected function incrLikeCount(ReviewModel $review) { $review->like_count += 1; + $review->update(); } diff --git a/composer.json b/composer.json index 7df5e8c1..bcd0e1cc 100644 --- a/composer.json +++ b/composer.json @@ -10,13 +10,13 @@ "swiftmailer/swiftmailer": "^6.0", "peppeocchi/php-cron-scheduler": "^2.4", "yansongda/pay": "^2.9", - "tencentcloud/tencentcloud-sdk-php": "3.*", - "qcloudsms/qcloudsms_php": "0.1.*", - "qcloud/cos-sdk-v5": "2.*", - "workerman/gateway-worker": "^3.0.12", - "workerman/gatewayclient": "^3.0.12", + "tencentcloud/tencentcloud-sdk-php": "^3.0", + "qcloudsms/qcloudsms_php": "^0.1", + "qcloud/cos-sdk-v5": "^2.0", + "workerman/gateway-worker": "^3.0", + "workerman/gatewayclient": "^3.0", "whichbrowser/parser": "^2.0", - "hightman/xunsearch": "^1.4.14", + "hightman/xunsearch": "^1.4", "aferrandini/phpqrcode": "1.0.1", "xiaochong0302/ip2region": "^1.0", "robmorgan/phinx": "^0.12", diff --git a/composer.lock b/composer.lock index 9bee1b6c..934c0305 100644 --- a/composer.lock +++ b/composer.lock @@ -1,20 +1,20 @@ { - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "66628b38c16e2071e5636757472860e8", - "packages": [ - { - "name": "aferrandini/phpqrcode", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/aferrandini/PHPQRCode.git", - "reference": "3c1c0454d43710ab5bbe19a51ad4cb41c22e3d46" - }, - "dist": { + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "cce345a8509cd31ff8492310a2a2332a", + "packages": [ + { + "name": "aferrandini/phpqrcode", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/aferrandini/PHPQRCode.git", + "reference": "3c1c0454d43710ab5bbe19a51ad4cb41c22e3d46" + }, + "dist": { "type": "zip", "url": "https://api.github.com/repos/aferrandini/PHPQRCode/zipball/3c1c0454d43710ab5bbe19a51ad4cb41c22e3d46", "reference": "3c1c0454d43710ab5bbe19a51ad4cb41c22e3d46", @@ -747,26 +747,26 @@ ], "time": "2019-07-01T23:21:34+00:00" }, - { - "name": "hightman/xunsearch", - "version": "1.4.14", - "source": { - "type": "git", - "url": "https://github.com/hightman/xs-sdk-php.git", - "reference": "d2faba65b9b4c0c0ea6e8b2ad5bafdefcbf3db87" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hightman/xs-sdk-php/zipball/d2faba65b9b4c0c0ea6e8b2ad5bafdefcbf3db87", - "reference": "d2faba65b9b4c0c0ea6e8b2ad5bafdefcbf3db87", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, + { + "name": "hightman/xunsearch", + "version": "1.4.15", + "source": { + "type": "git", + "url": "https://github.com/hightman/xs-sdk-php.git", + "reference": "8ec1a3aa3ef58b83cd4e0e72a171f6446f4136b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hightman/xs-sdk-php/zipball/8ec1a3aa3ef58b83cd4e0e72a171f6446f4136b9", + "reference": "8ec1a3aa3ef58b83cd4e0e72a171f6446f4136b9", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, "require": { "ext-mbstring": "*", "lib-pcre": "*", @@ -781,26 +781,26 @@ "dev-master": "1.4.x-dev" } }, - "autoload": { - "classmap": [ - "lib/", - "wrapper/yii-ext/" - ], - "psr-4": { - "hightman\\xunsearch\\": "wrapper/yii2-ext/" - } - }, - "notification-url": "https://packagist.jp/downloads/", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "hightman", - "email": "hightman@twomice.net", - "role": "Founder and project leader" - } - ], + "autoload": { + "classmap": [ + "lib/", + "wrapper/yii-ext/" + ], + "psr-4": { + "hightman\\xunsearch\\": "wrapper/yii2-ext/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "hightman", + "email": "hightman@twomice.net", + "role": "Founder and project leader" + } + ], "description": "xunsearch php sdk, include yii, yii2 supports", "homepage": "http://www.xunsearch.com/", "keywords": [ @@ -809,7 +809,7 @@ "yii", "yii2" ], - "time": "2019-11-01T02:17:32+00:00" + "time": "2020-09-03T16:46:04+00:00" }, { "name": "lcobucci/jwt", @@ -1436,26 +1436,26 @@ ], "time": "2017-10-23T01:57:42+00:00" }, - { - "name": "qcloud/cos-sdk-v5", - "version": "v2.0.0", - "source": { - "type": "git", - "url": "https://github.com/tencentyun/cos-php-sdk-v5.git", - "reference": "a8ac2dc1f58ddb36e5d702d19f9d7cb8d6f1dc5e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/tencentyun/cos-php-sdk-v5/zipball/a8ac2dc1f58ddb36e5d702d19f9d7cb8d6f1dc5e", - "reference": "a8ac2dc1f58ddb36e5d702d19f9d7cb8d6f1dc5e", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, + { + "name": "qcloud/cos-sdk-v5", + "version": "v2.0.9", + "source": { + "type": "git", + "url": "https://github.com/tencentyun/cos-php-sdk-v5.git", + "reference": "d9fa5e8468ce4462d671976555efaa9acd2896e4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tencentyun/cos-php-sdk-v5/zipball/d9fa5e8468ce4462d671976555efaa9acd2896e4", + "reference": "d9fa5e8468ce4462d671976555efaa9acd2896e4", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, "require": { "guzzlehttp/guzzle": "~6.3", "guzzlehttp/guzzle-services": "~1.1", @@ -1487,7 +1487,7 @@ "php", "qcloud" ], - "time": "2019-09-25T12:28:54+00:00" + "time": "2020-06-16T13:09:21+00:00" }, { "name": "qcloudsms/qcloudsms_php", @@ -2949,30 +2949,30 @@ ], "time": "2020-07-06T13:23:11+00:00" }, - { - "name": "tencentcloud/tencentcloud-sdk-php", - "version": "3.0.92", - "source": { - "type": "git", - "url": "https://github.com/TencentCloud/tencentcloud-sdk-php.git", - "reference": "71164956c234368c65c00e321e96f6dbd0f8d9c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/TencentCloud/tencentcloud-sdk-php/zipball/71164956c234368c65c00e321e96f6dbd0f8d9c0", - "reference": "71164956c234368c65c00e321e96f6dbd0f8d9c0", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, + { + "name": "tencentcloud/tencentcloud-sdk-php", + "version": "3.0.251", + "source": { + "type": "git", + "url": "https://github.com/TencentCloud/tencentcloud-sdk-php.git", + "reference": "a3b3054262e48776e8014d5e385a8932b0102f29" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/TencentCloud/tencentcloud-sdk-php/zipball/a3b3054262e48776e8014d5e385a8932b0102f29", + "reference": "a3b3054262e48776e8014d5e385a8932b0102f29", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, "require": { "guzzlehttp/guzzle": "^6.3", "guzzlehttp/psr7": "^1.4", - "php": ">=5.6.33" + "php": ">=5.6.0" }, "type": "library", "autoload": { @@ -2997,7 +2997,7 @@ ], "description": "TencentCloudApi php sdk", "homepage": "https://github.com/TencentCloud/tencentcloud-sdk-php", - "time": "2019-09-27T09:23:30+00:00" + "time": "2020-09-15T00:59:07+00:00" }, { "name": "whichbrowser/parser", @@ -3064,28 +3064,28 @@ ], "time": "2018-10-02T09:26:41+00:00" }, - { - "name": "workerman/gateway-worker", - "version": "v3.0.13", - "source": { - "type": "git", - "url": "https://github.com/walkor/GatewayWorker.git", - "reference": "38b44c95f21cd340b5a9cff3987ddb2abb9a2a38" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/walkor/GatewayWorker/zipball/38b44c95f21cd340b5a9cff3987ddb2abb9a2a38", - "reference": "38b44c95f21cd340b5a9cff3987ddb2abb9a2a38", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, + { + "name": "workerman/gateway-worker", + "version": "v3.0.18", + "source": { + "type": "git", + "url": "https://github.com/walkor/GatewayWorker.git", + "reference": "50d3a77deb7f7fb206d641ee0307ae1c41d5d41d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/walkor/GatewayWorker/zipball/50d3a77deb7f7fb206d641ee0307ae1c41d5d41d", + "reference": "50d3a77deb7f7fb206d641ee0307ae1c41d5d41d", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, "require": { - "workerman/workerman": ">=3.1.8" + "workerman/workerman": ">=3.5.0" }, "type": "library", "autoload": { @@ -3102,7 +3102,7 @@ "communication", "distributed" ], - "time": "2019-07-02T11:55:24+00:00" + "time": "2020-07-15T06:45:01+00:00" }, { "name": "workerman/gatewayclient", diff --git a/public/static/desktop/css/common.css b/public/static/desktop/css/common.css index b8a830d6..71368583 100644 --- a/public/static/desktop/css/common.css +++ b/public/static/desktop/css/common.css @@ -92,6 +92,11 @@ width: 320px; } +.layui-main .vditor-reset { + font: 14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial, sans-serif; + color: #666; +} + body { display: flex; flex-flow: column; @@ -500,7 +505,6 @@ body { .course-meta .info .price { color: red; - font-size: 14px; } .course-meta .info .free { @@ -548,11 +552,6 @@ body { font-size: 30px; } -.course-details { - line-height: 1.8em; - color: #666; -} - .lesson-item { position: relative; padding: 0 10px; @@ -583,6 +582,10 @@ body { color: #666; } +.lesson-item .live .active { + color: red; +} + .lesson-item .study-time { color: green; } diff --git a/public/static/desktop/js/vip.js b/public/static/desktop/js/vip.js index cf9aa2a5..8a0a94d7 100644 --- a/public/static/desktop/js/vip.js +++ b/public/static/desktop/js/vip.js @@ -3,6 +3,13 @@ layui.use(['jquery', 'helper'], function () { var $ = layui.jquery; var helper = layui.helper; + $('.btn-order').on('click', function () { + var url = $(this).data('url'); + helper.checkLogin(function () { + window.location.href = url; + }); + }); + if ($('#tab-discount-courses').length > 0) { var $tabDiscountCourses = $('#tab-discount-courses'); helper.ajaxLoadHtml($tabDiscountCourses.data('url'), $tabDiscountCourses.attr('id')); From cddbc08c0bcfffb196312e9cfec62b5db6196d24 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Thu, 17 Sep 2020 21:29:29 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 63 ++++++------ app/Caches/IndexCarouselList.php | 72 -------------- app/Caches/IndexSlideList.php | 71 ++++++++++++++ app/Console/Tasks/CleanLogTask.php | 12 +-- app/Console/Tasks/DeliverTask.php | 6 +- app/Console/Tasks/LiveNotifyTask.php | 6 +- app/Console/Tasks/RefundTask.php | 6 +- app/Console/Tasks/SiteMapTask.php | 2 +- app/Console/Tasks/SyncCourseIndexTask.php | 6 +- app/Console/Tasks/SyncGroupIndexTask.php | 6 +- app/Console/Tasks/SyncLearningTask.php | 8 +- app/Console/Tasks/SyncUserIndexTask.php | 6 +- .../Admin/Controllers/ChapterController.php | 25 +++-- .../Admin/Controllers/SessionController.php | 2 +- .../Admin/Controllers/SettingController.php | 36 +++---- ...uselController.php => SlideController.php} | 52 +++++----- app/Http/Admin/Controllers/TestController.php | 22 ++--- .../Admin/Controllers/UploadController.php | 6 +- app/Http/Admin/Controllers/VodController.php | 4 +- app/Http/Admin/Services/AlipayTest.php | 2 +- app/Http/Admin/Services/AuthNode.php | 12 +-- app/Http/Admin/Services/Chapter.php | 4 +- app/Http/Admin/Services/ChapterContent.php | 10 ++ app/Http/Admin/Services/Course.php | 6 +- app/Http/Admin/Services/Session.php | 4 +- app/Http/Admin/Services/Setting.php | 24 ++--- .../Services/{Carousel.php => Slide.php} | 90 +++++++++--------- app/Http/Admin/Views/carousel/add.volt | 8 +- app/Http/Admin/Views/carousel/edit.volt | 59 +++--------- app/Http/Admin/Views/carousel/list.volt | 22 ++--- app/Http/Admin/Views/category/edit.volt | 4 +- app/Http/Admin/Views/category/list.volt | 2 +- app/Http/Admin/Views/chapter/edit_lesson.volt | 6 +- .../Admin/Views/chapter/lessons_live.volt | 6 +- .../Admin/Views/chapter/lessons_read.volt | 6 +- app/Http/Admin/Views/chapter/lessons_vod.volt | 6 +- app/Http/Admin/Views/consult/list.volt | 2 +- app/Http/Admin/Views/course/edit_basic.volt | 8 +- app/Http/Admin/Views/course/list.volt | 4 +- app/Http/Admin/Views/help/edit.volt | 4 +- app/Http/Admin/Views/help/list.volt | 4 +- app/Http/Admin/Views/im/group/edit.volt | 4 +- app/Http/Admin/Views/im/group/list.volt | 4 +- app/Http/Admin/Views/index/index.volt | 6 +- app/Http/Admin/Views/index/main_app_info.volt | 2 +- app/Http/Admin/Views/nav/edit.volt | 12 +-- app/Http/Admin/Views/nav/list.volt | 2 +- app/Http/Admin/Views/package/list.volt | 2 +- app/Http/Admin/Views/page/edit.volt | 4 +- app/Http/Admin/Views/page/list.volt | 4 +- app/Http/Admin/Views/public/forbidden.volt | 2 +- app/Http/Admin/Views/public/live_player.volt | 8 +- app/Http/Admin/Views/public/login.volt | 4 +- app/Http/Admin/Views/public/vod_player.volt | 53 ++++++----- app/Http/Admin/Views/review/list.volt | 2 +- app/Http/Admin/Views/role/edit.volt | 2 +- app/Http/Admin/Views/setting/im_cs.volt | 4 +- app/Http/Admin/Views/setting/im_main.volt | 16 ++-- app/Http/Admin/Views/setting/live_pull.volt | 12 +-- app/Http/Admin/Views/setting/live_push.volt | 4 +- .../Admin/Views/setting/live_push_test.volt | 2 +- .../Views/setting/{mailer.volt => mail.volt} | 28 +++--- app/Http/Admin/Views/setting/pay_alipay.volt | 4 +- app/Http/Admin/Views/setting/pay_wxpay.volt | 4 +- app/Http/Admin/Views/setting/site.volt | 12 +-- .../Views/setting/{smser.volt => sms.volt} | 12 +-- app/Http/Admin/Views/setting/storage.volt | 6 +- app/Http/Admin/Views/setting/vod.volt | 24 ++--- app/Http/Admin/Views/topic/list.volt | 4 +- app/Http/Admin/Views/user/edit.volt | 8 +- app/Http/Admin/Views/user/list.volt | 2 +- app/Http/Desktop/Views/teaching/menu.volt | 10 -- app/Http/Desktop/Views/topic/show.volt | 19 ---- .../Controllers/AccountController.php | 70 +++++++------- .../Controllers/ChapterController.php | 24 ++--- .../Controllers/ConsultController.php | 30 +++--- .../Controllers/Controller.php | 13 ++- .../Controllers/CourseController.php | 52 +++++----- .../Controllers/DanmuController.php | 8 +- .../Controllers/ErrorController.php | 16 ++-- .../Controllers/HelpController.php | 10 +- .../Controllers/ImController.php | 60 ++++++------ .../Controllers/ImGroupController.php | 14 +-- .../Controllers/ImGroupManageController.php | 12 +-- .../Controllers/IndexController.php | 10 +- .../Controllers/LayerController.php | 6 +- .../Controllers/LiveController.php | 14 +-- .../Controllers/OrderController.php | 26 ++--- .../Controllers/PackageController.php | 10 +- .../Controllers/PageController.php | 6 +- .../Controllers/PublicController.php | 14 +-- .../Controllers/RefundController.php | 24 ++--- .../Controllers/ReviewController.php | 26 ++--- .../Controllers/SearchController.php | 14 +-- .../Controllers/TeacherConsoleController.php} | 44 ++++----- .../Controllers/TeacherController.php | 11 +-- .../Controllers/TopicController.php | 13 ++- .../Controllers/TradeController.php | 10 +- .../Controllers/UploadController.php | 8 +- .../Controllers/UserConsoleController.php} | 82 +++++++++------- .../Controllers/UserController.php | 22 ++--- .../Controllers/VerifyController.php | 8 +- .../Controllers/VipController.php | 14 +-- app/Http/{Desktop => Home}/Module.php | 6 +- .../{Desktop => Home}/Services/Account.php | 4 +- .../Services/CourseQuery.php | 8 +- app/Http/{Desktop => Home}/Services/Im.php | 2 +- .../{Desktop => Home}/Services/ImCsTrait.php | 2 +- .../Services/ImFriendTrait.php | 2 +- .../{Desktop => Home}/Services/ImGroup.php | 2 +- .../Services/ImGroupTrait.php | 2 +- .../Services/ImMessageTrait.php | 2 +- .../Services/ImNoticeTrait.php | 2 +- .../Services/ImStatTrait.php | 2 +- app/Http/{Desktop => Home}/Services/Index.php | 44 ++++----- app/Http/{Desktop => Home}/Services/Live.php | 4 +- .../{Desktop => Home}/Services/Service.php | 2 +- app/Http/{Desktop => Home}/Services/Trade.php | 6 +- .../Views/account/edit_email.volt | 4 +- .../Views/account/edit_password.volt | 2 +- .../Views/account/edit_phone.volt | 4 +- .../Views/account/forget_password.volt | 6 +- .../Views/account/login.volt | 8 +- .../Views/account/login_by_password.volt | 2 +- .../Views/account/login_by_verify.volt | 2 +- .../Views/account/register.volt | 4 +- .../Views/chapter/catalog.volt | 2 +- .../{Desktop => Home}/Views/chapter/live.volt | 8 +- .../Views/chapter/live_active.volt | 26 ++--- .../Views/chapter/live_chats.volt | 0 .../Views/chapter/live_forbid.volt | 2 +- .../Views/chapter/live_inactive.volt | 4 +- .../{Desktop => Home}/Views/chapter/read.volt | 20 ++-- .../{Desktop => Home}/Views/chapter/vod.volt | 18 ++-- .../{Desktop => Home}/Views/consult/add.volt | 2 +- .../{Desktop => Home}/Views/consult/edit.volt | 4 +- .../Views/consult/reply.volt | 2 +- .../{Desktop => Home}/Views/consult/show.volt | 4 +- .../Views/course/consults.volt | 6 +- .../{Desktop => Home}/Views/course/list.volt | 4 +- .../Views/course/list_filter.volt | 0 .../Views/course/packages.volt | 4 +- .../{Desktop => Home}/Views/course/pager.volt | 0 .../Views/course/recommended.volt | 0 .../Views/course/related.volt | 0 .../Views/course/reviews.volt | 4 +- .../{Desktop => Home}/Views/course/show.volt | 30 +++--- .../Views/course/show_catalog.volt | 6 +- .../Views/course/show_meta.volt | 0 .../Views/course/show_order.volt | 4 +- .../Views/course/show_teacher.volt | 2 +- .../Views/course/topics.volt | 2 +- .../Views/error/maintain.volt | 0 .../Views/error/show400.volt | 0 .../Views/error/show401.volt | 0 .../Views/error/show403.volt | 0 .../Views/error/show404.volt | 0 .../Views/error/show500.volt | 0 .../Views/error/show503.volt | 0 .../{Desktop => Home}/Views/help/index.volt | 4 +- .../{Desktop => Home}/Views/help/show.volt | 4 +- .../{Desktop => Home}/Views/im/chatlog.volt | 0 app/Http/{Desktop => Home}/Views/im/cs.volt | 2 +- .../Views/im/group/active_users.volt | 2 +- .../Views/im/group/list.volt | 6 +- .../Views/im/group/manage/edit.volt | 4 +- .../Views/im/group/manage/users.volt | 2 +- .../Views/im/group/pager.volt | 2 +- .../Views/im/group/show.volt | 11 +-- .../Views/im/group/show_owner.volt | 2 +- .../Views/im/group/users.volt | 4 +- .../{Desktop => Home}/Views/im/index.volt | 4 +- .../Views/im/index_groups.volt | 2 +- .../Views/im/index_users.volt | 2 +- .../{Desktop => Home}/Views/im/msgbox.volt | 2 +- .../{Desktop => Home}/Views/im/notice.volt | 2 +- .../{Desktop => Home}/Views/index/full.volt | 12 +-- .../{Desktop => Home}/Views/index/simple.volt | 12 +-- .../Views/macros/consult.volt | 0 .../Views/macros/course.volt | 6 +- .../{Desktop => Home}/Views/macros/group.volt | 0 .../{Desktop => Home}/Views/macros/order.volt | 0 .../Views/macros/refund.volt | 0 .../{Desktop => Home}/Views/macros/user.volt | 12 ++- .../Views/order/confirm.volt | 8 +- .../{Desktop => Home}/Views/order/info.volt | 4 +- .../{Desktop => Home}/Views/order/pay.volt | 12 +-- .../{Desktop => Home}/Views/page/show.volt | 5 +- .../Views/partials/footer.volt | 0 .../Views/partials/header.volt | 18 ++-- .../Views/partials/js_vars.volt | 6 +- .../Views/partials/pager.volt | 0 .../Views/partials/pager_ajax.volt | 0 .../Views/refund/confirm.volt | 2 +- .../{Desktop => Home}/Views/refund/info.volt | 2 +- .../{Desktop => Home}/Views/review/add.volt | 4 +- .../{Desktop => Home}/Views/review/edit.volt | 4 +- .../Views/search/course.volt | 4 +- .../{Desktop => Home}/Views/search/empty.volt | 0 .../{Desktop => Home}/Views/search/group.volt | 4 +- .../{Desktop => Home}/Views/search/index.volt | 2 +- .../Views/search/sidebar.volt | 4 +- .../{Desktop => Home}/Views/search/user.volt | 12 +-- .../Views/teacher/console}/consults.volt | 14 +-- .../Views/teacher/console}/courses.volt | 4 +- .../Views/teacher/console/live.volt} | 4 +- .../Views/teacher/console}/lives.volt | 17 ++-- app/Http/Home/Views/teacher/console/menu.volt | 10 ++ .../{Desktop => Home}/Views/teacher/list.volt | 6 +- .../Views/teacher/pager.volt | 2 +- .../Views/templates/error.volt | 2 +- .../Views/templates/layer.volt | 4 +- .../Views/templates/main.volt | 6 +- .../Views/topic/courses.volt | 0 app/Http/Home/Views/topic/show.volt | 21 ++++ .../Views/user/console}/account.volt | 10 +- .../Views/user/console}/consults.volt | 12 +-- .../Views/user/console}/courses.volt | 8 +- .../Views/user/console}/favorites.volt | 8 +- .../Views/user/console}/friends.volt | 18 +--- .../Views/user/console}/groups.volt | 12 +-- .../Views/user/console}/groups_joined.volt | 6 +- .../Views/user/console}/groups_owned.volt | 4 +- .../my => Home/Views/user/console}/menu.volt | 22 ++--- .../Views/user/console}/orders.volt | 8 +- .../Views/user/console}/profile.volt | 8 +- .../Views/user/console}/refunds.volt | 8 +- .../Views/user/console}/reviews.volt | 10 +- .../{Desktop => Home}/Views/user/courses.volt | 0 .../Views/user/favorites.volt | 0 .../{Desktop => Home}/Views/user/friends.volt | 2 +- .../{Desktop => Home}/Views/user/groups.volt | 2 +- .../{Desktop => Home}/Views/user/show.volt | 20 ++-- .../{Desktop => Home}/Views/vip/courses.volt | 0 .../{Desktop => Home}/Views/vip/index.volt | 10 +- .../{Desktop => Home}/Views/vip/users.volt | 2 +- app/Listeners/Listener.php | 2 +- app/Models/Client.php | 4 +- app/Models/Course.php | 6 +- app/Models/ImGroup.php | 6 +- app/Models/{Carousel.php => Slide.php} | 54 +++-------- app/Models/User.php | 6 +- app/Repos/{Carousel.php => Slide.php} | 14 +-- .../LiveList.php => Repos/Teacher.php} | 61 +----------- app/Services/Auth/{Desktop.php => Home.php} | 4 +- app/Services/Captcha.php | 4 +- app/Services/Frontend/Chapter/BasicInfo.php | 29 ------ app/Services/Frontend/ChapterLiveTrait.php | 13 --- app/Services/Frontend/Course/BasicInfo.php | 21 ---- app/Services/Frontend/Help/HelpList.php | 20 ---- app/Services/Frontend/My/CourseList.php | 20 ---- app/Services/Frontend/My/FavoriteList.php | 20 ---- app/Services/Frontend/My/FriendList.php | 20 ---- app/Services/Frontend/Teacher/TeacherInfo.php | 18 ---- app/Services/Frontend/Teaching/CourseList.php | 84 ---------------- .../Frontend/Teaching/LivePushUrl.php | 29 ------ app/Services/Live.php | 8 +- app/Services/LiveNotify.php | 2 +- .../Account/EmailUpdate.php | 6 +- .../Account/PasswordReset.php | 6 +- .../Account/PasswordUpdate.php | 6 +- .../Account/PhoneUpdate.php | 6 +- .../{Frontend => Logic}/Account/Register.php | 6 +- .../Chapter/BasicInfo.php} | 28 ++++-- .../Chapter/ChapterInfo.php | 17 ++-- .../Chapter/ChapterLike.php | 8 +- .../{Frontend => Logic}/Chapter/DanmuList.php | 8 +- .../{Frontend => Logic}/Chapter/Learning.php | 16 ++-- .../{Frontend => Logic}/ChapterTrait.php | 7 +- .../Consult/ConsultCreate.php | 10 +- .../Consult/ConsultDelete.php | 12 +-- .../Consult/ConsultInfo.php | 8 +- .../Consult/ConsultLike.php | 8 +- .../Consult/ConsultReply.php | 8 +- .../Consult/ConsultUpdate.php | 8 +- .../{Frontend => Logic}/ConsultTrait.php | 2 +- .../Course/BasicInfo.php} | 27 +++--- .../Course/ChapterList.php | 8 +- .../Course/ConsultList.php | 8 +- .../Course/CourseFavorite.php | 8 +- .../{Frontend => Logic}/Course/CourseInfo.php | 13 +-- .../{Frontend => Logic}/Course/CourseList.php | 6 +- .../Course/PackageList.php | 8 +- .../Course/RecommendedList.php | 8 +- .../Course/RelatedList.php | 8 +- .../{Frontend => Logic}/Course/ReviewList.php | 8 +- .../Course/TeacherList.php | 8 +- .../{Frontend => Logic}/Course/TopicList.php | 8 +- .../{Frontend => Logic}/CourseTrait.php | 2 +- .../{Frontend => Logic}/Danmu/DanmuCreate.php | 8 +- .../{Frontend => Logic}/Danmu/DanmuInfo.php | 8 +- .../{Frontend => Logic}/DanmuTrait.php | 2 +- .../{Frontend => Logic}/Help/HelpInfo.php | 8 +- app/Services/Logic/Help/HelpList.php | 18 ++++ .../{Frontend => Logic}/HelpTrait.php | 2 +- .../{Frontend => Logic}/Order/OrderCancel.php | 8 +- .../Order/OrderConfirm.php | 6 +- .../{Frontend => Logic}/Order/OrderCreate.php | 6 +- .../{Frontend => Logic}/Order/OrderInfo.php | 6 +- .../{Frontend => Logic}/OrderTrait.php | 2 +- .../Package/CourseList.php | 8 +- .../Package/PackageInfo.php | 8 +- .../{Frontend => Logic}/PackageTrait.php | 2 +- .../{Frontend => Logic}/Page/PageInfo.php | 10 +- .../{Frontend => Logic}/PageTrait.php | 2 +- .../Refund/RefundCancel.php | 8 +- .../Refund/RefundConfirm.php | 8 +- .../Refund/RefundCreate.php | 8 +- .../{Frontend => Logic}/Refund/RefundInfo.php | 8 +- .../{Frontend => Logic}/RefundTrait.php | 2 +- .../Review/ReviewCreate.php | 10 +- .../Review/ReviewDelete.php | 10 +- .../{Frontend => Logic}/Review/ReviewInfo.php | 8 +- .../{Frontend => Logic}/Review/ReviewLike.php | 8 +- .../Review/ReviewUpdate.php | 10 +- .../{Frontend => Logic}/ReviewTrait.php | 2 +- .../{Frontend => Logic}/Reward/OptionList.php | 6 +- .../{Frontend => Logic}/Search/Course.php | 2 +- .../{Frontend => Logic}/Search/Group.php | 2 +- .../{Frontend => Logic}/Search/Handler.php | 6 +- .../{Frontend => Logic}/Search/User.php | 2 +- app/Services/{Frontend => Logic}/Service.php | 2 +- .../Teacher/Console}/ConsultList.php | 10 +- .../Teacher/Console}/CourseList.php | 12 +-- .../Logic/Teacher/Console/LiveList.php | 65 +++++++++++++ .../Logic/Teacher/Console/LivePushUrl.php | 25 +++++ app/Services/Logic/Teacher/TeacherInfo.php | 18 ++++ .../Teacher/TeacherList.php | 6 +- .../{Frontend => Logic}/Topic/CourseList.php | 8 +- .../{Frontend => Logic}/Topic/TopicInfo.php | 10 +- .../{Frontend => Logic}/TopicTrait.php | 2 +- .../{Frontend => Logic}/Trade/TradeCreate.php | 8 +- .../{Frontend => Logic}/Trade/TradeInfo.php | 8 +- .../{Frontend => Logic}/TradeTrait.php | 2 +- .../My => Logic/User/Console}/AccountInfo.php | 6 +- .../My => Logic/User/Console}/ConsultList.php | 6 +- .../Logic/User/Console/CourseList.php | 20 ++++ .../Logic/User/Console/FavoriteList.php | 20 ++++ .../Logic/User/Console/FriendList.php | 20 ++++ .../My => Logic/User/Console}/GroupList.php | 8 +- .../My => Logic/User/Console}/OrderList.php | 8 +- .../My => Logic/User/Console}/ProfileInfo.php | 6 +- .../User/Console}/ProfileUpdate.php | 6 +- .../My => Logic/User/Console}/RefundList.php | 8 +- .../My => Logic/User/Console}/ReviewList.php | 6 +- .../{Frontend => Logic}/User/CourseList.php | 8 +- .../{Frontend => Logic}/User/FavoriteList.php | 8 +- .../{Frontend => Logic}/User/FriendList.php | 8 +- .../{Frontend => Logic}/User/GroupList.php | 8 +- .../{Frontend => Logic}/User/UserInfo.php | 8 +- .../{Frontend => Logic}/UserTrait.php | 2 +- .../{Frontend => Logic}/Verify/EmailCode.php | 10 +- .../{Frontend => Logic}/Verify/SmsCode.php | 10 +- .../{Frontend => Logic}/Verify/VerifyCode.php | 14 +-- .../{Frontend => Logic}/Vip/CourseList.php | 6 +- .../{Frontend => Logic}/Vip/OptionList.php | 6 +- .../{Frontend => Logic}/Vip/UserList.php | 6 +- app/Services/{Mailer => Mail}/Test.php | 2 +- app/Services/{Mailer => Mail}/Verify.php | 2 +- app/Services/Mailer.php | 6 +- app/Services/MyStorage.php | 6 +- app/Services/Pay/AlipayGateway.php | 2 +- app/Services/Pay/WxpayGateway.php | 2 +- app/Services/Service.php | 2 +- app/Services/{Smser => Sms}/Live.php | 2 +- app/Services/{Smser => Sms}/Order.php | 2 +- app/Services/{Smser => Sms}/Refund.php | 2 +- app/Services/{Smser => Sms}/Test.php | 2 +- app/Services/{Smser => Sms}/Verify.php | 2 +- app/Services/Smser.php | 4 +- app/Services/Storage.php | 4 +- app/Services/{Syncer => Sync}/CourseIndex.php | 2 +- app/Services/{Syncer => Sync}/GroupIndex.php | 2 +- app/Services/{Syncer => Sync}/Learning.php | 2 +- app/Services/{Syncer => Sync}/UserIndex.php | 2 +- app/Services/Vod.php | 6 +- app/Validators/Carousel.php | 55 +++++------ bootstrap/HttpErrorHandler.php | 2 +- bootstrap/HttpKernel.php | 6 +- config/errors.php | 28 +++--- config/routes.php | 8 +- db/migrations/20200827063842_init_table.php | 2 +- .../20200827112717_insert_setting_data.php | 26 ++--- db/migrations/schema.php | 32 +++---- public/static/admin/js/vditor.js | 2 +- public/static/desktop/js/markdown.preview.js | 11 --- .../static/{desktop => home}/css/common.css | 34 +++---- public/static/{desktop => home}/css/error.css | 0 .../static/{desktop => home}/img/alipay.png | Bin .../{desktop => home}/img/vip_cover.png | Bin public/static/{desktop => home}/img/wxpay.png | Bin .../{desktop => home}/js/captcha.login.js | 0 .../{desktop => home}/js/captcha.verify.js | 0 .../{desktop => home}/js/chapter.action.js | 0 .../{desktop => home}/js/chapter.live.chat.js | 4 +- .../js/chapter.live.countdown.js | 0 .../js/chapter.live.player.js | 0 .../{desktop => home}/js/chapter.read.js | 0 .../js/chapter.vod.player.js | 0 public/static/{desktop => home}/js/common.js | 0 public/static/{desktop => home}/js/copy.js | 0 .../{desktop => home}/js/course.list.js | 0 .../{desktop => home}/js/course.share.js | 0 .../{desktop => home}/js/course.show.js | 0 public/static/{desktop => home}/js/fixbar.js | 0 public/static/{desktop => home}/js/help.js | 0 .../static/{desktop => home}/js/im.apply.js | 0 public/static/{desktop => home}/js/im.cs.js | 4 +- .../{desktop => home}/js/im.group.list.js | 0 .../{desktop => home}/js/im.group.show.js | 0 public/static/{desktop => home}/js/im.js | 4 +- .../static/{desktop => home}/js/im.msgbox.js | 0 public/static/{desktop => home}/js/index.js | 2 +- public/static/home/js/markdown.preview.js | 26 +++++ .../static/{desktop => home}/js/order.pay.js | 0 .../js/teacher.console.js} | 0 .../{desktop => home}/js/teacher.list.js | 0 .../static/{desktop => home}/js/topic.show.js | 0 .../{desktop => home}/js/upload.avatar.js | 0 .../js/user.console.account.js} | 0 .../js/my.js => home/js/user.console.js} | 0 .../js/user.console.profile.js} | 0 .../js/user.console.review.js} | 0 .../static/{desktop => home}/js/user.share.js | 0 .../static/{desktop => home}/js/user.show.js | 0 public/static/{desktop => home}/js/vip.js | 0 426 files changed, 1912 insertions(+), 2092 deletions(-) delete mode 100644 app/Caches/IndexCarouselList.php create mode 100644 app/Caches/IndexSlideList.php rename app/Http/Admin/Controllers/{CarouselController.php => SlideController.php} (50%) rename app/Http/Admin/Services/{Carousel.php => Slide.php} (52%) rename app/Http/Admin/Views/setting/{mailer.volt => mail.volt} (79%) rename app/Http/Admin/Views/setting/{smser.volt => sms.volt} (94%) delete mode 100644 app/Http/Desktop/Views/teaching/menu.volt delete mode 100644 app/Http/Desktop/Views/topic/show.volt rename app/Http/{Desktop => Home}/Controllers/AccountController.php (65%) rename app/Http/{Desktop => Home}/Controllers/ChapterController.php (76%) rename app/Http/{Desktop => Home}/Controllers/ConsultController.php (69%) rename app/Http/{Desktop => Home}/Controllers/Controller.php (94%) rename app/Http/{Desktop => Home}/Controllers/CourseController.php (68%) rename app/Http/{Desktop => Home}/Controllers/DanmuController.php (63%) rename app/Http/{Desktop => Home}/Controllers/ErrorController.php (77%) rename app/Http/{Desktop => Home}/Controllers/HelpController.php (69%) rename app/Http/{Desktop => Home}/Controllers/ImController.php (77%) rename app/Http/{Desktop => Home}/Controllers/ImGroupController.php (80%) rename app/Http/{Desktop => Home}/Controllers/ImGroupManageController.php (77%) rename app/Http/{Desktop => Home}/Controllers/IndexController.php (82%) rename app/Http/{Desktop => Home}/Controllers/LayerController.php (88%) rename app/Http/{Desktop => Home}/Controllers/LiveController.php (75%) rename app/Http/{Desktop => Home}/Controllers/OrderController.php (69%) rename app/Http/{Desktop => Home}/Controllers/PackageController.php (62%) rename app/Http/{Desktop => Home}/Controllers/PageController.php (68%) rename app/Http/{Desktop => Home}/Controllers/PublicController.php (86%) rename app/Http/{Desktop => Home}/Controllers/RefundController.php (66%) rename app/Http/{Desktop => Home}/Controllers/ReviewController.php (71%) rename app/Http/{Desktop => Home}/Controllers/SearchController.php (78%) rename app/Http/{Desktop/Controllers/TeachingController.php => Home/Controllers/TeacherConsoleController.php} (56%) rename app/Http/{Desktop => Home}/Controllers/TeacherController.php (70%) rename app/Http/{Desktop => Home}/Controllers/TopicController.php (63%) rename app/Http/{Desktop => Home}/Controllers/TradeController.php (67%) rename app/Http/{Desktop => Home}/Controllers/UploadController.php (78%) rename app/Http/{Desktop/Controllers/MyController.php => Home/Controllers/UserConsoleController.php} (50%) rename app/Http/{Desktop => Home}/Controllers/UserController.php (72%) rename app/Http/{Desktop => Home}/Controllers/VerifyController.php (78%) rename app/Http/{Desktop => Home}/Controllers/VipController.php (73%) rename app/Http/{Desktop => Home}/Module.php (84%) rename app/Http/{Desktop => Home}/Services/Account.php (93%) rename app/Http/{Desktop => Home}/Services/CourseQuery.php (95%) rename app/Http/{Desktop => Home}/Services/Im.php (99%) rename app/Http/{Desktop => Home}/Services/ImCsTrait.php (97%) rename app/Http/{Desktop => Home}/Services/ImFriendTrait.php (99%) rename app/Http/{Desktop => Home}/Services/ImGroup.php (99%) rename app/Http/{Desktop => Home}/Services/ImGroupTrait.php (99%) rename app/Http/{Desktop => Home}/Services/ImMessageTrait.php (99%) rename app/Http/{Desktop => Home}/Services/ImNoticeTrait.php (96%) rename app/Http/{Desktop => Home}/Services/ImStatTrait.php (94%) rename app/Http/{Desktop => Home}/Services/Index.php (64%) rename app/Http/{Desktop => Home}/Services/Live.php (97%) rename app/Http/{Desktop => Home}/Services/Service.php (60%) rename app/Http/{Desktop => Home}/Services/Trade.php (91%) rename app/Http/{Desktop => Home}/Views/account/edit_email.volt (93%) rename app/Http/{Desktop => Home}/Views/account/edit_password.volt (94%) rename app/Http/{Desktop => Home}/Views/account/edit_phone.volt (93%) rename app/Http/{Desktop => Home}/Views/account/forget_password.volt (92%) rename app/Http/{Desktop => Home}/Views/account/login.volt (77%) rename app/Http/{Desktop => Home}/Views/account/login_by_password.volt (96%) rename app/Http/{Desktop => Home}/Views/account/login_by_verify.volt (95%) rename app/Http/{Desktop => Home}/Views/account/register.volt (95%) rename app/Http/{Desktop => Home}/Views/chapter/catalog.volt (92%) rename app/Http/{Desktop => Home}/Views/chapter/live.volt (68%) rename app/Http/{Desktop => Home}/Views/chapter/live_active.volt (78%) rename app/Http/{Desktop => Home}/Views/chapter/live_chats.volt (100%) rename app/Http/{Desktop => Home}/Views/chapter/live_forbid.volt (78%) rename app/Http/{Desktop => Home}/Views/chapter/live_inactive.volt (88%) rename app/Http/{Desktop => Home}/Views/chapter/read.volt (76%) rename app/Http/{Desktop => Home}/Views/chapter/vod.volt (79%) rename app/Http/{Desktop => Home}/Views/consult/add.volt (95%) rename app/Http/{Desktop => Home}/Views/consult/edit.volt (90%) rename app/Http/{Desktop => Home}/Views/consult/reply.volt (93%) rename app/Http/{Desktop => Home}/Views/consult/show.volt (90%) rename app/Http/{Desktop => Home}/Views/course/consults.volt (86%) rename app/Http/{Desktop => Home}/Views/course/list.volt (60%) rename app/Http/{Desktop => Home}/Views/course/list_filter.volt (100%) rename app/Http/{Desktop => Home}/Views/course/packages.volt (88%) rename app/Http/{Desktop => Home}/Views/course/pager.volt (100%) rename app/Http/{Desktop => Home}/Views/course/recommended.volt (100%) rename app/Http/{Desktop => Home}/Views/course/related.volt (100%) rename app/Http/{Desktop => Home}/Views/course/reviews.volt (88%) rename app/Http/{Desktop => Home}/Views/course/show.volt (79%) rename app/Http/{Desktop => Home}/Views/course/show_catalog.volt (92%) rename app/Http/{Desktop => Home}/Views/course/show_meta.volt (100%) rename app/Http/{Desktop => Home}/Views/course/show_order.volt (78%) rename app/Http/{Desktop => Home}/Views/course/show_teacher.volt (90%) rename app/Http/{Desktop => Home}/Views/course/topics.volt (77%) rename app/Http/{Desktop => Home}/Views/error/maintain.volt (100%) rename app/Http/{Desktop => Home}/Views/error/show400.volt (100%) rename app/Http/{Desktop => Home}/Views/error/show401.volt (100%) rename app/Http/{Desktop => Home}/Views/error/show403.volt (100%) rename app/Http/{Desktop => Home}/Views/error/show404.volt (100%) rename app/Http/{Desktop => Home}/Views/error/show500.volt (100%) rename app/Http/{Desktop => Home}/Views/error/show503.volt (100%) rename app/Http/{Desktop => Home}/Views/help/index.volt (94%) rename app/Http/{Desktop => Home}/Views/help/show.volt (82%) rename app/Http/{Desktop => Home}/Views/im/chatlog.volt (100%) rename app/Http/{Desktop => Home}/Views/im/cs.volt (89%) rename app/Http/{Desktop => Home}/Views/im/group/active_users.volt (90%) rename app/Http/{Desktop => Home}/Views/im/group/list.volt (62%) rename app/Http/{Desktop => Home}/Views/im/group/manage/edit.volt (92%) rename app/Http/{Desktop => Home}/Views/im/group/manage/users.volt (91%) rename app/Http/{Desktop => Home}/Views/im/group/pager.volt (94%) rename app/Http/{Desktop => Home}/Views/im/group/show.volt (79%) rename app/Http/{Desktop => Home}/Views/im/group/show_owner.volt (89%) rename app/Http/{Desktop => Home}/Views/im/group/users.volt (92%) rename app/Http/{Desktop => Home}/Views/im/index.volt (91%) rename app/Http/{Desktop => Home}/Views/im/index_groups.volt (93%) rename app/Http/{Desktop => Home}/Views/im/index_users.volt (93%) rename app/Http/{Desktop => Home}/Views/im/msgbox.volt (77%) rename app/Http/{Desktop => Home}/Views/im/notice.volt (97%) rename app/Http/{Desktop => Home}/Views/index/full.volt (84%) rename app/Http/{Desktop => Home}/Views/index/simple.volt (77%) rename app/Http/{Desktop => Home}/Views/macros/consult.volt (100%) rename app/Http/{Desktop => Home}/Views/macros/course.volt (94%) rename app/Http/{Desktop => Home}/Views/macros/group.volt (100%) rename app/Http/{Desktop => Home}/Views/macros/order.volt (100%) rename app/Http/{Desktop => Home}/Views/macros/refund.volt (100%) rename app/Http/{Desktop => Home}/Views/macros/user.volt (64%) rename app/Http/{Desktop => Home}/Views/order/confirm.volt (92%) rename app/Http/{Desktop => Home}/Views/order/info.volt (87%) rename app/Http/{Desktop => Home}/Views/order/pay.volt (81%) rename app/Http/{Desktop => Home}/Views/page/show.volt (74%) rename app/Http/{Desktop => Home}/Views/partials/footer.volt (100%) rename app/Http/{Desktop => Home}/Views/partials/header.volt (61%) rename app/Http/{Desktop => Home}/Views/partials/js_vars.volt (82%) rename app/Http/{Desktop => Home}/Views/partials/pager.volt (100%) rename app/Http/{Desktop => Home}/Views/partials/pager_ajax.volt (100%) rename app/Http/{Desktop => Home}/Views/refund/confirm.volt (97%) rename app/Http/{Desktop => Home}/Views/refund/info.volt (96%) rename app/Http/{Desktop => Home}/Views/review/add.volt (93%) rename app/Http/{Desktop => Home}/Views/review/edit.volt (92%) rename app/Http/{Desktop => Home}/Views/search/course.volt (86%) rename app/Http/{Desktop => Home}/Views/search/empty.volt (100%) rename app/Http/{Desktop => Home}/Views/search/group.volt (85%) rename app/Http/{Desktop => Home}/Views/search/index.volt (94%) rename app/Http/{Desktop => Home}/Views/search/sidebar.volt (76%) rename app/Http/{Desktop => Home}/Views/search/user.volt (81%) rename app/Http/{Desktop/Views/teaching => Home/Views/teacher/console}/consults.volt (82%) rename app/Http/{Desktop/Views/teaching => Home/Views/teacher/console}/courses.volt (90%) rename app/Http/{Desktop/Views/teaching/live_push.volt => Home/Views/teacher/console/live.volt} (92%) rename app/Http/{Desktop/Views/teaching => Home/Views/teacher/console}/lives.volt (74%) create mode 100644 app/Http/Home/Views/teacher/console/menu.volt rename app/Http/{Desktop => Home}/Views/teacher/list.volt (62%) rename app/Http/{Desktop => Home}/Views/teacher/pager.volt (94%) rename app/Http/{Desktop => Home}/Views/templates/error.volt (86%) rename app/Http/{Desktop => Home}/Views/templates/layer.volt (88%) rename app/Http/{Desktop => Home}/Views/templates/main.volt (89%) rename app/Http/{Desktop => Home}/Views/topic/courses.volt (100%) create mode 100644 app/Http/Home/Views/topic/show.volt rename app/Http/{Desktop/Views/my => Home/Views/user/console}/account.volt (88%) rename app/Http/{Desktop/Views/my => Home/Views/user/console}/consults.volt (82%) rename app/Http/{Desktop/Views/my => Home/Views/user/console}/courses.volt (87%) rename app/Http/{Desktop/Views/my => Home/Views/user/console}/favorites.volt (85%) rename app/Http/{Desktop/Views/my => Home/Views/user/console}/friends.volt (78%) rename app/Http/{Desktop/Views/my => Home/Views/user/console}/groups.volt (66%) rename app/Http/{Desktop/Views/my => Home/Views/user/console}/groups_joined.volt (79%) rename app/Http/{Desktop/Views/my => Home/Views/user/console}/groups_owned.volt (85%) rename app/Http/{Desktop/Views/my => Home/Views/user/console}/menu.volt (57%) rename app/Http/{Desktop/Views/my => Home/Views/user/console}/orders.volt (84%) rename app/Http/{Desktop/Views/my => Home/Views/user/console}/profile.volt (94%) rename app/Http/{Desktop/Views/my => Home/Views/user/console}/refunds.volt (84%) rename app/Http/{Desktop/Views/my => Home/Views/user/console}/reviews.volt (84%) rename app/Http/{Desktop => Home}/Views/user/courses.volt (100%) rename app/Http/{Desktop => Home}/Views/user/favorites.volt (100%) rename app/Http/{Desktop => Home}/Views/user/friends.volt (93%) rename app/Http/{Desktop => Home}/Views/user/groups.volt (94%) rename app/Http/{Desktop => Home}/Views/user/show.volt (85%) rename app/Http/{Desktop => Home}/Views/vip/courses.volt (100%) rename app/Http/{Desktop => Home}/Views/vip/index.volt (83%) rename app/Http/{Desktop => Home}/Views/vip/users.volt (93%) rename app/Models/{Carousel.php => Slide.php} (73%) rename app/Repos/{Carousel.php => Slide.php} (83%) rename app/{Services/Frontend/Teaching/LiveList.php => Repos/Teacher.php} (51%) rename app/Services/Auth/{Desktop.php => Home.php} (91%) delete mode 100644 app/Services/Frontend/Chapter/BasicInfo.php delete mode 100644 app/Services/Frontend/ChapterLiveTrait.php delete mode 100644 app/Services/Frontend/Course/BasicInfo.php delete mode 100644 app/Services/Frontend/Help/HelpList.php delete mode 100644 app/Services/Frontend/My/CourseList.php delete mode 100644 app/Services/Frontend/My/FavoriteList.php delete mode 100644 app/Services/Frontend/My/FriendList.php delete mode 100644 app/Services/Frontend/Teacher/TeacherInfo.php delete mode 100644 app/Services/Frontend/Teaching/CourseList.php delete mode 100644 app/Services/Frontend/Teaching/LivePushUrl.php rename app/Services/{Frontend => Logic}/Account/EmailUpdate.php (86%) rename app/Services/{Frontend => Logic}/Account/PasswordReset.php (85%) rename app/Services/{Frontend => Logic}/Account/PasswordUpdate.php (86%) rename app/Services/{Frontend => Logic}/Account/PhoneUpdate.php (86%) rename app/Services/{Frontend => Logic}/Account/Register.php (94%) rename app/Services/{Frontend/Chapter/BasicInfoTrait.php => Logic/Chapter/BasicInfo.php} (81%) rename app/Services/{Frontend => Logic}/Chapter/ChapterInfo.php (91%) rename app/Services/{Frontend => Logic}/Chapter/ChapterLike.php (90%) rename app/Services/{Frontend => Logic}/Chapter/DanmuList.php (87%) rename app/Services/{Frontend => Logic}/Chapter/Learning.php (71%) rename app/Services/{Frontend => Logic}/ChapterTrait.php (94%) rename app/Services/{Frontend => Logic}/Consult/ConsultCreate.php (91%) rename app/Services/{Frontend => Logic}/Consult/ConsultDelete.php (81%) rename app/Services/{Frontend => Logic}/Consult/ConsultInfo.php (90%) rename app/Services/{Frontend => Logic}/Consult/ConsultLike.php (91%) rename app/Services/{Frontend => Logic}/Consult/ConsultReply.php (75%) rename app/Services/{Frontend => Logic}/Consult/ConsultUpdate.php (79%) rename app/Services/{Frontend => Logic}/ConsultTrait.php (87%) rename app/Services/{Frontend/Course/BasicInfoTrait.php => Logic/Course/BasicInfo.php} (79%) rename app/Services/{Frontend => Logic}/Course/ChapterList.php (92%) rename app/Services/{Frontend => Logic}/Course/ConsultList.php (90%) rename app/Services/{Frontend => Logic}/Course/CourseFavorite.php (91%) rename app/Services/{Frontend => Logic}/Course/CourseInfo.php (84%) rename app/Services/{Frontend => Logic}/Course/CourseList.php (94%) rename app/Services/{Frontend => Logic}/Course/PackageList.php (90%) rename app/Services/{Frontend => Logic}/Course/RecommendedList.php (64%) rename app/Services/{Frontend => Logic}/Course/RelatedList.php (63%) rename app/Services/{Frontend => Logic}/Course/ReviewList.php (89%) rename app/Services/{Frontend => Logic}/Course/TeacherList.php (63%) rename app/Services/{Frontend => Logic}/Course/TopicList.php (63%) rename app/Services/{Frontend => Logic}/CourseTrait.php (98%) rename app/Services/{Frontend => Logic}/Danmu/DanmuCreate.php (88%) rename app/Services/{Frontend => Logic}/Danmu/DanmuInfo.php (82%) rename app/Services/{Frontend => Logic}/DanmuTrait.php (86%) rename app/Services/{Frontend => Logic}/Help/HelpInfo.php (70%) create mode 100644 app/Services/Logic/Help/HelpList.php rename app/Services/{Frontend => Logic}/HelpTrait.php (91%) rename app/Services/{Frontend => Logic}/Order/OrderCancel.php (74%) rename app/Services/{Frontend => Logic}/Order/OrderConfirm.php (96%) rename app/Services/{Frontend => Logic}/Order/OrderCreate.php (98%) rename app/Services/{Frontend => Logic}/Order/OrderInfo.php (95%) rename app/Services/{Frontend => Logic}/OrderTrait.php (91%) rename app/Services/{Frontend => Logic}/Package/CourseList.php (64%) rename app/Services/{Frontend => Logic}/Package/PackageInfo.php (77%) rename app/Services/{Frontend => Logic}/PackageTrait.php (91%) rename app/Services/{Frontend => Logic}/Page/PageInfo.php (68%) rename app/Services/{Frontend => Logic}/PageTrait.php (91%) rename app/Services/{Frontend => Logic}/Refund/RefundCancel.php (81%) rename app/Services/{Frontend => Logic}/Refund/RefundConfirm.php (56%) rename app/Services/{Frontend => Logic}/Refund/RefundCreate.php (92%) rename app/Services/{Frontend => Logic}/Refund/RefundInfo.php (90%) rename app/Services/{Frontend => Logic}/RefundTrait.php (91%) rename app/Services/{Frontend => Logic}/Review/ReviewCreate.php (87%) rename app/Services/{Frontend => Logic}/Review/ReviewDelete.php (82%) rename app/Services/{Frontend => Logic}/Review/ReviewInfo.php (85%) rename app/Services/{Frontend => Logic}/Review/ReviewLike.php (90%) rename app/Services/{Frontend => Logic}/Review/ReviewUpdate.php (83%) rename app/Services/{Frontend => Logic}/ReviewTrait.php (86%) rename app/Services/{Frontend => Logic}/Reward/OptionList.php (79%) rename app/Services/{Frontend => Logic}/Search/Course.php (98%) rename app/Services/{Frontend => Logic}/Search/Group.php (97%) rename app/Services/{Frontend => Logic}/Search/Handler.php (51%) rename app/Services/{Frontend => Logic}/Search/User.php (97%) rename app/Services/{Frontend => Logic}/Service.php (61%) rename app/Services/{Frontend/Teaching => Logic/Teacher/Console}/ConsultList.php (93%) rename app/Services/{Frontend/Teacher => Logic/Teacher/Console}/CourseList.php (81%) create mode 100644 app/Services/Logic/Teacher/Console/LiveList.php create mode 100644 app/Services/Logic/Teacher/Console/LivePushUrl.php create mode 100644 app/Services/Logic/Teacher/TeacherInfo.php rename app/Services/{Frontend => Logic}/Teacher/TeacherList.php (90%) rename app/Services/{Frontend => Logic}/Topic/CourseList.php (85%) rename app/Services/{Frontend => Logic}/Topic/TopicInfo.php (62%) rename app/Services/{Frontend => Logic}/TopicTrait.php (91%) rename app/Services/{Frontend => Logic}/Trade/TradeCreate.php (80%) rename app/Services/{Frontend => Logic}/Trade/TradeInfo.php (76%) rename app/Services/{Frontend => Logic}/TradeTrait.php (91%) rename app/Services/{Frontend/My => Logic/User/Console}/AccountInfo.php (79%) rename app/Services/{Frontend/My => Logic/User/Console}/ConsultList.php (93%) create mode 100644 app/Services/Logic/User/Console/CourseList.php create mode 100644 app/Services/Logic/User/Console/FavoriteList.php create mode 100644 app/Services/Logic/User/Console/FriendList.php rename app/Services/{Frontend/My => Logic/User/Console}/GroupList.php (91%) rename app/Services/{Frontend/My => Logic/User/Console}/OrderList.php (91%) rename app/Services/{Frontend/My => Logic/User/Console}/ProfileInfo.php (89%) rename app/Services/{Frontend/My => Logic/User/Console}/ProfileUpdate.php (90%) rename app/Services/{Frontend/My => Logic/User/Console}/RefundList.php (91%) rename app/Services/{Frontend/My => Logic/User/Console}/ReviewList.php (92%) rename app/Services/{Frontend => Logic}/User/CourseList.php (90%) rename app/Services/{Frontend => Logic}/User/FavoriteList.php (88%) rename app/Services/{Frontend => Logic}/User/FriendList.php (87%) rename app/Services/{Frontend => Logic}/User/GroupList.php (87%) rename app/Services/{Frontend => Logic}/User/UserInfo.php (86%) rename app/Services/{Frontend => Logic}/UserTrait.php (91%) rename app/Services/{Frontend => Logic}/Verify/EmailCode.php (66%) rename app/Services/{Frontend => Logic}/Verify/SmsCode.php (66%) rename app/Services/{Frontend => Logic}/Verify/VerifyCode.php (61%) rename app/Services/{Frontend => Logic}/Vip/CourseList.php (92%) rename app/Services/{Frontend => Logic}/Vip/OptionList.php (79%) rename app/Services/{Frontend => Logic}/Vip/UserList.php (90%) rename app/Services/{Mailer => Mail}/Test.php (96%) rename app/Services/{Mailer => Mail}/Verify.php (97%) rename app/Services/{Smser => Sms}/Live.php (97%) rename app/Services/{Smser => Sms}/Order.php (96%) rename app/Services/{Smser => Sms}/Refund.php (96%) rename app/Services/{Smser => Sms}/Test.php (89%) rename app/Services/{Smser => Sms}/Verify.php (94%) rename app/Services/{Syncer => Sync}/CourseIndex.php (94%) rename app/Services/{Syncer => Sync}/GroupIndex.php (93%) rename app/Services/{Syncer => Sync}/Learning.php (98%) rename app/Services/{Syncer => Sync}/UserIndex.php (93%) delete mode 100644 public/static/desktop/js/markdown.preview.js rename public/static/{desktop => home}/css/common.css (98%) rename public/static/{desktop => home}/css/error.css (100%) rename public/static/{desktop => home}/img/alipay.png (100%) rename public/static/{desktop => home}/img/vip_cover.png (100%) rename public/static/{desktop => home}/img/wxpay.png (100%) rename public/static/{desktop => home}/js/captcha.login.js (100%) rename public/static/{desktop => home}/js/captcha.verify.js (100%) rename public/static/{desktop => home}/js/chapter.action.js (100%) rename public/static/{desktop => home}/js/chapter.live.chat.js (95%) rename public/static/{desktop => home}/js/chapter.live.countdown.js (100%) rename public/static/{desktop => home}/js/chapter.live.player.js (100%) rename public/static/{desktop => home}/js/chapter.read.js (100%) rename public/static/{desktop => home}/js/chapter.vod.player.js (100%) rename public/static/{desktop => home}/js/common.js (100%) rename public/static/{desktop => home}/js/copy.js (100%) rename public/static/{desktop => home}/js/course.list.js (100%) rename public/static/{desktop => home}/js/course.share.js (100%) rename public/static/{desktop => home}/js/course.show.js (100%) rename public/static/{desktop => home}/js/fixbar.js (100%) rename public/static/{desktop => home}/js/help.js (100%) rename public/static/{desktop => home}/js/im.apply.js (100%) rename public/static/{desktop => home}/js/im.cs.js (94%) rename public/static/{desktop => home}/js/im.group.list.js (100%) rename public/static/{desktop => home}/js/im.group.show.js (100%) rename public/static/{desktop => home}/js/im.js (98%) rename public/static/{desktop => home}/js/im.msgbox.js (100%) rename public/static/{desktop => home}/js/index.js (88%) create mode 100644 public/static/home/js/markdown.preview.js rename public/static/{desktop => home}/js/order.pay.js (100%) rename public/static/{desktop/js/teaching.js => home/js/teacher.console.js} (100%) rename public/static/{desktop => home}/js/teacher.list.js (100%) rename public/static/{desktop => home}/js/topic.show.js (100%) rename public/static/{desktop => home}/js/upload.avatar.js (100%) rename public/static/{desktop/js/my.account.js => home/js/user.console.account.js} (100%) rename public/static/{desktop/js/my.js => home/js/user.console.js} (100%) rename public/static/{desktop/js/my.profile.js => home/js/user.console.profile.js} (100%) rename public/static/{desktop/js/my.review.js => home/js/user.console.review.js} (100%) rename public/static/{desktop => home}/js/user.share.js (100%) rename public/static/{desktop => home}/js/user.show.js (100%) rename public/static/{desktop => home}/js/vip.js (100%) diff --git a/README.md b/README.md index eadac14f..a97005b5 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,20 @@ 酷瓜云课堂,依托腾讯云基础服务架构,采用 C 扩展框架 Phalcon 开发,致力网络教育软件。 +#### 系统功能 + 都有些什么功能?我也不想写一大堆,自己体验吧! - [前台演示](https://ctc.koogua.com) - [后台演示](https://ctc.koogua.com/admin) -> 帐号:100015@163.com / 123456 (前后台通用) +帐号:100015@163.com / 123456 (前后台通用,请不要修改密码) -PS:**管理后台已禁止提交并隐藏私人配置** +友情提示: + +- 系统配置低(1核 1G 1M 跑多个容器),手下留情 +- 课程数据来源于网络(无实质内容),切莫购买 +- 管理后台已禁止提交(私密配置已过滤) #### 项目组件 @@ -32,32 +38,7 @@ PS:**管理后台已禁止提交并隐藏私人配置** #### 安装指南 - [运行环境搭建](https://gitee.com/koogua/course-tencent-cloud-docker) -- [系统服务配置](https://gitee.com/koogua/course-tencent-cloud/wikis/服务配置) - -#### 会推出商业服务吗? - -- 如果不符合您对“开源”的认知,请移步其它同类产品,毕竟同类“免费”产品也很多。 -- 如果使用协议不能满足您的需求,或者您希望有更好的支持,商业服务是不错的选择。 - -我们为用户提供的服务包括: - -- 系统安装 -- 系统定制 -- 企业会员 - -#### 会有阿里云版吗? - -阿里云版规划中,之前阿里云服务过期未续费,所以腾讯云版本先出。 - -#### 代码有加密吗? - -所有代码都公开(授权代码除外,例如layim),没有所谓的商业版和付费插件。 - -#### 通过这个项目能学到什么? - -1. 项目规划,phalcon实战,缓存,JWT,即时通讯,全文检索 -2. docker,supervisor,devops -3. git,linux,php,mysql,redis,nginx +- [系统服务配置](https://gitee.com/koogua/course-tencent-cloud/wikis) #### 开发计划 @@ -73,7 +54,29 @@ PS:**管理后台已禁止提交并隐藏私人配置** #### 加入我们 -这是我的创业项目,个人能力和精力有限,要兼顾产品规划以及开发,还要处理很多琐碎事情。 -目前在南山科技园某个众创空间,希望有 **深圳前端同学** 加入我们。 +这是一个创业项目,个人能力和精力有限,要兼顾产品规划以及开发,还要处理很多琐碎事情。目前在南山科技园某个众创空间,希望有 **深圳前端同学** 加入我们。 联系邮箱:76632555@qq.com + +#### 通过这个项目能学到什么? + +- 项目规划,phalcon,缓存,JWT,即时通讯,全文检索 +- docker,supervisor,devops +- git,linux,php,mysql,redis,nginx + +#### 有阿里云版吗? + +阿里云版规划中,之前阿里云服务过期未续费,所以腾讯云版本先出。 + +#### 代码有加密吗? + +所有代码都公开(授权代码除外,例如layim),没有所谓的商业版和付费插件。 + +#### 有商业服务吗? + +生存是一个问题,生存才能发展,我们为用户提供的服务包括: + +- 系统安装 +- 系统定制 +- 企业授权 + diff --git a/app/Caches/IndexCarouselList.php b/app/Caches/IndexCarouselList.php deleted file mode 100644 index 94ccde8c..00000000 --- a/app/Caches/IndexCarouselList.php +++ /dev/null @@ -1,72 +0,0 @@ -lifetime; - } - - public function getKey($id = null) - { - return 'index_carousel_list'; - } - - public function getContent($id = null) - { - $limit = 5; - - $carousels = $this->findCarousels($limit); - - if ($carousels->count() == 0) { - return []; - } - - return $this->handleContent($carousels); - } - - /** - * @param CarouselModel[] $carousels - * @return array - */ - protected function handleContent($carousels) - { - $result = []; - - foreach ($carousels as $carousel) { - $result[] = [ - 'id' => $carousel->id, - 'title' => $carousel->title, - 'cover' => $carousel->cover, - 'style' => $carousel->style, - 'target' => $carousel->target, - 'content' => $carousel->content, - ]; - } - - return $result; - } - - /** - * @param int $limit - * @return ResultsetInterface|Resultset|CarouselModel[] - */ - public function findCarousels($limit = 5) - { - return CarouselModel::query() - ->where('published = 1') - ->orderBy('priority ASC') - ->limit($limit) - ->execute(); - } - -} diff --git a/app/Caches/IndexSlideList.php b/app/Caches/IndexSlideList.php new file mode 100644 index 00000000..72899070 --- /dev/null +++ b/app/Caches/IndexSlideList.php @@ -0,0 +1,71 @@ +lifetime; + } + + public function getKey($id = null) + { + return 'index_slide_list'; + } + + public function getContent($id = null) + { + $limit = 5; + + $slides = $this->findSlides($limit); + + if ($slides->count() == 0) { + return []; + } + + return $this->handleContent($slides); + } + + /** + * @param SlideModel[] $slides + * @return array + */ + protected function handleContent($slides) + { + $result = []; + + foreach ($slides as $slide) { + $result[] = [ + 'id' => $slide->id, + 'title' => $slide->title, + 'cover' => $slide->cover, + 'target' => $slide->target, + 'content' => $slide->content, + ]; + } + + return $result; + } + + /** + * @param int $limit + * @return ResultsetInterface|Resultset|SlideModel[] + */ + public function findSlides($limit = 5) + { + return SlideModel::query() + ->where('published = 1') + ->orderBy('priority ASC') + ->limit($limit) + ->execute(); + } + +} diff --git a/app/Console/Tasks/CleanLogTask.php b/app/Console/Tasks/CleanLogTask.php index dc499431..2b242985 100644 --- a/app/Console/Tasks/CleanLogTask.php +++ b/app/Console/Tasks/CleanLogTask.php @@ -13,8 +13,8 @@ class CleanLogTask extends Task $this->cleanSqlLog(); $this->cleanListenerLog(); $this->cleanCaptchaLog(); - $this->cleanMailerLog(); - $this->cleanSmserLog(); + $this->cleanMailLog(); + $this->cleanSmsLog(); $this->cleanVodLog(); $this->cleanLiveLog(); $this->cleanStorageLog(); @@ -99,17 +99,17 @@ class CleanLogTask extends Task /** * 清理短信服务日志 */ - protected function cleanSmserLog() + protected function cleanSmsLog() { - $this->cleanLog('smser', 7); + $this->cleanLog('sms', 7); } /** * 清理邮件服务日志 */ - protected function cleanMailerLog() + protected function cleanMailLog() { - $this->cleanLog('mailer', 7); + $this->cleanLog('mail', 7); } /** diff --git a/app/Console/Tasks/DeliverTask.php b/app/Console/Tasks/DeliverTask.php index a7ff11be..9b9ddebd 100644 --- a/app/Console/Tasks/DeliverTask.php +++ b/app/Console/Tasks/DeliverTask.php @@ -9,7 +9,7 @@ use App\Models\Task as TaskModel; use App\Models\Trade as TradeModel; use App\Repos\Order as OrderRepo; use App\Repos\User as UserRepo; -use App\Services\Smser\Order as OrderSmser; +use App\Services\Sms\Order as OrderSms; use Phalcon\Mvc\Model; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; @@ -164,9 +164,9 @@ class DeliverTask extends Task protected function handleOrderNotice(OrderModel $order) { - $smser = new OrderSmser(); + $sms = new OrderSms(); - $smser->handle($order); + $sms->handle($order); } protected function handleOrderRefund(OrderModel $order) diff --git a/app/Console/Tasks/LiveNotifyTask.php b/app/Console/Tasks/LiveNotifyTask.php index 5dd5b542..a36c3cf7 100644 --- a/app/Console/Tasks/LiveNotifyTask.php +++ b/app/Console/Tasks/LiveNotifyTask.php @@ -5,7 +5,7 @@ namespace App\Console\Tasks; use App\Models\CourseUser as CourseUserModel; use App\Repos\Chapter as ChapterRepo; use App\Services\LiveNotify as LiveNotifyService; -use App\Services\Smser\Live as LiveSmser; +use App\Services\Sms\Live as LiveSms; class LiveNotifyTask extends Task { @@ -53,10 +53,10 @@ class LiveNotifyTask extends Task if (!$targetUserIds) return; - $smser = new LiveSmser(); + $sms = new LiveSms(); foreach ($targetUserIds as $userId) { - $smser->handle($chapterId, $userId, $chapterLive->start_time); + $sms->handle($chapterId, $userId, $chapterLive->start_time); } } diff --git a/app/Console/Tasks/RefundTask.php b/app/Console/Tasks/RefundTask.php index 434cfdfb..0edf1a67 100644 --- a/app/Console/Tasks/RefundTask.php +++ b/app/Console/Tasks/RefundTask.php @@ -13,7 +13,7 @@ use App\Repos\Trade as TradeRepo; use App\Repos\User as UserRepo; use App\Services\Pay\Alipay as AlipayService; use App\Services\Pay\Wxpay as WxpayService; -use App\Services\Smser\Refund as RefundSmser; +use App\Services\Sms\Refund as RefundSms; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; @@ -283,9 +283,9 @@ class RefundTask extends Task */ protected function handleRefundNotice(RefundModel $refund) { - $smser = new RefundSmser(); + $sms = new RefundSms(); - $smser->handle($refund); + $sms->handle($refund); } /** diff --git a/app/Console/Tasks/SiteMapTask.php b/app/Console/Tasks/SiteMapTask.php index 0d389e26..d78ce46d 100644 --- a/app/Console/Tasks/SiteMapTask.php +++ b/app/Console/Tasks/SiteMapTask.php @@ -49,7 +49,7 @@ class SiteMapTask extends Task { $service = new AppService(); - $settings = $service->getSectionSettings('site'); + $settings = $service->getSettings('site'); return $settings['url'] ?? ''; } diff --git a/app/Console/Tasks/SyncCourseIndexTask.php b/app/Console/Tasks/SyncCourseIndexTask.php index abbe3b5b..1578f036 100644 --- a/app/Console/Tasks/SyncCourseIndexTask.php +++ b/app/Console/Tasks/SyncCourseIndexTask.php @@ -5,7 +5,7 @@ namespace App\Console\Tasks; use App\Repos\Course as CourseRepo; use App\Services\Search\CourseDocument; use App\Services\Search\CourseSearcher; -use App\Services\Syncer\CourseIndex as CourseIndexSyncer; +use App\Services\Sync\CourseIndex as CourseIndexSync; class SyncCourseIndexTask extends Task { @@ -54,9 +54,9 @@ class SyncCourseIndexTask extends Task protected function getSyncKey() { - $syncer = new CourseIndexSyncer(); + $sync = new CourseIndexSync(); - return $syncer->getSyncKey(); + return $sync->getSyncKey(); } } diff --git a/app/Console/Tasks/SyncGroupIndexTask.php b/app/Console/Tasks/SyncGroupIndexTask.php index 65ead9a9..d48223de 100644 --- a/app/Console/Tasks/SyncGroupIndexTask.php +++ b/app/Console/Tasks/SyncGroupIndexTask.php @@ -5,7 +5,7 @@ namespace App\Console\Tasks; use App\Repos\ImGroup as GroupRepo; use App\Services\Search\GroupDocument; use App\Services\Search\GroupSearcher; -use App\Services\Syncer\GroupIndex as GroupIndexSyncer; +use App\Services\Sync\GroupIndex as GroupIndexSync; class SyncGroupIndexTask extends Task { @@ -54,9 +54,9 @@ class SyncGroupIndexTask extends Task protected function getSyncKey() { - $syncer = new GroupIndexSyncer(); + $sync = new GroupIndexSync(); - return $syncer->getSyncKey(); + return $sync->getSyncKey(); } } diff --git a/app/Console/Tasks/SyncLearningTask.php b/app/Console/Tasks/SyncLearningTask.php index cac1e4dc..8adbc36e 100644 --- a/app/Console/Tasks/SyncLearningTask.php +++ b/app/Console/Tasks/SyncLearningTask.php @@ -9,7 +9,7 @@ use App\Repos\ChapterUser as ChapterUserRepo; use App\Repos\Course as CourseRepo; use App\Repos\CourseUser as CourseUserRepo; use App\Repos\Learning as LearningRepo; -use App\Services\Syncer\Learning as LearningSyncer; +use App\Services\Sync\Learning as LearningSync; class SyncLearningTask extends Task { @@ -20,9 +20,9 @@ class SyncLearningTask extends Task $redis = $this->getRedis(); - $syncer = new LearningSyncer(); + $sync = new LearningSync(); - $syncKey = $syncer->getSyncKey(); + $syncKey = $sync->getSyncKey(); $requestIds = $redis->sMembers($syncKey); @@ -30,7 +30,7 @@ class SyncLearningTask extends Task foreach ($requestIds as $requestId) { - $itemKey = $syncer->getItemKey($requestId); + $itemKey = $sync->getItemKey($requestId); $this->handleLearning($itemKey); diff --git a/app/Console/Tasks/SyncUserIndexTask.php b/app/Console/Tasks/SyncUserIndexTask.php index b8cb5669..7e55f3da 100644 --- a/app/Console/Tasks/SyncUserIndexTask.php +++ b/app/Console/Tasks/SyncUserIndexTask.php @@ -5,7 +5,7 @@ namespace App\Console\Tasks; use App\Repos\User as UserRepo; use App\Services\Search\UserDocument; use App\Services\Search\UserSearcher; -use App\Services\Syncer\UserIndex as UserIndexSyncer; +use App\Services\Sync\UserIndex as UserIndexSync; class SyncUserIndexTask extends Task { @@ -54,9 +54,9 @@ class SyncUserIndexTask extends Task protected function getSyncKey() { - $syncer = new UserIndexSyncer(); + $sync = new UserIndexSync(); - return $syncer->getSyncKey(); + return $sync->getSyncKey(); } } diff --git a/app/Http/Admin/Controllers/ChapterController.php b/app/Http/Admin/Controllers/ChapterController.php index 43418d73..6cfc8e7c 100644 --- a/app/Http/Admin/Controllers/ChapterController.php +++ b/app/Http/Admin/Controllers/ChapterController.php @@ -44,15 +44,15 @@ class ChapterController extends Controller $course = $courseService->getCourse($courseId); $chapters = $courseService->getChapters($courseId); + $this->view->pick('chapter/add_chapter'); + + if ($type == 'lesson') { + $this->view->pick('chapter/add_lesson'); + } + $this->view->setVar('course', $course); $this->view->setVar('parent_id', $parentId); $this->view->setVar('chapters', $chapters); - - if ($type == 'chapter') { - $this->view->pick('chapter/add_chapter'); - } else { - $this->view->pick('chapter/add_lesson'); - } } /** @@ -89,11 +89,12 @@ class ChapterController extends Controller $chapter = $chapterService->getChapter($id); $course = $courseService->getCourse($chapter->course_id); - $this->view->setVar('chapter', $chapter); - $this->view->setVar('course', $course); + $this->view->pick('chapter/edit_chapter'); if ($chapter->parent_id > 0) { + $this->view->pick('chapter/edit_lesson'); + switch ($course->model) { case CourseModel::MODEL_VOD: $vod = $contentService->getChapterVod($chapter->id); @@ -110,12 +111,10 @@ class ChapterController extends Controller $this->view->setVar('read', $read); break; } - - $this->view->pick('chapter/edit_lesson'); - - } else { - $this->view->pick('chapter/edit_chapter'); } + + $this->view->setVar('chapter', $chapter); + $this->view->setVar('course', $course); } /** diff --git a/app/Http/Admin/Controllers/SessionController.php b/app/Http/Admin/Controllers/SessionController.php index d868f531..3c67806f 100644 --- a/app/Http/Admin/Controllers/SessionController.php +++ b/app/Http/Admin/Controllers/SessionController.php @@ -48,7 +48,7 @@ class SessionController extends \Phalcon\Mvc\Controller $settingService = new SettingService(); - $captcha = $settingService->getSectionSettings('captcha'); + $captcha = $settingService->getSettings('captcha'); $this->view->pick('public/login'); $this->view->setVar('app_info', $appInfo); diff --git a/app/Http/Admin/Controllers/SettingController.php b/app/Http/Admin/Controllers/SettingController.php index e3dfc8f3..820b0ac0 100644 --- a/app/Http/Admin/Controllers/SettingController.php +++ b/app/Http/Admin/Controllers/SettingController.php @@ -29,7 +29,7 @@ class SettingController extends Controller } else { - $site = $settingService->getSectionSettings($section); + $site = $settingService->getSettings($section); $site['url'] = $site['url'] ?: kg_site_url(); @@ -56,7 +56,7 @@ class SettingController extends Controller } else { - $secret = $settingService->getSectionSettings($section); + $secret = $settingService->getSettings($section); $this->view->setVar('secret', $secret); } @@ -81,7 +81,7 @@ class SettingController extends Controller } else { - $cos = $settingService->getSectionSettings($section); + $cos = $settingService->getSettings($section); $this->view->setVar('cos', $cos); } @@ -106,7 +106,7 @@ class SettingController extends Controller } else { - $vod = $settingService->getSectionSettings($section); + $vod = $settingService->getSettings($section); $this->view->setVar('vod', $vod); } @@ -169,11 +169,11 @@ class SettingController extends Controller } /** - * @Route("/smser", name="admin.setting.smser") + * @Route("/sms", name="admin.setting.sms") */ - public function smserAction() + public function smsAction() { - $section = 'smser'; + $section = 'sms'; $settingService = new SettingService(); @@ -181,24 +181,24 @@ class SettingController extends Controller $data = $this->request->getPost(); - $settingService->updateSmserSettings($section, $data); + $settingService->updateSmsSettings($section, $data); return $this->jsonSuccess(['msg' => '更新配置成功']); } else { - $smser = $settingService->getSectionSettings($section); + $sms = $settingService->getSettings($section); - $this->view->setVar('smser', $smser); + $this->view->setVar('sms', $sms); } } /** - * @Route("/mailer", name="admin.setting.mailer") + * @Route("/mail", name="admin.setting.mail") */ - public function mailerAction() + public function mailAction() { - $section = 'mailer'; + $section = 'mail'; $settingService = new SettingService(); @@ -212,9 +212,9 @@ class SettingController extends Controller } else { - $mailer = $settingService->getSectionSettings($section); + $mail = $settingService->getSettings($section); - $this->view->setVar('mailer', $mailer); + $this->view->setVar('mail', $mail); } } @@ -242,7 +242,7 @@ class SettingController extends Controller } else { - $captcha = $settingService->getSectionSettings($section); + $captcha = $settingService->getSettings($section); $this->view->setVar('captcha', $captcha); } @@ -290,8 +290,8 @@ class SettingController extends Controller } else { - $main = $settingService->getSectionSettings('im.main'); - $cs = $settingService->getSectionSettings('im.cs'); + $main = $settingService->getSettings('im.main'); + $cs = $settingService->getSettings('im.cs'); $this->view->setVar('main', $main); $this->view->setVar('cs', $cs); diff --git a/app/Http/Admin/Controllers/CarouselController.php b/app/Http/Admin/Controllers/SlideController.php similarity index 50% rename from app/Http/Admin/Controllers/CarouselController.php rename to app/Http/Admin/Controllers/SlideController.php index 2d2472b5..8369c875 100644 --- a/app/Http/Admin/Controllers/CarouselController.php +++ b/app/Http/Admin/Controllers/SlideController.php @@ -2,28 +2,28 @@ namespace App\Http\Admin\Controllers; -use App\Http\Admin\Services\Carousel as CarouselService; +use App\Http\Admin\Services\Slide as SlideService; /** - * @RoutePrefix("/admin/carousel") + * @RoutePrefix("/admin/slide") */ -class CarouselController extends Controller +class SlideController extends Controller { /** - * @Get("/list", name="admin.carousel.list") + * @Get("/list", name="admin.slide.list") */ public function listAction() { - $carouselService = new CarouselService(); + $slideService = new SlideService(); - $pager = $carouselService->getCarousels(); + $pager = $slideService->getSlides(); $this->view->setVar('pager', $pager); } /** - * @Get("/add", name="admin.carousel.add") + * @Get("/add", name="admin.slide.add") */ public function addAction() { @@ -31,17 +31,17 @@ class CarouselController extends Controller } /** - * @Post("/create", name="admin.carousel.create") + * @Post("/create", name="admin.slide.create") */ public function createAction() { - $carouselService = new CarouselService(); + $slideService = new SlideService(); - $carousel = $carouselService->createCarousel(); + $slide = $slideService->createSlide(); $location = $this->url->get([ - 'for' => 'admin.carousel.edit', - 'id' => $carousel->id, + 'for' => 'admin.slide.edit', + 'id' => $slide->id, ]); $content = [ @@ -53,27 +53,27 @@ class CarouselController extends Controller } /** - * @Get("/{id:[0-9]+}/edit", name="admin.carousel.edit") + * @Get("/{id:[0-9]+}/edit", name="admin.slide.edit") */ public function editAction($id) { - $carouselService = new CarouselService(); + $slideService = new SlideService(); - $carousel = $carouselService->getCarousel($id); + $slide = $slideService->getSlide($id); - $this->view->setVar('carousel', $carousel); + $this->view->setVar('slide', $slide); } /** - * @Post("/{id:[0-9]+}/update", name="admin.carousel.update") + * @Post("/{id:[0-9]+}/update", name="admin.slide.update") */ public function updateAction($id) { - $carouselService = new CarouselService(); + $slideService = new SlideService(); - $carouselService->updateCarousel($id); + $slideService->updateSlide($id); - $location = $this->url->get(['for' => 'admin.carousel.list']); + $location = $this->url->get(['for' => 'admin.slide.list']); $content = [ 'location' => $location, @@ -84,13 +84,13 @@ class CarouselController extends Controller } /** - * @Post("/{id:[0-9]+}/delete", name="admin.carousel.delete") + * @Post("/{id:[0-9]+}/delete", name="admin.slide.delete") */ public function deleteAction($id) { - $carouselService = new CarouselService(); + $slideService = new SlideService(); - $carouselService->deleteCarousel($id); + $slideService->deleteSlide($id); $location = $this->request->getHTTPReferer(); @@ -103,13 +103,13 @@ class CarouselController extends Controller } /** - * @Post("/{id:[0-9]+}/restore", name="admin.carousel.restore") + * @Post("/{id:[0-9]+}/restore", name="admin.slide.restore") */ public function restoreAction($id) { - $carouselService = new CarouselService(); + $slideService = new SlideService(); - $carouselService->restoreCarousel($id); + $slideService->restoreSlide($id); $location = $this->request->getHTTPReferer(); diff --git a/app/Http/Admin/Controllers/TestController.php b/app/Http/Admin/Controllers/TestController.php index d363e8e3..ec650dc8 100644 --- a/app/Http/Admin/Controllers/TestController.php +++ b/app/Http/Admin/Controllers/TestController.php @@ -7,9 +7,9 @@ use App\Http\Admin\Services\Setting as SettingService; use App\Http\Admin\Services\WxpayTest as WxpayTestService; use App\Services\Captcha as CaptchaService; use App\Services\Live as LiveService; -use App\Services\Mailer\Test as TestMailerService; +use App\Services\Mail\Test as TestMailService; use App\Services\MyStorage as StorageService; -use App\Services\Smser\Test as TestSmserService; +use App\Services\Sms\Test as TestSmsService; use App\Services\Vod as VodService; /** @@ -66,7 +66,7 @@ class TestController extends Controller $pushUrl = $liveService->getPushUrl($streamName); $qrcode = $this->url->get( - ['for' => 'desktop.qrcode'], + ['for' => 'home.qrcode'], ['text' => urlencode($pushUrl)] ); @@ -96,15 +96,15 @@ class TestController extends Controller } /** - * @Post("/smser", name="admin.test.smser") + * @Post("/sms", name="admin.test.sms") */ - public function smserAction() + public function smsAction() { $phone = $this->request->getPost('phone', 'string'); - $smserService = new TestSmserService(); + $smsService = new TestSmsService(); - $response = $smserService->handle($phone); + $response = $smsService->handle($phone); if ($response) { return $this->jsonSuccess(['msg' => '发送短信成功,请到收件箱确认']); @@ -114,15 +114,15 @@ class TestController extends Controller } /** - * @Post("/mailer", name="admin.test.mailer") + * @Post("/mail", name="admin.test.mail") */ - public function mailerAction() + public function mailAction() { $email = $this->request->getPost('email', 'string'); - $mailerService = new TestMailerService(); + $mailService = new TestMailService(); - $result = $mailerService->handle($email); + $result = $mailService->handle($email); if ($result) { return $this->jsonSuccess(['msg' => '发送邮件成功,请到收件箱确认']); diff --git a/app/Http/Admin/Controllers/UploadController.php b/app/Http/Admin/Controllers/UploadController.php index eb251179..86709468 100644 --- a/app/Http/Admin/Controllers/UploadController.php +++ b/app/Http/Admin/Controllers/UploadController.php @@ -53,13 +53,13 @@ class UploadController extends Controller } /** - * @Post("/editor/img", name="admin.upload.editor_img") + * @Post("/content/img", name="admin.upload.content_img") */ - public function uploadEditorImageAction() + public function uploadContentImageAction() { $service = new StorageService(); - $file = $service->uploadEditorImage(); + $file = $service->uploadContentImage(); if ($file) { return $this->jsonSuccess([ diff --git a/app/Http/Admin/Controllers/VodController.php b/app/Http/Admin/Controllers/VodController.php index f319a578..d2ffdfa5 100644 --- a/app/Http/Admin/Controllers/VodController.php +++ b/app/Http/Admin/Controllers/VodController.php @@ -3,7 +3,6 @@ namespace App\Http\Admin\Controllers; use App\Services\Vod as VodService; -use Phalcon\Mvc\View; /** * @RoutePrefix("/admin/vod") @@ -31,10 +30,9 @@ class VodController extends Controller $chapterId = $this->request->getQuery('chapter_id', 'int'); $playUrl = $this->request->getQuery('play_url', 'string'); - $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); $this->view->pick('public/vod_player'); $this->view->setVar('chapter_id', $chapterId); - $this->view->setVar('play_url', urldecode($playUrl)); + $this->view->setVar('play_url', $playUrl); } } diff --git a/app/Http/Admin/Services/AlipayTest.php b/app/Http/Admin/Services/AlipayTest.php index 832f0514..dfc9269f 100644 --- a/app/Http/Admin/Services/AlipayTest.php +++ b/app/Http/Admin/Services/AlipayTest.php @@ -20,7 +20,7 @@ class AlipayTest extends PayTest if ($code) { $codeUrl = $this->url->get( - ['for' => 'desktop.qrcode'], + ['for' => 'home.qrcode'], ['text' => urlencode($code)] ); } diff --git a/app/Http/Admin/Services/AuthNode.php b/app/Http/Admin/Services/AuthNode.php index c30d4d0f..44482bb0 100644 --- a/app/Http/Admin/Services/AuthNode.php +++ b/app/Http/Admin/Services/AuthNode.php @@ -385,25 +385,25 @@ class AuthNode extends Service 'id' => '2-5-1', 'title' => '轮播列表', 'type' => 'menu', - 'route' => 'admin.carousel.list', + 'route' => 'admin.slide.list', ], [ 'id' => '2-5-2', 'title' => '添加轮播', 'type' => 'menu', - 'route' => 'admin.carousel.add', + 'route' => 'admin.slide.add', ], [ 'id' => '2-5-3', 'title' => '编辑轮播', 'type' => 'button', - 'route' => 'admin.carousel.edit', + 'route' => 'admin.slide.edit', ], [ 'id' => '2-5-4', 'title' => '删除轮播', 'type' => 'button', - 'route' => 'admin.carousel.delete', + 'route' => 'admin.slide.delete', ], ], ], @@ -675,13 +675,13 @@ class AuthNode extends Service 'id' => '5-1-6', 'title' => '短信设置', 'type' => 'menu', - 'route' => 'admin.setting.smser', + 'route' => 'admin.setting.sms', ], [ 'id' => '5-1-7', 'title' => '邮件设置', 'type' => 'menu', - 'route' => 'admin.setting.mailer', + 'route' => 'admin.setting.mail', ], [ 'id' => '5-1-8', diff --git a/app/Http/Admin/Services/Chapter.php b/app/Http/Admin/Services/Chapter.php index 11d94fb6..4eeb8264 100644 --- a/app/Http/Admin/Services/Chapter.php +++ b/app/Http/Admin/Services/Chapter.php @@ -3,7 +3,7 @@ namespace App\Http\Admin\Services; use App\Caches\Chapter as ChapterCache; -use App\Caches\CourseChapterList as CourseCatalogCache; +use App\Caches\CourseChapterList as CatalogCache; use App\Models\Chapter as ChapterModel; use App\Models\ChapterLive as ChapterLiveModel; use App\Models\ChapterRead as ChapterReadModel; @@ -249,7 +249,7 @@ class Chapter extends Service protected function rebuildCatalogCache(ChapterModel $chapter) { - $cache = new CourseCatalogCache(); + $cache = new CatalogCache(); $cache->rebuild($chapter->course_id); } diff --git a/app/Http/Admin/Services/ChapterContent.php b/app/Http/Admin/Services/ChapterContent.php index 1fbc24c6..665992bf 100644 --- a/app/Http/Admin/Services/ChapterContent.php +++ b/app/Http/Admin/Services/ChapterContent.php @@ -2,6 +2,7 @@ namespace App\Http\Admin\Services; +use App\Caches\CourseChapterList as CatalogCache; use App\Library\Utils\Word as WordUtil; use App\Models\Chapter as ChapterModel; use App\Models\Course as CourseModel; @@ -63,6 +64,8 @@ class ChapterContent extends Service $this->updateChapterRead($chapter); break; } + + $this->rebuildCatalogCache($chapter); } protected function updateChapterVod(ChapterModel $chapter) @@ -166,4 +169,11 @@ class ChapterContent extends Service $courseStats->updateReadAttrs($chapter->course_id); } + protected function rebuildCatalogCache(ChapterModel $chapter) + { + $cache = new CatalogCache(); + + $cache->rebuild($chapter->course_id); + } + } diff --git a/app/Http/Admin/Services/Course.php b/app/Http/Admin/Services/Course.php index 503e96b2..9dba1d7c 100644 --- a/app/Http/Admin/Services/Course.php +++ b/app/Http/Admin/Services/Course.php @@ -21,7 +21,7 @@ use App\Repos\CourseCategory as CourseCategoryRepo; use App\Repos\CourseRelated as CourseRelatedRepo; use App\Repos\CourseUser as CourseUserRepo; use App\Repos\User as UserRepo; -use App\Services\Syncer\CourseIndex as CourseIndexSyncer; +use App\Services\Sync\CourseIndex as CourseIndexSync; use App\Validators\Course as CourseValidator; class Course extends Service @@ -363,9 +363,9 @@ class Course extends Service protected function rebuildCourseIndex(CourseModel $course) { - $syncer = new CourseIndexSyncer(); + $sync = new CourseIndexSync(); - $syncer->addItem($course->id); + $sync->addItem($course->id); } protected function saveTeachers(CourseModel $course, $teacherIds) diff --git a/app/Http/Admin/Services/Session.php b/app/Http/Admin/Services/Session.php index 41064122..9ce79803 100644 --- a/app/Http/Admin/Services/Session.php +++ b/app/Http/Admin/Services/Session.php @@ -24,7 +24,7 @@ class Session extends Service $currentUser = $this->getCurrentUser(); if ($currentUser->id > 0) { - $this->response->redirect(['for' => 'desktop.index']); + $this->response->redirect(['for' => 'home.index']); } $post = $this->request->getPost(); @@ -33,7 +33,7 @@ class Session extends Service $user = $accountValidator->checkAdminLogin($post['account'], $post['password']); - $captchaSettings = $this->getSectionSettings('captcha'); + $captchaSettings = $this->getSettings('captcha'); /** * 验证码是一次性的,放到最后检查,减少第三方调用 diff --git a/app/Http/Admin/Services/Setting.php b/app/Http/Admin/Services/Setting.php index e6a18d10..f5b6ee0b 100644 --- a/app/Http/Admin/Services/Setting.php +++ b/app/Http/Admin/Services/Setting.php @@ -11,18 +11,18 @@ class Setting extends Service public function getAlipaySettings() { - $alipay = $this->getSectionSettings('pay.alipay'); + $alipay = $this->getSettings('pay.alipay'); - $alipay['notify_url'] = $alipay['notify_url'] ?: kg_full_url(['for' => 'desktop.alipay_notify']); + $alipay['notify_url'] = $alipay['notify_url'] ?: kg_full_url(['for' => 'home.alipay_notify']); return $alipay; } public function getWxpaySettings() { - $wxpay = $this->getSectionSettings('pay.wxpay'); + $wxpay = $this->getSettings('pay.wxpay'); - $wxpay['notify_url'] = $wxpay['notify_url'] ?: kg_full_url(['for' => 'desktop.wxpay_notify']); + $wxpay['notify_url'] = $wxpay['notify_url'] ?: kg_full_url(['for' => 'home.wxpay_notify']); return $wxpay; } @@ -36,20 +36,20 @@ class Setting extends Service public function getLiveSettings($section) { - $result = $this->getSectionSettings($section); + $result = $this->getSettings($section); if ($section == 'live.notify') { - $result['stream_begin_url'] = $result['stream_begin_url'] ?: kg_full_url(['for' => 'desktop.live_notify'], ['action' => 'streamBegin']); - $result['stream_end_url'] = $result['stream_end_url'] ?: kg_full_url(['for' => 'desktop.live_notify'], ['action' => 'streamEnd']); - $result['record_url'] = $result['record_url'] ?: kg_full_url(['for' => 'desktop.live_notify'], ['action' => 'record']); - $result['snapshot_url'] = $result['snapshot_url'] ?: kg_full_url(['for' => 'desktop.live_notify'], ['action' => 'snapshot']); - $result['porn_url'] = $result['porn_url'] ?: kg_full_url(['for' => 'desktop.live_notify'], ['action' => 'porn']); + $result['stream_begin_url'] = $result['stream_begin_url'] ?: kg_full_url(['for' => 'home.live_notify'], ['action' => 'streamBegin']); + $result['stream_end_url'] = $result['stream_end_url'] ?: kg_full_url(['for' => 'home.live_notify'], ['action' => 'streamEnd']); + $result['record_url'] = $result['record_url'] ?: kg_full_url(['for' => 'home.live_notify'], ['action' => 'record']); + $result['snapshot_url'] = $result['snapshot_url'] ?: kg_full_url(['for' => 'home.live_notify'], ['action' => 'snapshot']); + $result['porn_url'] = $result['porn_url'] ?: kg_full_url(['for' => 'home.live_notify'], ['action' => 'porn']); } return $result; } - public function getSectionSettings($section) + public function getSettings($section) { $settingsRepo = new SettingRepo(); @@ -112,7 +112,7 @@ class Setting extends Service $this->updateSectionSettings($section, $settings); } - public function updateSmserSettings($section, $settings) + public function updateSmsSettings($section, $settings) { $settings['template'] = kg_json_encode($settings['template']); diff --git a/app/Http/Admin/Services/Carousel.php b/app/Http/Admin/Services/Slide.php similarity index 52% rename from app/Http/Admin/Services/Carousel.php rename to app/Http/Admin/Services/Slide.php index cd746de6..54c7895b 100644 --- a/app/Http/Admin/Services/Carousel.php +++ b/app/Http/Admin/Services/Slide.php @@ -2,16 +2,16 @@ namespace App\Http\Admin\Services; -use App\Caches\IndexCarouselList as IndexCarouselListCache; +use App\Caches\IndexSlideList as IndexSlideListCache; use App\Library\Paginator\Query as PagerQuery; -use App\Models\Carousel as CarouselModel; -use App\Repos\Carousel as CarouselRepo; -use App\Validators\Carousel as CarouselValidator; +use App\Models\Slide as SlideModel; +use App\Repos\Slide as SlideRepo; +use App\Validators\Slide as SlideValidator; -class Carousel extends Service +class Slide extends Service { - public function getCarousels() + public function getSlides() { $pagerQuery = new PagerQuery(); @@ -23,55 +23,55 @@ class Carousel extends Service $page = $pagerQuery->getPage(); $limit = $pagerQuery->getLimit(); - $carouselRepo = new CarouselRepo(); + $slideRepo = new SlideRepo(); - return $carouselRepo->paginate($params, $sort, $page, $limit); + return $slideRepo->paginate($params, $sort, $page, $limit); } - public function getCarousel($id) + public function getSlide($id) { return $this->findOrFail($id); } - public function createCarousel() + public function createSlide() { $post = $this->request->getPost(); - $validator = new CarouselValidator(); + $validator = new SlideValidator(); $data['title'] = $validator->checkTitle($post['title']); $data['target'] = $validator->checkTarget($post['target']); - if ($post['target'] == CarouselModel::TARGET_COURSE) { + if ($post['target'] == SlideModel::TARGET_COURSE) { $course = $validator->checkCourse($post['content']); $data['content'] = $course->id; $data['cover'] = $course->cover; $data['summary'] = $course->summary; - } elseif ($post['target'] == CarouselModel::TARGET_PAGE) { + } elseif ($post['target'] == SlideModel::TARGET_PAGE) { $page = $validator->checkPage($post['content']); $data['content'] = $page->id; - } elseif ($post['target'] == CarouselModel::TARGET_LINK) { + } elseif ($post['target'] == SlideModel::TARGET_LINK) { $data['content'] = $validator->checkLink($post['content']); } $data['priority'] = 20; - $carousel = new CarouselModel(); + $slide = new SlideModel(); - $carousel->create($data); + $slide->create($data); - $this->rebuildCarouselCache(); + $this->rebuildSlideCache(); - return $carousel; + return $slide; } - public function updateCarousel($id) + public function updateSlide($id) { - $carousel = $this->findOrFail($id); + $slide = $this->findOrFail($id); $post = $this->request->getPost(); - $validator = new CarouselValidator(); + $validator = new SlideValidator(); $data = []; @@ -87,18 +87,14 @@ class Carousel extends Service $data['cover'] = $validator->checkCover($post['cover']); } - if (isset($post['style']['bg_color'])) { - $data['style']['bg_color'] = $validator->checkBgColor($post['style']['bg_color']); - } - if (isset($post['content'])) { - if ($carousel->target == CarouselModel::TARGET_COURSE) { + if ($slide->target == SlideModel::TARGET_COURSE) { $course = $validator->checkCourse($post['content']); $data['content'] = $course->id; - } elseif ($carousel->target == CarouselModel::TARGET_PAGE) { + } elseif ($slide->target == SlideModel::TARGET_PAGE) { $page = $validator->checkPage($post['content']); $data['content'] = $page->id; - } elseif ($carousel->target == CarouselModel::TARGET_LINK) { + } elseif ($slide->target == SlideModel::TARGET_LINK) { $data['content'] = $validator->checkLink($post['content']); } } @@ -111,51 +107,51 @@ class Carousel extends Service $data['published'] = $validator->checkPublishStatus($post['published']); } - $carousel->update($data); + $slide->update($data); - $this->rebuildCarouselCache(); + $this->rebuildSlideCache(); - return $carousel; + return $slide; } - public function deleteCarousel($id) + public function deleteSlide($id) { - $carousel = $this->findOrFail($id); + $slide = $this->findOrFail($id); - $carousel->deleted = 1; + $slide->deleted = 1; - $carousel->update(); + $slide->update(); - $this->rebuildCarouselCache(); + $this->rebuildSlideCache(); - return $carousel; + return $slide; } - public function restoreCarousel($id) + public function restoreSlide($id) { - $carousel = $this->findOrFail($id); + $slide = $this->findOrFail($id); - $carousel->deleted = 0; + $slide->deleted = 0; - $carousel->update(); + $slide->update(); - $this->rebuildCarouselCache(); + $this->rebuildSlideCache(); - return $carousel; + return $slide; } - protected function rebuildCarouselCache() + protected function rebuildSlideCache() { - $cache = new IndexCarouselListCache(); + $cache = new IndexSlideListCache(); $cache->rebuild(); } protected function findOrFail($id) { - $validator = new CarouselValidator(); + $validator = new SlideValidator(); - return $validator->checkCarousel($id); + return $validator->checkSlide($id); } } diff --git a/app/Http/Admin/Views/carousel/add.volt b/app/Http/Admin/Views/carousel/add.volt index a1a7e1e2..ba0cb7f9 100644 --- a/app/Http/Admin/Views/carousel/add.volt +++ b/app/Http/Admin/Views/carousel/add.volt @@ -2,7 +2,7 @@ {% block content %} - +
    添加轮播
    @@ -15,9 +15,9 @@
    - - - + + +
    diff --git a/app/Http/Admin/Views/carousel/edit.volt b/app/Http/Admin/Views/carousel/edit.volt index b2381874..03c453bd 100644 --- a/app/Http/Admin/Views/carousel/edit.volt +++ b/app/Http/Admin/Views/carousel/edit.volt @@ -3,67 +3,58 @@ {% block content %} {%- macro content_label(target) %} - {% if target == 'course' %} + {% if target == 1 %} 课程编号 - {% elseif target == 'page' %} + {% elseif target == 2 %} 单页编号 - {% elseif target == 'link' %} + {% elseif target == 3 %} 链接地址 {% endif %} {%- endmacro %} - +
    编辑轮播
    - - + +
    -
    - -
    - -
    -
    -
    -
    -
    - +
    - +
    - +
    - +
    - +
    - - + +
    @@ -81,28 +72,4 @@ {{ js_include('admin/js/cover.upload.js') }} -{% endblock %} - -{% block inline_js %} - - - {% endblock %} \ No newline at end of file diff --git a/app/Http/Admin/Views/carousel/list.volt b/app/Http/Admin/Views/carousel/list.volt index c60351b5..fb832a23 100644 --- a/app/Http/Admin/Views/carousel/list.volt +++ b/app/Http/Admin/Views/carousel/list.volt @@ -3,17 +3,15 @@ {% block content %} {%- macro target_info(value) %} - {% if value == 'course' %} + {% if value == 1 %} 课程 - {% elseif value == 'page' %} + {% elseif value == 2 %} 单页 - {% elseif value == 'link' %} - 链接 + {% elseif value == 3 %} + 链接 {% endif %} {%- endmacro %} - {% set add_url = url({'for':'admin.carousel.add'}) %} -
    @@ -43,16 +41,16 @@ {% for item in pager.items %} - {% set edit_url = url({'for':'admin.carousel.edit','id':item.id}) %} - {% set update_url = url({'for':'admin.carousel.update','id':item.id}) %} - {% set delete_url = url({'for':'admin.carousel.delete','id':item.id}) %} - {% set restore_url = url({'for':'admin.carousel.restore','id':item.id}) %} + {% set edit_url = url({'for':'admin.slide.edit','id':item.id}) %} + {% set update_url = url({'for':'admin.slide.update','id':item.id}) %} + {% set delete_url = url({'for':'admin.slide.delete','id':item.id}) %} + {% set restore_url = url({'for':'admin.slide.restore','id':item.id}) %} {{ item.id }} - {{ item.title }} + {{ item.title }} {{ target_info(item.target) }} - +
    diff --git a/app/Http/Admin/Views/category/edit.volt b/app/Http/Admin/Views/category/edit.volt index 0d12f1eb..13bc5302 100644 --- a/app/Http/Admin/Views/category/edit.volt +++ b/app/Http/Admin/Views/category/edit.volt @@ -21,8 +21,8 @@
    - - + +
    diff --git a/app/Http/Admin/Views/category/list.volt b/app/Http/Admin/Views/category/list.volt index 840af593..6a2e9b04 100644 --- a/app/Http/Admin/Views/category/list.volt +++ b/app/Http/Admin/Views/category/list.volt @@ -61,7 +61,7 @@ {{ item.level }} {{ item.child_count }} - +
    diff --git a/app/Http/Admin/Views/chapter/edit_lesson.volt b/app/Http/Admin/Views/chapter/edit_lesson.volt index 802c973e..69bfd8d1 100644 --- a/app/Http/Admin/Views/chapter/edit_lesson.volt +++ b/app/Http/Admin/Views/chapter/edit_lesson.volt @@ -41,7 +41,7 @@ {% block link_css %} - {% if chapter.model == '3' %} + {% if chapter.model == 3 %} {{ css_link('https://cdn.jsdelivr.net/npm/vditor/dist/index.css', false) }} {% endif %} @@ -49,12 +49,12 @@ {% block include_js %} - {% if chapter.model == '3' %} + {% if chapter.model == 3 %} {{ js_include('https://cdn.jsdelivr.net/npm/vditor/dist/index.min.js', false) }} {{ js_include('admin/js/vditor.js') }} - {% elseif chapter.model == '1' %} + {% elseif chapter.model == 1 %} {{ js_include('lib/vod-js-sdk-v6.min.js') }} {{ js_include('lib/clipboard.min.js') }} diff --git a/app/Http/Admin/Views/chapter/lessons_live.volt b/app/Http/Admin/Views/chapter/lessons_live.volt index 649374af..8ecd0f97 100644 --- a/app/Http/Admin/Views/chapter/lessons_live.volt +++ b/app/Http/Admin/Views/chapter/lessons_live.volt @@ -42,7 +42,7 @@ {% for item in lessons %} - {% set preview_url = url({'for':'desktop.chapter.show','id':item.id}) %} + {% set preview_url = url({'for':'home.chapter.show','id':item.id}) %} {% set edit_url = url({'for':'admin.chapter.edit','id':item.id}) %} {% set update_url = url({'for':'admin.chapter.update','id':item.id}) %} {% set delete_url = url({'for':'admin.chapter.delete','id':item.id}) %} @@ -56,8 +56,8 @@ {{ live_time_info(item.attrs) }} {{ live_status_info(item.attrs['stream']['status']) }} - - + +
    diff --git a/app/Http/Admin/Views/chapter/lessons_read.volt b/app/Http/Admin/Views/chapter/lessons_read.volt index af794cbf..e5fdacb0 100644 --- a/app/Http/Admin/Views/chapter/lessons_read.volt +++ b/app/Http/Admin/Views/chapter/lessons_read.volt @@ -21,7 +21,7 @@ {% for item in lessons %} - {% set preview_url = url({'for':'desktop.chapter.show','id':item.id}) %} + {% set preview_url = url({'for':'home.chapter.show','id':item.id}) %} {% set edit_url = url({'for':'admin.chapter.edit','id':item.id}) %} {% set update_url = url({'for':'admin.chapter.update','id':item.id}) %} {% set delete_url = url({'for':'admin.chapter.delete','id':item.id}) %} @@ -34,8 +34,8 @@ {{ item.attrs['word_count'] }} - - + +
    diff --git a/app/Http/Admin/Views/chapter/lessons_vod.volt b/app/Http/Admin/Views/chapter/lessons_vod.volt index 93777824..838017da 100644 --- a/app/Http/Admin/Views/chapter/lessons_vod.volt +++ b/app/Http/Admin/Views/chapter/lessons_vod.volt @@ -37,7 +37,7 @@ {% for item in lessons %} - {% set preview_url = url({'for':'desktop.chapter.show','id':item.id}) %} + {% set preview_url = url({'for':'home.chapter.show','id':item.id}) %} {% set edit_url = url({'for':'admin.chapter.edit','id':item.id}) %} {% set update_url = url({'for':'admin.chapter.update','id':item.id}) %} {% set delete_url = url({'for':'admin.chapter.delete','id':item.id}) %} @@ -51,8 +51,8 @@ {{ file_status(item.attrs['file']['status']) }} {{ item.attrs['duration']|duration }} - - + +
    diff --git a/app/Http/Admin/Views/consult/list.volt b/app/Http/Admin/Views/consult/list.volt index 2ab73896..21a74f8d 100644 --- a/app/Http/Admin/Views/consult/list.volt +++ b/app/Http/Admin/Views/consult/list.volt @@ -57,7 +57,7 @@

    编号:{{ item.owner.id }}

    {{ date('Y-m-d H:i:s',item.create_time) }} - +
    diff --git a/app/Http/Admin/Views/course/edit_basic.volt b/app/Http/Admin/Views/course/edit_basic.volt index 7d3d5703..e28afa78 100644 --- a/app/Http/Admin/Views/course/edit_basic.volt +++ b/app/Http/Admin/Views/course/edit_basic.volt @@ -30,10 +30,10 @@
    - - - - + + + +
    diff --git a/app/Http/Admin/Views/course/list.volt b/app/Http/Admin/Views/course/list.volt index 7022c87d..9580510d 100644 --- a/app/Http/Admin/Views/course/list.volt +++ b/app/Http/Admin/Views/course/list.volt @@ -69,7 +69,7 @@ {% for item in pager.items %} - {% set preview_url = url({'for':'desktop.course.show','id':item.id}) %} + {% set preview_url = url({'for':'home.course.show','id':item.id}) %} {% set edit_url = url({'for':'admin.course.edit','id':item.id}) %} {% set update_url = url({'for':'admin.course.update','id':item.id}) %} {% set delete_url = url({'for':'admin.course.delete','id':item.id}) %} @@ -97,7 +97,7 @@

    市场:{{ '¥%0.2f'|format(item.market_price) }}

    会员:{{ '¥%0.2f'|format(item.vip_price) }}

    - +
    diff --git a/app/Http/Admin/Views/help/edit.volt b/app/Http/Admin/Views/help/edit.volt index 4d9ab1d4..72cf83dd 100644 --- a/app/Http/Admin/Views/help/edit.volt +++ b/app/Http/Admin/Views/help/edit.volt @@ -39,8 +39,8 @@
    - - + +
    diff --git a/app/Http/Admin/Views/help/list.volt b/app/Http/Admin/Views/help/list.volt index c930b3db..f7926df5 100644 --- a/app/Http/Admin/Views/help/list.volt +++ b/app/Http/Admin/Views/help/list.volt @@ -32,7 +32,7 @@ {% for item in helps %} {% set list_url = url({'for':'admin.help.list'},{'category_id':item.category.id}) %} - {% set preview_url = url({'for':'desktop.help.show','id':item.id}) %} + {% set preview_url = url({'for':'home.help.show','id':item.id}) %} {% set edit_url = url({'for':'admin.help.edit','id':item.id}) %} {% set update_url = url({'for':'admin.help.update','id':item.id}) %} {% set delete_url = url({'for':'admin.help.delete','id':item.id}) %} @@ -42,7 +42,7 @@ {{ item.title }} {{ item.category.name }} - +
    diff --git a/app/Http/Admin/Views/im/group/edit.volt b/app/Http/Admin/Views/im/group/edit.volt index 10be069f..1a3b7cb1 100644 --- a/app/Http/Admin/Views/im/group/edit.volt +++ b/app/Http/Admin/Views/im/group/edit.volt @@ -37,8 +37,8 @@
    - - + +
    diff --git a/app/Http/Admin/Views/im/group/list.volt b/app/Http/Admin/Views/im/group/list.volt index d304bba3..6570f894 100644 --- a/app/Http/Admin/Views/im/group/list.volt +++ b/app/Http/Admin/Views/im/group/list.volt @@ -49,7 +49,7 @@ {% for item in pager.items %} - {% set preview_url = url({'for':'desktop.group.show','id':item.id}) %} + {% set preview_url = url({'for':'home.group.show','id':item.id}) %} {% set edit_url = url({'for':'admin.group.edit','id':item.id}) %} {% set update_url = url({'for':'admin.group.update','id':item.id}) %} {% set delete_url = url({'for':'admin.group.delete','id':item.id}) %} @@ -59,7 +59,7 @@ {{ item.name }} {{ type_info(item.type) }} {{ owner_info(item.owner) }} {{ item.user_count }} - +
    diff --git a/app/Http/Admin/Views/index/index.volt b/app/Http/Admin/Views/index/index.volt index c14f300f..e0973609 100644 --- a/app/Http/Admin/Views/index/index.volt +++ b/app/Http/Admin/Views/index/index.volt @@ -28,13 +28,13 @@
  • {{ auth_user.name }}
    -
    基本资料
    -
    安全设置
    +
    基本资料
    +
    安全设置
    退出登录
  • - 前台 + 前台
diff --git a/app/Http/Admin/Views/index/main_app_info.volt b/app/Http/Admin/Views/index/main_app_info.volt index 33661931..e5199d2e 100644 --- a/app/Http/Admin/Views/index/main_app_info.volt +++ b/app/Http/Admin/Views/index/main_app_info.volt @@ -19,7 +19,7 @@ 获取渠道 Gitee  - Github + Github diff --git a/app/Http/Admin/Views/nav/edit.volt b/app/Http/Admin/Views/nav/edit.volt index 60ad58ad..fd7673e3 100644 --- a/app/Http/Admin/Views/nav/edit.volt +++ b/app/Http/Admin/Views/nav/edit.volt @@ -27,22 +27,22 @@
- - + +
- - + +
- - + +
diff --git a/app/Http/Admin/Views/nav/list.volt b/app/Http/Admin/Views/nav/list.volt index 2e6a65ab..669a1eed 100644 --- a/app/Http/Admin/Views/nav/list.volt +++ b/app/Http/Admin/Views/nav/list.volt @@ -82,7 +82,7 @@ {{ position_info(item.position) }} {{ target_info(item.target) }} - +
diff --git a/app/Http/Admin/Views/package/list.volt b/app/Http/Admin/Views/package/list.volt index 49940aee..e319bd11 100644 --- a/app/Http/Admin/Views/package/list.volt +++ b/app/Http/Admin/Views/package/list.volt @@ -43,7 +43,7 @@ {{ item.course_count }} {{ '¥%0.2f'|format(item.market_price) }} {{ '¥%0.2f'|format(item.vip_price) }} - +
diff --git a/app/Http/Admin/Views/page/edit.volt b/app/Http/Admin/Views/page/edit.volt index cc4d7232..d7eaca4e 100644 --- a/app/Http/Admin/Views/page/edit.volt +++ b/app/Http/Admin/Views/page/edit.volt @@ -22,8 +22,8 @@
- - + +
diff --git a/app/Http/Admin/Views/page/list.volt b/app/Http/Admin/Views/page/list.volt index 99e8a4c2..5e7a5062 100644 --- a/app/Http/Admin/Views/page/list.volt +++ b/app/Http/Admin/Views/page/list.volt @@ -31,7 +31,7 @@ {% for item in pager.items %} - {% set preview_url = url({'for':'desktop.page.show','id':item.id}) %} + {% set preview_url = url({'for':'home.page.show','id':item.id}) %} {% set edit_url = url({'for':'admin.page.edit','id':item.id}) %} {% set update_url = url({'for':'admin.page.update','id':item.id}) %} {% set delete_url = url({'for':'admin.page.delete','id':item.id}) %} @@ -40,7 +40,7 @@ {{ item.title }} {{ date('Y-m-d H:i',item.create_time) }} {{ date('Y-m-d H:i',item.update_time) }} - +
diff --git a/app/Http/Admin/Views/public/forbidden.volt b/app/Http/Admin/Views/public/forbidden.volt index 35cf5cd1..28975e59 100644 --- a/app/Http/Admin/Views/public/forbidden.volt +++ b/app/Http/Admin/Views/public/forbidden.volt @@ -19,6 +19,6 @@ {% block link_css %} - {{ css_link("desktop/css/error.css") }} + {{ css_link("home/css/error.css") }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Admin/Views/public/live_player.volt b/app/Http/Admin/Views/public/live_player.volt index a6d3f352..334eb6e5 100644 --- a/app/Http/Admin/Views/public/live_player.volt +++ b/app/Http/Admin/Views/public/live_player.volt @@ -18,7 +18,7 @@ {% block inline_js %} - + diff --git a/app/Http/Admin/Views/public/login.volt b/app/Http/Admin/Views/public/login.volt index 5e583d7d..d2afecea 100644 --- a/app/Http/Admin/Views/public/login.volt +++ b/app/Http/Admin/Views/public/login.volt @@ -26,7 +26,7 @@ {% endif %}
- {% set disabled = captcha.enabled ? 'disabled' : '' %} + {% set disabled = captcha.enabled ? 'disabled="disabled"' : '' %} @@ -71,7 +71,7 @@ var $ = layui.jquery; - var captcha = new TencentCaptcha( + new TencentCaptcha( $('#captcha-btn')[0], $('#captcha-btn').data('app-id'), function (res) { diff --git a/app/Http/Admin/Views/public/vod_player.volt b/app/Http/Admin/Views/public/vod_player.volt index 63c1c400..12489974 100644 --- a/app/Http/Admin/Views/public/vod_player.volt +++ b/app/Http/Admin/Views/public/vod_player.volt @@ -1,31 +1,38 @@ - - - - - - 视频点播 - +{% extends 'templates/main.volt' %} + +{% block content %} + +
+ +{% endblock %} + +{% block inline_css %} + - - -
- - - - \ No newline at end of file + + +{% endblock %} \ No newline at end of file diff --git a/app/Http/Admin/Views/review/list.volt b/app/Http/Admin/Views/review/list.volt index 30ae9ef3..3e61817e 100644 --- a/app/Http/Admin/Views/review/list.volt +++ b/app/Http/Admin/Views/review/list.volt @@ -54,7 +54,7 @@

昵称:{{ item.owner.name }}

编号:{{ item.owner.id }}

- +
diff --git a/app/Http/Admin/Views/role/edit.volt b/app/Http/Admin/Views/role/edit.volt index 23afcd58..d54835c6 100644 --- a/app/Http/Admin/Views/role/edit.volt +++ b/app/Http/Admin/Views/role/edit.volt @@ -31,7 +31,7 @@ {{ level2.title }} {% for level3 in level2.children %} - + {% endfor %} diff --git a/app/Http/Admin/Views/setting/im_cs.volt b/app/Http/Admin/Views/setting/im_cs.volt index b21920dc..156633c5 100644 --- a/app/Http/Admin/Views/setting/im_cs.volt +++ b/app/Http/Admin/Views/setting/im_cs.volt @@ -2,8 +2,8 @@
- - + +
diff --git a/app/Http/Admin/Views/setting/im_main.volt b/app/Http/Admin/Views/setting/im_main.volt index 7776e094..3e392a17 100644 --- a/app/Http/Admin/Views/setting/im_main.volt +++ b/app/Http/Admin/Views/setting/im_main.volt @@ -14,29 +14,29 @@
- - + +
- - + +
- - + +
- - + +
diff --git a/app/Http/Admin/Views/setting/live_pull.volt b/app/Http/Admin/Views/setting/live_pull.volt index 7990554a..d8cc833c 100644 --- a/app/Http/Admin/Views/setting/live_pull.volt +++ b/app/Http/Admin/Views/setting/live_pull.volt @@ -8,8 +8,8 @@
- - + +
@@ -24,8 +24,8 @@
- - + +
@@ -48,8 +48,8 @@
- - + +
diff --git a/app/Http/Admin/Views/setting/live_push.volt b/app/Http/Admin/Views/setting/live_push.volt index 6eaeb1b2..6550b759 100644 --- a/app/Http/Admin/Views/setting/live_push.volt +++ b/app/Http/Admin/Views/setting/live_push.volt @@ -16,8 +16,8 @@
- - + +
diff --git a/app/Http/Admin/Views/setting/live_push_test.volt b/app/Http/Admin/Views/setting/live_push_test.volt index 45430f41..969c162f 100644 --- a/app/Http/Admin/Views/setting/live_push_test.volt +++ b/app/Http/Admin/Views/setting/live_push_test.volt @@ -17,7 +17,7 @@
- +
复制 diff --git a/app/Http/Admin/Views/setting/mailer.volt b/app/Http/Admin/Views/setting/mail.volt similarity index 79% rename from app/Http/Admin/Views/setting/mailer.volt rename to app/Http/Admin/Views/setting/mail.volt index 651114e9..440c3fe9 100644 --- a/app/Http/Admin/Views/setting/mailer.volt +++ b/app/Http/Admin/Views/setting/mail.volt @@ -2,60 +2,60 @@ {% block content %} - +
邮件配置
- +
- +
- +
- +
- - - + + +
- - + +
- +
- +
@@ -68,7 +68,7 @@
-
+
邮件测试
@@ -98,7 +98,7 @@ var $ = layui.jquery; var form = layui.form; - form.on('radio(smtp_auth)', function (data) { + form.on('radio(smtp_auth_enabled)', function (data) { var block = $('#smtp-auth-block'); if (data.value === '1') { block.show(); diff --git a/app/Http/Admin/Views/setting/pay_alipay.volt b/app/Http/Admin/Views/setting/pay_alipay.volt index b99f0581..3a773750 100644 --- a/app/Http/Admin/Views/setting/pay_alipay.volt +++ b/app/Http/Admin/Views/setting/pay_alipay.volt @@ -2,8 +2,8 @@
- - + +
diff --git a/app/Http/Admin/Views/setting/pay_wxpay.volt b/app/Http/Admin/Views/setting/pay_wxpay.volt index aec88276..14e7bf66 100644 --- a/app/Http/Admin/Views/setting/pay_wxpay.volt +++ b/app/Http/Admin/Views/setting/pay_wxpay.volt @@ -2,8 +2,8 @@
- - + +
diff --git a/app/Http/Admin/Views/setting/site.volt b/app/Http/Admin/Views/setting/site.volt index 3f994ab2..7d51d8b5 100644 --- a/app/Http/Admin/Views/setting/site.volt +++ b/app/Http/Admin/Views/setting/site.volt @@ -12,8 +12,8 @@
- - + +
@@ -27,8 +27,8 @@
- - + +
@@ -92,8 +92,8 @@
- - + +
diff --git a/app/Http/Admin/Views/setting/smser.volt b/app/Http/Admin/Views/setting/sms.volt similarity index 94% rename from app/Http/Admin/Views/setting/smser.volt rename to app/Http/Admin/Views/setting/sms.volt index a9ba080c..dbddfc49 100644 --- a/app/Http/Admin/Views/setting/smser.volt +++ b/app/Http/Admin/Views/setting/sms.volt @@ -2,28 +2,28 @@ {% block content %} - {% set template = smser.template|json_decode %} + {% set template = sms.template|json_decode %} - +
基础配置
- +
- +
- +
@@ -80,7 +80,7 @@
-
+
短信测试
diff --git a/app/Http/Admin/Views/setting/storage.volt b/app/Http/Admin/Views/setting/storage.volt index ced0f8ca..34ab1e62 100644 --- a/app/Http/Admin/Views/setting/storage.volt +++ b/app/Http/Admin/Views/setting/storage.volt @@ -21,8 +21,8 @@
- - + +
@@ -56,7 +56,7 @@ mageMogr2/thumbnail/270x/interlace/0 - carousel_1100 + slide_1100 imageMogr2/thumbnail/1100x/interlace/0 diff --git a/app/Http/Admin/Views/setting/vod.volt b/app/Http/Admin/Views/setting/vod.volt index bf2ba42d..fc8b7d55 100644 --- a/app/Http/Admin/Views/setting/vod.volt +++ b/app/Http/Admin/Views/setting/vod.volt @@ -13,8 +13,8 @@
- - + +
@@ -31,22 +31,22 @@
- - + +
- - + +
- - + +
@@ -63,8 +63,8 @@
- - + +
@@ -79,8 +79,8 @@
- - + +
diff --git a/app/Http/Admin/Views/topic/list.volt b/app/Http/Admin/Views/topic/list.volt index 029bcf84..295d1484 100644 --- a/app/Http/Admin/Views/topic/list.volt +++ b/app/Http/Admin/Views/topic/list.volt @@ -33,7 +33,7 @@ {% for item in pager.items %} - {% set preview_url = url({'for':'desktop.topic.show','id':item.id}) %} + {% set preview_url = url({'for':'home.topic.show','id':item.id}) %} {% set edit_url = url({'for':'admin.topic.edit','id':item.id}) %} {% set update_url = url({'for':'admin.topic.update','id':item.id}) %} {% set delete_url = url({'for':'admin.topic.delete','id':item.id}) %} @@ -44,7 +44,7 @@ {{ item.course_count }} {{ date('Y-m-d H:i',item.create_time) }} {{ date('Y-m-d H:i',item.update_time) }} - +
diff --git a/app/Http/Admin/Views/user/edit.volt b/app/Http/Admin/Views/user/edit.volt index f10cb96c..7a0fb973 100644 --- a/app/Http/Admin/Views/user/edit.volt +++ b/app/Http/Admin/Views/user/edit.volt @@ -29,18 +29,18 @@
- - + +
{% if auth_user.root == 1 %}
- + {% for role in roles %} {% if role.id > 1 %} - + {% endif %} {% endfor %}
diff --git a/app/Http/Admin/Views/user/list.volt b/app/Http/Admin/Views/user/list.volt index 15fde050..837e94cb 100644 --- a/app/Http/Admin/Views/user/list.volt +++ b/app/Http/Admin/Views/user/list.volt @@ -68,7 +68,7 @@ {% for item in pager.items %} - {% set preview_url = url({'for':'desktop.user.show','id':item.id}) %} + {% set preview_url = url({'for':'home.user.show','id':item.id}) %} {% set edit_url = url({'for':'admin.user.edit','id':item.id}) %} {{ item.id }} diff --git a/app/Http/Desktop/Views/teaching/menu.volt b/app/Http/Desktop/Views/teaching/menu.volt deleted file mode 100644 index 5ab72115..00000000 --- a/app/Http/Desktop/Views/teaching/menu.volt +++ /dev/null @@ -1,10 +0,0 @@ -
-
教学中心
- -
diff --git a/app/Http/Desktop/Views/topic/show.volt b/app/Http/Desktop/Views/topic/show.volt deleted file mode 100644 index 9d953fb7..00000000 --- a/app/Http/Desktop/Views/topic/show.volt +++ /dev/null @@ -1,19 +0,0 @@ -{% extends 'templates/main.volt' %} - -{% block content %} - - {% set courses_url = url({'for':'desktop.topic.courses','id':topic.id}) %} - -
-
{{ topic.title }}
-
- -
- -{% endblock %} - -{% block include_js %} - - {{ js_include('desktop/js/topic.show.js') }} - -{% endblock %} \ No newline at end of file diff --git a/app/Http/Desktop/Controllers/AccountController.php b/app/Http/Home/Controllers/AccountController.php similarity index 65% rename from app/Http/Desktop/Controllers/AccountController.php rename to app/Http/Home/Controllers/AccountController.php index 7b0749b9..92969579 100644 --- a/app/Http/Desktop/Controllers/AccountController.php +++ b/app/Http/Home/Controllers/AccountController.php @@ -1,12 +1,12 @@ authUser->id > 0) { - $this->response->redirect('/'); + return $this->response->redirect('/'); } $service = new AccountService(); - $captcha = $service->getSectionSettings('captcha'); + $captcha = $service->getSettings('captcha'); $returnUrl = $this->request->getHTTPReferer(); @@ -35,7 +35,7 @@ class AccountController extends Controller } /** - * @Post("/register", name="desktop.account.do_register") + * @Post("/register", name="home.account.do_register") */ public function doRegisterAction() { @@ -54,7 +54,7 @@ class AccountController extends Controller } /** - * @Get("/login", name="desktop.account.login") + * @Get("/login", name="home.account.login") */ public function loginAction() { @@ -64,7 +64,7 @@ class AccountController extends Controller $service = new AccountService(); - $captcha = $service->getSectionSettings('captcha'); + $captcha = $service->getSettings('captcha'); $returnUrl = $this->request->getHTTPReferer(); @@ -73,7 +73,7 @@ class AccountController extends Controller } /** - * @Post("/password/login", name="desktop.account.pwd_login") + * @Post("/password/login", name="home.account.pwd_login") */ public function loginByPasswordAction() { @@ -83,7 +83,7 @@ class AccountController extends Controller $returnUrl = $this->request->getPost('return_url', 'string'); - $location = $returnUrl ?: $this->url->get(['for' => 'desktop.index']); + $location = $returnUrl ?: $this->url->get(['for' => 'home.index']); $content = ['location' => $location]; @@ -91,7 +91,7 @@ class AccountController extends Controller } /** - * @Post("/verify/login", name="desktop.account.verify_login") + * @Post("/verify/login", name="home.account.verify_login") */ public function loginByVerifyAction() { @@ -101,7 +101,7 @@ class AccountController extends Controller $returnUrl = $this->request->getPost('return_url', 'string'); - $location = $returnUrl ?: $this->url->get(['for' => 'desktop.index']); + $location = $returnUrl ?: $this->url->get(['for' => 'home.index']); $content = ['location' => $location]; @@ -109,7 +109,7 @@ class AccountController extends Controller } /** - * @Get("/logout", name="desktop.account.logout") + * @Get("/logout", name="home.account.logout") */ public function logoutAction() { @@ -117,38 +117,38 @@ class AccountController extends Controller $service->logout(); - $this->response->redirect(['for' => 'desktop.index']); + $this->response->redirect(['for' => 'home.index']); } /** - * @Get("/password/forget", name="desktop.account.forget_pwd") + * @Get("/password/forget", name="home.account.forget_pwd") */ public function forgetPasswordAction() { if ($this->authUser->id > 0) { - $this->response->redirect(['for' => 'desktop.index']); + $this->response->redirect(['for' => 'home.index']); } $service = new AccountService(); - $captcha = $service->getSectionSettings('captcha'); + $captcha = $service->getSettings('captcha'); $this->view->pick('account/forget_password'); $this->view->setVar('captcha', $captcha); } /** - * @Get("/password/edit", name="desktop.account.edit_pwd") + * @Get("/password/edit", name="home.account.edit_pwd") */ public function editPasswordAction() { if ($this->authUser->id == 0) { - $this->response->redirect(['for' => 'desktop.account.login']); + $this->response->redirect(['for' => 'home.account.login']); } $service = new AccountService(); - $captcha = $service->getSectionSettings('captcha'); + $captcha = $service->getSettings('captcha'); $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); $this->view->pick('account/edit_password'); @@ -156,17 +156,17 @@ class AccountController extends Controller } /** - * @Get("/phone/edit", name="desktop.account.edit_phone") + * @Get("/phone/edit", name="home.account.edit_phone") */ public function editPhoneAction() { if ($this->authUser->id == 0) { - $this->response->redirect(['for' => 'desktop.account.login']); + $this->response->redirect(['for' => 'home.account.login']); } $service = new AccountService(); - $captcha = $service->getSectionSettings('captcha'); + $captcha = $service->getSettings('captcha'); $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); $this->view->pick('account/edit_phone'); @@ -174,17 +174,17 @@ class AccountController extends Controller } /** - * @Get("/email/edit", name="desktop.account.edit_email") + * @Get("/email/edit", name="home.account.edit_email") */ public function editEmailAction() { if ($this->authUser->id == 0) { - $this->response->redirect(['for' => 'desktop.account.login']); + $this->response->redirect(['for' => 'home.account.login']); } $service = new AccountService(); - $captcha = $service->getSectionSettings('captcha'); + $captcha = $service->getSettings('captcha'); $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); $this->view->pick('account/edit_email'); @@ -192,7 +192,7 @@ class AccountController extends Controller } /** - * @Post("/password/reset", name="desktop.account.reset_pwd") + * @Post("/password/reset", name="home.account.reset_pwd") */ public function resetPasswordAction() { @@ -200,7 +200,7 @@ class AccountController extends Controller $service->handle(); - $loginUrl = $this->url->get(['for' => 'desktop.account.login']); + $loginUrl = $this->url->get(['for' => 'home.account.login']); $content = [ 'location' => $loginUrl, @@ -211,7 +211,7 @@ class AccountController extends Controller } /** - * @Post("/phone/update", name="desktop.account.update_phone") + * @Post("/phone/update", name="home.account.update_phone") */ public function updatePhoneAction() { @@ -225,7 +225,7 @@ class AccountController extends Controller } /** - * @Post("/email/update", name="desktop.account.update_email") + * @Post("/email/update", name="home.account.update_email") */ public function updateEmailAction() { @@ -239,7 +239,7 @@ class AccountController extends Controller } /** - * @Post("/password/update", name="desktop.account.update_pwd") + * @Post("/password/update", name="home.account.update_pwd") */ public function updatePasswordAction() { diff --git a/app/Http/Desktop/Controllers/ChapterController.php b/app/Http/Home/Controllers/ChapterController.php similarity index 76% rename from app/Http/Desktop/Controllers/ChapterController.php rename to app/Http/Home/Controllers/ChapterController.php index 3438fa7b..1db71e31 100644 --- a/app/Http/Desktop/Controllers/ChapterController.php +++ b/app/Http/Home/Controllers/ChapterController.php @@ -1,14 +1,14 @@ response->redirect([ - 'for' => 'desktop.course.show', + return $this->response->redirect([ + 'for' => 'home.course.show', 'id' => $chapter['course']['id'], ]); } @@ -63,7 +63,7 @@ class ChapterController extends Controller } /** - * @Get("/{id:[0-9]+}/danmu", name="desktop.chapter.danmu") + * @Get("/{id:[0-9]+}/danmu", name="home.chapter.danmu") */ public function danmuAction($id) { @@ -75,7 +75,7 @@ class ChapterController extends Controller } /** - * @Post("/{id:[0-9]+}/like", name="desktop.chapter.like") + * @Post("/{id:[0-9]+}/like", name="home.chapter.like") */ public function likeAction($id) { @@ -91,7 +91,7 @@ class ChapterController extends Controller } /** - * @Post("/{id:[0-9]+}/learning", name="desktop.chapter.learning") + * @Post("/{id:[0-9]+}/learning", name="home.chapter.learning") */ public function learningAction($id) { diff --git a/app/Http/Desktop/Controllers/ConsultController.php b/app/Http/Home/Controllers/ConsultController.php similarity index 69% rename from app/Http/Desktop/Controllers/ConsultController.php rename to app/Http/Home/Controllers/ConsultController.php index e1d2078f..e31c1f32 100644 --- a/app/Http/Desktop/Controllers/ConsultController.php +++ b/app/Http/Home/Controllers/ConsultController.php @@ -1,13 +1,13 @@ siteInfo = $this->getSiteInfo(); - $this->authUser = $this->getAuthUser(); $this->checkSiteStatus(); @@ -91,7 +90,7 @@ class Controller extends \Phalcon\Mvc\Controller protected function getAuthUser() { /** - * @var DesktopAuth $auth + * @var HomeAuth $auth */ $auth = $this->getDI()->get('auth'); @@ -140,7 +139,7 @@ class Controller extends \Phalcon\Mvc\Controller return [ 'main' => $cache->get('im.main'), 'cs' => $cache->get('im.cs'), - 'websocket' => $websocket, + 'ws' => $websocket, ]; } diff --git a/app/Http/Desktop/Controllers/CourseController.php b/app/Http/Home/Controllers/CourseController.php similarity index 68% rename from app/Http/Desktop/Controllers/CourseController.php rename to app/Http/Home/Controllers/CourseController.php index 75dd8aca..c06fba43 100644 --- a/app/Http/Desktop/Controllers/CourseController.php +++ b/app/Http/Home/Controllers/CourseController.php @@ -1,19 +1,19 @@ handle($id); $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - $this->view->pick('course/packages'); $this->view->setVar('packages', $packages); } /** - * @Get("/{id:[0-9]+}/consults", name="desktop.course.consults") + * @Get("/{id:[0-9]+}/consults", name="home.course.consults") */ public function consultsAction($id) { @@ -115,12 +114,11 @@ class CourseController extends Controller $pager->target = 'tab-consults'; $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - $this->view->pick('course/consults'); $this->view->setVar('pager', $pager); } /** - * @Get("/{id:[0-9]+}/reviews", name="desktop.course.reviews") + * @Get("/{id:[0-9]+}/reviews", name="home.course.reviews") */ public function reviewsAction($id) { @@ -131,12 +129,11 @@ class CourseController extends Controller $pager->target = 'tab-reviews'; $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - $this->view->pick('course/reviews'); $this->view->setVar('pager', $pager); } /** - * @Get("/{id:[0-9]+}/recommended", name="desktop.course.recommended") + * @Get("/{id:[0-9]+}/recommended", name="home.course.recommended") */ public function recommendedAction($id) { @@ -145,12 +142,11 @@ class CourseController extends Controller $courses = $service->handle($id); $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - $this->view->pick('course/recommended'); $this->view->setVar('courses', $courses); } /** - * @Get("/{id:[0-9]+}/related", name="desktop.course.related") + * @Get("/{id:[0-9]+}/related", name="home.course.related") */ public function relatedAction($id) { @@ -159,12 +155,11 @@ class CourseController extends Controller $courses = $service->handle($id); $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - $this->view->pick('course/related'); $this->view->setVar('courses', $courses); } /** - * @Get("/{id:[0-9]+}/topics", name="desktop.course.topics") + * @Get("/{id:[0-9]+}/topics", name="home.course.topics") */ public function topicsAction($id) { @@ -173,12 +168,11 @@ class CourseController extends Controller $topics = $service->handle($id); $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - $this->view->pick('course/topics'); $this->view->setVar('topics', $topics); } /** - * @Post("/{id:[0-9]+}/favorite", name="desktop.course.favorite") + * @Post("/{id:[0-9]+}/favorite", name="home.course.favorite") */ public function favoriteAction($id) { diff --git a/app/Http/Desktop/Controllers/DanmuController.php b/app/Http/Home/Controllers/DanmuController.php similarity index 63% rename from app/Http/Desktop/Controllers/DanmuController.php rename to app/Http/Home/Controllers/DanmuController.php index 5897614c..908b5290 100644 --- a/app/Http/Desktop/Controllers/DanmuController.php +++ b/app/Http/Home/Controllers/DanmuController.php @@ -1,9 +1,9 @@ authUser->id == 0) { - return $this->response->redirect(['for' => 'desktop.account.login']); + return $this->response->redirect(['for' => 'home.account.login']); } } /** - * @Get("/", name="desktop.im.index") + * @Get("/", name="home.im.index") */ public function indexAction() { @@ -44,7 +44,7 @@ class ImController extends Controller } /** - * @Get("/cs", name="desktop.im.cs") + * @Get("/cs", name="home.im.cs") */ public function csAction() { @@ -56,7 +56,7 @@ class ImController extends Controller } /** - * @Get("/init", name="desktop.im.init") + * @Get("/init", name="home.im.init") */ public function initAction() { @@ -68,7 +68,7 @@ class ImController extends Controller } /** - * @Get("/group/users", name="desktop.im.group_users") + * @Get("/group/users", name="home.im.group_users") */ public function groupUsersAction() { @@ -80,7 +80,7 @@ class ImController extends Controller } /** - * @Get("/msgbox", name="desktop.im.msgbox") + * @Get("/msgbox", name="home.im.msgbox") */ public function msgboxAction() { @@ -88,12 +88,11 @@ class ImController extends Controller $pager = $service->getNotices(); - $this->view->pick('im/msgbox'); $this->view->setVar('pager', $pager); } /** - * @Get("/chatlog", name="desktop.im.chatlog") + * @Get("/chatlog", name="home.im.chatlog") */ public function chatlogAction() { @@ -102,12 +101,11 @@ class ImController extends Controller $pager = $service->getChatMessages(); $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - $this->view->pick('im/chatlog'); $this->view->setVar('pager', $pager); } /** - * @Get("/friend/msg/unread", name="desktop.im.unread_friend_msg") + * @Get("/friend/msg/unread", name="home.im.unread_friend_msg") */ public function unreadFriendMessageAction() { @@ -121,7 +119,7 @@ class ImController extends Controller } /** - * @Get("/notice/unread", name="desktop.im.unread_notice") + * @Get("/notice/unread", name="home.im.unread_notice") */ public function unreadNoticeAction() { @@ -133,7 +131,7 @@ class ImController extends Controller } /** - * @Get("/notice", name="desktop.im.notice") + * @Get("/notice", name="home.im.notice") */ public function noticeAction() { @@ -145,7 +143,7 @@ class ImController extends Controller } /** - * @Post("/notice/read", name="desktop.im.read_notice") + * @Post("/notice/read", name="home.im.read_notice") */ public function readNoticeAction() { @@ -157,7 +155,7 @@ class ImController extends Controller } /** - * @Get("/friend/status", name="desktop.im.friend_status") + * @Get("/friend/status", name="home.im.friend_status") */ public function friendStatusAction() { @@ -169,7 +167,7 @@ class ImController extends Controller } /** - * @Get("/chat/history", name="desktop.im.chat_history") + * @Get("/chat/history", name="home.im.chat_history") */ public function chatHistoryAction() { @@ -181,7 +179,7 @@ class ImController extends Controller } /** - * @Post("/user/bind", name="desktop.im.bind_user") + * @Post("/user/bind", name="home.im.bind_user") */ public function bindUserAction() { @@ -193,7 +191,7 @@ class ImController extends Controller } /** - * @Post("/msg/chat/send", name="desktop.im.send_chat_msg") + * @Post("/msg/chat/send", name="home.im.send_chat_msg") */ public function sendChatMessageAction() { @@ -208,7 +206,7 @@ class ImController extends Controller } /** - * @Post("/msg/cs/send", name="desktop.im.send_cs_msg") + * @Post("/msg/cs/send", name="home.im.send_cs_msg") */ public function sendCsMessageAction() { @@ -223,7 +221,7 @@ class ImController extends Controller } /** - * @Post("/status/update", name="desktop.im.update_status") + * @Post("/status/update", name="home.im.update_status") */ public function updateStatusAction() { @@ -235,7 +233,7 @@ class ImController extends Controller } /** - * @Post("/sign/update", name="desktop.desktop.im.update_sign") + * @Post("/sign/update", name="home.home.im.update_sign") */ public function updateSignatureAction() { @@ -247,7 +245,7 @@ class ImController extends Controller } /** - * @Post("/skin/update", name="desktop.desktop.im.update_skin") + * @Post("/skin/update", name="home.home.im.update_skin") */ public function updateSKinAction() { @@ -259,7 +257,7 @@ class ImController extends Controller } /** - * @Post("/friend/apply", name="desktop.im.apply_friend") + * @Post("/friend/apply", name="home.im.apply_friend") */ public function applyFriendAction() { @@ -273,7 +271,7 @@ class ImController extends Controller } /** - * @Post("/friend/accept", name="desktop.im.accept_friend") + * @Post("/friend/accept", name="home.im.accept_friend") */ public function acceptFriendAction() { @@ -285,7 +283,7 @@ class ImController extends Controller } /** - * @Post("/friend/refuse", name="desktop.im.refuse_friend") + * @Post("/friend/refuse", name="home.im.refuse_friend") */ public function refuseFriendAction() { @@ -297,7 +295,7 @@ class ImController extends Controller } /** - * @Post("/group/apply", name="desktop.im.apply_group") + * @Post("/group/apply", name="home.im.apply_group") */ public function applyGroupAction() { @@ -311,7 +309,7 @@ class ImController extends Controller } /** - * @Post("/group/accept", name="desktop.desktop.im.accept_group") + * @Post("/group/accept", name="home.home.im.accept_group") */ public function acceptGroupAction() { @@ -323,7 +321,7 @@ class ImController extends Controller } /** - * @Post("/group/refuse", name="desktop.desktop.im.refuse_group") + * @Post("/group/refuse", name="home.home.im.refuse_group") */ public function refuseGroupAction() { @@ -335,7 +333,7 @@ class ImController extends Controller } /** - * @Post("/friend/{id:[0-9]+}/quit", name="desktop.im.quit_friend") + * @Post("/friend/{id:[0-9]+}/quit", name="home.im.quit_friend") */ public function quitFriendAction($id) { @@ -349,7 +347,7 @@ class ImController extends Controller } /** - * @Post("/group/{id:[0-9]+}/quit", name="desktop.im.quit_group") + * @Post("/group/{id:[0-9]+}/quit", name="home.im.quit_group") */ public function quitGroupAction($id) { diff --git a/app/Http/Desktop/Controllers/ImGroupController.php b/app/Http/Home/Controllers/ImGroupController.php similarity index 80% rename from app/Http/Desktop/Controllers/ImGroupController.php rename to app/Http/Home/Controllers/ImGroupController.php index 12329885..bde92ad8 100644 --- a/app/Http/Desktop/Controllers/ImGroupController.php +++ b/app/Http/Home/Controllers/ImGroupController.php @@ -1,8 +1,8 @@ view->pick('index/full'); $this->view->setVar('lives', $service->getLives()); - $this->view->setVar('carousels', $service->getCarousels()); + $this->view->setVar('slides', $service->getSlides()); $this->view->setVar('new_courses', $service->getNewCourses()); $this->view->setVar('free_courses', $service->getFreeCourses()); $this->view->setVar('vip_courses', $service->getVipCourses()); @@ -42,7 +42,7 @@ class IndexController extends Controller $this->view->pick('index/simple'); $this->view->setVar('lives', $service->getLives()); - $this->view->setVar('carousels', $service->getCarousels()); + $this->view->setVar('slides', $service->getSlides()); $this->view->setVar('new_courses', $service->getSimpleNewCourses()); $this->view->setVar('free_courses', $service->getSimpleFreeCourses()); $this->view->setVar('vip_courses', $service->getSimpleVipCourses()); diff --git a/app/Http/Desktop/Controllers/LayerController.php b/app/Http/Home/Controllers/LayerController.php similarity index 88% rename from app/Http/Desktop/Controllers/LayerController.php rename to app/Http/Home/Controllers/LayerController.php index c0c420c3..2d15d84b 100644 --- a/app/Http/Desktop/Controllers/LayerController.php +++ b/app/Http/Home/Controllers/LayerController.php @@ -1,9 +1,9 @@ getDI()->get('auth'); diff --git a/app/Http/Desktop/Controllers/LiveController.php b/app/Http/Home/Controllers/LiveController.php similarity index 75% rename from app/Http/Desktop/Controllers/LiveController.php rename to app/Http/Home/Controllers/LiveController.php index 0a1625c7..9f205c26 100644 --- a/app/Http/Desktop/Controllers/LiveController.php +++ b/app/Http/Home/Controllers/LiveController.php @@ -1,8 +1,8 @@ authUser->id == 0) { - $this->response->redirect(['for' => 'desktop.account.login']); + $this->response->redirect(['for' => 'home.account.login']); return false; } @@ -29,7 +29,7 @@ class OrderController extends Controller } /** - * @Get("/info", name="desktop.order.info") + * @Get("/info", name="home.order.info") */ public function infoAction() { @@ -44,7 +44,7 @@ class OrderController extends Controller } /** - * @Get("/confirm", name="desktop.order.confirm") + * @Get("/confirm", name="home.order.confirm") */ public function confirmAction() { @@ -59,7 +59,7 @@ class OrderController extends Controller } /** - * @Post("/create", name="desktop.order.create") + * @Post("/create", name="home.order.create") */ public function createAction() { @@ -67,13 +67,13 @@ class OrderController extends Controller $order = $service->handle(); - $location = $this->url->get(['for' => 'desktop.order.pay'], ['sn' => $order->sn]); + $location = $this->url->get(['for' => 'home.order.pay'], ['sn' => $order->sn]); return $this->jsonSuccess(['location' => $location]); } /** - * @Get("/pay", name="desktop.order.pay") + * @Get("/pay", name="home.order.pay") */ public function payAction() { @@ -84,14 +84,14 @@ class OrderController extends Controller $order = $service->handle($sn); if ($order['status'] != OrderModel::STATUS_PENDING) { - $this->response->redirect(['for' => 'desktop.my.orders']); + $this->response->redirect(['for' => 'home.my.orders']); } $this->view->setVar('order', $order); } /** - * @Post("/cancel", name="desktop.order.cancel") + * @Post("/cancel", name="home.order.cancel") */ public function cancelAction() { diff --git a/app/Http/Desktop/Controllers/PackageController.php b/app/Http/Home/Controllers/PackageController.php similarity index 62% rename from app/Http/Desktop/Controllers/PackageController.php rename to app/Http/Home/Controllers/PackageController.php index a57f684f..261cbb47 100644 --- a/app/Http/Desktop/Controllers/PackageController.php +++ b/app/Http/Home/Controllers/PackageController.php @@ -1,9 +1,9 @@ handle(); $content = [ - 'location' => $this->url->get(['for' => 'desktop.my.refunds']), + 'location' => $this->url->get(['for' => 'home.my.refunds']), 'msg' => '申请退款成功', ]; @@ -53,7 +53,7 @@ class RefundController extends Controller } /** - * @Get("/info", name="desktop.refund.info") + * @Get("/info", name="home.refund.info") */ public function infoAction() { @@ -68,7 +68,7 @@ class RefundController extends Controller } /** - * @Post("/cancel", name="desktop.refund.cancel") + * @Post("/cancel", name="home.refund.cancel") */ public function cancelAction() { @@ -79,7 +79,7 @@ class RefundController extends Controller $service->handle($sn); $content = [ - 'location' => $this->url->get(['for' => 'desktop.my.refunds']), + 'location' => $this->url->get(['for' => 'home.my.refunds']), 'msg' => '取消退款成功', ]; diff --git a/app/Http/Desktop/Controllers/ReviewController.php b/app/Http/Home/Controllers/ReviewController.php similarity index 71% rename from app/Http/Desktop/Controllers/ReviewController.php rename to app/Http/Home/Controllers/ReviewController.php index d49a2a58..48b09a67 100644 --- a/app/Http/Desktop/Controllers/ReviewController.php +++ b/app/Http/Home/Controllers/ReviewController.php @@ -1,12 +1,12 @@ request->get('type', ['trim', 'string'], 'course'); if (empty($query)) { - return $this->response->redirect(['for' => 'desktop.course.list']); + return $this->response->redirect(['for' => 'home.course.list']); } $this->seo->prependTitle(['搜索', $query]); @@ -43,7 +43,7 @@ class SearchController extends Controller } /** - * @Get("/form", name="desktop.search.form") + * @Get("/form", name="home.search.form") */ public function formAction() { diff --git a/app/Http/Desktop/Controllers/TeachingController.php b/app/Http/Home/Controllers/TeacherConsoleController.php similarity index 56% rename from app/Http/Desktop/Controllers/TeachingController.php rename to app/Http/Home/Controllers/TeacherConsoleController.php index d2eb9382..d98b46c7 100644 --- a/app/Http/Desktop/Controllers/TeachingController.php +++ b/app/Http/Home/Controllers/TeacherConsoleController.php @@ -1,19 +1,18 @@ authUser->id == 0) { - $this->response->redirect(['for' => 'desktop.account.login']); + $this->response->redirect(['for' => 'home.account.login']); return false; } @@ -29,7 +28,7 @@ class TeachingController extends Controller } /** - * @Get("/", name="desktop.teaching.index") + * @Get("/index", name="home.tc.index") */ public function indexAction() { @@ -37,7 +36,7 @@ class TeachingController extends Controller } /** - * @Get("/courses", name="desktop.teaching.courses") + * @Get("/courses", name="home.tc.courses") */ public function coursesAction() { @@ -45,13 +44,12 @@ class TeachingController extends Controller $pager = $service->handle(); - $pager->items = kg_array_object($pager->items); - + $this->view->pick('teacher/console/courses'); $this->view->setVar('pager', $pager); } /** - * @Get("/lives", name="desktop.teaching.lives") + * @Get("/lives", name="home.tc.lives") */ public function livesAction() { @@ -59,13 +57,12 @@ class TeachingController extends Controller $pager = $service->handle(); - $pager->items = kg_array_object($pager->items); - + $this->view->pick('teacher/console/lives'); $this->view->setVar('pager', $pager); } /** - * @Get("/consults", name="desktop.teaching.consults") + * @Get("/consults", name="home.tc.consults") */ public function consultsAction() { @@ -73,22 +70,21 @@ class TeachingController extends Controller $pager = $service->handle(); - $pager->items = kg_array_object($pager->items); - + $this->view->pick('teacher/console/consults'); $this->view->setVar('pager', $pager); } /** - * @Get("/live/push", name="desktop.teaching.live_push") + * @Get("/live/{id:[0-9]+}", name="home.tc.live") */ - public function livePushAction() + public function liveAction($id) { $service = new LivePushUrlService(); - $pushUrl = $service->handle(); + $pushUrl = $service->handle($id); $qrcode = $this->url->get( - ['for' => 'desktop.qrcode'], + ['for' => 'home.qrcode'], ['text' => urlencode($pushUrl)] ); @@ -99,7 +95,7 @@ class TeachingController extends Controller 'stream_code' => substr($pushUrl, $pos + 1), ]; - $this->view->pick('teaching/live_push'); + $this->view->pick('teacher/console/live_push'); $this->view->setVar('qrcode', $qrcode); $this->view->setVar('obs', $obs); } diff --git a/app/Http/Desktop/Controllers/TeacherController.php b/app/Http/Home/Controllers/TeacherController.php similarity index 70% rename from app/Http/Desktop/Controllers/TeacherController.php rename to app/Http/Home/Controllers/TeacherController.php index ea6275e4..a6f2f2ce 100644 --- a/app/Http/Desktop/Controllers/TeacherController.php +++ b/app/Http/Home/Controllers/TeacherController.php @@ -1,8 +1,8 @@ target = 'teacher-list'; $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - $this->view->pick('teacher/pager'); $this->view->setVar('pager', $pager); } /** - * @Get("/{id:[0-9]+}", name="desktop.teacher.show") + * @Get("/{id:[0-9]+}", name="home.teacher.show") */ public function showAction($id) { diff --git a/app/Http/Desktop/Controllers/TopicController.php b/app/Http/Home/Controllers/TopicController.php similarity index 63% rename from app/Http/Desktop/Controllers/TopicController.php rename to app/Http/Home/Controllers/TopicController.php index 349cd128..bd0375e9 100644 --- a/app/Http/Desktop/Controllers/TopicController.php +++ b/app/Http/Home/Controllers/TopicController.php @@ -1,9 +1,9 @@ handle($id); - $this->seo->prependTitle($topic['title']); + $this->seo->prependTitle(['专题', $topic['title']]); $this->seo->setDescription($topic['summary']); $this->view->setVar('topic', $topic); } /** - * @Get("/{id:[0-9]+}/courses", name="desktop.topic.courses") + * @Get("/{id:[0-9]+}/courses", name="home.topic.courses") */ public function coursesAction($id) { @@ -39,7 +39,6 @@ class TopicController extends Controller $pager->target = 'course-list'; $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - $this->view->pick('topic/courses'); $this->view->setVar('pager', $pager); } diff --git a/app/Http/Desktop/Controllers/TradeController.php b/app/Http/Home/Controllers/TradeController.php similarity index 67% rename from app/Http/Desktop/Controllers/TradeController.php rename to app/Http/Home/Controllers/TradeController.php index 046c87f6..6e1c7ad5 100644 --- a/app/Http/Desktop/Controllers/TradeController.php +++ b/app/Http/Home/Controllers/TradeController.php @@ -1,9 +1,9 @@ authUser->id == 0) { - $this->response->redirect(['for' => 'desktop.account.login']); + $this->response->redirect(['for' => 'home.account.login']); return false; } @@ -34,7 +34,7 @@ class MyController extends Controller } /** - * @Get("/", name="desktop.my.index") + * @Get("/index", name="home.uc.index") */ public function indexAction() { @@ -42,7 +42,7 @@ class MyController extends Controller } /** - * @Get("/profile", name="desktop.my.profile") + * @Get("/profile", name="home.uc.profile") */ public function profileAction() { @@ -50,11 +50,12 @@ class MyController extends Controller $user = $service->handle(); + $this->view->pick('user/console/profile'); $this->view->setVar('user', $user); } /** - * @Get("/account", name="desktop.my.account") + * @Get("/account", name="home.uc.account") */ public function accountAction() { @@ -62,112 +63,119 @@ class MyController extends Controller $account = $service->handle(); + $this->view->pick('user/console/account'); $this->view->setVar('account', $account); } /** - * @Get("/courses", name="desktop.my.courses") + * @Get("/courses", name="home.uc.courses") */ public function coursesAction() { - $service = new MyCourseListService(); + $service = new CourseListService(); $pager = $service->handle(); + $this->view->pick('user/console/courses'); $this->view->setVar('pager', $pager); } /** - * @Get("/favorites", name="desktop.my.favorites") + * @Get("/favorites", name="home.uc.favorites") */ public function favoritesAction() { - $service = new MyFavoriteListService(); + $service = new FavoriteListService(); $pager = $service->handle(); + $this->view->pick('user/console/favorites'); $this->view->setVar('pager', $pager); } /** - * @Get("/consults", name="desktop.my.consults") + * @Get("/consults", name="home.uc.consults") */ public function consultsAction() { - $service = new MyConsultListService(); + $service = new ConsultListService(); $pager = $service->handle(); + $this->view->pick('user/console/consults'); $this->view->setVar('pager', $pager); } /** - * @Get("/reviews", name="desktop.my.reviews") + * @Get("/reviews", name="home.uc.reviews") */ public function reviewsAction() { - $service = new MyReviewListService(); + $service = new ReviewListService(); $pager = $service->handle(); + $this->view->pick('user/console/reviews'); $this->view->setVar('pager', $pager); } /** - * @Get("/orders", name="desktop.my.orders") + * @Get("/orders", name="home.uc.orders") */ public function ordersAction() { - $service = new MyOrderListService(); + $service = new OrderListService(); $pager = $service->handle(); + $this->view->pick('user/console/orders'); $this->view->setVar('pager', $pager); } /** - * @Get("/refunds", name="desktop.my.refunds") + * @Get("/refunds", name="home.uc.refunds") */ public function refundsAction() { - $service = new MyRefundListService(); + $service = new RefundListService(); $pager = $service->handle(); + $this->view->pick('user/console/refunds'); $this->view->setVar('pager', $pager); } /** - * @Get("/friends", name="desktop.my.friends") + * @Get("/friends", name="home.uc.friends") */ public function friendsAction() { - $service = new MyFriendListService(); + $service = new FriendListService(); $pager = $service->handle(); - $this->view->pick('my/friends'); + $this->view->pick('user/console/friends'); $this->view->setVar('pager', $pager); } /** - * @Get("/groups", name="desktop.my.groups") + * @Get("/groups", name="home.uc.groups") */ public function groupsAction() { $scope = $this->request->getQuery('scope', 'string', 'joined'); - $service = new MyGroupListService(); + $service = new GroupListService(); $pager = $service->handle($scope); - $this->view->pick('my/groups'); + $this->view->pick('user/console/groups'); $this->view->setVar('scope', $scope); $this->view->setVar('pager', $pager); } /** - * @Post("/profile/update", name="desktop.my.update_profile") + * @Post("/profile/update", name="home.uc.update_profile") */ public function updateProfileAction() { diff --git a/app/Http/Desktop/Controllers/UserController.php b/app/Http/Home/Controllers/UserController.php similarity index 72% rename from app/Http/Desktop/Controllers/UserController.php rename to app/Http/Home/Controllers/UserController.php index 4ea12c97..d547a2b2 100644 --- a/app/Http/Desktop/Controllers/UserController.php +++ b/app/Http/Home/Controllers/UserController.php @@ -1,12 +1,12 @@ setShared('auth', function () { - return new DesktopAuth(); + return new HomeAuth(); }); } diff --git a/app/Http/Desktop/Services/Account.php b/app/Http/Home/Services/Account.php similarity index 93% rename from app/Http/Desktop/Services/Account.php rename to app/Http/Home/Services/Account.php index 1005fe93..4858213d 100644 --- a/app/Http/Desktop/Services/Account.php +++ b/app/Http/Home/Services/Account.php @@ -1,10 +1,10 @@ baseUrl = $this->url->get(['for' => 'desktop.course.list']); + $this->baseUrl = $this->url->get(['for' => 'home.course.list']); } public function handleTopCategories() @@ -30,7 +30,7 @@ class CourseQuery extends Service unset($params['sc']); } - $baseUrl = $this->url->get(['for' => 'desktop.course.list']); + $baseUrl = $this->url->get(['for' => 'home.course.list']); $defaultItem = [ 'id' => 'all', @@ -78,7 +78,7 @@ class CourseQuery extends Service unset($params['sc']); } - $baseUrl = $this->url->get(['for' => 'desktop.course.list']); + $baseUrl = $this->url->get(['for' => 'home.course.list']); $defaultItem = [ 'id' => 'all', diff --git a/app/Http/Desktop/Services/Im.php b/app/Http/Home/Services/Im.php similarity index 99% rename from app/Http/Desktop/Services/Im.php rename to app/Http/Home/Services/Im.php index c1aed7df..b988473e 100644 --- a/app/Http/Desktop/Services/Im.php +++ b/app/Http/Home/Services/Im.php @@ -1,6 +1,6 @@ get(); + $slides = $cache->get(); - if (!$carousels) return []; + if (!$slides) return []; - foreach ($carousels as $key => $carousel) { + foreach ($slides as $key => $slide) { - $carousels[$key]['style'] = CarouselModel::htmlStyle($carousel['style']); - - switch ($carousel['target']) { - case CarouselModel::TARGET_COURSE: - $carousels[$key]['url'] = $this->url->get([ - 'for' => 'desktop.course.show', - 'id' => $carousel['content'], + switch ($slide['target']) { + case SlideModel::TARGET_COURSE: + $slides[$key]['url'] = $this->url->get([ + 'for' => 'home.course.show', + 'id' => $slide['content'], ]); break; - case CarouselModel::TARGET_PAGE: - $carousels[$key]['url'] = $this->url->get([ - 'for' => 'desktop.page.show', - 'id' => $carousel['content'], + case SlideModel::TARGET_PAGE: + $slides[$key]['url'] = $this->url->get([ + 'for' => 'home.page.show', + 'id' => $slide['content'], ]); break; - case CarouselModel::TARGET_LINK: - $carousels[$key]['url'] = $carousel['content']; + case SlideModel::TARGET_LINK: + $slides[$key]['url'] = $slide['content']; break; default: break; } } - return $carousels; + return $slides; } public function getLives() diff --git a/app/Http/Desktop/Services/Live.php b/app/Http/Home/Services/Live.php similarity index 97% rename from app/Http/Desktop/Services/Live.php rename to app/Http/Home/Services/Live.php index ed4ecb97..686c9ba6 100644 --- a/app/Http/Desktop/Services/Live.php +++ b/app/Http/Home/Services/Live.php @@ -1,8 +1,8 @@ url->get( - ['for' => 'desktop.qrcode'], + ['for' => 'home.qrcode'], ['text' => urlencode($text)] ); } diff --git a/app/Http/Desktop/Views/account/edit_email.volt b/app/Http/Home/Views/account/edit_email.volt similarity index 93% rename from app/Http/Desktop/Views/account/edit_email.volt rename to app/Http/Home/Views/account/edit_email.volt index 3c09146b..9a9b1b09 100644 --- a/app/Http/Desktop/Views/account/edit_email.volt +++ b/app/Http/Home/Views/account/edit_email.volt @@ -2,7 +2,7 @@ {% block content %} - +

@@ -37,6 +37,6 @@ {% block include_js %} {{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }} - {{ js_include('desktop/js/captcha.verify.js') }} + {{ js_include('home/js/captcha.verify.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Desktop/Views/account/edit_password.volt b/app/Http/Home/Views/account/edit_password.volt similarity index 94% rename from app/Http/Desktop/Views/account/edit_password.volt rename to app/Http/Home/Views/account/edit_password.volt index b5ea7b28..b13a77d8 100644 --- a/app/Http/Desktop/Views/account/edit_password.volt +++ b/app/Http/Home/Views/account/edit_password.volt @@ -2,7 +2,7 @@ {% block content %} - +
diff --git a/app/Http/Desktop/Views/account/edit_phone.volt b/app/Http/Home/Views/account/edit_phone.volt similarity index 93% rename from app/Http/Desktop/Views/account/edit_phone.volt rename to app/Http/Home/Views/account/edit_phone.volt index c4257703..d24685ca 100644 --- a/app/Http/Desktop/Views/account/edit_phone.volt +++ b/app/Http/Home/Views/account/edit_phone.volt @@ -2,7 +2,7 @@ {% block content %} - +

@@ -37,6 +37,6 @@ {% block include_js %} {{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }} - {{ js_include('desktop/js/captcha.verify.js') }} + {{ js_include('home/js/captcha.verify.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Desktop/Views/account/forget_password.volt b/app/Http/Home/Views/account/forget_password.volt similarity index 92% rename from app/Http/Desktop/Views/account/forget_password.volt rename to app/Http/Home/Views/account/forget_password.volt index 8a2dcf16..d72ccd9d 100644 --- a/app/Http/Desktop/Views/account/forget_password.volt +++ b/app/Http/Home/Views/account/forget_password.volt @@ -4,11 +4,11 @@ @@ -34,8 +34,8 @@ {% block include_js %} {{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }} - {{ js_include('desktop/js/captcha.login.js') }} - {{ js_include('desktop/js/captcha.verify.js') }} + {{ js_include('home/js/captcha.login.js') }} + {{ js_include('home/js/captcha.verify.js') }} {% endblock %} diff --git a/app/Http/Desktop/Views/account/login_by_password.volt b/app/Http/Home/Views/account/login_by_password.volt similarity index 96% rename from app/Http/Desktop/Views/account/login_by_password.volt rename to app/Http/Home/Views/account/login_by_password.volt index a896cd2d..53b31fab 100644 --- a/app/Http/Desktop/Views/account/login_by_password.volt +++ b/app/Http/Home/Views/account/login_by_password.volt @@ -1,4 +1,4 @@ - +
diff --git a/app/Http/Desktop/Views/account/login_by_verify.volt b/app/Http/Home/Views/account/login_by_verify.volt similarity index 95% rename from app/Http/Desktop/Views/account/login_by_verify.volt rename to app/Http/Home/Views/account/login_by_verify.volt index b49b5b6b..adee53ed 100644 --- a/app/Http/Desktop/Views/account/login_by_verify.volt +++ b/app/Http/Home/Views/account/login_by_verify.volt @@ -1,4 +1,4 @@ - +
diff --git a/app/Http/Desktop/Views/account/register.volt b/app/Http/Home/Views/account/register.volt similarity index 95% rename from app/Http/Desktop/Views/account/register.volt rename to app/Http/Home/Views/account/register.volt index 5a009a17..25d65749 100644 --- a/app/Http/Desktop/Views/account/register.volt +++ b/app/Http/Home/Views/account/register.volt @@ -8,7 +8,7 @@