Browse Source

清理文件

gwang 4 years ago
parent
commit
1066004368

+ 0 - 214
Gameserver/Amfphp/util/CDbUtil.php

@@ -1,214 +0,0 @@
-<?php
-
-// 淘汰掉这个, 保留单一的MySQL操作入口: daoInst(). --gwang 2020年11月9日13:58:03
-//
-//namespace loyalsoft;
-//
-///**
-// * CDB工具类[APHP三大操作单元之一]
-// * @version 2.0.1 gwang 修补了部分mysqli方法 2020.3.25
-// *           2.0   gwang 升级到mysqli,以便能在PHP7.0以后的环境下继续运行. 约 2017
-// *           1.0   jgao  created 约 2013
-// * @author jgao,gwang
-// */
-//class CDbUtil {
-//
-//    public $conn = 0;
-//
-//    public function dbconn($dbhost, $dbport, $dbuser, $dbpw, $dbname) {
-//        $this->conn = mysqli_connect($dbhost, $dbuser, $dbpw, $dbname, $dbport, true);
-//        !$this->conn && $this->halt("Connect to MySQL failed");
-//        $serverinfo = mysqli_get_server_info($this->conn);
-//        if ($serverinfo > '4.1' && $GLOBALS['charset']) {
-//            mysqli_query($this->conn, "SET character_set_connection=" . $GLOBALS['charset'] . ",character_set_results=" . $GLOBALS['charset'] . ",character_set_client=binary");
-//        }
-//        if ($serverinfo > '5.0') {
-//            mysqli_query($this->conn, "SET sql_mode=''");
-//        }
-//        if ($dbname && !mysqli_select_db($this->conn, $dbname)) {
-//            $this->halt('Cannot use database');
-//        }
-//    }
-//
-//    /**
-//     * 切换db
-//     * @param type $dbname
-//     */
-//    public function select_db($dbname) {
-//        if (!mysqli_select_db($this->conn, $dbname)) {
-//            $this->halt('Cannot use database');
-//        }
-//    }
-//
-//    /**
-//     * 调取服务器信息
-//     * @return type
-//     */
-//    public function server_info() {
-//        return mysqli_get_server_info($this->conn);
-//    }
-//
-//    /**
-//     * 最后一次执行insert时插入的第一行记录Id,(如果一次插入3条记录,则得到第一条的记录)
-//     * 所以,这个如何用要慎重(gwang)
-//     * @return type
-//     */
-//    public function insert_id() {
-//        $arr = $this->fetch_array('SELECT LAST_INSERT_ID() as id');
-//        return $arr["id"];
-//    }
-//
-//    /**
-//     * 直接取查询结果的某行某列的数值
-//     * @param type $SQL
-//     * @param type $offset
-//     * @param type $field
-//     * @return boolean
-//     */
-//    public function get_value($SQL, $offset = 0, $field = 0) {
-//        $rt = $this->fetch_result($SQL);
-//        if (isset($rt[$offset][$field])) {
-//            return $rt[$offset][$field];
-//        }
-//        return false;
-//    }
-//
-//    /**
-//     * 执行查询
-//     * @param type $SQL
-//     * @param type $method
-//     * @param type $error
-//     * @return mixed
-//     */
-//    public function query($SQL, $method = null, $error = true) {
-//        $query = mysqli_query($this->conn, $SQL);
-//        !$query && $error && $this->halt('Query Error: ' . $SQL);
-//        return $query;
-//    }
-//
-//    /**
-//     * 执行更新的时候加上事物逻辑
-//     * @param type $SQL
-//     * @return int errno
-//     */
-//    public function safeQuery($SQL) {
-//        mysqli_query($this->conn, 'start transaction');
-//        mysqli_query($this->conn, 'SET autocommit=0');
-//        $query = mysqli_query($this->conn, $SQL);
-//        $err = mysqli_errno($this->conn);
-//        if ($err && !$query) {
-//            mysqli_query($this->conn, 'rollback');
-//        } else {
-//            mysqli_query($this->conn, 'commit');
-//        }
-//        mysqli_query($this->conn, 'SET autocommit=1');
-//        return $err;
-//    }
-//
-//    /**
-//     * 将查询结果作为索引数组返回
-//     * @param string $SQL
-//     * @return array
-//     */
-//    public function fetch_row($SQL) {
-//        return $this->fetch_result($SQL, MYSQLI_NUM);
-//    }
-//
-//    /**
-//     * 将查询结果作为关联数组返回
-//     * @param string $SQL
-//     * @return array
-//     */
-//    public function fetch_array($SQL) {
-//        return $this->fetch_result($SQL, MYSQLI_ASSOC);
-//    }
-//
-//    /**
-//     * 从结果中取一行作为结果返回
-//     * @param string $SQL
-//     * @param int $result_type 1. 关联数组, 2. 索引数组, 3 both
-//     * @return type
-//     */
-//    public function fetch_result($SQL, $result_type = MYSQLI_BOTH) {
-//        $arr = array();
-//        $query = $this->query($SQL);
-//        $data = mysqli_fetch_array($query, $result_type);
-//        while ($data) {
-//            $arr[] = $data;
-//            $data = mysqli_fetch_array($query, $result_type);
-//        }
-//        $this->free_result();
-//        return $arr;
-//    }
-//
-//    /**
-//     * 调取查询影响的行数
-//     * @return type
-//     */
-//    public function affected_rows() {
-//        return mysqli_affected_rows($this->conn);
-//    }
-//
-//    /**
-//     * 调取结果集中行的数目
-//     * @param type $SQL
-//     * @return int
-//     */
-//    public function num_rows($SQL) {
-//        $query = $this->query($SQL);
-//        if (!is_bool($query)) {
-//            return mysqli_num_rows($query);
-//        }
-//        return 0;
-//    }
-//
-//    /**
-//     * 调取结果集中字段数量
-//     * @param type $SQL
-//     * @return type
-//     */
-//    public function num_fields($SQL) {
-//        $query = $this->query($SQL);
-//        return mysqli_num_fields($query);
-//    }
-//
-//    /**
-//     * 封装SQL字符串中特殊字符,以免SQL语句执行失败.
-//     * @param type $str 带有风险字符的SQL语句或者字符串
-//     * @return type 处理后的字符串
-//     */
-//    public function escape_string($str) {
-//        return mysqli_real_escape_string($this->conn, $str);
-//    }
-//
-//    /**
-//     * 释放SQL查询结果
-//     */
-//    public function free_result() {
-//        $void = func_get_args();
-//        foreach ($void as $query) {
-//            if (is_resource($query) && get_resource_type($query) === 'mysql result') {
-//                mysqli_free_result($query);
-//            }
-//        }
-//        unset($void);
-//    }
-//
-//    /**
-//     * 关闭当前实例的连接
-//     * @return type
-//     */
-//    public function close() {
-//        $this->free_result();
-//        return mysqli_close($this->conn);
-//    }
-//
-//    /**
-//     * 直接报错退出
-//     * @param type $msg
-//     */
-//    public function halt($msg = null) {
-//        exit($msg . '<br /><br />' . mysqli_error($this->conn));
-//    }
-//
-//}

