mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-24 04:01:31 +08:00
修正workerman中onMessage无法调用问题
This commit is contained in:
parent
9545dd5760
commit
a56a891883
@ -1,9 +1,15 @@
|
||||
{% for chat in chats %}
|
||||
<div class="chat">
|
||||
{% if chat.user.vip == 1 %}
|
||||
<span class="layui-icon layui-icon-diamond icon-vip"></span>
|
||||
{% endif %}
|
||||
<span class="user">{{ chat.user.name }}</span>
|
||||
<span class="content">{{ chat.content }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if chat.user.vip == 1 %}
|
||||
<div class="chat chat-vip">
|
||||
<span class="icon"><i class="layui-icon layui-icon-diamond"></i></span>
|
||||
<span class="user layui-badge layui-bg-orange">{{ chat.user.name }}</span>
|
||||
<span class="content">{{ chat.content }}</span>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="chat chat-normal">
|
||||
<span class="icon"><i class="layui-icon layui-icon-username"></i></span>
|
||||
<span class="user layui-badge layui-bg-blue">{{ chat.user.name }}</span>
|
||||
<span class="content">{{ chat.content }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
@ -11,9 +11,9 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="preview">
|
||||
<div class="live-preview">
|
||||
<div class="icon"><i class="layui-icon layui-icon-face-cry"></i></div>
|
||||
<div class="tips">直播已禁止,谢谢关注!</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@ -13,19 +13,19 @@
|
||||
</div>
|
||||
|
||||
{% if time() < chapter.start_time %}
|
||||
<div class="preview countdown">
|
||||
<div class="live-preview countdown wrap">
|
||||
<div class="icon"><i class="layui-icon layui-icon-time"></i></div>
|
||||
<div class="timer"></div>
|
||||
<div class="tips">直播倒计时开始啦,敬请关注!</div>
|
||||
</div>
|
||||
{% elseif chapter.start_time < time() and chapter.end_time > time() %}
|
||||
<div class="preview countdown">
|
||||
<div class="live-preview countdown wrap">
|
||||
<div class="icon"><i class="layui-icon layui-icon-face-surprised"></i></div>
|
||||
<div class="timer"></div>
|
||||
<div class="tips">直播时间到了,老师去哪了?</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="preview">
|
||||
<div class="live-preview wrap">
|
||||
<div class="icon"><i class="layui-icon layui-icon-tree"></i></div>
|
||||
<div class="tips">直播已结束,谢谢关注!</div>
|
||||
</div>
|
||||
@ -43,4 +43,4 @@
|
||||
|
||||
{{ js_include('home/js/chapter.live.countdown.js') }}
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<div class="icon" title="{{ like_title }}" data-url="{{ like_url }}">
|
||||
<i class="layui-icon layui-icon-praise icon-praise {{ like_class }}"></i>
|
||||
</div>
|
||||
<div class="text">{{ chapter.like_count }}</div>
|
||||
<div class="text" data-count="{{ chapter.like_count }}">{{ chapter.like_count }}</div>
|
||||
</div>
|
||||
<div class="item" id="toolbar-online">
|
||||
<div class="icon" title="在线人数">
|
||||
@ -15,4 +15,4 @@
|
||||
</div>
|
||||
<div class="text">0</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
51
app/Library/Paginator/Adapter/NativeArray.php
Normal file
51
app/Library/Paginator/Adapter/NativeArray.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2024 深圳市酷瓜软件有限公司
|
||||
* @license https://opensource.org/licenses/GPL-2.0
|
||||
* @link https://www.koogua.com
|
||||
*/
|
||||
|
||||
namespace App\Library\Paginator\Adapter;
|
||||
|
||||
use App\Library\Paginator\Query as PaginatorQuery;
|
||||
use Phalcon\Paginator\Adapter\NativeArray as PhNativeArray;
|
||||
use stdClass;
|
||||
|
||||
class NativeArray extends PhNativeArray
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $baseUrl;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $params = [];
|
||||
|
||||
public function paginate(): stdClass
|
||||
{
|
||||
$pager = parent::paginate();
|
||||
|
||||
$query = new PaginatorQuery();
|
||||
|
||||
$this->baseUrl = $query->getBaseUrl();
|
||||
$this->params = $query->getParams();
|
||||
|
||||
$pager->first = $this->buildPageUrl($pager->first);
|
||||
$pager->previous = $this->buildPageUrl($pager->previous);
|
||||
$pager->next = $this->buildPageUrl($pager->next);
|
||||
$pager->last = $this->buildPageUrl($pager->last);
|
||||
|
||||
return $pager;
|
||||
}
|
||||
|
||||
protected function buildPageUrl($page)
|
||||
{
|
||||
$this->params['page'] = $page;
|
||||
|
||||
return $this->baseUrl . '?' . http_build_query($this->params);
|
||||
}
|
||||
|
||||
}
|
@ -33,7 +33,7 @@ class Article extends Handler
|
||||
'limit' => $limit,
|
||||
]);
|
||||
|
||||
$pager = $paginator->getPaginate();
|
||||
$pager = $paginator->paginate();
|
||||
|
||||
return $this->handleArticles($pager);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class Course extends Handler
|
||||
'limit' => $limit,
|
||||
]);
|
||||
|
||||
$pager = $paginator->getPaginate();
|
||||
$pager = $paginator->paginate();
|
||||
|
||||
return $this->handleCourses($pager);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class Question extends Handler
|
||||
'limit' => $limit,
|
||||
]);
|
||||
|
||||
$pager = $paginator->getPaginate();
|
||||
$pager = $paginator->paginate();
|
||||
|
||||
return $this->handleQuestions($pager);
|
||||
}
|
||||
|
@ -112,6 +112,16 @@
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.breadcrumb .share {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: -5px;
|
||||
}
|
||||
|
||||
.breadcrumb .share a {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.wrap {
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
@ -144,10 +154,6 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.layer .pager {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.loading {
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
@ -198,12 +204,6 @@
|
||||
min-height: 80px;
|
||||
}
|
||||
|
||||
.breadcrumb .share {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: -5px;
|
||||
}
|
||||
|
||||
#header {
|
||||
left: 0;
|
||||
top: 0;
|
||||
@ -313,10 +313,6 @@
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.cs-sidebar p {
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.index-wrap {
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
@ -1359,44 +1355,21 @@
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.share .layui-icon {
|
||||
margin-right: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.share .active,
|
||||
.share .layui-icon-star-fill {
|
||||
color: orange;
|
||||
}
|
||||
|
||||
.share a {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.share i {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.share em {
|
||||
font-style: normal;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.preview {
|
||||
.live-preview {
|
||||
color: #666;
|
||||
margin-top: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.preview .icon {
|
||||
.live-preview .icon {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.preview .icon .layui-icon {
|
||||
.live-preview .icon .layui-icon {
|
||||
font-size: 150px;
|
||||
}
|
||||
|
||||
.preview .tips {
|
||||
.live-preview .tips {
|
||||
font-size: 16px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
@ -1424,7 +1397,6 @@
|
||||
height: 428px;
|
||||
}
|
||||
|
||||
|
||||
.play-mask {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
@ -1458,37 +1430,33 @@
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.chat-msg-list .chat, .chat-msg-list .chat-sys {
|
||||
.chat {
|
||||
margin-bottom: 10px;
|
||||
line-height: 25px;
|
||||
line-height: 1.5em;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.chat-sys {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.chat-sys span, .chat span {
|
||||
.chat-sys {
|
||||
padding: 5px;
|
||||
background-color: black;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.chat span {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.chat .user {
|
||||
color: orange;
|
||||
}
|
||||
|
||||
.chat .icon-vip {
|
||||
color: orange;
|
||||
}
|
||||
|
||||
.chat .content {
|
||||
color: #666;
|
||||
.chat .icon .layui-icon {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.chat-msg-form .layui-input {
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.vip-header {
|
||||
|
@ -67,19 +67,19 @@ layui.use(['jquery', 'form', 'helper'], function () {
|
||||
}
|
||||
|
||||
function showNewMessage(res) {
|
||||
var html = '<div class="chat">';
|
||||
var html = '';
|
||||
if (res.user.vip === 1) {
|
||||
html += '<span class="layui-icon layui-icon-diamond icon-vip"></span>';
|
||||
html = getVipUserMessage(res);
|
||||
} else {
|
||||
html = getNormalUserMessage(res);
|
||||
}
|
||||
html += '<span class="user">' + res.user.name + ':</span>';
|
||||
html += '<span class="content">' + res.content + '</span>';
|
||||
html += '</div>';
|
||||
$chatMsgList.append(html);
|
||||
scrollToBottom();
|
||||
}
|
||||
|
||||
function showLoginMessage(res) {
|
||||
var html = '<div class="chat chat-sys">';
|
||||
html += '<span class="icon"><i class="layui-icon layui-icon-speaker"></i></span>';
|
||||
html += '<span>' + res.user.name + '</span>';
|
||||
html += '<span>进入了直播间</span>';
|
||||
html += '</div>';
|
||||
@ -87,11 +87,27 @@ layui.use(['jquery', 'form', 'helper'], function () {
|
||||
scrollToBottom();
|
||||
}
|
||||
|
||||
function getVipUserMessage(res) {
|
||||
var html = '<div class="chat chat-vip">';
|
||||
html += '<span class="icon"><i class="layui-icon layui-icon-diamond"></i></span>';
|
||||
html += '<span class="user layui-badge layui-bg-orange">' + res.user.name + '</span>';
|
||||
html += '<span class="content">' + res.content + '</span>';
|
||||
html += '</div>';
|
||||
return html;
|
||||
}
|
||||
|
||||
function getNormalUserMessage(res) {
|
||||
var html = '<div class="chat chat-normal">';
|
||||
html += '<span class="icon"><i class="layui-icon layui-icon-username"></i></span>';
|
||||
html += '<span class="user layui-badge layui-bg-blue">' + res.user.name + '</span>';
|
||||
html += '<span class="content">' + res.content + '</span>';
|
||||
html += '</div>';
|
||||
return html;
|
||||
}
|
||||
|
||||
function scrollToBottom() {
|
||||
var $scrollTo = $chatMsgList.find('.chat:last');
|
||||
$chatMsgList.scrollTop(
|
||||
$scrollTo.offset().top - $chatMsgList.offset().top + $chatMsgList.scrollTop()
|
||||
);
|
||||
$chatMsgList.scrollTop($scrollTo.offset().top - $chatMsgList.offset().top + $chatMsgList.scrollTop());
|
||||
}
|
||||
|
||||
function refreshLiveStats() {
|
||||
@ -105,4 +121,4 @@ layui.use(['jquery', 'form', 'helper'], function () {
|
||||
helper.ajaxLoadHtml($chatMsgList.data('url'), $chatMsgList.attr('id'));
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -9,25 +9,24 @@ ini_set('display_errors', 'on');
|
||||
|
||||
use Workerman\Worker;
|
||||
|
||||
if(strpos(strtolower(PHP_OS), 'win') === 0)
|
||||
{
|
||||
if (strpos(strtolower(PHP_OS), 'win') === 0) {
|
||||
exit("start.php not support windows, please use start_for_win.bat\n");
|
||||
}
|
||||
|
||||
if(!extension_loaded('pcntl'))
|
||||
{
|
||||
if (!extension_loaded('pcntl')) {
|
||||
exit("Please install pcntl extension. See http://doc3.workerman.net/appendices/install-extension.html\n");
|
||||
}
|
||||
|
||||
if(!extension_loaded('posix'))
|
||||
{
|
||||
if (!extension_loaded('posix')) {
|
||||
exit("Please install posix extension. See http://doc3.workerman.net/appendices/install-extension.html\n");
|
||||
}
|
||||
|
||||
define('GLOBAL_START', 1);
|
||||
const GLOBAL_START = 1;
|
||||
|
||||
require_once dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
require_once __DIR__ . '/Events.php';
|
||||
|
||||
require_once __DIR__ . '/start_business_worker.php';
|
||||
|
||||
require_once __DIR__ . '/start_gateway.php';
|
||||
|
Loading…
x
Reference in New Issue
Block a user