diff --git a/CHANGELOG.md b/CHANGELOG.md index c6238fc4..729de666 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +### [v1.5.2](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.2)(2022-04-17) + +- 补充话题列表课程数据结构 +- 调整发送验证码相关样式 +- 优化套餐和话题下拉课程数据显示 +- 去除礼物详情中多出来的"}}"标签 +- 修正关闭秒杀订单时没有回填库存的问题 +- vditor编辑器切换为七牛cdn加速 + ### [v1.5.1](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.1)(2022-03-17) - 推荐课程等列表补充属性 diff --git a/app/Builders/CourseTopicList.php b/app/Builders/CourseTopicList.php index 88ec8643..6a7ebf2d 100644 --- a/app/Builders/CourseTopicList.php +++ b/app/Builders/CourseTopicList.php @@ -45,7 +45,7 @@ class CourseTopicList extends Builder 'id', 'title', 'cover', 'market_price', 'vip_price', 'rating', 'model', 'level', 'attrs', - 'user_count', 'lesson_count', + 'user_count', 'lesson_count', 'review_count', 'favorite_count', ]; $courses = $courseRepo->findByIds($ids, $columns); diff --git a/app/Console/Tasks/CloseFlashSaleOrderTask.php b/app/Console/Tasks/CloseFlashSaleOrderTask.php index e51da67c..b83afe2b 100644 --- a/app/Console/Tasks/CloseFlashSaleOrderTask.php +++ b/app/Console/Tasks/CloseFlashSaleOrderTask.php @@ -8,6 +8,7 @@ namespace App\Console\Tasks; use App\Models\Order as OrderModel; +use App\Repos\FlashSale as FlashSaleRepo; use App\Services\Logic\FlashSale\Queue as FlashSaleQueue; use App\Services\Logic\FlashSale\UserOrderCache; use Phalcon\Mvc\Model\Resultset; @@ -27,6 +28,7 @@ class CloseFlashSaleOrderTask extends Task echo '------ start close order task ------' . PHP_EOL; foreach ($orders as $order) { + $this->incrFlashSaleStock($order->promotion_id); $this->pushFlashSaleQueue($order->promotion_id); $this->deleteUserOrderCache($order->owner_id, $order->promotion_id); $order->status = OrderModel::STATUS_CLOSED; @@ -36,6 +38,17 @@ class CloseFlashSaleOrderTask extends Task echo '------ end close order task ------' . PHP_EOL; } + protected function incrFlashSaleStock($saleId) + { + $flashSaleRepo = new FlashSaleRepo(); + + $flashSale = $flashSaleRepo->findById($saleId); + + $flashSale->stock += 1; + + $flashSale->update(); + } + protected function pushFlashSaleQueue($saleId) { $queue = new FlashSaleQueue(); diff --git a/app/Http/Admin/Services/ChapterContent.php b/app/Http/Admin/Services/ChapterContent.php index 3cc3fda3..5d257fc5 100644 --- a/app/Http/Admin/Services/ChapterContent.php +++ b/app/Http/Admin/Services/ChapterContent.php @@ -15,7 +15,6 @@ use App\Repos\Chapter as ChapterRepo; use App\Repos\Course as CourseRepo; use App\Services\ChapterVod as ChapterVodService; use App\Services\CourseStat as CourseStatService; -use App\Services\Vod as VodService; use App\Validators\ChapterLive as ChapterLiveValidator; use App\Validators\ChapterOffline as ChapterOfflineValidator; use App\Validators\ChapterRead as ChapterReadValidator; @@ -134,28 +133,14 @@ class ChapterContent extends Service $vod = $chapterRepo->findChapterVod($chapter->id); - /** - * 无新文件上传 - */ - if ($fileId == $vod->file_id) return; - - /** - * 删除旧文件 - */ - if ($vod->file_id) { - $this->deleteVodFile($vod->file_id); - } - $vod->file_id = $fileId; $vod->file_transcode = []; - $vod->update(); $attrs = $chapter->attrs; $attrs['duration'] = 0; $attrs['file']['status'] = ChapterModel::FS_UPLOADED; $chapter->attrs = $attrs; - $chapter->update(); $this->updateCourseVodAttrs($vod->course_id); @@ -331,13 +316,6 @@ class ChapterContent extends Service $statService->updateOfflineAttrs($courseId); } - protected function deleteVodFile($fileId) - { - $vodService = new VodService(); - - $vodService->deleteMedia($fileId); - } - protected function rebuildCatalogCache(ChapterModel $chapter) { $cache = new CatalogCache(); diff --git a/app/Http/Admin/Services/Package.php b/app/Http/Admin/Services/Package.php index f42e040e..ec92f2ae 100644 --- a/app/Http/Admin/Services/Package.php +++ b/app/Http/Admin/Services/Package.php @@ -59,8 +59,9 @@ class Package extends Service $result = []; foreach ($items as $item) { + $price = $item->market_price > 0 ? sprintf("¥%0.2f", $item->market_price) : '免费'; $result[] = [ - 'name' => sprintf('%s - %s(¥%0.2f)', $item->id, $item->title, $item->market_price), + 'name' => sprintf('%s - %s(¥%0.2f)', $item->id, $item->title, $price), 'value' => $item->id, 'selected' => in_array($item->id, $courseIds), ]; diff --git a/app/Http/Admin/Services/Slide.php b/app/Http/Admin/Services/Slide.php index 685e88ef..492284e1 100644 --- a/app/Http/Admin/Services/Slide.php +++ b/app/Http/Admin/Services/Slide.php @@ -34,8 +34,9 @@ class Slide extends Service $result = []; foreach ($items as $item) { + $price = $item->market_price > 0 ? sprintf("¥%0.2f", $item->market_price) : '免费'; $result[] = [ - 'name' => sprintf('%s(¥%0.2f)', $item->title, $item->market_price), + 'name' => sprintf('%s- %s(%s)', $item->id, $item->title, $price), 'value' => $item->id, ]; } diff --git a/app/Http/Admin/Services/Topic.php b/app/Http/Admin/Services/Topic.php index 5b336cb7..b463a716 100644 --- a/app/Http/Admin/Services/Topic.php +++ b/app/Http/Admin/Services/Topic.php @@ -45,8 +45,9 @@ class Topic extends Service $result = []; foreach ($items as $item) { + $price = $item->market_price > 0 ? sprintf("¥%0.2f", $item->market_price) : '免费'; $result[] = [ - 'name' => sprintf('%s - %s(¥%0.2f)', $item->id, $item->title, $item->market_price), + 'name' => sprintf('%s - %s(¥%0.2f)', $item->id, $item->title, $price), 'value' => $item->id, 'selected' => in_array($item->id, $courseIds), ]; diff --git a/app/Http/Admin/Views/answer/add.volt b/app/Http/Admin/Views/answer/add.volt index d0e4792d..f7c65072 100644 --- a/app/Http/Admin/Views/answer/add.volt +++ b/app/Http/Admin/Views/answer/add.volt @@ -29,13 +29,13 @@ {% block link_css %} - {{ css_link('https://cdn.jsdelivr.net/npm/vditor/dist/index.css', false) }} + {{ css_link('https://cdn.staticfile.org/vditor/3.8.13/index.css', false) }} {% endblock %} {% block include_js %} - {{ js_include('https://cdn.jsdelivr.net/npm/vditor/dist/index.min.js', false) }} + {{ js_include('https://cdn.staticfile.org/vditor/3.8.13/index.min.js', false) }} {{ js_include('admin/js/vditor.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Admin/Views/answer/edit.volt b/app/Http/Admin/Views/answer/edit.volt index 4812e5c8..8469dd47 100644 --- a/app/Http/Admin/Views/answer/edit.volt +++ b/app/Http/Admin/Views/answer/edit.volt @@ -28,13 +28,13 @@ {% block link_css %} - {{ css_link('https://cdn.jsdelivr.net/npm/vditor/dist/index.css', false) }} + {{ css_link('https://cdn.staticfile.org/vditor/3.8.13/index.css', false) }} {% endblock %} {% block include_js %} - {{ js_include('https://cdn.jsdelivr.net/npm/vditor/dist/index.min.js', false) }} + {{ js_include('https://cdn.staticfile.org/vditor/3.8.13/index.min.js', false) }} {{ js_include('admin/js/vditor.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Admin/Views/article/edit.volt b/app/Http/Admin/Views/article/edit.volt index 179f055e..dc9fa67f 100644 --- a/app/Http/Admin/Views/article/edit.volt +++ b/app/Http/Admin/Views/article/edit.volt @@ -25,13 +25,13 @@ {% block link_css %} - {{ css_link('https://cdn.jsdelivr.net/npm/vditor/dist/index.css', false) }} + {{ css_link('https://cdn.staticfile.org/vditor/3.8.13/index.css', false) }} {% endblock %} {% block include_js %} - {{ js_include('https://cdn.jsdelivr.net/npm/vditor/dist/index.min.js', false) }} + {{ js_include('https://cdn.staticfile.org/vditor/3.8.13/index.min.js', false) }} {{ js_include('lib/xm-select.js') }} {{ js_include('admin/js/vditor.js') }} diff --git a/app/Http/Admin/Views/chapter/edit_lesson.volt b/app/Http/Admin/Views/chapter/edit_lesson.volt index 8d9bd066..b42b75d6 100644 --- a/app/Http/Admin/Views/chapter/edit_lesson.volt +++ b/app/Http/Admin/Views/chapter/edit_lesson.volt @@ -50,7 +50,7 @@ {% block link_css %} {% if chapter.model == 3 %} - {{ css_link('https://cdn.jsdelivr.net/npm/vditor/dist/index.css', false) }} + {{ css_link('https://cdn.staticfile.org/vditor/3.8.13/index.css', false) }} {% endif %} {% endblock %} @@ -59,7 +59,7 @@ {% if chapter.model == 3 %} - {{ js_include('https://cdn.jsdelivr.net/npm/vditor/dist/index.min.js', false) }} + {{ js_include('https://cdn.staticfile.org/vditor/3.8.13/index.min.js', false) }} {{ js_include('admin/js/vditor.js') }} {% elseif chapter.model == 1 %} diff --git a/app/Http/Admin/Views/course/edit.volt b/app/Http/Admin/Views/course/edit.volt index 70d6f475..a8dc5e15 100644 --- a/app/Http/Admin/Views/course/edit.volt +++ b/app/Http/Admin/Views/course/edit.volt @@ -41,13 +41,13 @@ {% block link_css %} - {{ css_link('https://cdn.jsdelivr.net/npm/vditor/dist/index.css', false) }} + {{ css_link('https://cdn.staticfile.org/vditor/3.8.13/index.css', false) }} {% endblock %} {% block include_js %} - {{ js_include('https://cdn.jsdelivr.net/npm/vditor/dist/index.min.js', false) }} + {{ js_include('https://cdn.staticfile.org/vditor/3.8.13/index.min.js', false) }} {{ js_include('lib/xm-select.js') }} {{ js_include('admin/js/cover.upload.js') }} {{ js_include('admin/js/vditor.js') }} diff --git a/app/Http/Admin/Views/help/add.volt b/app/Http/Admin/Views/help/add.volt index fe2a2508..947a986d 100644 --- a/app/Http/Admin/Views/help/add.volt +++ b/app/Http/Admin/Views/help/add.volt @@ -49,13 +49,13 @@ {% block link_css %} - {{ css_link('https://cdn.jsdelivr.net/npm/vditor/dist/index.css', false) }} + {{ css_link('https://cdn.staticfile.org/vditor/3.8.13/index.css', false) }} {% endblock %} {% block include_js %} - {{ js_include('https://cdn.jsdelivr.net/npm/vditor/dist/index.min.js', false) }} + {{ js_include('https://cdn.staticfile.org/vditor/3.8.13/index.min.js', false) }} {{ js_include('admin/js/vditor.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Admin/Views/help/edit.volt b/app/Http/Admin/Views/help/edit.volt index 72cf83dd..f084dc67 100644 --- a/app/Http/Admin/Views/help/edit.volt +++ b/app/Http/Admin/Views/help/edit.volt @@ -56,13 +56,13 @@ {% block link_css %} - {{ css_link('https://cdn.jsdelivr.net/npm/vditor/dist/index.css', false) }} + {{ css_link('https://cdn.staticfile.org/vditor/3.8.13/index.css', false) }} {% endblock %} {% block include_js %} - {{ js_include('https://cdn.jsdelivr.net/npm/vditor/dist/index.min.js', false) }} + {{ js_include('https://cdn.staticfile.org/vditor/3.8.13/index.min.js', false) }} {{ js_include('admin/js/vditor.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Admin/Views/page/add.volt b/app/Http/Admin/Views/page/add.volt index 399e5fe8..1447d34f 100644 --- a/app/Http/Admin/Views/page/add.volt +++ b/app/Http/Admin/Views/page/add.volt @@ -32,13 +32,13 @@ {% block link_css %} - {{ css_link('https://cdn.jsdelivr.net/npm/vditor/dist/index.css', false) }} + {{ css_link('https://cdn.staticfile.org/vditor/3.8.13/index.css', false) }} {% endblock %} {% block include_js %} - {{ js_include('https://cdn.jsdelivr.net/npm/vditor/dist/index.min.js', false) }} + {{ js_include('https://cdn.staticfile.org/vditor/3.8.13/index.min.js', false) }} {{ js_include('admin/js/vditor.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Admin/Views/page/edit.volt b/app/Http/Admin/Views/page/edit.volt index 532b3b3f..9b3b6c26 100644 --- a/app/Http/Admin/Views/page/edit.volt +++ b/app/Http/Admin/Views/page/edit.volt @@ -45,13 +45,13 @@ {% block link_css %} - {{ css_link('https://cdn.jsdelivr.net/npm/vditor/dist/index.css', false) }} + {{ css_link('https://cdn.staticfile.org/vditor/3.8.13/index.css', false) }} {% endblock %} {% block include_js %} - {{ js_include('https://cdn.jsdelivr.net/npm/vditor/dist/index.min.js', false) }} + {{ js_include('https://cdn.staticfile.org/vditor/3.8.13/index.min.js', false) }} {{ js_include('admin/js/vditor.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Admin/Views/point_gift/edit.volt b/app/Http/Admin/Views/point_gift/edit.volt index 8c1d654f..6d0494e6 100644 --- a/app/Http/Admin/Views/point_gift/edit.volt +++ b/app/Http/Admin/Views/point_gift/edit.volt @@ -15,7 +15,7 @@ {% block link_css %} {% if gift.type == 2 %} - {{ css_link('https://cdn.jsdelivr.net/npm/vditor/dist/index.css', false) }} + {{ css_link('https://cdn.staticfile.org/vditor/3.8.13/index.css', false) }} {% endif %} {% endblock %} @@ -23,7 +23,7 @@ {% block include_js %} {% if gift.type == 2 %} - {{ js_include('https://cdn.jsdelivr.net/npm/vditor/dist/index.min.js', false) }} + {{ js_include('https://cdn.staticfile.org/vditor/3.8.13/index.min.js', false) }} {{ js_include('admin/js/cover.upload.js') }} {{ js_include('admin/js/vditor.js') }} {% endif %} diff --git a/app/Http/Admin/Views/question/edit.volt b/app/Http/Admin/Views/question/edit.volt index c99a7fc0..9158bf95 100644 --- a/app/Http/Admin/Views/question/edit.volt +++ b/app/Http/Admin/Views/question/edit.volt @@ -25,13 +25,13 @@ {% block link_css %} - {{ css_link('https://cdn.jsdelivr.net/npm/vditor/dist/index.css', false) }} + {{ css_link('https://cdn.staticfile.org/vditor/3.8.13/index.css', false) }} {% endblock %} {% block include_js %} - {{ js_include('https://cdn.jsdelivr.net/npm/vditor/dist/index.min.js', false) }} + {{ js_include('https://cdn.staticfile.org/vditor/3.8.13/index.min.js', false) }} {{ js_include('lib/xm-select.js') }} {{ js_include('admin/js/vditor.js') }} diff --git a/app/Http/Home/Services/FullH5Url.php b/app/Http/Home/Services/FullH5Url.php index cd161aa1..7df818d1 100644 --- a/app/Http/Home/Services/FullH5Url.php +++ b/app/Http/Home/Services/FullH5Url.php @@ -7,6 +7,8 @@ namespace App\Http\Home\Services; +use App\Models\Course as CourseModel; +use App\Repos\Chapter as ChapterRepo; use App\Traits\Client as ClientTrait; class FullH5Url extends Service @@ -118,7 +120,19 @@ class FullH5Url extends Service public function getChapterInfoUrl($id) { - return sprintf('%s/chapter/info?id=%s', $this->baseUrl, $id); + $chapterRepo = new ChapterRepo(); + + $chapter = $chapterRepo->findById($id); + + if ($chapter->model == CourseModel::MODEL_VOD) { + return sprintf('%s/chapter/vod?id=%s', $this->baseUrl, $id); + } elseif ($chapter->model == CourseModel::MODEL_LIVE) { + return sprintf('%s/chapter/live?id=%s', $this->baseUrl, $id); + } elseif ($chapter->model == CourseModel::MODEL_READ) { + return sprintf('%s/chapter/read?id=%s', $this->baseUrl, $id); + } else { + return $this->getHomeUrl(); + } } public function getUserIndexUrl($id) diff --git a/app/Http/Home/Views/account/forget_password.volt b/app/Http/Home/Views/account/forget_password.volt index 5683bf28..8872c571 100644 --- a/app/Http/Home/Views/account/forget_password.volt +++ b/app/Http/Home/Views/account/forget_password.volt @@ -23,7 +23,7 @@