+ 0 - 94
Gameserver/Amfphp/util/CMemBase.php

@@ -1,94 +0,0 @@
-<?php
-
-namespace loyalsoft;
-
-//
-///*
-// * 功能: 内存数据库操作基类
-// * version:
-// *
-// */
-//
-///**
-// * Description of CMemBase
-// * CMemNoSqL db 操作基类
-// * @author gwang (mail@wanggangzero.cn)
-// */
-//abstract class CMemBase {
-//
-//    /**
-//     * 连接
-//     */
-//    abstract public function conn($host, $port, $pwd = "");
-//
-//    /**
-//     * 查询/获取 指定 key 对应的value
-//     */
-//    abstract public function get($key);
-//
-//    abstract public function set($key, $value, $ts = 0);
-//
-//    /**
-//     * 取没有进行json编码的数据
-//     * @param type $key
-//
-//     * @return type
-//     */
-//    abstract public function getWithoutJson($key);
-//
-//    /**
-//     * 设置值,内部不加 json_encode
-//     * @param string $key
-//     * @param string $value
-//     * @param seconds $ts
-//     * @return boolean
-//     */
-//    abstract public function setWithoutJson($key, $value, $ts = 0);
-//
-//    /**
-//     * 给某个指定数据 加上 指定的数值
-//     */
-//    abstract public function add($key, $value, $ts = 0);
-//
-//    /**
-//     * 替换某条数据
-//     */
-//    abstract public function replace($key, $value, $ts = 0);
-//
-//    /**
-//     * 删除某条指定的数据
-//     */
-//    abstract public function delete($key);
-//
-//    /**
-//     * 给指定的key所对应的值增加1
-//     */
-//    abstract public function increment($key);
-//
-//    /**
-//     * 一次取多个值
-//     */
-//    abstract public function getMulti($keys);
-//
-//    /**
-//     * 一次设置多个值
-//     * @param array $dict [{"key":value},{"key":value}, ...]
-//     * @param int $expireTs 超时时间
-//     */
-//    abstract public function setMutlti($dict, $expireTs = 0);
-//
-////    /**
-////     * Compare and set 比较并且(结果相同则)写入
-////     */
-////    abstract public function cas($key, $value, $ts);
-//
-//    /**
-//     * 复制
-//     */
-//    abstract public function copy($surKey, $desKey);
-//
-//    /**
-//     * 关闭连接
-//     */
-//    abstract public function close();
-//}

