Authored by xiaofeng.yao@yoho.cn

合并

... ... @@ -9,16 +9,16 @@ $this->title = $this->params['main_title'].'-'.$this->params['sub_title'];
$this->registerJsFile('/js/php.js',array('postion'=>View::POS_END));
?>
<script type="text/javascript">
<?php $this->beginBlock('javascript');?>
var i = 0;
var room_id = <?=$room->room_id?>;
var interval_handle;
var default_interval = 3;
/**
<?php $this->beginBlock('javascript');?>
var i = 0;
var room_id = <?=$room->room_id?>;
var interval_handle;
var default_interval = 3;
/**
* websocket推送指令
* @returns {undefined}
*/
function callWebsocket(callback){
function callWebsocket(callback){
if (!window.ws || window.ws.readyState === undefined || window.ws.readyState != 1) {
websocket('192.168.102.17',9501,'/',function(){
consoleLog('连接服务器');
... ... @@ -40,13 +40,13 @@ $this->registerJsFile('/js/php.js',array('postion'=>View::POS_END));
}else{
callback();
}
}
/**
}
/**
* 推送商品列表刷新指令
* @param {type} product_id
* @returns {undefined}
*/
function refreshProduct(){
function refreshProduct(){
if (!confirm('将推送商品列表刷新指令,确定?')){
return;
}
... ... @@ -64,13 +64,13 @@ $this->registerJsFile('/js/php.js',array('postion'=>View::POS_END));
ws.send(cmd);
getPushlog(default_interval);
});
}
/**
}
/**
* 推送商品
* @param {type} product_id
* @returns {undefined}
*/
function sendProduct(product_id){
function sendProduct(product_id){
if (!confirm('将推送该商品,确定?')){
return;
}
... ... @@ -95,13 +95,13 @@ $this->registerJsFile('/js/php.js',array('postion'=>View::POS_END));
getPushlog(default_interval);
});
}
/**
}
/**
* 监听推送记录
* @param {type} package
* @returns {unresolved}
*/
function getPushlog(interval){
function getPushlog(interval){
clearInterval(interval_handle);
if (interval){
... ... @@ -117,21 +117,21 @@ $this->registerJsFile('/js/php.js',array('postion'=>View::POS_END));
}else{
$('#pushlog').text('开始监听推送记录').attr('onclick','getPushlog('+default_interval+')');
}
}
/**
}
/**
* 页面打印发送记录
* @param {type} msg
* @returns {undefined}
*/
function consoleLog(msg){
function consoleLog(msg){
$('#runtime').append('&nbsp;'+msg+'<br />');
}
/**
}
/**
* 密钥生成
* @param {type} package
* @returns {unresolved}
*/
function makeSign(package){
function makeSign(package){
package['private_key'] = 'a85bb0674e08986c6b115d5e3a4884fa';
package = ksort(package);
packageList = [];
... ... @@ -139,11 +139,11 @@ $this->registerJsFile('/js/php.js',array('postion'=>View::POS_END));
packageList.push(trim(key + '=' + package[key]));
}
return strtolower(md5(implode('&', packageList)));
}
<?php
$this->endBlock();
$this->registerJs($this->blocks['javascript'],View::POS_END)
?>
}
<?php
$this->endBlock();
$this->registerJs($this->blocks['javascript'],View::POS_END)
?>
</script>
<div class="panel">
... ...
... ... @@ -4,12 +4,12 @@ return [
'components' => [
'fileCache' => [
'class' => 'yii\caching\FileCache',
'keyPrefix' => 'YOHOLive',
'keyPrefix' => 'YOHOLive:',
],
'cache' => [
'class' => 'common\components\pagecache\Redis',
'redis' => 'redis',
'keyPrefix' => 'YOHOLive',
'keyPrefix' => 'YOHOLive:',
],
'redis' => [
'class' => 'common\components\caching\RedisCache',
... ...
... ... @@ -91,7 +91,7 @@ class LivingController extends BaseController
}else{
$keys = [];
foreach ($ret as $k=>$row){
$keys[] = sprintf("%s:online_nums_room_%s",Yii::$app->params['cache_prefix'],$row['room_id']);
$keys[] = sprintf("%sonline_nums_room_%s",Yii::$app->params['cache_prefix'],$row['room_id']);
}
$values = $keys ? call_user_func_array(array(Yii::$app->redisIm,'mget'), $keys) : [];
... ...