Authored by 郝肖肖

通过 zookeeper 客服开关

... ... @@ -79,7 +79,7 @@ class AbstractAction extends Controller_Abstract
//客服配置
protected function getCustomerServiceSwitch() {
return $this->_useSession && empty($this->getCache('customerServiceSwitch')) ? 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409' : '/service/client';
return $this->_useSession && empty($this->getCacheBy('zookeeper:/pc/clientService/new')) ? 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409' : '/service/client';
}
/**
* 封装一下获取get参数
... ...
... ... @@ -95,7 +95,7 @@ class WebAction extends Controller_Abstract
//客服配置
protected function getCustomerServiceSwitch() {
return $this->_useSession && empty($this->getCache('customerServiceSwitch')) ? 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409' : '/service/client';
return $this->_useSession && empty($this->getCacheBy('zookeeper:/pc/clientService/new')) ? 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409' : '/service/client';
}
/**
... ... @@ -347,6 +347,22 @@ class WebAction extends Controller_Abstract
}
/**
* 直接查询缓存,不对key做任何处理<php与node cache对接>
*
* @param string $key 键名
* @param bool $isMaster 控制是到主服务器取,还是到从服务器取缓存
* @return mixed
*/
protected function getCacheBy($key, $isMaster = true)
{
if ($isMaster) {
return Cache::getBy($key, 'master');
} else {
return Cache::getBy($key, 'slave');
}
}
/**
* 设置Session
*
* @param string $name 名称
... ...
... ... @@ -262,6 +262,18 @@ class ToolsController extends WebAction
var_dump(Cache::get('customerServiceSwitch'));
}
public function customerZllkeeperAction()
{
echo 'cache:get(zookeeper:/pc/clientService/new) ';
var_dump(Cache::get('zookeeper:/pc/clientService/new'));
echo 'cache:getBy(zookeeper:/pc/clientService/new) ';
var_dump(Cache::getBy('zookeeper:/pc/clientService/new'));
echo 'cache:getBy(zookeeper:/wap/clientService/new) ';
var_dump(Cache::getBy('zookeeper:/wap/clientService/new'));
}
}
?>
\ No newline at end of file
... ...
... ... @@ -45,7 +45,7 @@ class UserModel
}
public static function getCustomerServiceSwitch() {
return USE_CACHE && empty(Cache::get('customerServiceSwitch')) ? 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409' : '/service/client';
return USE_CACHE && empty(Cache::getBy('zookeeper:/pc/clientService/new')) ? 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409' : '/service/client';
}
/**
* 个人中心-左侧导航
... ...