flower_svr/class/gzhq_base.class.php
2021-06-11 16:09:56 +08:00

65 lines
1.7 KiB
PHP

<?php
/**
* Created by gzhq.
* User: 252378189@qq.com
* Date: 2017/12/29
* Time: 11:16
*/
class gzhq_base{
public function __construct() {
}
/*
Array(
"a":字符串,
"m":字符串,
"d":数组
)
*/
public $arr = array();
//设置提交上来的数据
public function set_data($data){
echo(__CLASS__."->".__FUNCTION__."\r\n");
$this->arr = array();
$this->arr = $data;
if(empty($this->arr) || !isset($this->arr['d']) || !isset($this->arr['server']) || !isset($this->arr['m']) || !isset($this->arr['a']) ){
echo("\r set_data,key:".$this->arr['d']."\r\n");
return false;
}else{
return true;
}
}
//心跳包
public function heartbeat(){
echo(__CLASS__."->".__FUNCTION__."\r\n");
$tmp_send = 'PONG';
$this->arr['server']->send_user($this->arr['fd'],$tmp_send);
}
//这是测试返回数据的
public function error_bak(){
echo(__CLASS__."->".__FUNCTION__."\r\n");
$tmp_send = $GLOBALS["SYS_RETURN_TMP"];
$tmp_send['a']= "error_bak";
$tmp_send['m'] = "login";
$tmp_send['d'] = array("t"=>time());
$tmp_send['d']['dd'] = $this->arr['d'];
$this->arr['server']->send_user($this->arr['fd'],$tmp_send);
}
//进行游戏数据配置的更新
public function hotUpdate(){
//进行游戏配置的初始化
$redis_conn = $this->arr['server']->redis_pool->get();
hotUpdata($redis_conn,false);
$this->arr['server']->redis_pool->put($redis_conn);
sys_log_write_content( '进行了热更' ,"error_log","data_config_ok_hot.log");
}
}