mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-27 13:00:23 +08:00
增加full_url()函数
This commit is contained in:
parent
cd8e84b574
commit
d5559ec49c
@ -43,12 +43,16 @@ class CloseTradeTask extends Task
|
|||||||
$alipayTrade = $alipay->find($trade->sn);
|
$alipayTrade = $alipay->find($trade->sn);
|
||||||
|
|
||||||
if ($alipayTrade) {
|
if ($alipayTrade) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步通知接收异常,补救漏网
|
* 异步通知接收异常,补救漏网
|
||||||
*/
|
*/
|
||||||
if ($alipayTrade->trade_status == 'TRADE_SUCCESS') {
|
if ($alipayTrade->trade_status == 'TRADE_SUCCESS') {
|
||||||
|
|
||||||
$this->eventsManager->fire('pay:afterPay', $this, $trade);
|
$this->eventsManager->fire('pay:afterPay', $this, $trade);
|
||||||
|
|
||||||
$allowClosed = false;
|
$allowClosed = false;
|
||||||
|
|
||||||
} elseif ($alipayTrade->trade_status == 'WAIT_BUYER_PAY') {
|
} elseif ($alipayTrade->trade_status == 'WAIT_BUYER_PAY') {
|
||||||
$alipay->close($trade->sn);
|
$alipay->close($trade->sn);
|
||||||
}
|
}
|
||||||
@ -75,12 +79,16 @@ class CloseTradeTask extends Task
|
|||||||
$wxpayTrade = $wxpay->find($trade->sn);
|
$wxpayTrade = $wxpay->find($trade->sn);
|
||||||
|
|
||||||
if ($wxpayTrade) {
|
if ($wxpayTrade) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步通知接收异常,补救漏网
|
* 异步通知接收异常,补救漏网
|
||||||
*/
|
*/
|
||||||
if ($wxpayTrade->trade_state == 'SUCCESS') {
|
if ($wxpayTrade->trade_state == 'SUCCESS') {
|
||||||
|
|
||||||
$this->eventsManager->fire('pay:afterPay', $this, $trade);
|
$this->eventsManager->fire('pay:afterPay', $this, $trade);
|
||||||
|
|
||||||
$allowClosed = false;
|
$allowClosed = false;
|
||||||
|
|
||||||
} elseif ($wxpayTrade->trade_state == 'NOTPAY') {
|
} elseif ($wxpayTrade->trade_state == 'NOTPAY') {
|
||||||
$wxpay->close($trade->sn);
|
$wxpay->close($trade->sn);
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,7 @@ class CourseController extends Controller
|
|||||||
$packages = $service->handle($id);
|
$packages = $service->handle($id);
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
|
$this->view->pick('course/show_packages');
|
||||||
$this->view->setVar('packages', $packages);
|
$this->view->setVar('packages', $packages);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,6 +123,7 @@ class CourseController extends Controller
|
|||||||
$pager->target = 'tab-consults';
|
$pager->target = 'tab-consults';
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
|
$this->view->pick('course/show_consults');
|
||||||
$this->view->setVar('pager', $pager);
|
$this->view->setVar('pager', $pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +139,7 @@ class CourseController extends Controller
|
|||||||
$pager->target = 'tab-reviews';
|
$pager->target = 'tab-reviews';
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
|
$this->view->pick('course/show_reviews');
|
||||||
$this->view->setVar('pager', $pager);
|
$this->view->setVar('pager', $pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,6 +153,7 @@ class CourseController extends Controller
|
|||||||
$courses = $service->handle($id);
|
$courses = $service->handle($id);
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
|
$this->view->pick('course/show_recommended');
|
||||||
$this->view->setVar('courses', $courses);
|
$this->view->setVar('courses', $courses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,6 +167,7 @@ class CourseController extends Controller
|
|||||||
$courses = $service->handle($id);
|
$courses = $service->handle($id);
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
|
$this->view->pick('course/show_related');
|
||||||
$this->view->setVar('courses', $courses);
|
$this->view->setVar('courses', $courses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,21 +181,10 @@ class CourseController extends Controller
|
|||||||
$topics = $service->handle($id);
|
$topics = $service->handle($id);
|
||||||
|
|
||||||
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
$this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
|
||||||
|
$this->view->pick('course/show_topics');
|
||||||
$this->view->setVar('topics', $topics);
|
$this->view->setVar('topics', $topics);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Get("/{id:[0-9]+}/reward", name="web.course.reward")
|
|
||||||
*/
|
|
||||||
public function rewardAction($id)
|
|
||||||
{
|
|
||||||
$service = new RewardOptionList();
|
|
||||||
|
|
||||||
$options = $service->handle();
|
|
||||||
|
|
||||||
$this->view->setVar('options', $options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Get("/{id:[0-9]+}/rating", name="web.course.rating")
|
* @Get("/{id:[0-9]+}/rating", name="web.course.rating")
|
||||||
*/
|
*/
|
||||||
@ -200,6 +194,7 @@ class CourseController extends Controller
|
|||||||
|
|
||||||
$course = $service->handle($id);
|
$course = $service->handle($id);
|
||||||
|
|
||||||
|
$this->view->pick('course/rating');
|
||||||
$this->view->setVar('course', $course);
|
$this->view->setVar('course', $course);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% set like_url = url({'for':'web.chapter.like','id':chapter.id}) %}
|
{% set chapter_url = url({'for':'web.chapter.show','id':chapter.id}) %}
|
||||||
{% set learning_url = url({'for':'web.chapter.learning','id':chapter.id}) %}
|
|
||||||
{% set danmu_url = url({'for':'web.chapter.danmu','id':chapter.id}) %}
|
{% set danmu_url = url({'for':'web.chapter.danmu','id':chapter.id}) %}
|
||||||
|
{% set learning_url = url({'for':'web.chapter.learning','id':chapter.id}) %}
|
||||||
|
{% set like_url = url({'for':'web.chapter.like','id':chapter.id}) %}
|
||||||
|
{% set qrcode_url = url({'for':'web.qrcode_img'},{'text':'http://baidu.com','size':5}) %}
|
||||||
|
|
||||||
<div class="breadcrumb">
|
<div class="breadcrumb">
|
||||||
<span class="layui-breadcrumb">
|
<span class="layui-breadcrumb">
|
||||||
@ -19,12 +21,16 @@
|
|||||||
<div id="player"></div>
|
<div id="player"></div>
|
||||||
<div id="danmu"></div>
|
<div id="danmu"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chapter-action wrap">
|
<div class="chapter-action wrap clearfix">
|
||||||
<span><i class="layui-icon layui-icon-praise" id="icon-like" title="点赞" data-url="{{ like_url }}"></i><em id="like-count">{{ chapter.like_count }}</em></span>
|
<div class="share">
|
||||||
<span><i class="layui-icon layui-icon-user" id="icon-user" title="学习人次"></i><em>{{ chapter.user_count }}</em></span>
|
<a href="javascript:" title="点赞" data-url="{{ like_url }}"><i class="layui-icon layui-icon-praise icon-praise"></i><em class="like-count">{{ chapter.like_count }}</em></a>
|
||||||
<span><i class="layui-icon layui-icon-share" id="icon-share" title="分享"></i></span>
|
<a href="javascript:" title="学习人次"><i class="layui-icon layui-icon-user"></i><em>{{ chapter.user_count }}</em></a>
|
||||||
<span><i class="layui-icon layui-icon-set" id="icon-danmu-set" title="弹幕设置"></i></span>
|
<a href="javascript:" title="分享到微信" data-url=""><i class="layui-icon layui-icon-login-wechat icon-wechat"></i></a>
|
||||||
|
<a href="javascript:" title="分享到QQ空间"><i class="layui-icon layui-icon-login-qq icon-qq"></i></a>
|
||||||
|
<a href="javascript:" title="分享到微博"><i class="layui-icon layui-icon-login-weibo icon-weibo"></i></a>
|
||||||
|
</div>
|
||||||
<form class="layui-form danmu-form" lay-filter="danmu.form" action="{{ url({'for':'web.danmu.create'}) }}">
|
<form class="layui-form danmu-form" lay-filter="danmu.form" action="{{ url({'for':'web.danmu.create'}) }}">
|
||||||
|
<a href="javascript:" title="弹幕设置"><i class="layui-icon layui-icon-set icon-danmu-set"></i></a>
|
||||||
{% if auth_user.id > 0 %}
|
{% if auth_user.id > 0 %}
|
||||||
<input class="layui-input" type="text" name="danmu.text" maxlength="50" placeholder="快来发个弹幕吧" lay-verType="tips" lay-verify="required">
|
<input class="layui-input" type="text" name="danmu.text" maxlength="50" placeholder="快来发个弹幕吧" lay-verType="tips" lay-verify="required">
|
||||||
{% else %}
|
{% else %}
|
||||||
@ -94,6 +100,13 @@
|
|||||||
<input type="hidden" name="chapter.play_urls" value='{{ chapter.play_urls|json_encode }}'>
|
<input type="hidden" name="chapter.play_urls" value='{{ chapter.play_urls|json_encode }}'>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-hide">
|
||||||
|
<input type="hidden" name="share.title" value="{{ chapter.course.title }}">
|
||||||
|
<input type="hidden" name="share.pic" value="{{ chapter.course.cover }}">
|
||||||
|
<input type="hidden" name="share.url" value="{{ chapter_url }}">
|
||||||
|
<input type="hidden" name="share.qrcode" value="{{ qrcode_url }}">
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block include_js %}
|
{% block include_js %}
|
||||||
@ -102,6 +115,7 @@
|
|||||||
|
|
||||||
{{ js_include('lib/jquery.min.js') }}
|
{{ js_include('lib/jquery.min.js') }}
|
||||||
{{ js_include('lib/jquery.danmu.min.js') }}
|
{{ js_include('lib/jquery.danmu.min.js') }}
|
||||||
|
{{ js_include('web/js/share.js') }}
|
||||||
{{ js_include('web/js/vod.player.js') }}
|
{{ js_include('web/js/vod.player.js') }}
|
||||||
{{ js_include('web/js/chapter.action.js') }}
|
{{ js_include('web/js/chapter.action.js') }}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="course-meta wrap clearfix">
|
<div class="course-meta wrap clearfix">
|
||||||
{{ partial('course/meta') }}
|
{{ partial('course/show_meta') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="layout-main clearfix">
|
<div class="layout-main clearfix">
|
||||||
@ -26,27 +26,18 @@
|
|||||||
|
|
||||||
<div class="layout-content">
|
<div class="layout-content">
|
||||||
<div class="course-tab-wrap wrap">
|
<div class="course-tab-wrap wrap">
|
||||||
{% if show_tab_packages == 1 %}
|
|
||||||
<span class="tab-count package-count">{{ course.package_count }}</span>
|
|
||||||
{% endif %}
|
|
||||||
{% if show_tab_consults == 1 %}
|
|
||||||
<span class="tab-count consult-count">{{ course.consult_count }}</span>
|
|
||||||
{% endif %}
|
|
||||||
{% if show_tab_reviews == 1 %}
|
|
||||||
<span class="tab-count review-count">{{ course.review_count }}</span>
|
|
||||||
{% endif %}
|
|
||||||
<div class="layui-tab layui-tab-brief course-tab">
|
<div class="layui-tab layui-tab-brief course-tab">
|
||||||
<ul class="layui-tab-title">
|
<ul class="layui-tab-title">
|
||||||
<li class="layui-this">详情</li>
|
<li class="layui-this">详情</li>
|
||||||
<li>目录</li>
|
<li>目录</li>
|
||||||
{% if show_tab_packages == 1 %}
|
{% if show_tab_packages == 1 %}
|
||||||
<li>套餐</li>
|
<li>套餐<span class="tab-count package-count">{{ course.package_count }}</span></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if show_tab_consults == 1 %}
|
{% if show_tab_consults == 1 %}
|
||||||
<li>咨询</li>
|
<li>咨询<span class="tab-count consult-count">{{ course.consult_count }}</span></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if show_tab_reviews == 1 %}
|
{% if show_tab_reviews == 1 %}
|
||||||
<li>评价</li>
|
<li>评价<span class="tab-count review-count">{{ course.review_count }}</span></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
<div class="layui-tab-content">
|
<div class="layui-tab-content">
|
||||||
@ -54,7 +45,7 @@
|
|||||||
<div class="course-details">{{ course.details }}</div>
|
<div class="course-details">{{ course.details }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-tab-item">
|
<div class="layui-tab-item">
|
||||||
{{ partial('course/chapters') }}
|
{{ partial('course/show_chapters') }}
|
||||||
</div>
|
</div>
|
||||||
{% if show_tab_packages == 1 %}
|
{% if show_tab_packages == 1 %}
|
||||||
{% set packages_url = url({'for':'web.course.packages','id':course.id}) %}
|
{% set packages_url = url({'for':'web.course.packages','id':course.id}) %}
|
||||||
@ -79,8 +70,8 @@
|
|||||||
{% set show_sidebar_related = 1 %}
|
{% set show_sidebar_related = 1 %}
|
||||||
|
|
||||||
<div class="layout-sidebar">
|
<div class="layout-sidebar">
|
||||||
{{ partial('course/order') }}
|
{{ partial('course/show_order') }}
|
||||||
{{ partial('course/teachers') }}
|
{{ partial('course/show_teachers') }}
|
||||||
{% if show_sidebar_topics %}
|
{% if show_sidebar_topics %}
|
||||||
{% set topics_url = url({'for':'web.course.topics','id':course.id}) %}
|
{% set topics_url = url({'for':'web.course.topics','id':course.id}) %}
|
||||||
<div class="sidebar" id="sidebar-topics" data-url="{{ topics_url }}"></div>
|
<div class="sidebar" id="sidebar-topics" data-url="{{ topics_url }}"></div>
|
||||||
|
@ -34,14 +34,14 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
{% set favorite_url = url({'for':'web.course.favorite','id':course.id}) %}
|
{% set favorite_url = url({'for':'web.course.favorite','id':course.id}) %}
|
||||||
{% set course_url = url({'for':'web.course.show','id':course.id}) %}
|
{% set full_course_url = full_url({'for':'web.course.show','id':course.id}) %}
|
||||||
{% set qrcode_url = url({'for':'web.qrcode_img'},{'text':'http://baidu.com','size':5}) %}
|
{% set qrcode_url = url({'for':'web.qrcode_img'},{'text':full_course_url}) %}
|
||||||
|
|
||||||
<div class="layui-hide">
|
<div class="layui-hide">
|
||||||
<input type="hidden" name="course.title" value="{{ course.title }}">
|
<input type="hidden" name="share.title" value="{{ course.title }}">
|
||||||
<input type="hidden" name="course.cover" value="{{ course.cover }}">
|
<input type="hidden" name="share.pic" value="{{ course.cover }}">
|
||||||
<input type="hidden" name="course.url" value="{{ course_url }}">
|
<input type="hidden" name="share.url" value="{{ full_course_url }}">
|
||||||
<input type="hidden" name="course.qrcode" value="{{ qrcode_url }}">
|
<input type="hidden" name="share.qrcode" value="{{ qrcode_url }}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="share">
|
<div class="share">
|
@ -1,6 +1,7 @@
|
|||||||
<div class="layui-fluid">
|
<div class="layui-fluid">
|
||||||
<div class="kg-tips">
|
<div class="kg-tips">
|
||||||
<i class="layui-icon layui-icon-face-surprised"></i>
|
<i class="layui-icon layui-icon-face-surprised"></i>
|
||||||
|
<div class="message">{{ flashSession.output() }}</div>
|
||||||
<div class="layui-text">
|
<div class="layui-text">
|
||||||
<h1>
|
<h1>
|
||||||
<span class="layui-anim layui-anim-loop">4</span>
|
<span class="layui-anim layui-anim-loop">4</span>
|
||||||
|
@ -314,7 +314,7 @@ function kg_can($route = null)
|
|||||||
/**
|
/**
|
||||||
* 构造icon路径
|
* 构造icon路径
|
||||||
*
|
*
|
||||||
* @param $path
|
* @param string $path
|
||||||
* @param bool $local
|
* @param bool $local
|
||||||
* @param string $version
|
* @param string $version
|
||||||
* @return string
|
* @return string
|
||||||
@ -329,7 +329,7 @@ function kg_icon_link($path, $local = true, $version = null)
|
|||||||
/**
|
/**
|
||||||
* 构造css路径
|
* 构造css路径
|
||||||
*
|
*
|
||||||
* @param $path
|
* @param string $path
|
||||||
* @param bool $local
|
* @param bool $local
|
||||||
* @param string $version
|
* @param string $version
|
||||||
* @return string
|
* @return string
|
||||||
@ -344,7 +344,7 @@ function kg_css_link($path, $local = true, $version = null)
|
|||||||
/**
|
/**
|
||||||
* 构造js引入
|
* 构造js引入
|
||||||
*
|
*
|
||||||
* @param $path
|
* @param string $path
|
||||||
* @param bool $local
|
* @param bool $local
|
||||||
* @param string $version
|
* @param string $version
|
||||||
* @return string
|
* @return string
|
||||||
@ -359,7 +359,7 @@ function kg_js_include($path, $local = true, $version = null)
|
|||||||
/**
|
/**
|
||||||
* 构造静态url
|
* 构造静态url
|
||||||
*
|
*
|
||||||
* @param $path
|
* @param string $path
|
||||||
* @param bool $local
|
* @param bool $local
|
||||||
* @param string $version
|
* @param string $version
|
||||||
* @return string
|
* @return string
|
||||||
@ -379,3 +379,22 @@ function kg_static_url($path, $local = true, $version = null)
|
|||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造全路径url
|
||||||
|
*
|
||||||
|
* @param mixed $uri
|
||||||
|
* @param mixed $args
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function kg_full_url($uri, $args = null)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var $url Phalcon\Mvc\Url
|
||||||
|
*/
|
||||||
|
$url = Di::getDefault()->getShared('url');
|
||||||
|
|
||||||
|
$baseUrl = kg_site_base_url();
|
||||||
|
|
||||||
|
return $baseUrl . $url->get($uri, $args);
|
||||||
|
}
|
@ -55,6 +55,8 @@ class CourseCounter extends Listener
|
|||||||
$this->counter->hIncrBy($course->id, 'review_count');
|
$this->counter->hIncrBy($course->id, 'review_count');
|
||||||
|
|
||||||
$this->syncCourseCounter($course);
|
$this->syncCourseCounter($course);
|
||||||
|
|
||||||
|
$this->syncCourseIndex($course);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decrReviewCount(Event $event, $source, CourseModel $course)
|
public function decrReviewCount(Event $event, $source, CourseModel $course)
|
||||||
@ -62,6 +64,8 @@ class CourseCounter extends Listener
|
|||||||
$this->counter->hDecrBy($course->id, 'review_count');
|
$this->counter->hDecrBy($course->id, 'review_count');
|
||||||
|
|
||||||
$this->syncCourseCounter($course);
|
$this->syncCourseCounter($course);
|
||||||
|
|
||||||
|
$this->syncCourseIndex($course);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function incrCommentCount(Event $event, $source, CourseModel $course)
|
public function incrCommentCount(Event $event, $source, CourseModel $course)
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Phalcon\Mvc\Model\Behavior\SoftDelete;
|
|
||||||
|
|
||||||
class CourseRating extends Model
|
class CourseRating extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -42,13 +40,6 @@ class CourseRating extends Model
|
|||||||
*/
|
*/
|
||||||
public $rating3;
|
public $rating3;
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除标识
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
public $deleted;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*
|
*
|
||||||
@ -68,18 +59,6 @@ class CourseRating extends Model
|
|||||||
return 'kg_course_rating';
|
return 'kg_course_rating';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initialize()
|
|
||||||
{
|
|
||||||
parent::initialize();
|
|
||||||
|
|
||||||
$this->addBehavior(
|
|
||||||
new SoftDelete([
|
|
||||||
'field' => 'deleted',
|
|
||||||
'value' => 1,
|
|
||||||
])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
$this->create_time = time();
|
||||||
|
@ -17,14 +17,14 @@ class Cache extends Provider
|
|||||||
$config = $this->getShared('config');
|
$config = $this->getShared('config');
|
||||||
|
|
||||||
$frontend = new IgbinaryFrontend([
|
$frontend = new IgbinaryFrontend([
|
||||||
'lifetime' => $config->redis->lifetime,
|
'lifetime' => $config->cache->lifetime,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return new RedisBackend($frontend, [
|
return new RedisBackend($frontend, [
|
||||||
'host' => $config->redis->host,
|
'host' => $config->redis->host,
|
||||||
'port' => $config->redis->port,
|
'port' => $config->redis->port,
|
||||||
'auth' => $config->redis->auth,
|
'auth' => $config->redis->auth,
|
||||||
'index' => $config->redis->index,
|
'index' => $config->cache->db,
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ class Session extends Provider
|
|||||||
'host' => $config->redis->host,
|
'host' => $config->redis->host,
|
||||||
'port' => $config->redis->port,
|
'port' => $config->redis->port,
|
||||||
'auth' => $config->redis->auth,
|
'auth' => $config->redis->auth,
|
||||||
'index' => $config->redis->index,
|
'index' => $config->session->db,
|
||||||
'lifetime' => $config->session->lifetime,
|
'lifetime' => $config->session->lifetime,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -22,6 +22,10 @@ class Volt extends Provider
|
|||||||
|
|
||||||
$compiler = $volt->getCompiler();
|
$compiler = $volt->getCompiler();
|
||||||
|
|
||||||
|
$compiler->addFunction('full_url', function ($resolvedArgs) {
|
||||||
|
return 'kg_full_url(' . $resolvedArgs . ')';
|
||||||
|
});
|
||||||
|
|
||||||
$compiler->addFunction('static_url', function ($resolvedArgs) {
|
$compiler->addFunction('static_url', function ($resolvedArgs) {
|
||||||
return 'kg_static_url(' . $resolvedArgs . ')';
|
return 'kg_static_url(' . $resolvedArgs . ')';
|
||||||
});
|
});
|
||||||
|
@ -8,16 +8,15 @@ use App\Models\Chapter as ChapterModel;
|
|||||||
use App\Models\ChapterUser as ChapterUserModel;
|
use App\Models\ChapterUser as ChapterUserModel;
|
||||||
use App\Models\Comment as CommentModel;
|
use App\Models\Comment as CommentModel;
|
||||||
use App\Models\Consult as ConsultModel;
|
use App\Models\Consult as ConsultModel;
|
||||||
use App\Models\ConsultLike as ConsultLikeModel;
|
|
||||||
use App\Models\Course as CourseModel;
|
use App\Models\Course as CourseModel;
|
||||||
use App\Models\CourseCategory as CourseCategoryModel;
|
use App\Models\CourseCategory as CourseCategoryModel;
|
||||||
use App\Models\CourseFavorite as CourseFavoriteModel;
|
use App\Models\CourseFavorite as CourseFavoriteModel;
|
||||||
use App\Models\CoursePackage as CoursePackageModel;
|
use App\Models\CoursePackage as CoursePackageModel;
|
||||||
|
use App\Models\CourseRating as CourseRatingModel;
|
||||||
use App\Models\CourseRelated as CourseRelatedModel;
|
use App\Models\CourseRelated as CourseRelatedModel;
|
||||||
use App\Models\CourseUser as CourseUserModel;
|
use App\Models\CourseUser as CourseUserModel;
|
||||||
use App\Models\Package as PackageModel;
|
use App\Models\Package as PackageModel;
|
||||||
use App\Models\Review as ReviewModel;
|
use App\Models\Review as ReviewModel;
|
||||||
use App\Models\ReviewLike as ReviewLikeModel;
|
|
||||||
use App\Models\User as UserModel;
|
use App\Models\User as UserModel;
|
||||||
use Phalcon\Mvc\Model;
|
use Phalcon\Mvc\Model;
|
||||||
use Phalcon\Mvc\Model\Resultset;
|
use Phalcon\Mvc\Model\Resultset;
|
||||||
@ -132,6 +131,18 @@ class Course extends Repository
|
|||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $courseId
|
||||||
|
* @return CourseRatingModel|Model|bool
|
||||||
|
*/
|
||||||
|
public function findCourseRating($courseId)
|
||||||
|
{
|
||||||
|
return CourseRatingModel::findFirst([
|
||||||
|
'conditions' => 'course_id = :course_id:',
|
||||||
|
'bind' => ['course_id' => $courseId],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $courseId
|
* @param int $courseId
|
||||||
* @return ResultsetInterface|Resultset|UserModel[]
|
* @return ResultsetInterface|Resultset|UserModel[]
|
||||||
@ -234,38 +245,6 @@ class Course extends Repository
|
|||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $courseId
|
|
||||||
* @param int $userId
|
|
||||||
* @return ResultsetInterface|Resultset|ConsultLikeModel[]
|
|
||||||
*/
|
|
||||||
public function findUserConsultLikes($courseId, $userId)
|
|
||||||
{
|
|
||||||
return $this->modelsManager->createBuilder()
|
|
||||||
->columns('cv.*')
|
|
||||||
->addFrom(ConsultModel::class, 'c')
|
|
||||||
->join(ConsultLikeModel::class, 'c.id = cv.consult_id', 'cv')
|
|
||||||
->where('c.course_id = :course_id:', ['course_id' => $courseId])
|
|
||||||
->andWhere('cv.user_id = :user_id:', ['user_id' => $userId])
|
|
||||||
->getQuery()->execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $courseId
|
|
||||||
* @param int $userId
|
|
||||||
* @return ResultsetInterface|Resultset|ReviewLikeModel[]
|
|
||||||
*/
|
|
||||||
public function findUserReviewLikes($courseId, $userId)
|
|
||||||
{
|
|
||||||
return $this->modelsManager->createBuilder()
|
|
||||||
->columns('rv.*')
|
|
||||||
->addFrom(ReviewModel::class, 'r')
|
|
||||||
->join(ReviewLikeModel::class, 'r.id = rv.review_id', 'rv')
|
|
||||||
->where('r.course_id = :course_id:', ['course_id' => $courseId])
|
|
||||||
->andWhere('rv.user_id = :user_id:', ['user_id' => $userId])
|
|
||||||
->getQuery()->execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function countLessons($courseId)
|
public function countLessons($courseId)
|
||||||
{
|
{
|
||||||
return ChapterModel::count([
|
return ChapterModel::count([
|
||||||
|
60
app/Repos/CourseRating.php
Normal file
60
app/Repos/CourseRating.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repos;
|
||||||
|
|
||||||
|
use App\Models\CourseRating as CourseRatingModel;
|
||||||
|
use App\Models\Review as ReviewModel;
|
||||||
|
use Phalcon\Mvc\Model;
|
||||||
|
|
||||||
|
class CourseRating extends Repository
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $courseId
|
||||||
|
* @return CourseRatingModel|Model|bool
|
||||||
|
*/
|
||||||
|
public function findByCourseId($courseId)
|
||||||
|
{
|
||||||
|
return CourseRatingModel::findFirst([
|
||||||
|
'conditions' => 'course_id = :course_id:',
|
||||||
|
'bind' => ['course_id' => $courseId],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function averageRating($courseId)
|
||||||
|
{
|
||||||
|
return (float)ReviewModel::average([
|
||||||
|
'column' => 'rating',
|
||||||
|
'conditions' => 'course_id = :course_id: AND published = 1',
|
||||||
|
'bind' => ['course_id' => $courseId],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function averageRating1($courseId)
|
||||||
|
{
|
||||||
|
return (float)ReviewModel::average([
|
||||||
|
'column' => 'rating1',
|
||||||
|
'conditions' => 'course_id = :course_id: AND published = 1',
|
||||||
|
'bind' => ['course_id' => $courseId],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function averageRating2($courseId)
|
||||||
|
{
|
||||||
|
return (float)ReviewModel::average([
|
||||||
|
'column' => 'rating2',
|
||||||
|
'conditions' => 'course_id = :course_id: AND published = 1',
|
||||||
|
'bind' => ['course_id' => $courseId],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function averageRating3($courseId)
|
||||||
|
{
|
||||||
|
return (float)ReviewModel::average([
|
||||||
|
'column' => 'rating3',
|
||||||
|
'conditions' => 'course_id = :course_id: AND published = 1',
|
||||||
|
'bind' => ['course_id' => $courseId],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -5,6 +5,7 @@ namespace App\Services\Frontend\Review;
|
|||||||
use App\Models\Course as CourseModel;
|
use App\Models\Course as CourseModel;
|
||||||
use App\Models\Review as ReviewModel;
|
use App\Models\Review as ReviewModel;
|
||||||
use App\Models\User as UserModel;
|
use App\Models\User as UserModel;
|
||||||
|
use App\Repos\CourseRating as CourseRatingRepo;
|
||||||
use App\Services\Frontend\CourseTrait;
|
use App\Services\Frontend\CourseTrait;
|
||||||
use App\Services\Frontend\Service as FrontendService;
|
use App\Services\Frontend\Service as FrontendService;
|
||||||
use App\Validators\CourseUser as CourseUserValidator;
|
use App\Validators\CourseUser as CourseUserValidator;
|
||||||
@ -48,6 +49,8 @@ class ReviewCreate extends FrontendService
|
|||||||
|
|
||||||
$review->create($data);
|
$review->create($data);
|
||||||
|
|
||||||
|
$this->updateCourseRating($course);
|
||||||
|
|
||||||
$this->incrCourseReviewCount($course);
|
$this->incrCourseReviewCount($course);
|
||||||
|
|
||||||
$this->incrUserDailyReviewCount($user);
|
$this->incrUserDailyReviewCount($user);
|
||||||
@ -55,6 +58,22 @@ class ReviewCreate extends FrontendService
|
|||||||
return $review;
|
return $review;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function updateCourseRating(CourseModel $course)
|
||||||
|
{
|
||||||
|
$repo = new CourseRatingRepo();
|
||||||
|
|
||||||
|
$courseRating = $repo->findByCourseId($course->id);
|
||||||
|
|
||||||
|
$courseRating->rating = $repo->averageRating($course->id);
|
||||||
|
$courseRating->rating1 = $repo->averageRating1($course->id);
|
||||||
|
$courseRating->rating2 = $repo->averageRating2($course->id);
|
||||||
|
$courseRating->rating3 = $repo->averageRating3($course->id);
|
||||||
|
$courseRating->update();
|
||||||
|
|
||||||
|
$course->rating = $courseRating->rating;
|
||||||
|
$course->update();
|
||||||
|
}
|
||||||
|
|
||||||
protected function incrCourseReviewCount(CourseModel $course)
|
protected function incrCourseReviewCount(CourseModel $course)
|
||||||
{
|
{
|
||||||
$this->eventsManager->fire('courseCounter:incrReviewCount', $this, $course);
|
$this->eventsManager->fire('courseCounter:incrReviewCount', $this, $course);
|
||||||
|
@ -108,7 +108,7 @@ class HttpErrorHandler extends Component
|
|||||||
{
|
{
|
||||||
$content = $this->translate($e->getMessage());
|
$content = $this->translate($e->getMessage());
|
||||||
|
|
||||||
$this->flash->error($content);
|
$this->flashSession->error($content['msg']);
|
||||||
|
|
||||||
$code = $this->response->getStatusCode();
|
$code = $this->response->getStatusCode();
|
||||||
|
|
||||||
|
@ -83,19 +83,24 @@ $config['redis']['port'] = 6379;
|
|||||||
$config['redis']['auth'] = '1qaz2wsx3edc';
|
$config['redis']['auth'] = '1qaz2wsx3edc';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* redis库编号
|
* 缓存所用redis库编号
|
||||||
*/
|
*/
|
||||||
$config['redis']['index'] = 0;
|
$config['cache']['db'] = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存有效期(秒)
|
* 缓存有效期(秒)
|
||||||
*/
|
*/
|
||||||
$config['redis']['lifetime'] = 2 * 86400;
|
$config['cache']['lifetime'] = 2 * 3600;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会话所用redis库编号
|
||||||
|
*/
|
||||||
|
$config['session']['db'] = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会话有效期(秒)
|
* 会话有效期(秒)
|
||||||
*/
|
*/
|
||||||
$config['session']['lifetime'] = 2 * 3600;
|
$config['session']['lifetime'] = 24 * 3600;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 访问令牌有效期(秒)
|
* 访问令牌有效期(秒)
|
||||||
|
@ -468,29 +468,18 @@ body {
|
|||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.course-tab-wrap {
|
.layui-tab-title li {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.course-tab-wrap .tab-count {
|
.layui-tab-title .tab-count {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 25px;
|
top: -10px;
|
||||||
|
left: 70px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
.course-tab-wrap .package-count {
|
|
||||||
left: 275px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.course-tab-wrap .consult-count {
|
|
||||||
left: 370px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.course-tab-wrap .review-count {
|
|
||||||
left: 465px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.course-tab {
|
.course-tab {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
@ -803,8 +792,13 @@ body {
|
|||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidebar-chapter {
|
||||||
|
padding: 20px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
.sidebar-chapter .layui-field-title {
|
.sidebar-chapter .layui-field-title {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-chapter .layui-field-title legend {
|
.sidebar-chapter .layui-field-title legend {
|
||||||
@ -820,11 +814,10 @@ body {
|
|||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
color: #333;
|
color: #333;
|
||||||
background-color: #fff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-lesson-list {
|
.sidebar-lesson-list {
|
||||||
margin-left: 15px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-lesson-list .lesson-title {
|
.sidebar-lesson-list .lesson-title {
|
||||||
@ -845,50 +838,54 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.read-info {
|
.read-info {
|
||||||
min-height: 428px;
|
min-height: 454px;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chapter-action {
|
.chapter-action {
|
||||||
position: relative;
|
height: 32px;
|
||||||
padding: 20px;
|
line-height: 32px;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chapter-action .layui-icon {
|
.chapter-action .share {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chapter-action .danmu-form {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share .layui-icon {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chapter-action .active, .chapter-action .layui-icon:hover {
|
.share .active, .share .layui-icon:hover {
|
||||||
color: green;
|
color: green;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chapter-action span {
|
.share a {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chapter-action i {
|
.share i {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chapter-action em {
|
.share em {
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
color: #999;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
#icon-danmu-set {
|
.danmu-form .icon-danmu-set {
|
||||||
position: absolute;
|
margin-right: 5px;
|
||||||
top: 22px;
|
|
||||||
right: 530px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chapter-action .layui-input {
|
.danmu-form .layui-input {
|
||||||
position: absolute;
|
|
||||||
top: 15px;
|
|
||||||
right: 20px;
|
|
||||||
width: 500px;
|
width: 500px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
display: inline;
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
color: #393D49;
|
color: #393D49;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.kg-tips .message {
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
.kg-tips .layui-text {
|
.kg-tips .layui-text {
|
||||||
width: 500px;
|
width: 500px;
|
||||||
margin: 30px auto;
|
margin: 30px auto;
|
||||||
|
@ -1,26 +1,35 @@
|
|||||||
layui.use(['jquery', 'form', 'layer'], function () {
|
layui.use(['jquery', 'layer', 'helper'], function () {
|
||||||
|
|
||||||
var $ = layui.jquery;
|
var $ = layui.jquery;
|
||||||
var layer = layui.layer;
|
var layer = layui.layer;
|
||||||
|
var helper = layui.helper;
|
||||||
|
|
||||||
var $likeIcon = $('#icon-like');
|
var myShare = {
|
||||||
var $likeCount = $('#like-count');
|
title: $('input[name="share.title"]').val(),
|
||||||
var likeCount = parseInt($likeCount.text());
|
pic: $('input[name="share.pic"]').val(),
|
||||||
|
url: $('input[name="share.url"]').val(),
|
||||||
|
qrcode: $('input[name="share.qrcode"]').val()
|
||||||
|
};
|
||||||
|
|
||||||
$likeIcon.on('click', function () {
|
$('.icon-praise').on('click', function () {
|
||||||
|
var $this = $(this);
|
||||||
|
var $likeCount = $this.next();
|
||||||
|
var likeCount = parseInt($likeCount.text());
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: $(this).data('url'),
|
url: $this.data('url'),
|
||||||
success: function (res) {
|
beforeSend: function () {
|
||||||
if ($likeIcon.hasClass('active')) {
|
return helper.checkLogin();
|
||||||
$likeIcon.removeClass('active');
|
},
|
||||||
|
success: function () {
|
||||||
|
if ($this.hasClass('active')) {
|
||||||
|
$this.removeClass('active');
|
||||||
$likeCount.text(likeCount - 1);
|
$likeCount.text(likeCount - 1);
|
||||||
likeCount -= 1;
|
likeCount -= 1;
|
||||||
} else {
|
} else {
|
||||||
$likeIcon.addClass('active');
|
$this.addClass('active');
|
||||||
$likeCount.text(likeCount + 1);
|
$likeCount.text(likeCount + 1);
|
||||||
likeCount += 1;
|
likeCount += 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr) {
|
error: function (xhr) {
|
||||||
@ -30,8 +39,35 @@ layui.use(['jquery', 'form', 'layer'], function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#icon-share').on('click', function () {
|
$('.icon-wechat').on('click', function () {
|
||||||
|
var content = '<div class="qrcode"><img src="' + myShare.qrcode + '" alt="分享到微信"></div>';
|
||||||
|
layer.open({
|
||||||
|
type: 1,
|
||||||
|
title: false,
|
||||||
|
closeBtn: 0,
|
||||||
|
shadeClose: true,
|
||||||
|
content: content
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.icon-qq').on('click', function () {
|
||||||
|
var title = '推荐一门好课:' + myShare.title + ',快来和我一起学习吧!';
|
||||||
|
Share.qq(title, myShare.url, myShare.pic);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.icon-weibo').on('click', function () {
|
||||||
|
var title = '推荐一门好课:' + myShare.title + ',快来和我一起学习吧!';
|
||||||
|
Share.weibo(title, myShare.url, myShare.pic);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.icon-danmu-set').on('click', function () {
|
||||||
|
layer.open({
|
||||||
|
type: 1,
|
||||||
|
title: '弹幕设置',
|
||||||
|
area: '600px',
|
||||||
|
shadeClose: true,
|
||||||
|
content: $('#my-danmu-set')
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
@ -4,11 +4,11 @@ layui.use(['jquery', 'layer', 'helper'], function () {
|
|||||||
var layer = layui.layer;
|
var layer = layui.layer;
|
||||||
var helper = layui.helper;
|
var helper = layui.helper;
|
||||||
|
|
||||||
var course = {
|
var myShare = {
|
||||||
title: $('input[name="course.title"]').val(),
|
title: $('input[name="share.title"]').val(),
|
||||||
cover: $('input[name="course.cover"]').val(),
|
pic: $('input[name="share.cover"]').val(),
|
||||||
url: $('input[name="course.url"]').val(),
|
url: $('input[name="share.url"]').val(),
|
||||||
qrcode: $('input[name="course.qrcode"]').val()
|
qrcode: $('input[name="share.qrcode"]').val()
|
||||||
};
|
};
|
||||||
|
|
||||||
$('.rating-btn').on('click', function () {
|
$('.rating-btn').on('click', function () {
|
||||||
@ -44,7 +44,7 @@ layui.use(['jquery', 'layer', 'helper'], function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('.icon-wechat').on('click', function () {
|
$('.icon-wechat').on('click', function () {
|
||||||
var content = '<div class="qrcode"><img src="' + course.qrcode + '" alt="分享到微信"></div>';
|
var content = '<div class="qrcode"><img src="' + myShare.qrcode + '" alt="分享到微信"></div>';
|
||||||
layer.open({
|
layer.open({
|
||||||
type: 1,
|
type: 1,
|
||||||
title: false,
|
title: false,
|
||||||
@ -55,13 +55,13 @@ layui.use(['jquery', 'layer', 'helper'], function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('.icon-qq').on('click', function () {
|
$('.icon-qq').on('click', function () {
|
||||||
var title = '推荐一门好课:' + course.title + ',快来和我一起学习吧!';
|
var title = '推荐一门好课:' + myShare.title + ',快来和我一起学习吧!';
|
||||||
Share.qq(title, null, course.cover);
|
Share.qq(title, myShare.url, myShare.pic);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.icon-weibo').on('click', function () {
|
$('.icon-weibo').on('click', function () {
|
||||||
var title = '推荐一门好课:' + course.title + ',快来和我一起学习吧!';
|
var title = '推荐一门好课:' + myShare.title + ',快来和我一起学习吧!';
|
||||||
Share.weibo(title, null, course.cover);
|
Share.weibo(title, myShare.url, myShare.pic);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('body').on('click', '.icon-praise', function () {
|
$('body').on('click', '.icon-praise', function () {
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
layui.use(['jquery', 'form', 'slider', 'layer', 'helper'], function () {
|
layui.use(['jquery', 'form', 'layer', 'helper'], function () {
|
||||||
|
|
||||||
var $ = layui.jquery;
|
var $ = layui.jquery;
|
||||||
var form = layui.form;
|
var form = layui.form;
|
||||||
var slider = layui.slider;
|
|
||||||
var layer = layui.layer;
|
var layer = layui.layer;
|
||||||
var helper = layui.helper;
|
var helper = layui.helper;
|
||||||
|
|
||||||
@ -66,10 +65,6 @@ layui.use(['jquery', 'form', 'slider', 'layer', 'helper'], function () {
|
|||||||
|
|
||||||
initDanmu();
|
initDanmu();
|
||||||
|
|
||||||
$('#icon-danmu-set').on('click', function () {
|
|
||||||
showMyDanmuSet();
|
|
||||||
});
|
|
||||||
|
|
||||||
form.on('switch(danmu.status)', function (data) {
|
form.on('switch(danmu.status)', function (data) {
|
||||||
if (data.elem.checked) {
|
if (data.elem.checked) {
|
||||||
$('#danmu').danmu('setOpacity', 1);
|
$('#danmu').danmu('setOpacity', 1);
|
||||||
@ -164,15 +159,6 @@ layui.use(['jquery', 'form', 'slider', 'layer', 'helper'], function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showMyDanmuSet() {
|
|
||||||
layer.open({
|
|
||||||
type: 1,
|
|
||||||
title: '弹幕设置',
|
|
||||||
area: '600px',
|
|
||||||
content: $('#my-danmu-set')
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function startDanmu() {
|
function startDanmu() {
|
||||||
$('#danmu').danmu('danmuResume');
|
$('#danmu').danmu('danmuResume');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user