+ 0 - 171
Gameserver/Amfphp/util/CMemUtil.php

@@ -1,171 +0,0 @@
-<?php
-
-//
-//namespace loyalsoft;
-//
-///*
-// * 操作内存数据库 Memcache工具类
-// * version:
-// *     2016.4.12  (gwang)改造出一个基类
-// *     2016.4.12  以前的记录无
-// */
-//
-///**
-// * Description of MemCacheUtil
-// * CMem工具类[APHP三大操作单元之一]
-// * @deprecated since version 2017.08.08
-// * @author jgao,gwang
-// */
-//class CMemUtil extends CMemBase
-//{
-//
-//    //put your code here
-//    public $mem = 0;
-//    public $keyDic = null;
-//
-//    public function conn($host, $port, $pwd = "")
-//    {
-//        $this->keyDic = new \stdClass();
-//        $this->mem = new Memcache();
-//        return $this->mem->connect($host, $port);
-//    }
-//
-//    /**
-//     *
-//     * @param string $key
-//     * @return any
-//     */
-//    public function get($key)
-//    {
-//        $cas_token = "";
-//        if ($GLOBALS['mem_version'] == "3.0") {
-//            $result = memcache_get($this->mem, $key, null, $cas_token);
-//        } else {
-//            $result = memcache_get($this->mem, $key);
-//        }
-//        if (!$result || $result == "" || $result == null) {
-//            return null;
-//        }
-//        if ($GLOBALS['mem_version'] == "3.0") {
-//            $this->keyDic->$key = $cas_token;
-//        }
-//        return JsonUtil::decode($result);
-//    }
-//
-//    public function set($key, $value, $ts = 0)
-//    {
-//        if ($value == null || $value == "") {
-//            return false;
-//        }
-//        return memcache_set($this->mem, $key, JsonUtil::encode($value), MEMCACHE_COMPRESSED, $ts);
-//    }
-//
-//    /**
-//     * 取没有进行json编码的数据
-//     * @param type $key
-//     * @return string
-//     */
-//    public function getWithoutJson($key)
-//    {
-//        $cas_token = "";
-//        if ($GLOBALS['mem_version'] == "3.0") {
-//            $result = memcache_get($this->mem, $key, null, $cas_token);
-//        } else {
-//            $result = memcache_get($this->mem, $key);
-//        }
-//        if (!$result || $result == "" || $result == null) {
-//            return null;
-//        }
-//        if ($GLOBALS['mem_version'] == "3.0") {
-//            $this->keyDic->$key = $cas_token;
-//        }
-//        return $result;
-//    }
-//
-//    /**
-//     * 设置值,内部不加 json_encode
-//     * @param string $key
-//     * @param string $value
-//     * @param int $ts expirets Ps.当ts的值大于一个月的时候将被视为时间戳
-//     * @return boolean
-//     */
-//    public function setWithoutJson($key, $value, $ts = 0)
-//    {
-//        if ($value == null || $value == "") {
-//            return false;
-//        }
-//        return memcache_set($this->mem, $key, JsonUtil::encode($value), MEMCACHE_COMPRESSED, $ts);
-//    }
-//
-//    public function add($key, $value, $ts = 0)
-//    {
-//        if ($value == null || $value == "") {
-//            return false;
-//        }
-//        return memcache_add($this->mem, $key, JsonUtil::encode($value), MEMCACHE_COMPRESSED, $ts);
-//    }
-//
-//    public function replace($key, $value, $ts = 0)
-//    {
-//        if ($value == null || $value == "") {
-//            return false;
-//        }
-//        return memcache_replace($this->mem, $key, JsonUtil::encode($value), MEMCACHE_COMPRESSED, $ts);
-//    }
-//
-//    public function delete($key)
-//    {
-//        return memcache_delete($this->mem, $key);
-//    }
-//
-//    public function increment($key)
-//    {
-//        return memcache_increment($this->mem, $key);
-//    }
-//
-//    public function getMulti($keys)
-//    {
-//        $retArray = array();
-//        foreach ($keys as $key) {
-//            $result = $this->get($key);
-//            if ($result == null) {
-//                $retArray[] = null;
-//            } else {
-//                $retArray[] = $result;
-//            }
-//        }
-//        return $retArray;
-//    }
-//
-//    public function setMutlti($dict, $expireTs = 0)
-//    {
-//        ;
-//    }
-//
-//    public function cas($key, $value, $ts)
-//    {
-//        if ($GLOBALS['mem_version'] == "3.0") {
-//            if ($value == null || $value == "") {
-//                return false;
-//            }
-//            if (!property_exists($this->keyDic, $key)) {
-//                return memcache_set($this->mem, $key, JsonUtil::encode($value), MEMCACHE_COMPRESSED, $ts);
-//            }
-//            $cas_token = $this->keyDic->$key;
-//            return memcache_cas($this->mem, $key, JsonUtil::encode($value), MEMCACHE_COMPRESSED, $ts, $cas_token);
-//        } else {
-//            return $this->set($key, $value, $ts);
-//        }
-//    }
-//
-//    public function copy($surKey, $desKey)
-//    {
-//        return $this->set($desKey, $this->get($surKey));
-//    }
-//
-//    public function close()
-//    {
-//        return memcache_close($this->mem);
-//    }
-//
-//}

