mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-24 12:05:39 +08:00
修正workerman中onMessage无法调用问题
This commit is contained in:
parent
9545dd5760
commit
a56a891883
@ -1,9 +1,15 @@
|
|||||||
{% for chat in chats %}
|
{% for chat in chats %}
|
||||||
<div class="chat">
|
{% if chat.user.vip == 1 %}
|
||||||
{% if chat.user.vip == 1 %}
|
<div class="chat chat-vip">
|
||||||
<span class="layui-icon layui-icon-diamond icon-vip"></span>
|
<span class="icon"><i class="layui-icon layui-icon-diamond"></i></span>
|
||||||
{% endif %}
|
<span class="user layui-badge layui-bg-orange">{{ chat.user.name }}</span>
|
||||||
<span class="user">{{ chat.user.name }}</span>
|
<span class="content">{{ chat.content }}</span>
|
||||||
<span class="content">{{ chat.content }}</span>
|
</div>
|
||||||
</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 %}
|
{% endfor %}
|
@ -11,7 +11,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="preview">
|
<div class="live-preview">
|
||||||
<div class="icon"><i class="layui-icon layui-icon-face-cry"></i></div>
|
<div class="icon"><i class="layui-icon layui-icon-face-cry"></i></div>
|
||||||
<div class="tips">直播已禁止,谢谢关注!</div>
|
<div class="tips">直播已禁止,谢谢关注!</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,19 +13,19 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if time() < chapter.start_time %}
|
{% 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="icon"><i class="layui-icon layui-icon-time"></i></div>
|
||||||
<div class="timer"></div>
|
<div class="timer"></div>
|
||||||
<div class="tips">直播倒计时开始啦,敬请关注!</div>
|
<div class="tips">直播倒计时开始啦,敬请关注!</div>
|
||||||
</div>
|
</div>
|
||||||
{% elseif chapter.start_time < time() and chapter.end_time > time() %}
|
{% 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="icon"><i class="layui-icon layui-icon-face-surprised"></i></div>
|
||||||
<div class="timer"></div>
|
<div class="timer"></div>
|
||||||
<div class="tips">直播时间到了,老师去哪了?</div>
|
<div class="tips">直播时间到了,老师去哪了?</div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="preview">
|
<div class="live-preview wrap">
|
||||||
<div class="icon"><i class="layui-icon layui-icon-tree"></i></div>
|
<div class="icon"><i class="layui-icon layui-icon-tree"></i></div>
|
||||||
<div class="tips">直播已结束,谢谢关注!</div>
|
<div class="tips">直播已结束,谢谢关注!</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<div class="icon" title="{{ like_title }}" data-url="{{ like_url }}">
|
<div class="icon" title="{{ like_title }}" data-url="{{ like_url }}">
|
||||||
<i class="layui-icon layui-icon-praise icon-praise {{ like_class }}"></i>
|
<i class="layui-icon layui-icon-praise icon-praise {{ like_class }}"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="text">{{ chapter.like_count }}</div>
|
<div class="text" data-count="{{ chapter.like_count }}">{{ chapter.like_count }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item" id="toolbar-online">
|
<div class="item" id="toolbar-online">
|
||||||
<div class="icon" title="在线人数">
|
<div class="icon" title="在线人数">
|
||||||
|
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,
|
'limit' => $limit,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$pager = $paginator->getPaginate();
|
$pager = $paginator->paginate();
|
||||||
|
|
||||||
return $this->handleArticles($pager);
|
return $this->handleArticles($pager);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class Course extends Handler
|
|||||||
'limit' => $limit,
|
'limit' => $limit,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$pager = $paginator->getPaginate();
|
$pager = $paginator->paginate();
|
||||||
|
|
||||||
return $this->handleCourses($pager);
|
return $this->handleCourses($pager);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class Question extends Handler
|
|||||||
'limit' => $limit,
|
'limit' => $limit,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$pager = $paginator->getPaginate();
|
$pager = $paginator->paginate();
|
||||||
|
|
||||||
return $this->handleQuestions($pager);
|
return $this->handleQuestions($pager);
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,16 @@
|
|||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.breadcrumb .share {
|
||||||
|
position: absolute;
|
||||||
|
top: 2px;
|
||||||
|
right: -5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb .share a {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.wrap {
|
.wrap {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
@ -144,10 +154,6 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layer .pager {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading {
|
.loading {
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -198,12 +204,6 @@
|
|||||||
min-height: 80px;
|
min-height: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.breadcrumb .share {
|
|
||||||
position: absolute;
|
|
||||||
top: 2px;
|
|
||||||
right: -5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#header {
|
#header {
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -313,10 +313,6 @@
|
|||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cs-sidebar p {
|
|
||||||
line-height: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.index-wrap {
|
.index-wrap {
|
||||||
padding-bottom: 15px;
|
padding-bottom: 15px;
|
||||||
}
|
}
|
||||||
@ -1359,44 +1355,21 @@
|
|||||||
background-color: #f2f2f2;
|
background-color: #f2f2f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.share .layui-icon {
|
.live-preview {
|
||||||
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 {
|
|
||||||
color: #666;
|
color: #666;
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview .icon {
|
.live-preview .icon {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview .icon .layui-icon {
|
.live-preview .icon .layui-icon {
|
||||||
font-size: 150px;
|
font-size: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview .tips {
|
.live-preview .tips {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
}
|
}
|
||||||
@ -1424,7 +1397,6 @@
|
|||||||
height: 428px;
|
height: 428px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.play-mask {
|
.play-mask {
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
@ -1458,37 +1430,33 @@
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-msg-list .chat, .chat-msg-list .chat-sys {
|
.chat {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
line-height: 25px;
|
line-height: 1.5em;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
font-size: 12px;
|
||||||
|
|
||||||
.chat-sys {
|
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-sys span, .chat span {
|
.chat-sys {
|
||||||
|
padding: 5px;
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat span {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat .user {
|
.chat .icon .layui-icon {
|
||||||
color: orange;
|
font-size: 14px;
|
||||||
}
|
|
||||||
|
|
||||||
.chat .icon-vip {
|
|
||||||
color: orange;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat .content {
|
|
||||||
color: #666;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-msg-form .layui-input {
|
.chat-msg-form .layui-input {
|
||||||
height: 32px;
|
height: 32px;
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #666;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vip-header {
|
.vip-header {
|
||||||
|
@ -67,19 +67,19 @@ layui.use(['jquery', 'form', 'helper'], function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showNewMessage(res) {
|
function showNewMessage(res) {
|
||||||
var html = '<div class="chat">';
|
var html = '';
|
||||||
if (res.user.vip === 1) {
|
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);
|
$chatMsgList.append(html);
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
function showLoginMessage(res) {
|
function showLoginMessage(res) {
|
||||||
var html = '<div class="chat chat-sys">';
|
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>' + res.user.name + '</span>';
|
||||||
html += '<span>进入了直播间</span>';
|
html += '<span>进入了直播间</span>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
@ -87,11 +87,27 @@ layui.use(['jquery', 'form', 'helper'], function () {
|
|||||||
scrollToBottom();
|
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() {
|
function scrollToBottom() {
|
||||||
var $scrollTo = $chatMsgList.find('.chat:last');
|
var $scrollTo = $chatMsgList.find('.chat:last');
|
||||||
$chatMsgList.scrollTop(
|
$chatMsgList.scrollTop($scrollTo.offset().top - $chatMsgList.offset().top + $chatMsgList.scrollTop());
|
||||||
$scrollTo.offset().top - $chatMsgList.offset().top + $chatMsgList.scrollTop()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshLiveStats() {
|
function refreshLiveStats() {
|
||||||
|
@ -9,25 +9,24 @@ ini_set('display_errors', 'on');
|
|||||||
|
|
||||||
use Workerman\Worker;
|
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");
|
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");
|
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");
|
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 dirname(__DIR__) . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
require_once __DIR__ . '/Events.php';
|
||||||
|
|
||||||
require_once __DIR__ . '/start_business_worker.php';
|
require_once __DIR__ . '/start_business_worker.php';
|
||||||
|
|
||||||
require_once __DIR__ . '/start_gateway.php';
|
require_once __DIR__ . '/start_gateway.php';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user