diff --git a/CHANGELOG.md b/CHANGELOG.md index 4130dd6d..c6238fc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +### [v1.5.1](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.1)(2022-03-17) + +- 推荐课程等列表补充属性 +- 修正后台评价列表中的搜索链接 +- 修正后台点播设置视频码率后500错误问题 +- 修正多码率远程播放地址部分为空播放问题 +- 修正更新套餐课程缓存传参数据类型问题 +- 修正第三方登录解除绑定失败问题 +- 使用ServiceTrait归纳获取服务代码 +- 优化anonymous隐藏部分字符函数 +- 调整积分兑换相关定义命名 +- 去除js_vars中关于IM客服的配置 +- 增加验证码开关 + ### [v1.5.0](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.0)(2022-02-17) - 调整对内部人员通知任务类型的前缀 diff --git a/app/Caches/CourseRecommendedList.php b/app/Caches/CourseRecommendedList.php index 23d35b4d..fb6c5d17 100644 --- a/app/Caches/CourseRecommendedList.php +++ b/app/Caches/CourseRecommendedList.php @@ -57,12 +57,15 @@ class CourseRecommendedList extends Cache '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, + 'rating' => round($course->rating, 1), + 'market_price' => (float)$course->market_price, + 'vip_price' => (float)$course->vip_price, 'user_count' => $userCount, 'lesson_count' => $course->lesson_count, + 'review_count' => $course->review_count, + 'favorite_count' => $course->favorite_count, ]; } diff --git a/app/Caches/CourseRelatedList.php b/app/Caches/CourseRelatedList.php index 00220871..46274fc1 100644 --- a/app/Caches/CourseRelatedList.php +++ b/app/Caches/CourseRelatedList.php @@ -58,12 +58,15 @@ class CourseRelatedList extends Cache '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, + 'rating' => round($course->rating, 1), + 'market_price' => (float)$course->market_price, + 'vip_price' => (float)$course->vip_price, 'user_count' => $userCount, 'lesson_count' => $course->lesson_count, + 'review_count' => $course->review_count, + 'favorite_count' => $course->favorite_count, ]; } diff --git a/app/Caches/IndexFeaturedCourseList.php b/app/Caches/IndexFeaturedCourseList.php index db32e861..54b44f4d 100644 --- a/app/Caches/IndexFeaturedCourseList.php +++ b/app/Caches/IndexFeaturedCourseList.php @@ -76,12 +76,15 @@ class IndexFeaturedCourseList extends Cache '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, + 'rating' => round($course->rating, 1), + 'market_price' => (float)$course->market_price, + 'vip_price' => (float)$course->vip_price, 'user_count' => $userCount, 'lesson_count' => $course->lesson_count, + 'review_count' => $course->review_count, + 'favorite_count' => $course->favorite_count, ]; } diff --git a/app/Caches/IndexFreeCourseList.php b/app/Caches/IndexFreeCourseList.php index 23e1c41e..d96847c0 100644 --- a/app/Caches/IndexFreeCourseList.php +++ b/app/Caches/IndexFreeCourseList.php @@ -76,12 +76,15 @@ class IndexFreeCourseList extends Cache '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, + 'rating' => round($course->rating, 1), + 'market_price' => (float)$course->market_price, + 'vip_price' => (float)$course->vip_price, 'user_count' => $userCount, 'lesson_count' => $course->lesson_count, + 'review_count' => $course->review_count, + 'favorite_count' => $course->favorite_count, ]; } diff --git a/app/Caches/IndexNewCourseList.php b/app/Caches/IndexNewCourseList.php index 33bb9b32..27d83172 100644 --- a/app/Caches/IndexNewCourseList.php +++ b/app/Caches/IndexNewCourseList.php @@ -76,12 +76,15 @@ class IndexNewCourseList extends Cache '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, + 'rating' => round($course->rating, 1), + 'market_price' => (float)$course->market_price, + 'vip_price' => (float)$course->vip_price, 'user_count' => $userCount, 'lesson_count' => $course->lesson_count, + 'review_count' => $course->review_count, + 'favorite_count' => $course->favorite_count, ]; } diff --git a/app/Caches/IndexSimpleFeaturedCourseList.php b/app/Caches/IndexSimpleFeaturedCourseList.php index 32801d99..1ea87812 100644 --- a/app/Caches/IndexSimpleFeaturedCourseList.php +++ b/app/Caches/IndexSimpleFeaturedCourseList.php @@ -53,12 +53,15 @@ class IndexSimpleFeaturedCourseList extends Cache '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, + 'rating' => round($course->rating, 1), + 'market_price' => (float)$course->market_price, + 'vip_price' => (float)$course->vip_price, 'user_count' => $userCount, 'lesson_count' => $course->lesson_count, + 'review_count' => $course->review_count, + 'favorite_count' => $course->favorite_count, ]; } diff --git a/app/Caches/IndexSimpleFreeCourseList.php b/app/Caches/IndexSimpleFreeCourseList.php index 9a71dbb7..065c6066 100644 --- a/app/Caches/IndexSimpleFreeCourseList.php +++ b/app/Caches/IndexSimpleFreeCourseList.php @@ -53,12 +53,15 @@ class IndexSimpleFreeCourseList extends Cache '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, + 'rating' => round($course->rating, 1), + 'market_price' => (float)$course->market_price, + 'vip_price' => (float)$course->vip_price, 'user_count' => $userCount, 'lesson_count' => $course->lesson_count, + 'review_count' => $course->review_count, + 'favorite_count' => $course->favorite_count, ]; } diff --git a/app/Caches/IndexSimpleNewCourseList.php b/app/Caches/IndexSimpleNewCourseList.php index a498fac7..b6e0b6b9 100644 --- a/app/Caches/IndexSimpleNewCourseList.php +++ b/app/Caches/IndexSimpleNewCourseList.php @@ -53,12 +53,15 @@ class IndexSimpleNewCourseList extends Cache '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, + 'rating' => round($course->rating, 1), + 'market_price' => (float)$course->market_price, + 'vip_price' => (float)$course->vip_price, 'user_count' => $userCount, 'lesson_count' => $course->lesson_count, + 'review_count' => $course->review_count, + 'favorite_count' => $course->favorite_count, ]; } diff --git a/app/Caches/IndexSimpleVipCourseList.php b/app/Caches/IndexSimpleVipCourseList.php index 7162d431..bb073985 100644 --- a/app/Caches/IndexSimpleVipCourseList.php +++ b/app/Caches/IndexSimpleVipCourseList.php @@ -53,12 +53,15 @@ class IndexSimpleVipCourseList extends Cache '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, + 'rating' => round($course->rating, 1), + 'market_price' => (float)$course->market_price, + 'vip_price' => (float)$course->vip_price, 'user_count' => $userCount, 'lesson_count' => $course->lesson_count, + 'review_count' => $course->review_count, + 'favorite_count' => $course->favorite_count, ]; } diff --git a/app/Caches/IndexVipCourseList.php b/app/Caches/IndexVipCourseList.php index 4d8d78a6..db09222a 100644 --- a/app/Caches/IndexVipCourseList.php +++ b/app/Caches/IndexVipCourseList.php @@ -76,12 +76,15 @@ class IndexVipCourseList extends Cache '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, + 'rating' => round($course->rating, 1), + 'market_price' => (float)$course->market_price, + 'vip_price' => (float)$course->vip_price, 'user_count' => $userCount, 'lesson_count' => $course->lesson_count, + 'review_count' => $course->review_count, + 'favorite_count' => $course->favorite_count, ]; } diff --git a/app/Caches/PackageCourseList.php b/app/Caches/PackageCourseList.php index 0a4965ef..2843cd71 100644 --- a/app/Caches/PackageCourseList.php +++ b/app/Caches/PackageCourseList.php @@ -58,13 +58,15 @@ class PackageCourseList extends Cache 'id' => $course->id, 'title' => $course->title, 'cover' => $course->cover, - 'origin_price' => $course->origin_price, - 'market_price' => $course->market_price, - 'vip_price' => $course->vip_price, 'model' => $course->model, 'level' => $course->level, + 'rating' => round($course->rating, 1), + 'market_price' => (float)$course->market_price, + 'vip_price' => (float)$course->vip_price, 'user_count' => $userCount, 'lesson_count' => $course->lesson_count, + 'review_count' => $course->review_count, + 'favorite_count' => $course->favorite_count, ]; } diff --git a/app/Console/Tasks/PointGiftDeliverTask.php b/app/Console/Tasks/PointGiftDeliverTask.php index 8edc51d7..ec93e357 100644 --- a/app/Console/Tasks/PointGiftDeliverTask.php +++ b/app/Console/Tasks/PointGiftDeliverTask.php @@ -19,7 +19,7 @@ use App\Repos\ImGroupUser as ImGroupUserRepo; use App\Repos\PointGift as PointGiftRepo; use App\Repos\PointGiftRedeem as PointGiftRedeemRepo; use App\Services\Logic\Notice\DingTalk\PointGiftRedeem as PointGiftRedeemNotice; -use App\Services\Logic\Point\History\PointRefund as PointRefundPointHistory; +use App\Services\Logic\Point\History\PointGiftRefund as PointGiftRefundPointHistory; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; @@ -44,12 +44,6 @@ class PointGiftDeliverTask extends Task $redeem = $redeemRepo->findById($task->item_id); - if (!$redeem) { - $task->status = TaskModel::STATUS_FAILED; - $task->update(); - break; - } - try { $this->db->begin(); @@ -177,7 +171,7 @@ class PointGiftDeliverTask extends Task protected function handlePointRefund(PointGiftRedeemModel $redeem) { - $service = new PointRefundPointHistory(); + $service = new PointGiftRefundPointHistory(); $service->handle($redeem); } diff --git a/app/Console/Tasks/Task.php b/app/Console/Tasks/Task.php index b6f74790..a4cf06fd 100644 --- a/app/Console/Tasks/Task.php +++ b/app/Console/Tasks/Task.php @@ -7,46 +7,9 @@ namespace App\Console\Tasks; -use App\Services\Service as AppService; - +use App\Traits\Service as ServiceTrait; class Task extends \Phalcon\Cli\Task { - - public function getConfig() - { - $appService = new AppService(); - - return $appService->getConfig(); - } - - - public function getCache() - { - $appService = new AppService(); - - return $appService->getCache(); - } - - public function getRedis() - { - $appService = new AppService(); - - return $appService->getRedis(); - } - - public function getLogger($channel = 'console') - { - $appService = new AppService(); - - return $appService->getLogger($channel); - } - - public function getSettings($section) - { - $appService = new AppService(); - - return $appService->getSettings($section); - } - + use ServiceTrait; } diff --git a/app/Http/Admin/Services/Package.php b/app/Http/Admin/Services/Package.php index adf44462..f42e040e 100644 --- a/app/Http/Admin/Services/Package.php +++ b/app/Http/Admin/Services/Package.php @@ -106,7 +106,7 @@ class Package extends Service $package->create($data); - $this->rebuildPackageCache($package); + $this->rebuildPackageCache($package->id); return $package; } @@ -151,9 +151,9 @@ class Package extends Service $package->update($data); - $this->handlePackagedCourses($package); - $this->updatePackageCourseCount($package); - $this->rebuildPackageCache($package); + $this->handlePackagedCourses($package->id); + $this->updatePackageCourseCount($package->id); + $this->rebuildPackageCache($package->id); return $package; } @@ -166,8 +166,8 @@ class Package extends Service $package->update(); - $this->handlePackagedCourses($package); - $this->rebuildPackageCache($package); + $this->handlePackagedCourses($package->id); + $this->rebuildPackageCache($package->id); return $package; } @@ -180,8 +180,8 @@ class Package extends Service $package->update(); - $this->handlePackagedCourses($package); - $this->rebuildPackageCache($package); + $this->handlePackagedCourses($package->id); + $this->rebuildPackageCache($package->id); return $package; } @@ -228,25 +228,27 @@ class Package extends Service } } - protected function handlePackagedCourses(PackageModel $package) + protected function handlePackagedCourses($packageId) { $packageRepo = new PackageRepo(); - $courses = $packageRepo->findCourses($package->id); + $courses = $packageRepo->findCourses($packageId); if ($courses->count() == 0) return; foreach ($courses as $course) { - $this->rebuildCoursePackageCache($course); - $this->recountCoursePackages($course); + $this->rebuildCoursePackageCache($course->id); + $this->recountCoursePackages($course->id); } } - protected function updatePackageCourseCount(PackageModel $package) + protected function updatePackageCourseCount($packageId) { $packageRepo = new PackageRepo(); - $courseCount = $packageRepo->countCourses($package->id); + $package = $packageRepo->findById($packageId); + + $courseCount = $packageRepo->countCourses($packageId); $package->course_count = $courseCount; @@ -266,29 +268,31 @@ class Package extends Service $course->update(); } - protected function rebuildPackageCache(PackageModel $package) + protected function rebuildPackageCache($packageId) { $cache = new PackageCache(); - $cache->rebuild($package->id); + $cache->rebuild($packageId); $cache = new PackageCourseListCache(); - $cache->rebuild($package->id); + $cache->rebuild($packageId); } - protected function rebuildCoursePackageCache(CourseModel $course) + protected function rebuildCoursePackageCache($courseId) { $cache = new CoursePackageListCache(); - $cache->rebuild($course->id); + $cache->rebuild($courseId); } - protected function recountCoursePackages(CourseModel $course) + protected function recountCoursePackages($courseId) { $courseRepo = new CourseRepo(); - $course->package_count = $courseRepo->countPackages($course->id); + $course = $courseRepo->findById($courseId); + + $course->package_count = $courseRepo->countPackages($courseId); $course->update(); } diff --git a/app/Http/Admin/Views/moderation/reviews.volt b/app/Http/Admin/Views/moderation/reviews.volt index 256ed838..f3cc40c3 100644 --- a/app/Http/Admin/Views/moderation/reviews.volt +++ b/app/Http/Admin/Views/moderation/reviews.volt @@ -2,7 +2,7 @@ {% block content %} - {% set search_url = url({'for':'admin.consult.search'}) %} + {% set search_url = url({'for':'admin.review.search'}) %}
@@ -59,4 +59,4 @@ {{ partial('partials/pager') }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Http/Admin/Views/review/list.volt b/app/Http/Admin/Views/review/list.volt index 3bbba38b..59276eff 100644 --- a/app/Http/Admin/Views/review/list.volt +++ b/app/Http/Admin/Views/review/list.volt @@ -4,7 +4,7 @@ {{ partial('macros/review') }} - {% set search_url = url({'for':'admin.consult.search'}) %} + {% set search_url = url({'for':'admin.review.search'}) %}
diff --git a/app/Http/Admin/Views/setting/captcha.volt b/app/Http/Admin/Views/setting/captcha.volt index 1119fc25..1b05a222 100644 --- a/app/Http/Admin/Views/setting/captcha.volt +++ b/app/Http/Admin/Views/setting/captcha.volt @@ -2,20 +2,31 @@ {% block content %} + {% set captcha_display = captcha.enabled == 1 ? 'display:block' : 'display:none' %} +
验证码配置
- +
- + +
-
- -
- +
+
+ +
+ +
+
+
+ +
+ +
@@ -77,6 +88,15 @@ } ); + form.on('radio(captcha_enabled)', function (data) { + var block = $('#captcha-block'); + if (data.value === '1') { + block.show(); + } else { + block.hide(); + } + }); + form.on('submit(back_verify)', function (data) { $.ajax({ type: 'POST', diff --git a/app/Http/Admin/Views/setting/dingtalk_robot.volt b/app/Http/Admin/Views/setting/dingtalk_robot.volt index 76bb4ab9..64bbb80e 100644 --- a/app/Http/Admin/Views/setting/dingtalk_robot.volt +++ b/app/Http/Admin/Views/setting/dingtalk_robot.volt @@ -28,13 +28,13 @@
- +
- +
diff --git a/app/Http/Admin/Views/setting/im_cs.volt b/app/Http/Admin/Views/setting/im_cs.volt deleted file mode 100644 index ac4b83c3..00000000 --- a/app/Http/Admin/Views/setting/im_cs.volt +++ /dev/null @@ -1,35 +0,0 @@ - -
- -
- - -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- - - -
-
- \ No newline at end of file diff --git a/app/Http/Admin/Views/setting/im_main.volt b/app/Http/Admin/Views/setting/im_main.volt index 22e5080b..9542c2b0 100644 --- a/app/Http/Admin/Views/setting/im_main.volt +++ b/app/Http/Admin/Views/setting/im_main.volt @@ -9,13 +9,13 @@
- +
- +
diff --git a/app/Http/Admin/Views/setting/mail.volt b/app/Http/Admin/Views/setting/mail.volt index 440c3fe9..088b180c 100644 --- a/app/Http/Admin/Views/setting/mail.volt +++ b/app/Http/Admin/Views/setting/mail.volt @@ -9,25 +9,25 @@
- +
- +
- +
- +
@@ -49,13 +49,13 @@
- +
- +
diff --git a/app/Http/Admin/Views/setting/site.volt b/app/Http/Admin/Views/setting/site.volt index 3afc35d1..a8f2deb2 100644 --- a/app/Http/Admin/Views/setting/site.volt +++ b/app/Http/Admin/Views/setting/site.volt @@ -52,13 +52,13 @@
- +
- +
diff --git a/app/Http/Admin/Views/setting/vod.volt b/app/Http/Admin/Views/setting/vod.volt index 50c3f91c..9df01023 100644 --- a/app/Http/Admin/Views/setting/vod.volt +++ b/app/Http/Admin/Views/setting/vod.volt @@ -5,7 +5,7 @@ {% set storage_region_display = vod.storage_type == 'fixed' ? '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' %} - {% set video_quality = vod.video_quality|json_decode %} + {% set video_quality = vod.video_quality|json_decode(true) %}
@@ -96,13 +96,13 @@
- +
- +
diff --git a/app/Http/Home/Views/account/forget_password.volt b/app/Http/Home/Views/account/forget_password.volt index d95b541a..5683bf28 100644 --- a/app/Http/Home/Views/account/forget_password.volt +++ b/app/Http/Home/Views/account/forget_password.volt @@ -23,12 +23,13 @@
- +
+ diff --git a/app/Http/Home/Views/account/login_by_password.volt b/app/Http/Home/Views/account/login_by_password.volt index cded753e..b5a7e100 100644 --- a/app/Http/Home/Views/account/login_by_password.volt +++ b/app/Http/Home/Views/account/login_by_password.volt @@ -1,3 +1,6 @@ +{% set disabled_submit = captcha.enabled == 1 ? 'disabled="disabled"' : '' %} +{% set disabled_class = captcha.enabled == 1 ? 'layui-btn-disabled' : '' %} +
@@ -7,14 +10,16 @@
-
-
- + {% if captcha.enabled == 1 %} +
+
+ +
-
+ {% endif %}
- + diff --git a/app/Http/Home/Views/account/login_by_verify.volt b/app/Http/Home/Views/account/login_by_verify.volt index cb43f08e..41558f6b 100644 --- a/app/Http/Home/Views/account/login_by_verify.volt +++ b/app/Http/Home/Views/account/login_by_verify.volt @@ -9,14 +9,15 @@
- +
- + +
diff --git a/app/Http/Home/Views/account/register.volt b/app/Http/Home/Views/account/register.volt index 82787d53..06a11a06 100644 --- a/app/Http/Home/Views/account/register.volt +++ b/app/Http/Home/Views/account/register.volt @@ -38,13 +38,14 @@
- +
+ diff --git a/app/Http/Home/Views/connect/bind_register.volt b/app/Http/Home/Views/connect/bind_register.volt index 87208750..07e64e01 100644 --- a/app/Http/Home/Views/connect/bind_register.volt +++ b/app/Http/Home/Views/connect/bind_register.volt @@ -14,7 +14,7 @@
- +
@@ -24,6 +24,7 @@ + diff --git a/app/Http/Home/Views/course/show.volt b/app/Http/Home/Views/course/show.volt index a9472cb7..c274ca86 100644 --- a/app/Http/Home/Views/course/show.volt +++ b/app/Http/Home/Views/course/show.volt @@ -70,7 +70,6 @@
- {% set show_sidebar_teachers = 1 %} {% set show_sidebar_topics = 1 %} {% set show_sidebar_recommended = 1 %} {% set show_sidebar_related = 1 %} diff --git a/app/Http/Home/Views/order/confirm.volt b/app/Http/Home/Views/order/confirm.volt index 1c54f59d..3d2f7d14 100644 --- a/app/Http/Home/Views/order/confirm.volt +++ b/app/Http/Home/Views/order/confirm.volt @@ -13,8 +13,6 @@

{{ course.title }}

- 原始价格 - {{ '¥%0.2f'|format(course.origin_price) }} 优惠价格 {{ '¥%0.2f'|format(course.market_price) }} 会员价格 diff --git a/app/Http/Home/Views/partials/js_vars.volt b/app/Http/Home/Views/partials/js_vars.volt index 14bd81cd..40d2146b 100644 --- a/app/Http/Home/Views/partials/js_vars.volt +++ b/app/Http/Home/Views/partials/js_vars.volt @@ -29,9 +29,6 @@ tool_video_enabled: '{{ im_info.main.tool_video_enabled }}', msg_max_length: '{{ im_info.main.msg_max_length }}', }, - cs: { - enabled: '{{ im_info.cs.enabled }}' - }, ws: { connect_url: '{{ im_info.ws.connect_url }}', ping_interval: '{{ im_info.ws.ping_interval }}' diff --git a/app/Http/Home/Views/user/console/account_email.volt b/app/Http/Home/Views/user/console/account_email.volt index 5f4dde35..18cd2115 100644 --- a/app/Http/Home/Views/user/console/account_email.volt +++ b/app/Http/Home/Views/user/console/account_email.volt @@ -28,12 +28,13 @@

- +
+ diff --git a/app/Http/Home/Views/user/console/account_phone.volt b/app/Http/Home/Views/user/console/account_phone.volt index 93459066..7c34aa58 100644 --- a/app/Http/Home/Views/user/console/account_phone.volt +++ b/app/Http/Home/Views/user/console/account_phone.volt @@ -28,12 +28,13 @@
- +
+ diff --git a/app/Library/AppInfo.php b/app/Library/AppInfo.php index 8ae50148..a4dea0cb 100644 --- a/app/Library/AppInfo.php +++ b/app/Library/AppInfo.php @@ -16,7 +16,7 @@ class AppInfo protected $link = 'https://koogua.com'; - protected $version = '1.5.0'; + protected $version = '1.5.1'; public function __get($name) { diff --git a/app/Library/Helper.php b/app/Library/Helper.php index 3288ff70..7dcefc4b 100644 --- a/app/Library/Helper.php +++ b/app/Library/Helper.php @@ -499,8 +499,8 @@ function kg_anonymous($str) $start = 3; $end = $length - 4; } else { - $start = 1; - $end = $length - 2; + $start = ceil($length / 4); + $end = $length - $start - 1; } $list = []; diff --git a/app/Models/PointHistory.php b/app/Models/PointHistory.php index 49942b5f..24b6d122 100644 --- a/app/Models/PointHistory.php +++ b/app/Models/PointHistory.php @@ -14,8 +14,8 @@ class PointHistory extends Model * 事件类型 */ const EVENT_ORDER_CONSUME = 1; // 订单消费 - const EVENT_POINT_REDEEM = 2; // 积分兑换 - const EVENT_POINT_REFUND = 3; // 积分退款 + const EVENT_POINT_GIFT_REDEEM = 2; // 积分礼品兑换 + const EVENT_POINT_GIFT_REFUND = 3; // 积分礼品退款 const EVENT_ACCOUNT_REGISTER = 4; // 帐号注册 const EVENT_SITE_VISIT = 5; // 站点访问 const EVENT_CHAPTER_STUDY = 6; // 课时学习 @@ -126,8 +126,8 @@ class PointHistory extends Model { return [ self::EVENT_ORDER_CONSUME => '订单消费', - self::EVENT_POINT_REDEEM => '积分兑换', - self::EVENT_POINT_REFUND => '积分退款', + self::EVENT_POINT_GIFT_REDEEM => '积分礼品兑换', + self::EVENT_POINT_GIFT_REFUND => '积分礼品退款', self::EVENT_ACCOUNT_REGISTER => '用户注册', self::EVENT_SITE_VISIT => '用户登录', self::EVENT_CHAPTER_STUDY => '课时学习', diff --git a/app/Repos/Connect.php b/app/Repos/Connect.php index 7e6f7f82..4d580743 100644 --- a/app/Repos/Connect.php +++ b/app/Repos/Connect.php @@ -25,14 +25,18 @@ class Connect extends Repository $query->where('1 = 1'); - if (isset($where['user_id'])) { + if (!empty($where['user_id'])) { $query->andWhere('user_id = :user_id:', ['user_id' => $where['user_id']]); } - if (isset($where['provider'])) { + if (!empty($where['provider'])) { $query->andWhere('provider = :provider:', ['provider' => $where['provider']]); } + if (isset($where['deleted'])) { + $query->andWhere('deleted = :deleted:', ['deleted' => $where['deleted']]); + } + $query->orderBy('id DESC'); return $query->execute(); diff --git a/app/Services/ChapterVod.php b/app/Services/ChapterVod.php index 8f11bc3b..6b2e174e 100644 --- a/app/Services/ChapterVod.php +++ b/app/Services/ChapterVod.php @@ -23,12 +23,19 @@ class ChapterVod extends Service * 腾讯云点播优先 */ if ($vod->file_id) { - $result = $this->getCosPlayUrls($chapterId); + $playUrls = $this->getCosPlayUrls($chapterId); } else { - $result = $this->getRemotePlayUrls($chapterId); + $playUrls = $this->getRemotePlayUrls($chapterId); } - return $result; + /** + *过滤播放地址为空的条目 + */ + foreach ($playUrls as $key => $value) { + if (empty($value['url'])) unset($playUrls[$key]); + } + + return $playUrls; } public function getCosPlayUrls($chapterId) diff --git a/app/Services/Logic/Course/BasicInfo.php b/app/Services/Logic/Course/BasicInfo.php index 28eaaf44..12ab308b 100644 --- a/app/Services/Logic/Course/BasicInfo.php +++ b/app/Services/Logic/Course/BasicInfo.php @@ -46,9 +46,9 @@ class BasicInfo extends LogicService 'summary' => $course->summary, 'details' => $details, 'keywords' => $course->keywords, - 'origin_price' => $course->origin_price, - 'market_price' => $course->market_price, - 'vip_price' => $course->vip_price, + 'origin_price' => (float)$course->origin_price, + 'market_price' => (float)$course->market_price, + 'vip_price' => (float)$course->vip_price, 'study_expiry' => $course->study_expiry, 'refund_expiry' => $course->refund_expiry, 'teachers' => $teachers, diff --git a/app/Services/Logic/Course/CourseList.php b/app/Services/Logic/Course/CourseList.php index f3f62db1..ef4eb900 100644 --- a/app/Services/Logic/Course/CourseList.php +++ b/app/Services/Logic/Course/CourseList.php @@ -82,11 +82,11 @@ class CourseList extends LogicService 'id' => $course['id'], 'title' => $course['title'], 'cover' => $course['cover'], - 'market_price' => (float)$course['market_price'], - 'vip_price' => (float)$course['vip_price'], - 'rating' => round($course['rating'], 1), 'model' => $course['model'], 'level' => $course['level'], + 'rating' => round($course['rating'], 1), + 'market_price' => (float)$course['market_price'], + 'vip_price' => (float)$course['vip_price'], 'user_count' => $course['user_count'], 'lesson_count' => $course['lesson_count'], 'review_count' => $course['review_count'], diff --git a/app/Services/Logic/Course/PackageList.php b/app/Services/Logic/Course/PackageList.php index aa8f29b5..876e5c67 100644 --- a/app/Services/Logic/Course/PackageList.php +++ b/app/Services/Logic/Course/PackageList.php @@ -43,7 +43,7 @@ class PackageList extends LogicService if ($courses) { foreach ($courses as $course) { - $package['origin_price'] += $course['origin_price']; + $package['origin_price'] += $course['market_price']; } $package['courses'] = $this->sortCourses($courses, $firstCourseId); } diff --git a/app/Services/Logic/Order/OrderConfirm.php b/app/Services/Logic/Order/OrderConfirm.php index 0543a971..f4e466e9 100644 --- a/app/Services/Logic/Order/OrderConfirm.php +++ b/app/Services/Logic/Order/OrderConfirm.php @@ -38,7 +38,7 @@ class OrderConfirm extends LogicService $result['item_info']['course'] = $this->handleCourseInfo($course); - $result['total_amount'] = $course->origin_price; + $result['total_amount'] = $course->market_price; $result['pay_amount'] = $user->vip ? $course->vip_price : $course->market_price; $result['discount_amount'] = $result['total_amount'] - $result['pay_amount']; @@ -51,7 +51,7 @@ class OrderConfirm extends LogicService $result['total_amount'] = 0; foreach ($result['item_info']['package']['courses'] as $course) { - $result['total_amount'] += $course['origin_price']; + $result['total_amount'] += $course['market_price']; } $result['pay_amount'] = $user->vip ? $package->vip_price : $package->market_price; diff --git a/app/Services/Logic/Point/History/PointRedeem.php b/app/Services/Logic/Point/History/PointGiftRedeem.php similarity index 96% rename from app/Services/Logic/Point/History/PointRedeem.php rename to app/Services/Logic/Point/History/PointGiftRedeem.php index 0e4ccca9..046a9b90 100644 --- a/app/Services/Logic/Point/History/PointRedeem.php +++ b/app/Services/Logic/Point/History/PointGiftRedeem.php @@ -25,7 +25,7 @@ class PointGiftRedeem extends PointHistory if ($pointEnabled == 0) return; $eventId = $redeem->id; - $eventType = PointHistoryModel::EVENT_POINT_REDEEM; + $eventType = PointHistoryModel::EVENT_POINT_GIFT_REDEEM; $eventPoint = 0 - $redeem->gift_point; $historyRepo = new PointHistoryRepo(); diff --git a/app/Services/Logic/Point/History/PointRefund.php b/app/Services/Logic/Point/History/PointGiftRefund.php similarity index 93% rename from app/Services/Logic/Point/History/PointRefund.php rename to app/Services/Logic/Point/History/PointGiftRefund.php index e5db10e9..477af098 100644 --- a/app/Services/Logic/Point/History/PointRefund.php +++ b/app/Services/Logic/Point/History/PointGiftRefund.php @@ -13,13 +13,13 @@ use App\Repos\PointHistory as PointHistoryRepo; use App\Repos\User as UserRepo; use App\Services\Logic\Point\PointHistory; -class PointRefund extends PointHistory +class PointGiftRefund extends PointHistory { public function handle(PointGiftRedeemModel $redeem) { $eventId = $redeem->id; - $eventType = PointHistoryModel::EVENT_POINT_REFUND; + $eventType = PointHistoryModel::EVENT_POINT_GIFT_REFUND; $eventPoint = $redeem->gift_point; $historyRepo = new PointHistoryRepo(); diff --git a/app/Services/Logic/User/Console/ConnectDelete.php b/app/Services/Logic/User/Console/ConnectDelete.php index b2a4acc6..945cfba9 100644 --- a/app/Services/Logic/User/Console/ConnectDelete.php +++ b/app/Services/Logic/User/Console/ConnectDelete.php @@ -23,7 +23,9 @@ class ConnectDelete extends LogicService $validator->checkOwner($user->id, $connect->user_id); - $connect->delete(); + $connect->deleted = 1; + + $connect->update(); } } diff --git a/app/Services/Logic/User/Console/Online.php b/app/Services/Logic/User/Console/Online.php index 3480323a..8c2b6842 100644 --- a/app/Services/Logic/User/Console/Online.php +++ b/app/Services/Logic/User/Console/Online.php @@ -88,19 +88,20 @@ class Online extends LogicService $cache = $this->getCache(); - $content = $cache->get($keyName); - - if ($content) return; - - $service = new SiteVisitPointHistory(); - - $service->handle($user); + if ($cache->exists($keyName)) return; + /** + * 先写入缓存,再处理访问积分,防止重复插入记录 + */ $tomorrow = strtotime($todayDate) + 86400; $lifetime = $tomorrow - time(); $cache->save($keyName, 1, $lifetime); + + $service = new SiteVisitPointHistory(); + + $service->handle($user); } } diff --git a/app/Services/Logic/User/UserInfo.php b/app/Services/Logic/User/UserInfo.php index 73d514ea..44c3fefc 100644 --- a/app/Services/Logic/User/UserInfo.php +++ b/app/Services/Logic/User/UserInfo.php @@ -48,6 +48,8 @@ class UserInfo extends LogicService 'comment_count' => $user->comment_count, 'friend_count' => $imUser->friend_count, 'group_count' => $imUser->group_count, + 'vip_expiry_time' => $user->vip_expiry_time, + 'lock_expiry_time' => $user->lock_expiry_time, 'active_time' => $user->active_time, 'create_time' => $user->create_time, 'update_time' => $user->update_time, diff --git a/app/Services/Service.php b/app/Services/Service.php index 2d9797c3..a1a43116 100644 --- a/app/Services/Service.php +++ b/app/Services/Service.php @@ -7,69 +7,12 @@ 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\Config as PhConfig; -use Phalcon\Logger\Adapter\File as PhLogger; +use App\Traits\Service as ServiceTrait; use Phalcon\Mvc\User\Component; class Service extends Component { - use AuthTrait; - - /** - * @return PhConfig - */ - public function getConfig() - { - return $this->getDI()->getShared('config'); - } - - /** - * @return RedisCache - */ - public function getCache() - { - return $this->getDI()->getShared('cache'); - } - - /** - * @return \Redis - */ - public function getRedis() - { - return $this->getCache()->getRedis(); - } - - /** - * 获取Logger - * - * @param string $channel - * @return PhLogger - */ - public function getLogger($channel = null) - { - $logger = new AppLogger(); - - $channel = $channel ?: 'common'; - - return $logger->getInstance($channel); - } - - /** - * 获取某组配置项 - * - * @param string $section - * @return array - */ - public function getSettings($section) - { - $cache = new SettingCache(); - - return $cache->get($section); - } - + use ServiceTrait; } diff --git a/app/Traits/Service.php b/app/Traits/Service.php new file mode 100644 index 00000000..8ce0bf6d --- /dev/null +++ b/app/Traits/Service.php @@ -0,0 +1,72 @@ +getShared('config'); + } + + /** + * @return RedisCache + */ + public function getCache() + { + return Di::getDefault()->getShared('cache'); + } + + /** + * @return \Redis + */ + public function getRedis() + { + return $this->getCache()->getRedis(); + } + + /** + * 获取Logger + * + * @param string $channel + * @return PhLogger + */ + public function getLogger($channel = null) + { + $logger = new AppLogger(); + + $channel = $channel ?: 'common'; + + return $logger->getInstance($channel); + } + + /** + * 获取某组配置项 + * + * @param string $section + * @return array + */ + public function getSettings($section) + { + $cache = new SettingCache(); + + return $cache->get($section); + } + +} \ No newline at end of file diff --git a/db/migrations/20210403184518.php b/db/migrations/20210403184518.php index c8bd566e..8f854d97 100644 --- a/db/migrations/20210403184518.php +++ b/db/migrations/20210403184518.php @@ -821,7 +821,7 @@ final class V20210403184518 extends AbstractMigration [ 'section' => 'vod', 'item_key' => 'key_anti_ip_limit', - 'item_value' => '', + 'item_value' => '3', ], [ 'section' => 'dingtalk.robot', diff --git a/public/static/home/css/common.css b/public/static/home/css/common.css index 90493a22..8c93a398 100644 --- a/public/static/home/css/common.css +++ b/public/static/home/css/common.css @@ -1505,6 +1505,7 @@ } .cart-course-card .price { + margin-right: 5px; color: red; } diff --git a/public/static/home/js/captcha.verify.js b/public/static/home/js/captcha.verify.js index 13fe91c3..2196ffdf 100644 --- a/public/static/home/js/captcha.verify.js +++ b/public/static/home/js/captcha.verify.js @@ -5,40 +5,26 @@ layui.use(['jquery', 'util'], function () { var timeCounting = false; var $account = $('#cv-account'); - var $emit = $('#cv-verify-emit'); + var $emit = $('#cv-emit-btn'); + var $submit = $('#cv-submit-btn'); - var captcha = new TencentCaptcha( - $emit[0], - $('#cv-app-id').val(), - function (res) { - if (res.ret === 0) { - $('#cv-ticket').val(res.ticket); - $('#cv-rand').val(res.randstr); - if (isEmail($account.val()) || isPhone($account.val())) { - var postUrl; - var postData = { - ticket: $('#cv-ticket').val(), - rand: $('#cv-rand').val(), - }; - if (isPhone($account.val())) { - postData.phone = $account.val(); - postUrl = '/verify/sms/code'; - } else if (isEmail($account.val())) { - postData.email = $account.val(); - postUrl = '/verify/mail/code'; - } - $.ajax({ - type: 'POST', - url: postUrl, - data: postData - }); - $('#cv-submit-btn').removeClass('layui-btn-disabled').removeAttr('disabled'); - $emit.addClass('layui-btn-disabled').attr('disabled', 'disabled'); - showCountDown($emit); + if ($('#cv-enabled').val() === '1') { + var captcha = new TencentCaptcha( + $emit[0], + $('#cv-app-id').val(), + function (res) { + if (res.ret === 0) { + $('#cv-ticket').val(res.ticket); + $('#cv-rand').val(res.randstr); + sendVerifyCode(); } } - } - ); + ); + } else { + $emit.on('click', function () { + sendVerifyCode(); + }); + } $account.on('keyup', function () { var accountOk; @@ -58,14 +44,39 @@ layui.use(['jquery', 'util'], function () { } }); - function showCountDown(obj) { + function sendVerifyCode() { + if (isEmail($account.val()) || isPhone($account.val())) { + var postUrl; + var postData = { + ticket: $('#cv-ticket').val(), + rand: $('#cv-rand').val(), + }; + if (isPhone($account.val())) { + postData.phone = $account.val(); + postUrl = '/verify/sms/code'; + } else if (isEmail($account.val())) { + postData.email = $account.val(); + postUrl = '/verify/mail/code'; + } + $.ajax({ + type: 'POST', + url: postUrl, + data: postData, + }); + $submit.removeClass('layui-btn-disabled').removeAttr('disabled'); + $emit.addClass('layui-btn-disabled').attr('disabled', 'disabled'); + showCountDown($emit); + } + } + + function showCountDown() { var serverTime = new Date().getTime(); var endTime = serverTime + 60 * 1000; util.countdown(endTime, serverTime, function (date, serverTime, timer) { var left = date[0] * 86400 + date[1] * 3600 + date[2] * 60 + date[3]; - obj.text(left + '秒'); + $emit.text(left + '秒'); if (left === 0) { - obj.removeClass('layui-btn-disabled').removeAttr('disabled').text('重新发送'); + $emit.removeClass('layui-btn-disabled').removeAttr('disabled').text('重新发送'); clearInterval(timer); timeCounting = false; }