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'));