+ 0 - 135
Gameserver/Amfphp/util/CMemdUtil.php

@@ -1,135 +0,0 @@
-<?php
-
-//
-//namespace loyalsoft;
-//
-///**
-// * Description of CMemdUtil
-// * CMemd工具类[CMem线上版]
-// * @deprecated since version 2017.08.08
-// * @author jgao,gwang
-// */
-//class CMemdUtil extends CMemBase
-//{
-//
-//    //put your code here
-//    public $mem = 0;
-//    public $keyDic = null;
-//
-//    public function conn($host, $port, $pwd = "")
-//    {
-//        $this->mem = new Memcached();
-//        $this->mem->addServer($host, $port);
-//        $this->keyDic = new \stdClass();
-//    }
-//
-//    public function get($key)
-//    {
-//        $cas_token = "";
-//        $result = $this->mem->get($key, null, $cas_token);
-//        if (!$result || $result == "" || $result == null) {
-//            return null;
-//        }
-//        $this->keyDic->$key = $cas_token;
-//        return JsonUtil::decode($result);
-//    }
-//
-//    public function set($key, $value, $ts = 0)
-//    {
-//        if ($value == null || $value == "") {
-//            return false;
-//        }
-//        return $this->mem->set($key, JsonUtil::encode($value), $ts);
-//    }
-//
-//    public function add($key, $value, $ts = 0)
-//    {
-//        if ($value == null || $value == "") {
-//            return false;
-//        }
-//        return $this->mem->add($key, JsonUtil::encode($value), $ts);
-//    }
-//
-//    public function replace($key, $value, $ts = 0)
-//    {
-//        if ($value == null || $value == "") {
-//            return false;
-//        }
-//        return $this->mem->replace($this->mem, $key, JsonUtil::encode($value), $ts);
-//    }
-//
-//    public function delete($key)
-//    {
-//        return $this->mem->delete($key);
-//    }
-//
-//    public function increment($key)
-//    {
-//        return $this->mem->increment($key);
-//    }
-//
-//    public function getMulti($keys)
-//    {
-//        $resultMulti = $this->mem->getMulti($keys);
-//        $retArray = array();
-//        foreach ($resultMulti as $result) {
-//            if (!$result || $result == "" || $result == null) {
-//                $retArray[] = null;
-//            } else {
-//                $retArray[] = JsonUtil::decode($result);
-//            }
-//        }
-//        return $retArray;
-//    }
-//
-//    public function cas($key, $value, $ts)
-//    {
-//        if (!property_exists($this->keyDic, $key)) {
-//            return false;
-//        }
-//        if ($value == null || $value == "") {
-//            return false;
-//        }
-//        $cas_token = $this->keyDic->$key;
-//        return $this->mem->cas($cas_token, $key, JsonUtil::encode($value), $ts);
-//    }
-//
-//    public function close()
-//    {
-//        return $this->mem->quit();
-//    }
-//
-//// --> 实现抽象类的 功能
-//    public function copy($surKey, $desKey)
-//    {
-//        return $this->set($desKey, $this->get($surKey));
-//    }
-//
-//    /**
-//     *
-//     * @deprecated since version 20160413113950 经过自己考察json_encode对数据的影响并不存在
-//     * @param type $key
-//     */
-//    public function getWithoutJson($key)
-//    {
-//
-//    }
-//
-//    /**
-//     *
-//     * @deprecated since version 20160413113950 经过自己考察json_encode对数据的影响并不存在
-//     * @param type $key
-//     * @param type $value
-//     * @param type $ts
-//     */
-//    public function setWithoutJson($key, $value, $ts = 0)
-//    {
-//
-//    }
-//
-//    public function setMutlti($dict, $expireTs = 0)
-//    {
-//
-//    }
-//
-//}