Эх сурвалжийг харах

1. 添加排行榜模块, 战斗力榜部分代码.

gwang 5 жил өмнө
parent
commit
495e27e94a

+ 56 - 33
Gameserver/Amfphp/base/CmdCode.php

@@ -531,6 +531,61 @@ class CmdCode {
      */
     const box_SubCoolDown = 6517;
     // </editor-fold>
+    //
+    // <editor-fold defaultstate="collapsed" desc="排行榜操作码 - 66xx">
+    // 
+
+    /**
+     * 排行榜 - 战斗力榜
+     */
+    const rank_fpower_getRank = 6601;
+
+    /**
+     * 排行榜 - 领取战斗力榜突破奖励
+     */
+    const rank_fpower_drawReward = 6602;
+
+    /**
+     * 排行榜 - 查询玩家战斗力排名
+     */
+    const rank_fpower_getRanking = 6603;
+
+    // 
+    // </editor-fold>
+    //
+    // <editor-fold defaultstate="collapsed" desc="邮件操作码 - 67xx开始(ope)">
+
+    /**
+     * [6701]获取邮件列表
+     */
+    const cmd_email_questEmailList = 6701;
+
+    /**
+     * [6702]读取/领取一封邮件
+     */
+    const cmd_email_readAllEmail = 6702;
+
+    /**
+     * [6703]删除邮件
+     */
+    const cmd_email_delMmail = 6703;
+
+    /**
+     * [6704] 测试-插入一封邮件
+     */
+    const cmd_email_test = 6704;
+
+    /**
+     * [6705] 删除邮件——没有条件的
+     */
+    const cmd_mail_delMmailAnyConditions = 6705;
+
+    /**
+     * 6706   请求邮件未处理的数量
+     */
+    const cmd_mail_notReadMailNum = 6706;
+//    const
+// </editor-fold>    
     //
     // <editor-fold defaultstate="collapsed" desc="战斗操作码 - 68xx">
 
@@ -662,39 +717,7 @@ class CmdCode {
 
 // </editor-fold>
 //
-    // <editor-fold defaultstate="collapsed" desc="邮件操作码 - 67xx开始(ope)">
-
-    /**
-     * [6701]获取邮件列表
-     */
-    const cmd_email_questEmailList = 6701;
-
-    /**
-     * [6702]读取/领取一封邮件
-     */
-    const cmd_email_readAllEmail = 6702;
-
-    /**
-     * [6703]删除邮件
-     */
-    const cmd_email_delMmail = 6703;
-
-    /**
-     * [6704] 测试-插入一封邮件
-     */
-    const cmd_email_test = 6704;
-
-    /**
-     * [6705] 删除邮件——没有条件的
-     */
-    const cmd_mail_delMmailAnyConditions = 6705;
-
-    /**
-     * 6706   请求邮件未处理的数量
-     */
-    const cmd_mail_notReadMailNum = 6706;
-//    const
-// </editor-fold>
+//
 //
     // <editor-fold defaultstate="collapsed" desc="公会操作码 - 70xx开始(ope)">
 

+ 16 - 7
Gameserver/Amfphp/base/ErrCode.php

@@ -407,7 +407,7 @@ class ErrCode {
     const store_equip_type = 3411;
 
 // </editor-fold>
-    // ---------商城错误码----------- 3500
+    //  
     // <editor-fold defaultstate="collapsed" desc="    商城/付费 88xx    ">
 
     /**
@@ -545,8 +545,8 @@ class ErrCode {
      */
     const goal_rewarded = 3804;
     // </editor-fold>
-    // ---------礼包错误码----------- 3900
-// <editor-fold defaultstate="collapsed" desc="    活动 39xx    ">
+    //  
+    // <editor-fold defaultstate="collapsed" desc="    活动 39xx    ">
 
     /**
      * 不存在该活动礼包
@@ -788,7 +788,8 @@ class ErrCode {
      */
     const active_activecode_used = 3952;
     // </editor-fold>
-    // ---------战斗错误码----------- 4000
+    //  
+    // <editor-fold defaultstate="collapsed" desc="    战斗错误码 40xx ">
 
     /**
      * 关卡挑战 - 难度参数错误
@@ -924,8 +925,16 @@ class ErrCode {
      * 剧情关卡 - 剧情关卡不能重复挑战,只能挑战一次
      */
     const story_repeatfight = 4025;
+// </editor-fold>
+// 
+    // <editor-fold defaultstate="collapsed" desc="    排行榜错误码  41xx    ">
 
-
+    /**
+     * 排行榜 - 战斗力解锁条件尚未达成
+     */
+    const rank_fpower_unlocked = 4101;
+// </editor-fold>
+// 
 // ------------神兽碎片融合模块错误码---------
 
     /**
@@ -949,7 +958,7 @@ class ErrCode {
      */
     const err_manual_reward_wrongamt = 4602;
 //
-// <editor-fold defaultstate="collapsed" desc="    拍卖 47xx    ">
+    // <editor-fold defaultstate="collapsed" desc="    拍卖 47xx    ">
 
     /**
      * 拍卖物品的常量数据不存在
@@ -992,7 +1001,7 @@ class ErrCode {
     const auction_failprice = 4708;
 // </editor-fold>
 //
-// <editor-fold defaultstate="collapsed" desc="公会错误码 - 48xx开始">
+    // <editor-fold defaultstate="collapsed" desc="公会错误码 - 48xx开始">
 
     /**
      * 玩家等级不足

+ 13 - 0
Gameserver/Amfphp/base/MemKey_GameRun.php

@@ -10,6 +10,8 @@ namespace loyalsoft;
  * @copyright ? 2017-4-6, SJZ LoyalSoft Corporation & gwang. All rights reserved.
  */
 class MemKey_GameRun {
+    //
+// <editor-fold defaultstate="collapsed" desc="英雄">
 
     /**
      * 运行时数据 - 英雄评价内容
@@ -38,6 +40,8 @@ class MemKey_GameRun {
         return "gamerun-herodiscuss-$heroId-userscore";
     }
 
+// </editor-fold>
+
     /**
      * 运行时数据 - 订单编号 - 当前秒内的订单序号
      * @return type
@@ -65,6 +69,8 @@ class MemKey_GameRun {
         return "gamerun-sysmsg-zone$zoneid";
     }
 
+    // <editor-fold defaultstate="collapsed" desc="   PVP">
+
     /**
      * 运行时数据 - pvp蝉联信息
      * @param int $zoneid
@@ -132,6 +138,8 @@ class MemKey_GameRun {
         return "gamerun-pvpRewardRecord-zone$zoneid-$tsweek";
     }
 
+// </editor-fold>
+
     /**
      * 运行时数据 - 战斗力总榜
      * @param type $zoneid
@@ -168,6 +176,7 @@ class MemKey_GameRun {
     }
 
 //  ------ 统计分析 数据 ↓ ----
+    // <editor-fold defaultstate="collapsed" desc="   统计分析数据">
 
     /**
      * 统计数据 - 用户总数量 (int)
@@ -230,6 +239,9 @@ class MemKey_GameRun {
         return "stat-monthly-secretshopsales-zone$zoneid-$tsMonth";
     }
 
+// </editor-fold>
+    // <editor-fold defaultstate="collapsed" desc="   日志 ">
+
     /**
      *  神秘商城 - 消费日志 ()list1000)
      * @param type $zoneid
@@ -249,4 +261,5 @@ class MemKey_GameRun {
         return "log-" . $typename;
     }
 
+// </editor-fold>
 }

+ 5 - 0
Gameserver/Amfphp/base/OpeCode.php

@@ -38,6 +38,11 @@ class OpeCode {
      */
     const Active = 605;
 
+    /**
+     * 排行榜功能
+     */
+    const Rank = 611;
+
     /**
      * 战斗功能
      */

+ 17 - 1
Gameserver/Amfphp/configs/GameConfig.php

@@ -6,7 +6,7 @@ namespace loyalsoft;
 // 由CodeGenerator创建。
 // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
 // author: gwang 
-// 日期: 2020-04-01 10:22:37
+// 日期: 2020-04-07 09:34:16
 ////////////////////
 
 /**
@@ -1191,6 +1191,22 @@ class GameConfig {
         return self::get_hash_item('attack_relation', "$attack1-$attack2");
     }
 
+    /**
+     * 战斗力榜全服突破奖励
+     * @return \rankreward_fpower
+     */
+    public static function rankreward_fpower() {
+        static $a = null;
+        return self::initValue($a, 'rankreward_fpower');
+    }
+
+    /**
+     * @return \sm_rankreward_fpower rankreward_fpower item数据 
+     */
+    public static function rankreward_fpower_getItem($itemid) {
+        return self::get_hash_item('rankreward_fpower', $itemid);
+    }
+
     /**
      * 当前版本(时间戳)
      * @return \ver

+ 16 - 1
Gameserver/Amfphp/model/Const/globalsettings.php

@@ -4,7 +4,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2020-02-12 08:04:58
+ // 日期: 2020-04-01 17:27:39
 ////////////////////
 
 
@@ -596,5 +596,20 @@ class globalsettings
     */
     public $Game_PublicNotice;
 
+    /**
+    * @var Object 进入战场后,角色初始能量(sp)  
+    */
+    public $Arenas_Init_SP;
+
+    /**
+    * @var Object 普通攻击(一击)命中目标并造成上海, 增加3点能量SP  
+    */
+    public $Arenas_hit_SP;
+
+    /**
+    * @var Object 触发极限闪避并进入【失控漩涡】时间, 增加2点能量SP  
+    */
+    public $Arenas_jixianshanbi_SP;
+
 }
 

+ 38 - 0
Gameserver/Amfphp/model/Const/sm_rankreward_fpower.php

@@ -0,0 +1,38 @@
+<?php
+
+////////////////////
+ // 由CodeGenerator创建。
+ // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
+ // author: gwang 
+ // 日期: 2020-04-07 09:00:38
+////////////////////
+
+
+/**
+ * Static Model rankreward_fpower 战斗力榜全服突破奖励
+ */
+class sm_rankreward_fpower
+{
+
+    /**
+    * @var Int32 达成条件(战斗力数值)  
+    */
+    public $condition;
+
+    /**
+    * @var String 奖励  
+    */
+    public $reward;
+
+    /**
+    * @var String 备注  
+    */
+    public $desc;
+
+    /**
+    * @var DateTime 修改时间 default(CURRENT_TIMESTAMP) 
+    */
+    public $lastupdate;
+
+}
+

+ 100 - 0
Gameserver/Amfphp/process/RankProc.php

@@ -0,0 +1,100 @@
+<?php
+
+namespace loyalsoft;
+
+/**
+ * Description of RankProc 排行榜模块
+ * @version
+ *          1.0.0 Created at 2020.4.2. by --gwang
+ * @author gwang (mail@wanggangzero.cn)
+ * @copyright ? 2020.4.2, SJZ LoyalSoft Corporation & gwang. All rights reserved.
+ */
+class RankProc {
+
+    /**
+     * 处理逻辑分发
+     * 所有的Proc中必须有这样一个方法
+     * @param Req $req
+     */
+    static function procMain($req) {
+        switch ($req->cmd) {
+            case CmdCode::rank_fpower_getRank:                                  # 拉取战斗力榜单信息
+                return self::GetFpowerRank($req);
+            case CmdCode::rank_fpower_drawReward:                               # 领取战斗力榜单突破奖励
+
+                break;
+            case CmdCode::rank_fpower_getRanking:                               # 查询玩家战斗力排名
+                return self::GetRankingOfUserFightPower($req);
+            default:
+                return Resp::err(ErrCode::cmd_err);
+        }
+    }
+
+    /**
+     * 拉取战斗力榜单数据
+     * @param req $req
+     */
+    static function GetFpowerRank($req) {
+        $RowsPerPage = 10;                                                      # 常量:每页数据条数10条
+        $MaxRankId = 100;                                                       # 常量:最大上榜人数.
+        $pageId = $req->paras[0];                                               # 参数:页码, 从零开始.
+
+        $key = MemKey_GameRun::Game_FightPowerRank_zset($req->zoneid);          # redis key
+        $startid = 0 + $RowsPerPage * $pageId;                                  # 起始id
+        $endId = $startid + $RowsPerPage - 1;                                   # 结束id
+        if ($endId > $MaxRankId) {                                              # 榜单长度 
+            $endId = $MaxRankId;
+        }
+        $uids = $req->mem->zrevrange($key, $startid, $endId, true);             # 取上榜玩家
+        $userInfos = array();                                                   # 玩家信息
+        foreach ($uids as $uid => $fpower) {
+            $uinfo = UserProc::getUserInfo($req->mem, $req->zoneid, $uid);      # 读取玩家信息
+            $userInfos[] = array(#                                              # 拼装玩家信息
+                'uid' => $uid,
+                'name' => $uinfo->game->name,
+                'level' => $uinfo->game->level,
+                'power' => $fpower,
+                'headImg' => $uinfo->game->img
+            );
+        }
+        Resp::ok($userInfos);                                                   # 返回值
+    }
+
+    /**
+     * 领取战斗力突破奖励
+     * @param req $req
+     */
+    static function DrawFpowerBreakThrougReward($req) {
+        $rewardCondition = $req->paras[0];                                      # 领取奖励的档次条件(战斗力数值)
+
+        $key = MemKey_GameRun::Game_FightPowerRank_zset($req->zoneid);          # redis key
+        $no1 = $req->mem->zrevrange($key, 0, 0, true);                          # 取第一名信息
+        $_power = 0;
+        foreach ($no1 as $uid => $power) {                                      # 
+            $_power = $power;                                                   # 状元的站立值
+            break;
+        }
+        if ($_power < $rewardCondition) {                                       # 不满足领取条件
+            return Resp::err(ErrCode::rank_fpower_unlocked);
+        }
+        $rewardMo = GameConfig::rankreward_fpower_getItem($rewardCondition);    # 奖励mo
+        StoreProc::AddMultiItemInStore($req, $rewardMo->reward, $req->userInfo->game); # 发放奖励字符串.
+        return Resp::ok(true);
+    }
+
+    /**
+     * 查询玩家战斗力排名
+     * @param req $req
+     */
+    static function GetRankingOfUserFightPower($req) {
+        $key = MemKey_GameRun::Game_FightPowerRank_zset($req->zoneid);          # redis key
+        $ranking = $req->mem->zrevrank($key, $req->uid);                        # 查询排名
+        $power = $req->mem->zscore($key, $req->uid);                            # 查询战斗力
+        $ret = array(
+            'ranking' => $ranking,
+            'power' => $power
+        );
+        return Resp::ok($ret);                                                  # 返回  
+    }
+
+}

+ 13 - 19
Gameserver/Amfphp/test.php

@@ -9,22 +9,16 @@ include __DIR__ . '/main.php';
 echoLine("phpver:" . PHP_VERSION);
 
 
-
-
-CLog::info("我们的祖国像花园,花园里花朵真鲜艳.1");
-CLog::info("我们的祖国像花园,花园里花朵真鲜艳.2");
-CLog::warn("我们的祖国像花园,花园里花朵真鲜艳.3");
-CLog::warn("我们的祖国像花园,花园里花朵真鲜艳.4");
-CLog::warn("和暖的阳光照耀着我们,每个人的脸上都笑开颜.5");
-
-$a = json_decode('{"name":"王刚","age":null}');
-
-var_dump($a);
-
-var_dump($a->age != null);
-
-$a->sex = "male";
-
-var_dump(CommUtil::isPropertyExists($a, "age"));
-
-var_dump($a);
+$key = MemKey_GameRun::Game_FightPowerRank_zset(1);                             # redis key
+var_dump($key);
+//var_dump(gMem());
+var_dump(gMem()->get("test"));
+$no1 = gMem()->zrevrange($key, 0, 0, true);                                     # 取第一名信息
+$_power = 0;
+
+foreach ($no1 as $uid => $power) {
+    $_power = $power;
+    break;
+}
+
+var_dump($power);

+ 82 - 153
Gameserver/Amfphp/util/CRedisUtil.php

@@ -25,8 +25,7 @@ require __DIR__ . '/Predis/Autoloader.php';
  *          1.0.1  扩充了事务的使用方法.开发竞争类业务,圣树争夺战, gwang 2016.3.21 <br/>
  *          1.0.0  pguan,基础功能, 方法与memcache看齐. <br/>
  */
-class CRedisUtil extends CMemBase
-{
+class CRedisUtil extends CMemBase {
 
     public $keyDic = null;
 
@@ -39,13 +38,11 @@ class CRedisUtil extends CMemBase
     /**
      * 自动回收
      */
-    function __destruct()
-    {
+    function __destruct() {
         $this->close();
     }
 
-    private static function debug()
-    {
+    private static function debug() {
         if (defined('Redis_Debug') && Redis_Debug) {
             DebugHelper::print_stack_trace();
         }
@@ -60,8 +57,7 @@ class CRedisUtil extends CMemBase
      * @param int $ts=0 此值无效
      * @return true 成功, false 失败,此key已经存在
      */
-    public function add($key, $value, $ts = 0)
-    {
+    public function add($key, $value, $ts = 0) {
         self::debug();
         return $this->setnx($key, JsonUtil::encode($value));
     }
@@ -71,8 +67,7 @@ class CRedisUtil extends CMemBase
      * @param string $surKey 源数据的key
      * @param string $desKey 目的数据的key
      */
-    public function copy($surKey, $desKey)
-    {
+    public function copy($surKey, $desKey) {
         self::debug();
         return $this->set($desKey, $this->get($surKey));
     }
@@ -82,8 +77,7 @@ class CRedisUtil extends CMemBase
      * @param array(string) $keys
      * @return array
      */
-    public function getMulti($keys)
-    {
+    public function getMulti($keys) {
         self::debug();
 //        var_dump($keys);
         return $this->mget($keys);
@@ -95,8 +89,7 @@ class CRedisUtil extends CMemBase
      * @param int $expireTs=0 此值无效
      * @return true 永远成功
      */
-    public function setMutlti($dict, $expireTs = 0)
-    {
+    public function setMutlti($dict, $expireTs = 0) {
         self::debug();
         $params = array();
         foreach ($dict as $key => $val) {
@@ -116,8 +109,7 @@ class CRedisUtil extends CMemBase
      * @param int $ts
      * @return boolean true 成功,false 失败
      */
-    public function replace($key, $value, $ts = 0)
-    {
+    public function replace($key, $value, $ts = 0) {
         self::debug();
         $ret = $this->redis->setex($key, $value, $ts);
         if (strtolower($ret) == "ok") {
@@ -133,8 +125,7 @@ class CRedisUtil extends CMemBase
      * @param type $key
      * @return any
      */
-    public function getWithoutJson($key)
-    {
+    public function getWithoutJson($key) {
         self::debug();
         return $this->redis->get($key);
     }
@@ -147,8 +138,7 @@ class CRedisUtil extends CMemBase
      * @param int $ts
      * @return boolean
      */
-    public function setWithoutJson($key, $value, $ts = 0)
-    {
+    public function setWithoutJson($key, $value, $ts = 0) {
         self::debug();
         $ret = $this->redis->set($key, $value, $ts);
         if (strtolower($ret) == "ok") {
@@ -162,8 +152,7 @@ class CRedisUtil extends CMemBase
      * 输出日志
      * @param mixed $msg
      */
-    private function logErr($msg)
-    {
+    private function logErr($msg) {
         CLog::err($msg, "Redis Err:");
     }
 
@@ -174,8 +163,7 @@ class CRedisUtil extends CMemBase
      * @param string $pwd
      * @return \CRedisUtil
      */
-    public function conn($host, $port, $pwd = "")
-    {
+    public function conn($host, $port, $pwd = "") {
 //        DebugHelper::print_stack_trace();
         $this->redis = new \Predis\Client(array(
             'scheme' => 'tcp',
@@ -190,8 +178,7 @@ class CRedisUtil extends CMemBase
     /**
      * 关闭连接
      */
-    public function close()
-    {
+    public function close() {
         $this->redis->quit();
     }
 
@@ -200,8 +187,7 @@ class CRedisUtil extends CMemBase
      * @param string $key
      * @return any json_decode($result)
      */
-    public function get($key)
-    {
+    public function get($key) {
         self::debug();
         $result = $this->redis->get($key);
         if (!$result || $result == "" || $result == null) {
@@ -218,8 +204,7 @@ class CRedisUtil extends CMemBase
      * @param int $ts default(0)  过期时间(单位秒)
      * @return boolean 成功true,失败false
      */
-    public function set($key, $value, $ts = 0)
-    {
+    public function set($key, $value, $ts = 0) {
         self::debug();
         if ($value === null || $value === "") {    # 这里必须用全等符号
             return false;
@@ -248,8 +233,7 @@ class CRedisUtil extends CMemBase
      * @param any $value
      * @return boolean 成功true,失败false
      */
-    public function cas($key, $value, $ts = 0)
-    {
+    public function cas($key, $value, $ts = 0) {
         if (false) {                               # ps. 各云平台皆不支持eval方法执行lua脚本.等开放支持的时候才是真正支持cas的时候
             $castoken = $this->keyDic->$key;
 #                                                  # 定义一段脚本
@@ -277,8 +261,7 @@ casscript;
      * @param string $keys
      * @return int  删除键的个数
      */
-    public function delete($key)
-    {
+    public function delete($key) {
         self::debug();
         $infos = array();
         array_push($infos, $key);
@@ -288,14 +271,14 @@ casscript;
 // </editor-fold>
 //
 // <editor-fold defaultstate="collapsed" desc="    normal 普通对象操作  mget/mset">
+
     /**
      * 返回所有(一个或多个)给定 key 的值
      * 如果给定的 key 里面,有某个 key 不存在,那么这个 key 返回特殊值 nil 。因此,该命令永不失败。
      * @param array $keys
      * @return array  一个包含所有给定 key 的值的列表
      */
-    private function mget($keys)
-    {
+    private function mget($keys) {
 //        self::debug();
         $ret = array();
         if (count($keys)) {
@@ -316,8 +299,7 @@ casscript;
      * @param type $val
      * @return boolean 成功true,失败false
      */
-    private function setnx($key, $val)
-    {
+    private function setnx($key, $val) {
         self::debug();
         $ret = $this->redis->setnx($key, $val);
 // 成功返回1, 失败返回0
@@ -334,8 +316,7 @@ casscript;
      * @param array $dict
      * @return mixed
      */
-    private function mset($dict)
-    {
+    private function mset($dict) {
         self::debug();
         return $this->redis->mset($dict);
     }
@@ -347,8 +328,7 @@ casscript;
      * @param array $dict
      * @return int
      */
-    public function msetnx($dict)
-    {
+    public function msetnx($dict) {
         self::debug();
         $ret = $this->redis->msetnx($dict);
         return $ret == 1;
@@ -359,8 +339,7 @@ casscript;
      * @param type $key
      * @return boolean  true 存在, false 不存在
      */
-    public function exists($key)
-    {
+    public function exists($key) {
         self::debug();
         return $this->redis->exists($key) == 1;
     }
@@ -373,8 +352,7 @@ casscript;
      * @param type $key
      * @return int 执行 INCR 命令之后 key 的值
      */
-    public function increment($key)
-    {
+    public function increment($key) {
         self::debug();
         return $this->redis->incr($key);
     }
@@ -388,8 +366,7 @@ casscript;
      * @param int $i 增加的值
      * @return int 执行 INCR 命令之后 key 的值
      */
-    public function incrby($key, $i)
-    {
+    public function incrby($key, $i) {
         self::debug();
         return $this->redis->incrby($key, $i);
     }
@@ -403,8 +380,7 @@ casscript;
      * Server功能,看服务器是否连通
      * @return boolean true连通正常
      */
-    public function ping()
-    {
+    public function ping() {
         $ret = $this->redis->ping();
         if ($ret == "PONG") {
             return true;
@@ -418,8 +394,7 @@ casscript;
      * @param array $values
      * @return array
      */
-    static private function json_encode_arr($values)
-    {
+    static private function json_encode_arr($values) {
         $arr = array();
         if (is_array($values)) {
             $arr = array_map(function($v) {
@@ -436,8 +411,7 @@ casscript;
      * @param array $values
      * @return array
      */
-    static private function json_decode_arr(array $values)
-    {
+    static private function json_decode_arr(array $values) {
         $arr = array();
         if (is_array($values)) {
             $arr = array_map(function($v) {
@@ -457,24 +431,21 @@ casscript;
      * 监视一个(或多个) key ,如果在事务执行之前这个(或这些) key 被其他命令所改动,那么事务将被打断。
      * @param string $key
      */
-    public function watch($key)
-    {
+    public function watch($key) {
         $this->redis->watch($key);
     }
 
     /**
      * 取消监视
      */
-    public function unwatch()
-    {
+    public function unwatch() {
         $this->redis->unwatch();
     }
 
     /**
      * 开启事务
      */
-    public function multi()
-    {
+    public function multi() {
         $this->redis->multi();
     }
 
@@ -482,8 +453,7 @@ casscript;
      * 执行事务
      * @return type 事务块内所有命令的返回值,按命令执行的先后顺序排列。当操作被打断时,返回空值 nil 。
      */
-    public function exec()
-    {
+    public function exec() {
         return $this->redis->exec();
     }
 
@@ -501,8 +471,7 @@ casscript;
      * @return int
      * @expectedException type not set error
      */
-    public function sadd($key, $members)
-    {
+    public function sadd($key, $members) {
         self::debug();
         if (!is_array($members)) {                                              # 防御: 参数不为数组
             if (!is_string($members)) {                                         # 防御: 参数不为字符串
@@ -521,8 +490,7 @@ casscript;
      * @return int
      * @expectedException type not set error
      */
-    public function sremove($key, $members)
-    {
+    public function sremove($key, $members) {
         self::debug();
         return $this->redis->srem($key, $members);
     }
@@ -532,8 +500,7 @@ casscript;
      * @param strig $key
      * @return int
      */
-    public function scard($key)
-    {
+    public function scard($key) {
         self::debug();
         return $this->redis->scard($key);
     }
@@ -544,8 +511,7 @@ casscript;
      * @return int
      *
      */
-    public function slen($key)
-    {
+    public function slen($key) {
         self::debug();
         return $this->scard($key);
     }
@@ -556,8 +522,7 @@ casscript;
      * @param string $member
      * @return bool
      */
-    public function sismember($key, $member)
-    {
+    public function sismember($key, $member) {
         self::debug();
         return $this->redis->sismember($key, $member) == 1;
     }
@@ -567,8 +532,7 @@ casscript;
      * @param type $key
      * @return array 不存在的key视为空集合
      */
-    public function smembers($key)
-    {
+    public function smembers($key) {
         self::debug();
         return $this->redis->smembers($key);
     }
@@ -581,8 +545,7 @@ casscript;
      * @param int $count =10
      * @return array
      */
-    public function srandmember($key, $count = 10)
-    {
+    public function srandmember($key, $count = 10) {
         self::debug();
         return $this->redis->srandmember($key, $count);
     }
@@ -597,8 +560,7 @@ casscript;
      * @param array $fields
      * @return int 删除的字段的数量
      */
-    public function hdel($key, $fields)
-    {
+    public function hdel($key, $fields) {
         self::debug();
         return $this->redis->hdel($key, $fields);
     }
@@ -609,8 +571,7 @@ casscript;
      * @param string $field
      * @return boolean true=存在,false 找不到
      */
-    public function hexists($key, $field)
-    {
+    public function hexists($key, $field) {
         self::debug();
         return $this->redis->hexists($key, $field) == 1;
     }
@@ -621,8 +582,7 @@ casscript;
      * @param string $field 字段名
      * @return mixed json_decoded object
      */
-    public function hget($key, $field)
-    {
+    public function hget($key, $field) {
         self::debug();
 //        echo $field, $key;
         $ret = $this->redis->hget($key, $field);
@@ -635,8 +595,7 @@ casscript;
      * @param string $key
      * @return stdclass/associate_array (适用箭头取变量写法)
      */
-    public function hgetall($key)
-    {
+    public function hgetall($key) {
         self::debug();
         $ret = ArrayInit();
         $arr = $this->redis->hgetall($key);
@@ -652,8 +611,7 @@ casscript;
      * @param string $key
      * @return int
      */
-    public function hlen($key)
-    {
+    public function hlen($key) {
         self::debug();
         return $this->redis->hlen($key);
     }
@@ -664,8 +622,7 @@ casscript;
      * @param array $fields
      * @return Array
      */
-    public function hmget($key, $fields)
-    {
+    public function hmget($key, $fields) {
         self::debug();
         $ret = ArrayInit();
         if (is_array($fields) && count($fields) > 0) {
@@ -684,8 +641,7 @@ casscript;
      * @param assoc_array $dictionary
      * @return boolean true成功
      */
-    public function hmset($key, $dictionary)
-    {
+    public function hmset($key, $dictionary) {
         self::debug();
         $newdic = ArrayInit();
         foreach ($dictionary as $k => $v) {
@@ -705,8 +661,7 @@ casscript;
      * @param $mixed $value
      * @return int 0 覆盖旧值, 1 新建字段
      */
-    public function hset($key, $field, $value)
-    {
+    public function hset($key, $field, $value) {
         self::debug();
         return $this->redis->hset($key, $field, JsonUtil::encode($value));
     }
@@ -718,8 +673,7 @@ casscript;
      * @param string $value
      * @return boolean true成功
      */
-    public function hsetnx($key, $field, $value)
-    {
+    public function hsetnx($key, $field, $value) {
         self::debug();
         return $this->redis->hsetnx($key, $field, JsonUtil::encode($value)) == 1;
     }
@@ -731,8 +685,7 @@ casscript;
      * @param int $increment
      * @return int
      */
-    public function hincrby($key, $field, $increment)
-    {
+    public function hincrby($key, $field, $increment) {
         self::debug();
         return $this->redis->hincrby($key, $field, $increment);
     }
@@ -744,8 +697,7 @@ casscript;
      * @param string $increment float值用string
      * @return string  用string存float值
      */
-    public function hincrbyfloat($key, $field, $increment)
-    {
+    public function hincrbyfloat($key, $field, $increment) {
         self::debug();
         return $this->redis->hincrbyfloat($key, $field, $increment);
     }
@@ -754,8 +706,7 @@ casscript;
      * @param string $key
      * @return array
      */
-    public function hkeys($key)
-    {
+    public function hkeys($key) {
         self::debug();
         return $this->redis->hkeys($key);
     }
@@ -774,8 +725,7 @@ casscript;
      * @param int $timeout
      * @return array
      */
-    public function blpop(array $keys, $timeout)
-    {
+    public function blpop(array $keys, $timeout) {
         self::debug();
         $arr = $this->redis->blpop($keys, $timeout);
         $arr[1] = JsonUtil::decode($arr[1]);  // 对value进行解包
@@ -786,8 +736,7 @@ casscript;
      * 链表 - 阻塞队尾弹出, 当列表中没有元素的时候,命令会阻塞,直到等待超时或者有元素被添加到列表中.
      * @return array
      */
-    public function brpop(array $keys, $timeout)
-    {
+    public function brpop(array $keys, $timeout) {
         self::debug();
         $arr = $this->redis->brpop($keys, $timeout);
         $arr[1] = JsonUtil::decode($arr[1]);
@@ -800,8 +749,7 @@ casscript;
      * @return array 假如在指定时间内没有任何元素被弹出,则返回一个 nil 和等待时长。
      *        反之,返回一个含有两个元素的列表,第一个元素是被弹出元素的值,第二个元素是等待时长。
      */
-    public function brpoplpush($source, $destination, $timeout)
-    {
+    public function brpoplpush($source, $destination, $timeout) {
         self::debug();
         $arr = $this->redis > brpoplpush($source, $destination, $timeout);
         $arr[0] = JsonUtil::decode($arr[0]);
@@ -810,12 +758,12 @@ casscript;
 
 // </editor-fold>
 //
+
     /**
      * 链表 - 返回下标为index的元素
      * @return string
      */
-    public function lindex($key, $index)
-    {
+    public function lindex($key, $index) {
         self::debug();
         $a = $this->redis->lindex($key, $index);
         return JsonUtil::decode($a);
@@ -826,8 +774,7 @@ casscript;
      * @return int
      * @param type $key
      */
-    public function llen($key)
-    {
+    public function llen($key) {
         self::debug();
         return $this->redis->llen($key);
     }
@@ -837,8 +784,7 @@ casscript;
      * @return string
      * @param type $key
      */
-    public function lpop($key)
-    {
+    public function lpop($key) {
         self::debug();
         $a = $this->redis->lpop($key);
         return JsonUtil::decode($a);
@@ -850,8 +796,7 @@ casscript;
      * @param type $key
      * @param array $values
      */
-    public function lpush($key, $values)
-    {
+    public function lpush($key, $values) {
         self::debug();
         $arr = self::json_encode_arr($values);
         return $this->redis->lpush($key, $arr);
@@ -864,8 +809,7 @@ casscript;
      * @param int $start
      * @param int $stop
      */
-    public function lrange($key, $start, $stop)
-    {
+    public function lrange($key, $start, $stop) {
         self::debug();
         $values = $this->redis->lrange($key, $start, $stop);
         return self::json_decode_arr($values);
@@ -878,8 +822,7 @@ casscript;
      * @param int $count
      * @param string $value
      */
-    public function lrem($key, $count, $value)
-    {
+    public function lrem($key, $count, $value) {
         self::debug();
         return $this->redis->lrem($key, $count, JsonUtil::encode($value));
     }
@@ -892,8 +835,7 @@ casscript;
      * @param type $index
      * @param type $value
      */
-    public function lset($key, $index, $value)
-    {
+    public function lset($key, $index, $value) {
         self::debug();
         return $this->redis->lset($key, $index, JsonUtil::encode($value));
     }
@@ -905,8 +847,7 @@ casscript;
      * @param int $start
      * @param int $stop
      */
-    public function ltrim($key, $start, $stop)
-    {
+    public function ltrim($key, $start, $stop) {
         self::debug();
         // return mixed: ok or fails
         $ret = $this->redis->ltrim($key, $start, $stop);
@@ -921,8 +862,7 @@ casscript;
      * @param string $key
      * @return string 列表的尾元素。当 key 不存在时,返回 nil
      */
-    public function rpop($key)
-    {
+    public function rpop($key) {
         self::debug();
         return JsonUtil::decode($this->redis->rpop($key));
     }
@@ -933,8 +873,7 @@ casscript;
      * @param array $values
      * @return int
      */
-    public function rpush($key, array $values)
-    {
+    public function rpush($key, array $values) {
         self::debug();
         $arr = self::json_encode_arr($values);
         return $this->redis->rpush($key, $arr);
@@ -995,8 +934,7 @@ casscript;
      * @param array $membersAndScoresDictionary array( 'value'=>score,'value'=>score,...), score可以是int或float
      * @return int 新增元素数量,不包含更新的元素
      */
-    public function zadd($key, $membersAndScoresDictionary)
-    {
+    public function zadd($key, $membersAndScoresDictionary) {
         self::debug();
         return $this->redis->zadd($key, $membersAndScoresDictionary);
     }
@@ -1008,8 +946,7 @@ casscript;
      * @param int $increment
      * @return string
      */
-    public function zincrby($key, $member, $increment = 1)
-    {
+    public function zincrby($key, $member, $increment = 1) {
         self::debug();
         return $this->redis->zincrby($key, $increment, $member);
     }
@@ -1019,8 +956,7 @@ casscript;
      * @param string $key
      * @return int
      */
-    public function zlen($key)
-    {
+    public function zlen($key) {
         self::debug();
         return $this->redis->zcard($key);
     }
@@ -1032,8 +968,7 @@ casscript;
      * @param int/float $max 最高分
      * @return int
      */
-    public function zcount($key, $min, $max)
-    {
+    public function zcount($key, $min, $max) {
         self::debug();
         return $this->redis->zcount($key, $min, $max);
     }
@@ -1046,8 +981,7 @@ casscript;
      * @param boolean $withScore 返回值中是否带score字段
      * @return array (index=>member) or assoc_array (member=>score)
      */
-    public function zrange($key, $start, $stop, $withScore = false)
-    {
+    public function zrange($key, $start, $stop, $withScore = false) {
         self::debug();
         if ($withScore) {
             return $this->redis->zrange($key, $start, $stop, 'WITHSCORES');
@@ -1080,11 +1014,13 @@ casscript;
      * @param boolean $withScore 返回值中是否带score字段 default(false)
      * @return array (index=>member) or assoc_array (member=>score)
      */
-    public function zrevrange($key, $start, $stop, $withScore = false)
-    {
+    public function zrevrange($key, $start, $stop, $withScore = false) {
         self::debug();
         if ($withScore) {
-            return $this->redis->zrevrange($key, $start, $stop, 'WITHSCORES');
+            echoLine("带分数取");
+            $r = $this->redis->zrevrange($key, $start, $stop, 'WITHSCORES');
+            var_dump($r);
+            return $r;
         } else {
             return $this->redis->zrevrange($key, $start, $stop);
         }
@@ -1098,8 +1034,7 @@ casscript;
      * @param boolean $withScore
      * @return type
      */
-    public function zrangebyscore($key, $min, $max, $withScore = false)
-    {
+    public function zrangebyscore($key, $min, $max, $withScore = false) {
         self::debug();
         if ($withScore) {
             return $this->redis->zrangebyscore($key, $min, $max, 'WITHSCORES');
@@ -1114,8 +1049,7 @@ casscript;
      * @param string $member
      * @return int
      */
-    public function zrank($key, $member)
-    {
+    public function zrank($key, $member) {
         self::debug();
         return $this->redis->zrank($key, $member);
     }
@@ -1126,8 +1060,7 @@ casscript;
      * @param string $member
      * @return int
      */
-    public function zrevrank($key, $member)
-    {
+    public function zrevrank($key, $member) {
         self::debug();
         return $this->redis->zrevrank($key, $member);
     }
@@ -1138,8 +1071,7 @@ casscript;
      * @param string $member
      * @return int/float
      */
-    public function zscore($key, $member)
-    {
+    public function zscore($key, $member) {
         self::debug();
         return $this->redis->zscore($key, $member);
     }
@@ -1149,8 +1081,7 @@ casscript;
      * @param string $key
      * @param string $member
      */
-    public function zrem($key, $member)
-    {
+    public function zrem($key, $member) {
         self::debug();
         $this->redis->zrem($key, $member);
     }
@@ -1161,8 +1092,7 @@ casscript;
      * @param int $start
      * @param int $stop
      */
-    public function zremrangebyrank($key, $start, $stop)
-    {
+    public function zremrangebyrank($key, $start, $stop) {
         self::debug();
         $this->redis->zremrangebyrank($key, $start, $stop);
     }
@@ -1173,8 +1103,7 @@ casscript;
      * @param int/float $min
      * @param int/float $max
      */
-    public function zremrangebyscore($key, $min, $max)
-    {
+    public function zremrangebyscore($key, $min, $max) {
         self::debug();
         $this->redis->zremrangebyscore($key, $min, $max);
     }

+ 1 - 1
Gameserver/nbproject/private/private.properties

@@ -2,6 +2,6 @@ copy.src.files=false
 copy.src.on.open=false
 copy.src.target=
 index.file=index.php
-interpreter=E:\\Program-Files\\wnmp\\php\\php-5.6.40-nts-Win32-VC11-x64\\php.exe
+interpreter=E:\\Program-Files\\wnmp\\php\\php-7.4.4-nts-Win32-vc15-x64\\php.exe
 run.as=SCRIPT
 url=http://localhost/Gameserver/

+ 12 - 9
Gameserver/nbproject/private/private.xml

@@ -12,16 +12,19 @@
     </editor-bookmarks>
     <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
         <group>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/util/ErrHandler.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/UserProc.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/PreProc.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/index.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/util/CRedisUtil.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/service_call/pay/official/alipay/lotusphp_runtime/DB/Adapter/ConnectionAdapter/DbConnectionAdapterMysqli.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/test.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/StatProc.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/HeroDiscussProc.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/ActiveProc.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/HeroProc.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/FightProc/PVPProc.php</file>
             <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/FightProc.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/model/Const/globalsettings.php</file>
-            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/FightProc/SweepGatesProc.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/StoreProc.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/RankProc.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/PayProc.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/process/TaskProc.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/Services/AppServer.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/base/MemKey_GameRun.php</file>
+            <file>file:/E:/www/ylsj2019/Gameserver/Amfphp/test.php</file>
         </group>
     </open-files>
 </project-private>