王刚 1 anno fa
parent
commit
11713f0695

+ 0 - 111
Gameserver/App/base/MemKey_Guild.php

@@ -1,111 +0,0 @@
-<?php
-
-namespace loyalsoft;
-
-/**
- * Description of MemKey_Guild
- *
- * @author cyzhao
- */
-class MemKey_Guild {
-//
-// <editor-fold defaultstate="collapsed" desc="    辅助方法  ">
-//
-
-    /**
-     * @return bool 是否使用短名称
-     */
-    private static function bUseShort() {
-//        return true;  # 全部启用
-        return match (PLAT) {
-            Enum_Plat::dev_gwang => false, # dev时不使用
-            default => true,
-        };
-    }
-
-    /**
-     * key前缀
-     * @param int $zoneid 分区id
-     * @param string $uid
-     * @return string
-     */
-    private static function Key_($zoneid, $uid) {
-        return self::bUseShort() ? 'u-' . $uid . '-' . $zoneid : 'user-' . $uid . '-zone' . $zoneid;
-    }
-
-// </editor-fold>
-
-    /**
-     * 获取玩家公会信息
-     * @param type $zoneid
-     * @return string
-     */
-    public static function getUserGuildInfo_hash($uid, $zoneid) {
-        return self::Key_($zoneid, $uid) . "-guild";
-    }
-
-    /**
-     * 公会列表缓存
-     * @param type $page
-     * @param type $zoneid
-     * @return type
-     */
-    public static function guildListCache($page, $zoneid) {
-        return "cache-guild-list" . "-zone" . $zoneid . $page;
-    }
-
-//    /**
-//     * 推荐公会列表缓存
-//     * @return string
-//     */
-//    static function guildRecommendationCache($zoneid) {
-//        return "cache-guild-recommendation" . "-zone" . $zoneid;
-//    }
-//
-//    /**
-//     *  推荐公会队列
-//     * @return string
-//     */
-//    static function constGuildRecommendationQueue($zoneid) {
-//        return "guild-recommendation-queue" . "-zone" . $zoneid;
-//    }
-
-    /**
-     * 获取公会信息
-     */
-    static function getGuildInfo_hash($gid, $zoneid) {
-        return "guild-" . $gid . "-zone" . $zoneid;
-    }
-
-    /**
-     * 获取当前最大公会ID,
-     * @return string
-     */
-    static function constGetCurrentMaxGuildID($zoneid) {
-        return "guild-currentmaxid" . "-zone" . $zoneid;
-    }
-
-//    /**
-//     * 【哈希】捐献请求记录
-//     * @return string
-//     */
-//    static function CacheGuildDonate($guildId, $zoneid) {
-//        return "guild-donate-" . $guildId . "-zone" . $zoneid;
-//    }
-//
-//    /**
-//     * 【LIST】捐献者记录
-//     * @return string
-//     */
-//    static function UserDonateRecordList($guildId, $index, $zoneid) {
-//        return "guild-donor-" . $guildId . "-" . $index . "-zone" . $zoneid;
-//    }
-//
-//    /**
-//     * 【LIST】除了捐献之外的日志
-//     * @return string
-//     */
-//    static function constGuildJournal($guildId, $zoneid) {
-//        return "guild-journal-" . $guildId . "-zone" . $zoneid;
-//    }
-}

+ 7 - 8
Gameserver/App/process/EmailProc.php

@@ -23,7 +23,6 @@ class enum_Mail_Type extends Enum {
 
     /** 公会邮件 */
     const GuildNoticeMail = 8;
-
 }
 
 /**
@@ -454,18 +453,18 @@ class EmailProc {
         self::InsertMail($zoneid, $uid, $mail);
     }
 
-    public static function SendPaiHangRewardMail_fpower($zoneid, $uid,$index,$reward) {
-       $mail = new Ins_Email(null, enum_Mail_Type::SysTemMail, "战力榜排名奖励", #
+    public static function SendPaiHangRewardMail_fpower($zoneid, $uid, $index, $reward) {
+        $mail = new Ins_Email(null, enum_Mail_Type::SysTemMail, "战力榜排名奖励", #
                 "恭喜您在战力榜获得{$index}名,获得奖励!", $reward);
         self::InsertMail($zoneid, $uid, $mail);
     }
-    
-    public static function SendPaiHangRewardMail_level($zoneid, $uid,$index,$reward) {
-       $mail = new Ins_Email(null, enum_Mail_Type::SysTemMail, "等级榜排名奖励", #
+
+    public static function SendPaiHangRewardMail_level($zoneid, $uid, $index, $reward) {
+        $mail = new Ins_Email(null, enum_Mail_Type::SysTemMail, "等级榜排名奖励", #
                 "恭喜您在等级榜获得{$index}名,获得奖励!", $reward);
         self::InsertMail($zoneid, $uid, $mail);
     }
-      
+
 // </editor-fold>
 //
 // <editor-fold defaultstate="collapsed" desc="   公会邮件   ">
@@ -545,7 +544,7 @@ class EmailProc {
             }
         }
         self::logMail($zoneid, $uid, $mail);                                    # 将邮件写入Mysql中
-        CornerSignEventProc::OnNewMails();                                      # 角标更新
+//        CornerSignEventProc::OnNewMails();                                      # 角标更新
         return $mail->mailId;
     }
 

+ 0 - 112
Gameserver/App/process/EventProc.php

@@ -1,112 +0,0 @@
-<?php
-
-//
-//namespace loyalsoft;
-//
-///**
-// * 事件模块.
-// * @version
-// *          1.0.0 Created at 2017-8-28.   by --gwang
-// * @author gwang (mail@wanggangzero.cn)
-// * @copyright ? 2017-8-28, SJZ LoyalSoft Corporation & gwang. All rights reserved.
-// */
-//class EventProc {
-//
-//    public static function procMain() {
-//        switch (req()->cmd) {
-//            case CmdCode::cmd_event_GetNotifications:                           # 7201 拉取角标通知列表
-//                return self::GetCornerSignNotifications();
-//            case CmdCode::cmd_event_ClearNotifications:                         # 7202 清理指定类型的角标
-//                return self::ClearCornerSignNotification();
-//            default:
-//                return Resp::err(ErrCode::cmd_err);
-//        }
-//    }
-//
-//    /**
-//     * [7202] 清理指定类型的角标记录
-//     */
-//    static function ClearCornerSignNotification() {
-//        $ctype = req()->paras[0];
-//        $e = new OperateEventType();
-//        if ($e->isValidValue($ctype)) {
-//            StlUtil::arrayRemove(ctx()->privateData()->cornerSignNotifications, $ctype); # 移除角标
-//            UserProc::updateUserInfo();
-//        }
-//        $arr = array_values(array_unique(ctx()->privateData()->cornerSignNotifications)); # 返回值去重
-//        ctx()->privateData()->cornerSignNotifications = $arr;                    # 更新记录
-//        return Resp::ok(array("notifications" => $arr));                        # 返回
-//    }
-//
-//    /**
-//     * [7201] 拉取角标通知
-//     */
-//    static function GetCornerSignNotifications() {
-//        // 这里直接返回, 将来开发对应的触发逻辑, 给数组中添加相应的值
-//        $arr = array_values(array_unique(ctx()->privateData()->cornerSignNotifications)); # 返回值去重
-//        ctx()->privateData()->cornerSignNotifications = $arr;                    # 更新记录
-//        UserProc::updateUserInfo();
-//        return Resp::ok(array("notifications" => $arr));                        # 返回
-//    }
-//
-//    static function Init() {
-//        Event::register('onpay', array(new Data_UserProfile(ctx()->profile), "OnPay"));
-//    }
-//
-//    /**
-//     * 收到请求
-//     */
-//    static function OnRequest() {
-//
-//    }
-//
-//    /**
-//     * 处理完毕准备返回
-//     */
-//    static function AfterResponse() {
-//
-//    }
-//
-//    /**
-//     * 当天第一次登录
-//     */
-//    static function OnNewDay() {
-//        CornerSignEventProc::OnNewDay();
-//    }
-//
-//    /**
-//     * 当周第一次登录(周一)
-//     */
-//    static function OnNewWeek() {
-//
-//    }
-//
-//    /**
-//     * 当玩家等级变更
-//     * @param type $old
-//     * @param type $new
-//     */
-//    static function OnUserLevelup($old, $new) {
-//        // 处理逻辑,
-//        $ubs = ctx()->privateData()->unlockedBuild;
-//        foreach (GameConfig::build() as $id => $b) {
-//            isEditor() and $b = new \sm_build();
-//            if (!in_array($id, $ubs)) {                                         # 尚未解锁的建筑,判断,已解锁的跳过
-//                if ($b->playerLevelLimit <= $new) {                             # 符合解锁条件
-//                    ctx()->privateData()->unlockedBuild[] = $id;                 # 插入解锁记录
-//                    StatisticsProc::TargetStatistics(Enum_TargetStatistics::unlockbuidId, $id);
-//                    if ($id == 1000) {
-//                        $college = new Info_College();
-//                        $college->setFunUnluckTs();
-//                    }
-//                    StatisticsProc::unlockBuild($id);                           # 统计全服玩家解锁建筑
-//                    NormalEventProc::OnUnlockBuild($id, null);                  # 插入事件
-//                }
-//            }
-//        }
-//
-//
-//
-//        NormalEventProc::OnUserLvlUp($old, $new);                               # 添加升级事件,算了这个暂时没人关注
-//    }
-//}

+ 0 - 209
Gameserver/App/process/EventProc/CornerSignEventProc.php

@@ -1,209 +0,0 @@
-<?php
-
-namespace loyalsoft;
-
-/**
- * 枚举: 角标提示类型枚举
- */
-class OperateEventType extends Enum {
-
-    const _Empty = 0;                                                           // 空
-    //
-    const Task = 100;
-    const Task_plot = 101;                                                      # 任务 剧情任务
-    const Task_Daily = 102;                                                     # 任务 每日任务
-    //
-    const Call = 200;
-    const Call_Warrior = 201;                                                   # 召唤 战士
-    const Call_Magician = 202;                                                  # 召唤 法师
-    const Call_Archer = 203;                                                    # 召唤 射手
-    //
-    const Bag = 300;
-    const Bag_Weapon = 301;                                                     # 背包 武器
-    const Bag_Kotodama = 302;                                                   # 背包 言灵
-    const Bag_Fragment = 303;                                                   # 背包 碎片
-    const Bag_Material = 304;                                                   # 背包 材料
-    const Bag_TaskCard = 305;                                                   # 背包 任务卡
-    const Bag_Consume = 306;                                                    # 背包 消耗类(蓝屏 血瓶 卷轴等)
-    //
-    const Ranking = 400;
-    const Ranking_PowerReward = 401;                                            # 排行榜 战力榜奖励
-    const Ranking_ClearanceReward = 402;                                        # 排行榜 通关榜奖励
-    #
-    const Mail_New = 500;                                                       # 邮件 新邮件
-    const Notice_New = 600;                                                     # 公告 新公告
-    const Arena_FreeTimes = 700;                                                # 竞技场 可进入
-    #
-    const Gift = 800;                                                           # 礼包
-    const Gift_Day = 801;                                                       # 每日礼包
-    #
-    const Role = 900;                                                           # 角色模块
-    const Role_Attribute = 901;                                                 # 角色  属性(有新的可升级的道具)
-    const Role_YanLing = 902;                                                   # 角色 有新言灵
-    const Role_Weapon = 903;                                                    # 角色 有新武器
-
-}
-
-/**
- * Description of CornerSignEventProc
- *
- * @author Administrator
- */
-class CornerSignEventProc {
-    // <editor-fold defaultstate="collapsed" desc="礼包">
-
-    /**
-     * 每日礼包提示
-     */
-    public static function OnNewDay() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Gift_Day;
-    }
-
-// </editor-fold>
-    // <editor-fold defaultstate="collapsed" desc="任务">
-
-    /**
-     * 剧情任务状态有更新(新增/完成)
-     */
-    public static function OnTask_Plot_new() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Task_plot;
-    }
-
-    /**
-     * 每日任务状态有变动(完成)
-     */
-    public static function OnTask_Daily_new() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Task_Daily;
-    }
-
-// </editor-fold>
-    // <editor-fold defaultstate="collapsed" desc="言灵">
-
-    /**
-     * 言灵召唤状态,解锁新的战士
-     */
-    public static function OnCall_Warrior_new() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Call_Warrior;
-    }
-
-    /**
-     * 言灵召唤状态,解锁新的法师
-     */
-    public static function OnCall_Magician_new() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Call_Magician;
-    }
-
-    /**
-     * 言灵召唤状态,解锁新的射手
-     */
-    public static function OnCall_Archer_new() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Call_Archer;
-    }
-
-// </editor-fold>
-    // <editor-fold defaultstate="collapsed" desc="背包">
-
-    /**
-     * 包裹--获得新的武器
-     */
-    public static function OnBag_new_Weapon() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Bag_Weapon;
-    }
-
-    /**
-     * 包裹--获得新的言灵
-     */
-    public static function OnBag_new_Yanling() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Bag_Kotodama;
-    }
-
-    /**
-     * 包裹--获得新的碎片
-     */
-    public static function OnBag_new_Fragment() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Bag_Fragment;
-    }
-
-    /**
-     * 包裹--获得新的材料
-     */
-    public static function OnBag_new_Material() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Bag_Material;
-    }
-
-    /**
-     * 包裹--获得新的任务卡
-     */
-    public static function OnBag_new_TaskCard() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Bag_TaskCard;
-    }
-
-    /**
-     * 包裹--获得新的消耗性道具
-     */
-    public static function OnBag_new_Consume() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Bag_Consume;
-    }
-
-// </editor-fold>
-
-    /**
-     * 排行榜--战力奖励状态有变化
-     */
-    public static function OnRanking_PowerReward_new() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Ranking_PowerReward;
-    }
-
-    /**
-     * 排行榜--通关奖励状态有变化--暂时改成等级榜
-     */
-    public static function OnRanking_GageReward_new() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Ranking_ClearanceReward;
-    }
-
-    /**
-     * 邮件系统--有新的邮件
-     */
-    public static function OnNewMails() {
-        if (null != ctx()) {
-            ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Mail_New;
-            UserProc::updateUserInfo();
-        }
-    }
-
-    /**
-     * 公告有更新
-     */
-    public static function OnNotice_new() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Notice_New;
-    }
-
-    /**
-     * 角色 属性(有新的可升级道具)
-     */
-    public static function OnRoleAttribute() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Role_Attribute;
-    }
-
-    /**
-     * 角色 言灵(有新的可替换/装备言灵)
-     */
-    public static function OnRoleYanling() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Role_YanLing;
-    }
-
-    /**
-     * 角色 武器(有新的可装备/替换武器)
-     */
-    public static function OnRoleWeapon() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Role_Weapon;
-    }
-
-    /**
-     * AAA
-     */
-    public static function OnAAA() {
-        ctx()->privateData()->cornerSignNotifications[] = OperateEventType::Arena_FreeTimes;
-    }
-
-}

+ 0 - 224
Gameserver/App/process/EventProc/NormalEventProc.php

@@ -1,224 +0,0 @@
-<?php
-
-//
-//namespace loyalsoft;
-//
-///**
-// * 系统事件处理模块
-// * @author gwang
-// */
-//class NormalEventProc {
-//
-//    public static function OnHelloWorld($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::HelloWorld, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 包裹--获得新的道具
-//     * @param type $itemid
-//     * @param type $num
-//     * @param type $cid
-//     */
-//    public static function OnBag_new_Item($itemid, $num, $cid) {
-//        Resp::AddEvent(Enum_EventType::AddItem, "$itemid,$num", $cid);
-//    }
-//
-//    /**
-//     * 包裹--移除道具
-//     * @param type $arg1
-//     * @param type $arg2
-//     */
-//    public static function OnBag_Remove_Item($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::RemoveItem, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 任务卡包裹--获得新的任务卡
-//     * @param type $arg1
-//     * @param type $arg2
-//     */
-//    public static function OnTaskBag_new_Card($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::AddTaskItem, $arg1, $arg2);
-//    }
-//
-////
-//
-//    /**
-//     * 任务卡包裹--移除任务卡
-//     * @param type $arg1
-//     * @param type $arg2
-//     */
-//    public static function OnTaskBag_remove_Card($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::RemoveTaskItem, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 任务卡-任务步骤进度更新
-//     * @param type $arg1
-//     * @param type $arg2
-//     */
-//    public static function OnTaskCardStep_Process($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::MissionStepProcess, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 任务卡-任务步骤完成
-//     * @param type $arg1
-//     * @param type $arg2
-//     */
-//    public static function OnTaskCardStep_Complete($arg1, $arg2) {
-//
-//        Resp::AddEvent(Enum_EventType::MissionStepComplete, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 任务卡-完成
-//     * @param type $arg1
-//     * @param type $arg2
-//     */
-//    public static function OnTaskCard_Finish($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::TaskCardFinished, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 任务卡-激活
-//     * @param type $arg1
-//     * @param type $arg2
-//     */
-//    public static function OnTaskCard_Actived($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::TaskCardActived, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 任务卡-领取奖励
-//     * @param type $arg1
-//     * @param type $arg2
-//     */
-//    public static function OnTaskCard_Reward($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::TaskCardReward, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 剧情-开启一段新对话
-//     * @param type $arg1
-//     * @param type $arg2
-//     */
-//    public static function OnPlot_startNew($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::StartPlot, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 剧情-开启一段NPC对话
-//     * @param type $arg1
-//     * @param type $arg2
-//     */
-//    public static function OnNpcDialog_startNew($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::NpcDialog, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 解锁 - 功能建筑
-//     * @param type $arg1 建筑id
-//     * @param type $arg2
-//     */
-//    public static function OnUnlockBuild($arg1, $arg2 = null) {
-//        Resp::AddEvent(Enum_EventType::UnlockBuild, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 解锁 - 地图
-//     * @param type $arg1 关卡id
-//     * @param type $arg2
-//     */
-//    public static function OnUnlockMap($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::UnlockMap, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 升级-指挥官
-//     * @param type $arg1 旧等级
-//     * @param type $arg2 新等级
-//     */
-//    public static function OnUserLvlUp($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::UserLvlUP, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 升级-唤灵师
-//     * @param type $arg1 唤灵师uid
-//     * @param type $arg2 最新等级
-//     */
-//    public static function OnHeroLvlUp($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::HeroLvlUp, $arg1, $arg2);
-//    }
-//    /**
-//     * 突破-唤灵师
-//     * @param type $arg1
-//     * @param type $arg2
-//     */
-//    public static function OnHeroTuPo($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::HeroTuPo, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 升级-唤灵师
-//     * @param type $arg1 唤灵师uid
-//     * @param type $arg2 最新等级
-//     */
-//    public static function OnWeaponLvlUp($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::WeaponLvUp, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 突破-唤灵师
-//     * @param type $arg1
-//     * @param type $arg2
-//     */
-//    public static function OnWeaponLvTuPo($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::WeaponTuPo, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 升级-言灵
-//     * @param type $arg1 唤灵师uid
-//     * @param type $arg2 最新等级
-//     */
-//    public static function OnYanLingLvlUp($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::YanLingLvUp, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 突破-言灵
-//     * @param type $arg1
-//     * @param type $arg2
-//     */
-//    public static function OnYanLingLvTuPo($arg1, $arg2) {
-//        Resp::AddEvent(Enum_EventType::YanLingTuPo, $arg1, $arg2);
-//    }
-//
-//    /**
-//     * 支付成功
-//     * @param type $arg1
-//     * @param type $arg2
-//     */
-//    public static function OnPaySuccess() {
-//        Resp::AddEvent(Enum_EventType::PaySuccess, null, null);
-//    }
-//
-//    /**
-//     * 体力变化
-//     * @param type $arg1
-//     */
-//    public static function OnTiliChange($arg1) {
-//        Resp::AddEvent(Enum_EventType::TiliChange, $arg1, null);
-//    }
-//
-//    /**
-//     *
-//     * @param type $arg1
-//     */
-//    public static function OnHPMPItemConfigChange() {
-//        Resp::AddEvent(Enum_EventType::HPMPItemConfigChange, null, null);
-//    }
-//
-//}

+ 0 - 247
Gameserver/App/process/FightProc.php

@@ -1,247 +0,0 @@
-<?php
-
-//
-//namespace loyalsoft;
-//
-//
-//
-///**
-// * 战斗业务逻辑分发
-// * @author gwang
-// */
-//class FightProc {
-//
-//    /**
-//     * 战斗逻辑分发
-//     * 所有的Proc中必须有这样一个方法
-//     */
-//    static function procMain() {
-//        switch (req()->cmd) {
-//            # 关卡-征战
-//            case CmdCode::cmd_fight_arenas_preFight:                            # 6800 关卡挑战 - 预先计算掉落
-//                return SweepGatesProc::Arenas_preFight();
-//            case CmdCode::cmd_fight_arenasfight:                                # 6801 挑战关卡
-//                return SweepGatesProc::Arenas_Fight();
-//            case CmdCode::cmd_fight_arenassweep:                                # [6802] 扫荡
-//                Err(ErrCode::function_notopen_msg);                             # 暂未开放扫荡功能. -gwang 2020.4.20
-//                return SweepGatesProc::Arenas_NewSweepFight();
-//
-//            case CmdCode::cmd_fight_GetArenasActiveReward:                      # 6806 领取章节星级奖励
-//                return SweepGatesProc::DrawChapterStarsReward();
-//
-//            // <editor-fold defaultstate="collapsed" desc="    玩家挑战    ">
-//            case CmdCode::cmd_fight_GetChallengeAdversaryInfo:                  # 6803 获取挑战对手的信息
-//                return PVPProc::GetChallengeAdversaryInfo();
-//            case CmdCode::cmd_fight_LogChallengeResult:                         # 6804 记录挑战结果
-//                return PVPProc::LogChallengeInfo();
-//            case CmdCode::cmd_fight_GetChallengeLog:                            # 6805 拉取挑战记录
-//                return PVPProc::GetChagllengeLog();
-//
-//// </editor-fold>
-//            //  <editor-fold defaultstate="collapsed" desc="   PVP 模块 681x ">
-//            case CmdCode::cmd_fight_pvp_maininfo:                               # [6810] 竞技场 主界面拉取信息
-//                return PVPProc::pvpMainInfo();
-//            case CmdCode::cmd_fight_pvp_refresh:                                # [6811] 竞技场 刷新对手列表
-//                return PVPProc::pvp_Refresh();
-//            case CmdCode::cmd_fight_pvp_pk:                                     # [6812] 竞技场 挑战对手
-//                return PVPProc::pvp_PK();
-//            case CmdCode::cmd_fight_pvp_setTeam:                                # [6813] 竞技场 设定防守队伍
-//                return PVPProc::pvp_setTeam();
-//            case CmdCode::cmd_fight_pvp_buyTicket:                              # [6814] 竞技场 购买挑战票
-//                return PVPProc::pvp_buyticket();
-//            case CmdCode::cmd_fight_pvp_getrank:                                # [6815] 竞技场 查看排行榜
-//                return PVPProc::pvp_getRank();
-//            case CmdCode::cmd_fight_pvp_getLog:                                 # [6816] 竞技场 查看挑战记录
-//                return PVPProc::pvp_getFightLogs();
-//// </editor-fold>
-//            // <editor-fold defaultstate="collapsed" desc="   竞技商店 682x  ">
-//            case CmdCode::cmd_fight_pvpShop_getMainInfo:                        # [6820] 竞技场 竞技商店主界面
-//                return PVPProc::pvpShopMain();
-//            case CmdCode::cmd_fight_pvpShop_buy:                                # [6821] 竞技场 竞技商店购买道具
-//                return PVPProc::pvpShopBuy();
-//            case CmdCode::cmd_fight_pvpShop_refresh:                            # [6822] 竞技场 竞技商店刷新道具(扣钻)
-//                return PVPProc::pvpShopRefresh();
-//            // </editor-fold>
-//
-//            case CmdCode::fight_worldBoss_enter:                                # 6831 世界BOSS战 - 进入
-//                return self::WorldBossEnter();
-//            case CmdCode::fight_worldBoss_refresh_rank :                        # 6834 查询世界boss伤害输出榜
-//                return self::GetWorldBossRank();
-//// ---------- 无尽塔相关 -------------------------
-//            case CmdCode::fight_endlessTower_Get:                               # 6841 查询无尽塔的进度
-//                return self::EndlessTower_Get();
-//            case CmdCode::fight_endlessTower_Up:                                # 6842 无尽塔升级
-//                return self::EndlessTower_Up();
-//            case CmdCode::fight_endlessTower_drawreward:                        # 6843 无尽塔,领取特殊奖励
-//                return self::EndlessTower_Drawreward();
-//            case CmdCode::fight_fullBlood:                                      # 6844 满血复活
-//                return self::fullBlood();
-//            default:
-//                return Resp::err(ErrCode::cmd_err);
-//        }
-//    }
-//
-//    /**
-//     *
-//     * @return type
-//     */
-//    static function fullBlood() {
-//        if(ctx()->privateState->battleReviveNum < glc()->battleReviveNum){//免费复活次数
-//            ctx()->privateState->battleReviveNum += 1;
-//        } else {//消耗钻石复活
-//            my_Assert(ctx()->baseInfo->cash >= glc()->backFullBloodCost, ErrCode::notenough_cash_msg);
-//            ctx()->base(true)->Consume_Cash(glc()->backFullBloodCost);
-//        }
-//        ctx()->privateData(true)->bornPlace = 0;
-//
-//        UserProc::updateUserInfo();
-//
-//        return Resp::ok(array(
-//                    'cash' => ctx()->baseInfo->cash,
-//                    'battleReviveNum' => ctx()->privateState->battleReviveNum,
-//                    'ret'=>'true',
-//        ));
-//    }
-//
-////
-//// <editor-fold defaultstate="collapsed" desc="  世界boss  ">
-//
-//    static function WorldBossEnter() {
-//        list($bossid) = req()->paras;
-//        $gateId = 506000 + $bossid;
-//        TaskProc::OnPassWorldBoss($gateId);
-//        return Resp::ok();
-//    }
-//
-//    /**
-//     * [6834] 查询世界boss伤害输出榜
-//     */
-//    static function GetWorldBossRank() {
-//        $zoneid = req()->zoneid;
-//        list($bossId) = req()->paras;                                           # 提取参数bossid.
-//        $key = MemKey_GameRun::Game_WorldBoss_X_Rank($zoneid, $bossId);
-//        var_dump($key);
-//        var_dump($bossId);
-//        var_dump(req()->paras);
-//        $rank = gMem()->zrange($key, 0, 50, true);
-//        return Resp::ok(array('rank' => $rank));
-//    }
-//
-//    static function SettleWorldBoss($zoneId, $bossid) {
-//        $key = MemKey_GameRun::Game_WorldBoss_X_Rank($zoneId, $bossid);
-//        $range = gMem()->zrange($key, 0, -1);                                   # 全部取出(暂时这么写吧)
-//        $i = 1;
-//        foreach ($range as $uid_name) {
-//            $rwd = $bossid == 2 ? self::getWorldbossRankReward2($i) : self::getWorldbossRankReward($i);
-//            $uid = substr($uid_name, 0, strpos($uid_name, "__"));
-//            EmailProc::SendWorldBossReward($zoneId, $uid, $i++, $rwd->rankName, $rwd->reward);
-//        }
-//
-//        CLog::info("世界Boss($bossid)已结算,未更新结算标记(防止重复发放).");
-//    }
-//
-//    /**
-//     * 按排名查询上榜奖励配置对象
-//     * @param type $index
-//     * @return \sm_worldboss_rankreward
-//     */
-//    static function getWorldbossRankReward($index) {
-//        $arr = (array) GameConfig::worldboss_rankreward();
-//        foreach ($arr as $i => $v) {
-//            isEditor() and $v = new \sm_worldboss_rankreward();
-//            if ($index >= $v->minRank && $index <= $v->maxRank) {
-//                return $v;
-//            }
-//        }
-//        return $arr[max(array_keys($arr))];
-//    }
-//
-//    /**
-//     * 按排名查询上榜奖励配置对象
-//     * @param type $index
-//     * @return \sm_worldboss_rankreward2
-//     */
-//    static function getWorldbossRankReward2($index) {
-//        $arr = (array) GameConfig::worldboss_rankreward2();
-//        foreach ($arr as $i => $v) {
-//            isEditor() and $v = new \sm_worldboss_rankreward2();
-//            if ($index >= $v->minRank && $index <= $v->maxRank) {
-//                return $v;
-//            }
-//        }
-//        return $arr[max(array_keys($arr))];
-//    }
-//
-//// </editor-fold>
-////
-//// <editor-fold defaultstate="collapsed" desc=" 无尽塔 ">
-//
-//    /**
-//     * [6841] 查询无尽塔的进度
-//     */
-//    static function EndlessTower_Get() {
-//        return Resp::ok(array('index' => ctx()->privateData()->endlessTower));
-//    }
-//
-//    /**
-//     * [6842] 无尽塔升级
-//     */
-//    static function EndlessTower_Up() {
-//        $gateId = 600001;
-//        list($index) = req()->paras;
-//        my_Assert($index == ctx()->privateData()->endlessTower, ErrCode::Fight_endlessTower_index);
-//        ctx()->privateData()->endlessTower++;                                   # 指向下一关
-//        // 发放奖励
-//        $mo = GameConfig::endless_tower_getItem($index);                        # 取配置信息
-//        my_Assert(isset($mo), ErrCode::err_const_no);                           # 防御
-//        $rsArr = str_replace(',', ';', $mo->rewardList);                        # 修复下奖励格式, ,=>;
-//        $rewardStr = str_replace('_', ',', $rsArr);                             # _ => ,
-//        $err = StoreProc::AddMultiItemInStore($rewardStr);                      # 发放奖励
-//        my_Assert(ErrCode::ok == $err, $err);                                   # 防御代码
-//
-//        SystemProc::PassEndlessTower(req()->zoneid, ctx()->baseInfo->name, $index);
-//        UserProc::updateUserInfo();                                             # 更新
-//        TaskProc::OnPassEndlessCarboN($gateId, $index);
-//        //var_dump("无尽塔");
-//        return Resp::ok(array('index' => ctx()->privateData()->endlessTower,
-//                    'baseInfo' => ctx()->base(),
-//                    'store' => ctx()->store()
-//        ));
-//    }
-//
-//    static function EndlessTower_Drawreward() {
-//        list($index) = req()->paras;
-////        my_Assert($index % 5 == 0, ErrCode::paras_err);                         # 领取指定关卡的特殊奖励(逢5/0才有)
-//        my_Assert(ctx()->privateData()->endlessTower >= $index, "请先完成挑战再来领奖!"); # 防御未通关直接领奖(刷接口)
-//        my_Assert(!in_array($index, ctx()->privateData()->endlessTower_rewarded), "已经领取!"); # 防御已经领取
-//        $mo = GameConfig::endless_tower_getItem($index);
-//        my_Assert(isset($mo), ErrCode::err_const_no);
-//        my_Assert(strlen($mo->rewardOne) > 0, "该关卡无特殊奖励!");
-//        $rs = str_replace(',', ';', $mo->rewardOne);                            # 奖励串格式修复,
-//        $rewardStr = str_replace('_', ',', $rs);
-//        $err = StoreProc::AddMultiItemInStore($rewardStr);                      # 发放奖励
-//        my_Assert(ErrCode::ok == $err, $err);                                   # 防御
-//        ctx()->privateData()->endlessTower_rewarded[] = $index;                 # 更新记录
-//        UserProc::updateUserInfo();
-//        return Resp::ok(array(#                                                 # 返回
-//                    'baseInfo' => ctx()->base(),
-//                    'store' => ctx()->store()
-//        ));
-//    }
-//
-//// </editor-fold>
-////
-//
-//    /**
-//     * 清理每日字段
-//     */
-//    static function ClearByDay() {
-//        SweepGatesProc::ClearGateTimes();                                        # 清理每个难度副本的每日战斗次数
-//        $pvp = new Info_UserPVP(ctx()->pvp);
-//        $pvp->refreshDailyData();
-//        $pvp->sendRewardEmail(req()->zoneid, req()->uid, PVPProc::GetCurSeasonID());
-//        ctx()->pvp = $pvp;
-//        ctx()->privateState->materialDailyChallengeRecord = new \stdClass(); # 充值材料副本挑战记录
-//    }
-//
-//}

+ 0 - 661
Gameserver/App/process/FightProc/PVPProc.php

@@ -1,661 +0,0 @@
-<?php
-
-//
-//namespace loyalsoft;
-//
-///**
-// *  PVPProc 竞技场 战斗模块, 挑战玩家镜像
-// * @version
-// *          1.0.0 Created at 2017-6-26. by --gwang
-// * @author gwang (mail@wanggangzero.cn)
-// * @copyright ? 2017-6-26, SJZ LoyalSoft Corporation & gwang. All rights reserved.
-// */
-//class PVPProc {
-//    //
-//    // <editor-fold defaultstate="collapsed" desc="    常量    ">
-//
-//    /**
-//     * 挑战记录最大条数
-//     */
-//    const maxLogCount = 49;
-//
-//    /**
-//     * 查找对手数量
-//     */
-//    const matchCount = 5;
-//
-//    /**
-//     * 竞技场赛季起始时间戳
-//     */
-//    const pvpStartTs = 1588521600;                                              # 2020年5月4日 0时0分0秒
-//
-//    /**
-//     * 每个赛季持续时常
-//     */
-//    const pvpSeasonLengt = 86400 * 14;                                          # 2周
-//
-//    /**
-//     * 竞技场初始积分
-//     */
-//    const pvpBaseScore = 1000;
-//
-//    /**
-//     * 竞技场 最大上榜人数
-//     */
-//    const pvpMaxRank = 500;
-//
-//// </editor-fold>
-//
-//    /**
-//     * [6803] 挑战 - 查询对手信息 等级、头像、昵称、战队信息(言灵师,等级,星级,武器,技能,言灵)
-//     */
-//    public static function GetChallengeAdversaryInfo() {
-//        $targetUID = req()->paras[0];                                           # 参数: 对手的UID
-//        $game = UserProc::getUserGame(req()->zoneid, $targetUID);               # 读取玩家信息
-//        if (null == $game) {
-//            Err(ErrCode::user_no_err);
-//        }
-////        $game = UserProc::getUserGame(req()->zoneid, $targetUID);
-//        $team = JsonUtil::decode($game->heroTeamConfig);
-//
-//        $heros = new \stdClass();
-//        $curTeamId = $team->curUseTeamID;
-//        foreach ($team->teamDic->$curTeamId->heros as $i => $hid) {
-//            if ($hid > 0) {
-//                $n_hid = $hid - 10000;
-//                $heros->$n_hid = $game->heros->collectHeros->$hid;
-//            }
-//        }
-//
-//        $adversary = array(#                                                    # 拼装玩家信息
-//            'uid' => $targetUID,
-//            'name' => my_null_default($game->base()->name, ""),
-//            'level' => my_null_default($game->base()->level, 1),
-//            'headImg' => my_null_default($game->base()->headImg, ""),
-////            'skills' => null, #                                                  # skills暂时没有实例数据
-//            'equipment' => array("equipments" => my_null_default($game->store->equipment, new \stdClass())), # 武器
-//            'yanling' => array("items" => my_null_default($game->store->yanling, new \stdClass())), # 言灵
-//            'heros' => my_null_default($heros, new \stdClass()), #              # 英雄集合
-//        );
-//
-//        $result = array(#                                                       # 拼装返回值
-//            "adversaryInfo" => $adversary
-//        );
-//        return Resp::ok($result);
-//    }
-//
-//    /**
-//     * [6804] 挑战 - 记录挑战结果
-//     */
-//    static function LogChallengeInfo() {
-//        list($targetUID, $name, $headImg, $win, $msg) = req()->paras;     // 参数: 对手uid,对手昵称,对手头像, 对战结果, 胜利者的留言(失败时无法留言"")
-//        $key_mine = MemKey_User::OffensiveLog_zset(req()->zoneid, req()->uid);
-//        $key_target = MemKey_User::DefensiveLog_zset(req()->zoneid, $targetUID);
-//        $ts = now();                                                            # 记录时间戳
-//        gMem()->zadd($key_mine, array(#                                         # 组装被挑战对手信息
-//            JsonUtil::encode(array(
-//                'uid' => my_null_default($targetUID, "-"),
-//                'name' => my_null_default($name, ""),
-//                'headImg' => my_null_default($headImg, ""),
-//                'win' => my_null_default($win, false),
-//                'msg' => my_null_default($msg, ""),
-//                'ts' => $ts
-//            )) => $ts));
-//        gMem()->zremrangebyrank($key_mine, self::maxLogCount, -1);              # 保留50条数据
-//        gMem()->zadd($key_target, array(#                                       # 组装挑战者信息
-//            JsonUtil::encode(array(
-//                'uid' => req()->uid,
-//                'name' => ctx()->baseInfo->name,
-//                'headImg' => ctx()->baseInfo->headImg,
-//                'win' => !my_null_default($win, false),
-//                'msg' => my_null_default($msg, ""),
-//                'ts' => $ts
-//            )) => $ts));
-//        gMem()->zremrangebyrank($key_target, self::maxLogCount, -1);            # 保留50条数据
-//        // 暂无发放奖励流程
-//        TaskProc::OnRankChalenge();                                             // 更新每日任务
-//        UserProc::updateUserInfo();
-//        return Resp::ok();                                                      # 返回成功
-//    }
-//
-//    /**
-//     * [6805] 挑战 - 拉取挑战记录
-//     */
-//    static function GetChagllengeLog() {
-//        // 参数:无
-//        $key_off = MemKey_User::OffensiveLog_zset(req()->zoneid, req()->uid);
-//        $key_def = MemKey_User::DefensiveLog_zset(req()->zoneid, req()->uid);
-//        // 拉取自己的挑战记录
-//        $offLog = gMem()->zrange($key_off, 0, self::maxLogCount);
-//        $defLog = gMem()->zrange($key_def, 0, self::maxLogCount);
-//        // Ps. 挑战记录分为2个榜, 且按照时间戳记录,晚于指定时间戳的判定为未读消息,挑战记录最多记录50条
-////        if (!CommUtil::isPropertyExists($req->userInfo->game->privateState, "lastCheckDefLog")) {
-//        ctx()->privateState->lastCheckDefLog_ts = now();         # 记录时间戳
-////        }
-//        UserProc::updateUserInfo();                                             # 回写数据
-//        // 记录拉取时间戳(在主界面有个未读消息条数显示, 需要靠最后拉取时间戳对比, 时间戳之后的消息是未读消息)
-//        // 回传数据记录
-//        array_walk($offLog, function (&$i) {                                    # 解码一下
-//            $i = JsonUtil::decode($i);
-//        });
-//        array_walk($defLog, function (&$i) {                                    # 解码一下
-//            $i = JsonUtil::decode($i);
-//        });
-//        return Resp::ok(array(
-//                    'offLog' => $offLog,
-//                    'defLog' => $defLog
-//        ));
-//    }
-//
-//    // <editor-fold defaultstate="collapsed" desc="   竞技商店  ">
-//    /**
-//     * 王刚 16:23:39 (2020.5.9)
-//      商店现在的模式定位:
-//      商店显示所有物品, 刷新时是重置购买/售罄记录
-//      刘海 16:24:23 (2020.5.9)
-//      没错
-//     */
-//
-//    /**
-//     * [6820] 竞技商店 主界面
-//     */
-//    public static function pvpShopMain() {
-//        $pvp = new Info_UserPVP(ctx()->pvp);                     # PVP信息
-//        if ($pvp->shopRefreshTs < now()) {                                      # 检查刷新时间<now => 刷新商品列表
-//            $pvp->shopRefreshTs = now() + glc()->PVP_shop_refresh_interval;     # 更新刷新时间
-//            $pvp->curShopItems = GameConfig::pvp_shop();                        # 重刷道具
-//            ctx()->pvp = $pvp;                                   # 回写
-//            UserProc::updateUserInfo();
-//        }
-//        return Resp::ok($pvp);                                                  // 返回
-//    }
-//
-//    /**
-//     * [6821] 竞技 商店 购买道具
-//     */
-//    public static function pvpShopBuy() {
-//        $index = req()->paras[0];                                                # 参数:道具索引(typeId)
-//        $pvp = new Info_UserPVP(ctx()->pvp);                     # PVP 数据
-//        my_Assert(CommUtil::isPropertyExists($pvp->curShopItems, $index), ErrCode::err_innerfault); # 没有找到改商品
-////        isEditor() && $citem = new \sm_pvp_shop();
-//        $citem = $pvp->curShopItems->$index;                                    # 查询物品数据
-//        my_Assert($citem->sold == 0, ErrCode::pvp_item_soldout);                # 防御道具已售罄
-////        var_dump($citem);
-//        my_Assert($citem->priceType == 5, ErrCode::pay_price_err);              # 防御定价异常
-//        my_Assert($pvp->pvpCoins > $citem->price, ErrCode::pvp_coinnotenough);  # pvp币不足
-//        $citem->sold += 1;                                                      # 设置已售罄/已购买标志
-//        $pvp->pvpCoins -= $citem->price;                                        # 扣除竞技币
-//        StoreProc::AddMultiItemInStore($citem->goods);                          # 发放道具
-//        ctx()->pvp = $pvp;                                       // 回写数据
-//        UserProc::updateUserInfo();
-//        return Resp::ok(array('pvp' => $pvp, 'store' => ctx()->store)); # 返回
-//    }
-//
-//    /**
-//     * [6822] 竞技 商店 刷新道具
-//     */
-//    public static function pvpShopRefresh() {
-//        // 扣除刷新消耗
-//        $pvp = ctx()->pvp();
-//        $costCash = glc()->PVP_shop_refresh_cash;
-//        my_Assert(ctx()->base()->Consume_Cash($costCash), ErrCode::notenough_cash_msg);
-////        $pvp->shopRefreshTs = now() + glc()->PVP_shop_refresh_interval;         # 更新刷新时间
-//        $pvp->curShopItems = GameConfig::pvp_shop();                            # 重刷道具
-////        ctx()->pvp = $pvp;                                       # 回写
-//        UserProc::updateUserInfo();                                             # 回写玩家数据
-//        return Resp::ok($pvp);                                                  # 返回
-//    }
-//
-//// // </editor-fold>
-//    //
-//    // <editor-fold defaultstate="collapsed" desc="   竞技场   681x">
-//    //
-//
-//    /**
-//     * 辅助方法:取当前赛季的编号(从赛季起始开始算起)
-//     * @return int
-//     */
-//    public static function GetCurSeasonID() {
-//        $n = ceil((now() - self::pvpStartTs ) / self::pvpSeasonLengt);          # 进一取整
-//        return $n;
-//    }
-//
-//    /**
-//     * 辅助方法:取指定赛季的结束时间戳
-//     * @param int $seasonID
-//     * @return int
-//     */
-//    public static function GetSeasonEndTs($seasonID) {
-//        $ts = self::pvpStartTs + $seasonID * self::pvpSeasonLengt;              # 从起始点开始 + n个赛季时常
-//        return $ts;
-//    }
-//
-//    /**
-//     * [6810] 竞技场 拉取主界面信息
-//     */
-//    static function pvpMainInfo() {
-//        $uid = req()->uid;                                                       # 快速访问UID
-//        $zoneid = req()->zoneid;                                                 # 快速访问zoneid
-//        $pvp = new Info_UserPVP(ctx()->pvp);                     # 设计玩家pvp数据结构
-//        $pvp->refreshDailyData();                                               # 刷新免费挑战次数
-//        $seasonId = self::GetCurSeasonID();                                     # 当前赛季ID
-//        $key = MemKey_GameRun::Game_PVPScoreByZoneSeason_zset($zoneid, $seasonId); # 积分总榜
-//
-//        $score = self::_getScore_by_uid($uid, $key);                            # 玩家积分
-//        $rank = self::_getRank_by_uid($uid, $key);                              # 玩家排名
-//        $fPower = HeroProc::CalcUserFightPower($zoneid, $uid, ctx()); # 玩家总战力?还是当前防守队伍的战斗力?
-//        $numNewLog = 0; // todo: 真正查询是否有新战报
-//        $matches = self::getNewMatches($pvp, $uid, $zoneid);                    # 获得新的匹配对手
-//        $pvp->sendRewardEmail($zoneid, $uid, $seasonId);                        # 发奖励邮件
-//        ctx()->pvp = $pvp;
-//        UserProc::updateUserInfo();
-//        $ret = array(#                                                          # 组装 返回值结构
-//            'score' => $score, #                                                # 自己的积分
-//            'rank' => $rank, #                                                  # 自己的排名
-//            'pvpCoins' => $pvp->pvpCoins, #                                     # 自己的竞技币
-//            'fPower' => $fPower, #                                              # 自己的总战力
-//            'fightTicket' => $pvp->fightTicket, #                               # 自己的挑战票
-//            'defTeam' => $pvp->defTeam, #                                       # 自己的防守队伍
-//            'bHasNewFightLog' => $numNewLog, #                                  # 是否有战报刷新
-//            'matches' => my_null_default($matches, array()), #                  # 对手列表
-//        );
-//        return Resp::ok($ret);                                                  # 返回
-//    }
-//
-//    /**
-//     * [6811] 竞技场 刷新对手
-//     */
-//    static function pvp_Refresh() {
-//        // 刷新无花费, 间隔时间3秒(客户端控制得了)
-//        $pvp = new Info_UserPVP(ctx()->pvp);
-//        $ts = now();
-//        my_Assert($pvp->nextRefreshTs < $ts, ErrCode::pvp_refresh_time);        # 验证时间间隔
-//        $pvp->curMatches = self::getNewMatches($pvp, req()->uid, req()->zoneid);
-//        $pvp->nextRefreshTs = now(3);
-//        ctx()->pvp = $pvp;
-//        UserProc::updateUserInfo();                                             # 回写数据
-//        $ret = array(
-//            'curMatches' => my_null_default($pvp->curMatches, array()), #       # 当前对手清单
-//        );
-//        return Resp::ok($ret);
-//    }
-//
-//    /**
-//     * [6812] 竞技场 挑战对手xx
-//     */
-//    static function pvp_PK() {
-//        $uid = req()->uid;
-//        $zoneid = req()->zoneid;
-//        $baseInfo = ctx()->baseInfo;
-//        list($target_uid, $result, $target_name, $target_HeadImg) = req()->paras; # 对手id,胜负结果 0负,1胜
-//
-//        $pvp = ctx()->pvp;
-//
-//        if ($pvp->freeFightTickets > 0) {                                       # 有免费挑战票,先扣除免费的
-//            $pvp->freeFightTickets -= 1;
-//        } else {
-//            my_Assert($pvp->fightTicket > 0, ErrCode::pvp_no_tickets);          # 防御: 挑战票不足
-//            $pvp->fightTicket -= 1;                                             # 扣除挑战票
-//        }
-//
-//        $season = self::GetCurSeasonID();                                       # 当前赛季
-//        $key = MemKey_GameRun::Game_PVPScoreByZoneSeason_zset($zoneid, $season); # redis key
-//        $RA = self::_getScore_by_uid($uid, $key);                               # A的积分
-//        $RB = self::_getScore_by_uid($target_uid, $key);                        # B的积分
-//        $EA = 1 / (1 + pow(10, ($RA - $RB) / 400));                             # A的胜率期望值
-//        $EB = 1 / (1 + pow(10, ($RB - $RA) / 400));                             # B的胜率期望值
-//        $K = 32;                                                                # 浮动系数, 暂定为32
-//        $SA = $result ? 1 : 0;                                                  # 我的胜负结果
-//        $SB = $result ? 0 : 1;                                                  # 对手的胜负结果
-//        $R_A = intval($RA + $K * ($SA - $EA ));                                 # 我的最终积分
-//        $R_B = intval($RB + $K * ($SB - $EB));                                  # 对手的最终积分
-//        #
-//        $myOldRank = self::_getRank_by_uid($uid, $key);                         # 记录下战前排名
-//        self::_addScore_by_uid($zoneid, $uid, $R_A - $RA);                      # 更新A的积分
-//        $B_Change = $result ? $R_B - $RB : 0;                                   # 计算对方的积分变化:对方输了的情况下扣分,我输了的情况下,不加分
-//        if ($B_Change != 0) {                                                          #
-//            self::_addScore_by_uid($zoneid, $target_uid, $B_Change);            # 更新B的积分
-//        }
-//        $myNewRank = self::_getRank_by_uid($uid, $key);                         # 查询战后排名
-//        if ($result) {
-//            $pvp->totalWin += 1;
-//            TaskProc::OnPvPWinN($pvp->totalWin);
-//            TaskProc::OnPvPScoreN($R_A);
-//        }
-//        ctx()->pvp = $pvp;
-//        TaskProc::OnPvp();                                                      # 每日PVP挑战即可
-//        UserProc::updateUserInfo();                                             # 回写数据
-//        // 写挑战记录
-//        $key_mine = MemKey_User::PVP_OffensiveLog_zset($zoneid, $uid);          # 我的主动挑战记录
-//        self::_Log_PVP_PK_Info($key_mine, $target_uid, $target_name, $target_HeadImg, $result, $R_A - $RA); # 自己的挑战记录
-//        $key_target = MemKey_User::PVP_DefensiveLog_zset($zoneid, $target_uid); # 对手的被挑战记录
-//        self::_Log_PVP_PK_Info($key_target, $uid, $baseInfo->name, $baseInfo->headImg, !$result, $B_Change); # 对手的被挑战记录
-//
-//        $ret = array(#                                                          # 组装返回值
-//            'freeFightTickets' => $pvp->freeFightTickets, #                     # 自己剩余免费票
-//            'fightTicket' => $pvp->fightTicket, #                               # 自己剩余挑战票
-//            'RA' => $RA, #                                                      # 自己挑战之前积分
-//            'RB' => $RB, #                                                      # 对手挑战之前积分
-//            'R_A' => $R_A, #                                                    # 自己最新积分
-//            'R_B' => $R_B, #                                                    # 对手最新积分
-//            'rank_diff' => $myNewRank - $myOldRank, #                           # 自己的排名变化
-//            'rank_new' => $myNewRank, #                                         # 最新排名
-//        );
-//        return Resp::ok($ret);                                                  # 返回
-//    }
-//
-//    /**
-//     * [6813] 竞技场 设置防守队伍
-//     */
-//    public static function pvp_setTeam() {
-//        $heros = req()->paras[0];                                                # para: 新阵容
-//        $pvp = new Info_UserPVP(ctx()->pvp);
-//        my_Assert(is_array($heros), ErrCode::paras_err);                        # 参数检查
-//        $pvp->defTeam = $heros;                                                 # 更新阵容
-//        ctx()->pvp = $pvp;
-//        UserProc::updateUserInfo();                                             # 回存数据
-//        return Resp::ok($pvp);                                                  # 返回
-//    }
-//
-//    /**
-//     * [6814] 购买挑战票
-//     * @return Resp
-//     */
-//    static function pvp_buyticket() {
-//        $amt = req()->paras[0];                                                 # 购买数量
-//        my_Assert($amt > 0, ErrCode::paras_err);                                # 数量>0
-//        $pvp = ctx()->pvp();
-//        $g = glc();
-//        $costCash = $g->PVP_pk_ticket_price * $amt;                             # 计算消耗钻石
-//        my_Assert($costCash > 0, ErrCode::pvp_ticket_cost_ilegal);              # 定价数据异常
-//        my_Assert(ctx()->base()->Consume_Cash($costCash), ErrCode::notenough_cash_msg);    # 扣除钻石失败
-//
-//        $pvp->fightTicket += $amt;                                              # 发放挑战票
-////        ctx()->pvp = $pvp;
-//        UserProc::updateUserInfo();                                             # 回写玩家数据
-//        $ret = array(
-//            'fightTicket' => $pvp->fightTicket,
-//            'costCash' => $costCash,
-//            'userCash' => ctx()->baseInfo->cash
-//        );
-//        return Resp::ok($ret);                                                  # 返回
-//    }
-//
-//    /**
-//     * [6815] 竞技场 拉取榜单数据
-//     */
-//    static function pvp_getRank() {
-//        $maxAmt = 10;                                                           # 一次最多取10个玩家信息
-//        $zoneid = req()->zoneid;
-//        list($index, $n) = req()->paras;                                        # 起始(0), 数量(n<=max)
-//        if ($n < 1 || $n > $maxAmt) {                                           # 防御非法情况
-//            $n = $maxAmt;
-//        }
-//        $arr = self::getRankPlayers($zoneid, $index - 1, ($index + $n) - 1);    // 上榜玩家
-//        $rankId = $index;
-//        $result = ObjectInit();
-//        if (count($arr)) {
-//            foreach ($arr as $key => $value) {                                  //  $value 的数据类型是array
-//                $value["uid"] = $key;
-//                $result->$rankId = $value;
-//                $rankId += 1;
-//            }
-//        }
-//        $key_rank = MemKey_GameRun::Game_PVPScoreByZoneSeason_zset($zoneid, self::GetCurSeasonID());
-//        $myRank = self::_getRank_by_uid(req()->uid, $key_rank);
-//        $myScore = self::_getScore_by_uid(req()->uid, $key_rank);
-//        $ret = array(
-//            'dic' => $result,
-//            'myRank' => $myRank,
-//            'myScore' => $myScore
-//        );
-//        return Resp::ok($ret);
-//    }
-//
-//    /**
-//     * [6816] 竞技场 查看战报
-//     */
-//    static function pvp_getFightLogs() {
-//        // 提取主动挑战+被挑战记录
-//        // 更新下刷新时间
-//        // 返回
-//        // 参数:无
-//        $key_off = MemKey_User::PVP_OffensiveLog_zset(req()->zoneid, req()->uid);
-//        $key_def = MemKey_User::PVP_DefensiveLog_zset(req()->zoneid, req()->uid);
-//        // 拉取自己的挑战记录
-//        $offLog = gMem()->zrange($key_off, 0, self::maxLogCount);               # 主动挑战数据
-//        $defLog = gMem()->zrange($key_def, 0, self::maxLogCount);               # 防守数据
-//        // Ps. 挑战记录分为2个榜, 且按照时间戳记录,晚于指定时间戳的判定为未读消息,挑战记录最多记录50条
-//        $pvp = new Info_UserPVP(ctx()->pvp);                    # 玩家竞技场数据
-//        $pvp->lastCheckDefLog_ts = now();                                       # 记录时间戳
-//        UserProc::updateUserInfo();                                             # 回写数据
-//        array_walk($offLog, function (&$i) {                                    # 解码一下
-//            $i = JsonUtil::decode($i);
-//        });
-//        array_walk($defLog, function (&$i) {                                    # 解码一下
-//            $i = JsonUtil::decode($i);
-//        });
-//        return Resp::ok(array(
-//                    'offLog' => $offLog,
-//                    'defLog' => $defLog
-//        ));
-//    }
-//
-//// ---------------- 辅助函数 -----------------------
-//// <editor-fold defaultstate="collapsed" desc="    辅助 函数   ">
-//
-//    /**
-//     * 竞技场 - 记录挑战结果
-//     */
-//    private static function _Log_PVP_PK_Info($key, $oppUID, $name, $headImg, $win, $score) {
-//        $ts = now();                                                            # 记录时间戳
-//        gMem()->zadd($key, array(#                                              # 组装被挑战对手信息
-//            JsonUtil::encode(array(
-//                'uid' => my_null_default($oppUID, "-"), #                       # 对手uid
-//                'name' => my_null_default($name, ""), #                         # 对手昵称
-//                'headImg' => my_null_default($headImg, ""), #                   # 对手头像
-//                'win' => my_null_default($win, false), #                        # 胜负结果
-//                'msg' => "竞技场中没有留言羞辱对手的设定.", #                     # 胜利者留言
-//                'scoreInfo' => my_null_default($score, 0), #                    # 积分变动
-//                'ts' => $ts, #                                                  # 时间戳
-//            )) => $ts));
-//        gMem()->zremrangebyrank($key, self::maxLogCount, -1);                   # 保留50条数据
-//    }
-//
-//    /**
-//     * 修改积分
-//     * @param int $zoneid
-//     * @param string $uid
-//     * @param int $addValue 可以是负值
-//     */
-//    private static function _addScore_by_uid($zoneid, $uid, $addValue) {
-//        $mem = gMem();
-//        $seasonId = self::GetCurSeasonID();
-//        $key = MemKey_GameRun::Game_PVPScoreByZoneSeason_zset($zoneid, $seasonId); # 积分榜
-//        $score = $mem->zscore($key, $uid);
-//        if (is_null($score) || $score <= 0) {                                   # 分数异常, 理论上不会出现负分
-//            $score = self::pvpBaseScore;                                        # 新手基础分
-//            $mem->zadd($key, array($uid => $score));                            # 重置玩家积分
-//        }
-//        $newscore = $mem->zincrby($key, $uid, $addValue);                       # 返回最新值
-////        var_dump($newscore);
-//        return $newscore;
-//    }
-//
-//    /**
-//     * 竞技场 查询玩家的积分
-//     * @param type $uid
-//     * @return int
-//     */
-//    static function _getScore_by_uid($uid, $key) {
-//        if ("" == $uid) {
-//            CLog::err('"uid" is Null!');
-//            return 10;                                                          # 记录错误并返回一个极低分
-//        }
-//        $mem = gMem();
-////        var_dump($key);
-//        $score = $mem->zscore($key, $uid);
-//        if (is_null($score) || $score <= 0) {                                   # 分数异常
-//            $score = self::pvpBaseScore;                                        # 新手基础分
-//            $mem->zadd($key, array($uid => $score));                            # 更新玩家积分
-//        }
-//        return $score;
-//    }
-//
-//    /**
-//     * 竞技场 查询玩家的排名
-//     * @param string $uid
-//     * @param string $key
-//     * @return int
-//     */
-//    static function _getRank_by_uid($uid, $key) {
-//        $rank = self::pvpMaxRank + 1;                                           # 未上榜
-//        if ("" == $uid) {
-//            CLog::err('"uid" is Null!');
-//            return $rank;                                                       # 记录错误并返回未上榜
-//        }
-//        $mem = gMem();
-//
-//        $r = $mem->zrevrank($key, $uid);
-//        if (!is_null($r)) {
-//            $rank = $r + 1;                                                     # 有名次,更新(zset从0开始排序)
-//        }
-//        return $rank;                                                           # 返回
-//    }
-//
-//    /**
-//     * 获取对手匹配结果
-//     * @param Info_UserPVP $pvp
-//     * @param CRedisutil $mem
-//     * @param type $uid
-//     * @param type $zoneid
-//     */
-//    private static function getNewMatches($pvp, $uid, $zoneid) {
-//        $seasonID = self::GetCurSeasonID();
-//        $key = MemKey_GameRun::Game_PVPScoreByZoneSeason_zset($zoneid, $seasonID); # redis key
-//        $arr = self::findmatcher($key, $uid);                                   # 积分榜查找
-//        if (count($arr) < self::matchCount) {                                   # 再不行, 准备机器人吧
-//            CLog::err('PVP刷对手数量不足, 赶快考虑加入机器人.', 'PVP');           // todo: 这里引入gm对手数据,
-//        }
-//        $ret = self::GetPlayerInfosForPVP($zoneid, $arr);
-//        return $ret;
-//    }
-//
-//    /**
-//     * 查找匹配的对手
-//     * @param type $key
-//     * @param type $uid
-//     */
-//    private static function findmatcher($key, $uid) {
-//        // 根据匹配规格获得5个对手即可(1. 排除自己, 2. 最好不要出现已经刷到过的对手)
-//        // 低于玩家当前积分 -- 1个 -5%~-20%之间
-//        // 与玩家当前积分基本持平 2个, ±5%之间
-//        // 高于玩家当前积分 -- 1个 +5%~+40%之间
-//        $score = self::_getScore_by_uid($uid, $key);                            # 查积分
-//        // 计算 比自己弱的 上线下线
-//        $bH = ceil($score * (1 - 0.05));                                        # 低于当前玩家积分5%
-//        $bL = ceil($score * (1 - 0.2));                                         # 低于当前玩家积分20%
-//        $aL = ceil($score * (1 + 0.05));                                        # 高于当前玩家积分5%
-//        $aH = ceil($score * (1 + 0.2));                                         # 高于当前玩家积分20%
-//        $bPlayerUIDs = gMem()->zrevrangebyscore($key, $bH, $bL, true, true, 0, 10); # 取低于玩家积分的uids1个
-//        $mPlayerUIDs = gMem()->zrevrangebyscore($key, $aL, $bH, true, true, 0, 13); # 取玩家相当的uid2个(以防包含玩家自己)
-//        $aPlayerUIDs = gMem()->zrevrangebyscore($key, $aH, $aL, true, true, 0, 10); # 取高于玩家的uids1个
-//        if (array_key_exists($uid, $mPlayerUIDs)) {                             # 如果积分相近的那一组包含自己
-//            unset($mPlayerUIDs[$uid]);                                          # 剔除掉
-//        } else {                                                                # 或者不包含自己
-//            array_pop($mPlayerUIDs);                                            # 那多一个人,踢掉一个
-//        }
-//
-//        $bPlayerUIDs = self::array_random_assoc($bPlayerUIDs, 1);
-//        $mPlayerUIDs = self::array_random_assoc($mPlayerUIDs, 2);
-//        $aPlayerUIDs = self::array_random_assoc($aPlayerUIDs, 1);
-//
-//        $uidWithScore = array_merge($bPlayerUIDs, $mPlayerUIDs, $aPlayerUIDs);    # 合并为玩家列表
-//
-//        return $uidWithScore;                                                   # 返回uid集合
-//    }
-//
-//    /**
-//     * 随机关联数组
-//     * @param type $arr
-//     * @param type $num
-//     * @return type
-//     */
-//    private static function array_random_assoc($arr, $num = 1) {
-//        $keys = array_keys($arr);
-//        shuffle($keys);
-//
-//        if ($num > count($arr)) {
-//            $num = count($keys);
-//        }
-//
-//        $r = array();
-//        for ($i = 0; $i < $num; $i++) {
-//            $r[$keys[$i]] = $arr[$keys[$i]];
-//        }
-//        return $r;
-//    }
-//
-//    /**
-//     * 获取榜单玩家
-//     * @param Credisutil $mem
-//     * @param int $zoneid
-//     * @param int $start
-//     * @param int $stop
-//     * @return type
-//     */
-//    private static function getRankPlayers($zoneid, $start, $stop) {
-//        $key = MemKey_GameRun::Game_PVPScoreByZoneSeason_zset($zoneid, self::GetCurSeasonID());
-//        $retUidsWithScore = gMem()->zrevrange($key, $start, $stop, true);
-//        return self::GetPlayerInfosForPVP($zoneid, $retUidsWithScore);
-//    }
-//
-////    private  static function get
-//
-//    /**
-//     * 拉取玩家信息-pvp模块专用信息
-//     * @param CredisUtil $mem
-//     * @param type $zoneid
-//     * @param type $retUidsWithScore
-//     * @return type
-//     */
-//    private static function GetPlayerInfosForPVP($zoneid, $retUidsWithScore) {
-//        $arr = ArrayInit();
-//        foreach ($retUidsWithScore as $uid => $score) {
-//            $game = UserProc::getUserGame($zoneid, $uid);                       # 玩家数据
-//            $teamConfig = $game->pvp->defTeam;                                  # 防守阵容
-//            $heros = new \stdClass();                                           # 英雄集合
-//            foreach ($teamConfig as $hid) {
-//                if ($hid > 0) {
-//                    $n_hid = $hid - 10000;
-//                    $heros->$n_hid = $game->heros->collectHeros->$hid;
-//                }
-//            }
-//            $fpower = HeroProc::CalcUserFightPower($zoneid, $uid, $game);       # 计算总战力
-//            $adversary = array(#                                                # 拼装玩家信息
-//                'uid' => $uid,
-//                'name' => my_null_default($game->baseInfo->name, ""),
-//                'level' => my_null_default($game->baseInfo->level, 1),
-//                'headImg' => my_null_default($game->baseInfo->headImg, ""),
-////            'skills' => null, #                                                 # skills暂时没有实例数据
-//                'equipment' => array("equipments" => my_null_default($game->store->equipment, new \stdClass())), # 武器
-//                'yanling' => array("items" => my_null_default($game->store->yanling, new \stdClass())), # 言灵
-//                'heros' => my_null_default($heros, new \stdClass()), #          # 英雄集合
-//                'score' => $score, #                                            # 积分
-//                'fpower' => $fpower, #                                          # 总战力
-//            );
-////            $arr[$uid] = $adversary;
-//            $arr[] = $adversary;
-//        }
-//
-//        if (count($arr) <= 0) {
-//            $arr = null;
-//        }
-//        return $arr;
-//    }
-//
-//// </editor-fold>
-////
-//// </editor-fold>
-////
-//}

+ 0 - 1071
Gameserver/App/process/FightProc/SweepGatesProc.php

@@ -1,1071 +0,0 @@
-<?php
-
-//
-//namespace loyalsoft;
-//
-///**
-// * 战斗 -  关卡
-// * @author gwang
-// */
-//class SweepGatesProc {
-//
-//    /**
-//     * 提取某个对象的某个字段(利用后面2个参数组合为字段名)
-//     * @param type $obj
-//     * @param type $name
-//     * @param type $index
-//     * @return type
-//     */
-//    private static function getProperty_n($obj, $name, $index) {
-//        if (is_object($obj)) {
-//            $ke = "$name$index";
-//            if (property_exists($obj, $ke)) {
-//                return $obj->$ke;
-//            }
-//        }
-//        return null;
-//    }
-//
-//    /**
-//     * [6800] 关卡战斗 - 预计算掉落
-//     */
-//    public static function Arenas_preFight() {
-//        Err(ErrCode::err_method_obsoleted, "reward字段已于2022.1.11被删除,代码需维护!");
-//        list($gateId, $difficulty) = req()->paras;                               # 提取参数
-//        my_Assert($gateId > 0, "关卡id非法");
-//        $isFirst = self::isFirstChallenge($gateId, $difficulty);                # 是否首次通关
-//        $smGate = GameConfig::gate_getItem($gateId);                            # 关卡配置数据
-//        $i = $difficulty + 1;                                                   # 按三个难度取不同的值.
-////        $tili = self::getProperty_n($smGate, "tili", $i);                     # 体力暂时未用上
-//        $rwdstr = self::getProperty_n($smGate, "reward", $i);
-//        $firstPassRewardStr = self::getProperty_n($smGate, 'first_reward', $i);
-//        if ($isFirst) {                                                         # 是否首次通关切换奖励内容
-//            $rwdstr = $firstPassRewardStr;
-//        }
-//        $rsarr = explode(';', $rwdstr);
-//        my_Assert(count($rsarr) > 0, "关卡奖励数据异常");
-//        $dic = array();
-//        foreach ($rsarr as $rs) {
-//            $rarr = explode(',', $rs);
-//            $id = intval($rarr[0]);
-//            $num = intval($rarr[1]);
-//            $percent = intval(rtrim($rarr[2], '%'));
-//            if (CommUtil::randomPercent($percent)) {                            # 投骰子 决定是否本次掉落
-//                $dic[] = array($id => $num);                                    # 掉落
-//            }
-//        }
-//        $arr = array();                                                         # 拼接返回字符串
-//        foreach ($dic as $item) {
-//            foreach ($item as $k => $v) {
-//                $arr[] = sprintf("%s,%s", $k, $v);
-//            }
-//        }
-//        $_rewards = implode(";", $arr);                                         # 最终奖励字符串
-//        $redis_key = MemKey_User::temp_arenas_pre_reward_md5_str(req()->zoneid, req()->uid);
-//        $md5 = md5($gateId . $difficulty . $_rewards);
-//        gMem()->set($redis_key, $md5, 86400);                                   # 有效期一天,有新的就覆盖
-//        return Resp::ok(array("r" => $_rewards));                               # 返回奖励字符串
-//// 生成奖励串, 写入redis一个md5(过期时间1day)
-//// 奖励串返回客户端
-//// 客户端根据奖励串展示奖励
-//// 最后再将奖励串通过挑战接口返回给服务端,
-//// 服务端计算奖励传的md5并与redis中的md5做对比.(这里最好采用字段排序后的字符串或者啥的,避免中间因json序列化/反序列化时改变字符串)
-//    }
-//
-//    /**
-//     * [6806] 领取章节星数奖励
-//     */
-//    public static function DrawChapterStarsReward() {
-//        list($chapterId, $hard, $stars) = req()->paras;                         # 参数: 章节id, 难度, 分数
-//        $hard = $hard + 1;
-//        $userGates = ctx()->gates();
-//        if (!property_exists($userGates->chapterStarsRwd, $chapterId)) {        # 防御第一次读取本章节数据
-//            $userGates->chapterStarsRwd->$chapterId = ObjectInit();
-//        }
-//        $chapterInfo = $userGates->chapterStarsRwd->$chapterId;                 # 本章节数据
-//        if (!property_exists($chapterInfo, $hard)) {                            # 防御当前难度数据未创建
-//            $chapterInfo->$hard = array();
-//        }
-//        $starsArr = $chapterInfo->$hard;                                        # 当前章节,当前难度的领取记录
-//        my_Assert(!in_array($stars, $starsArr), ErrCode::err_arenas_hasgetstarreward); # 奖励已领取
-//        $rwdCfgArr = GameConfig::gate_starreward_getItem($chapterId, $hard);    # 奖励配置数组
-//        $starCfg = StlUtil::arrayFind($rwdCfgArr, function ($v, $k)use ($stars) { # 在数组中查找到对应星数的奖励
-//                    return ($v->star == $stars);
-//                });
-//        my_Assert(null != $starCfg, ErrCode::err_arenas_starreward_const_no);   # 找不到指定星数的配置数据
-//        $sumOfStars = 0;
-//        $userGateL = null;
-//        switch ($hard) {                                                        # 取不同难度数据记录
-//            case 1:
-//                $userGateL = new Ins_UserGatesModel($userGates->normal);
-//                break;
-//            case 2:
-//                $userGateL = new Ins_UserGatesModel($userGates->hard);
-//                break;
-//            case 3:
-//                $userGateL = new Ins_UserGatesModel($userGates->elite);
-//                break;
-//            default:
-//                break;
-//        }
-//        my_Assert(null != $userGateL, ErrCode::err_innerfault);                 # 玩家数据有问题
-//        array_walk($userGateL->gates, function ($v, $k)use (&$sumOfStars) {     # 累加星数
-//            $sinfo = new GateStar($v->star);
-//            $sumOfStars += $sinfo->Stars();
-//        });
-//        my_Assert($stars <= $sumOfStars, ErrCode::err_arenas_starreward_starNotEnough); # 星数未达标
-//        StoreProc::AddMultiItemInStore($starCfg->reward);                       # 发放奖励
-//        $starsArr[] = $stars;                                                   # 领奖记录
-//        $userGates->chapterStarsRwd->$chapterId->$hard = $starsArr;             # 回写数据
-//
-//        UserProc::updateUserInfo();
-//        return Resp::ok(array("store" => ctx()->store(),
-//                    'gold' => ctx()->base()->gold,
-//                    'cash' => ctx()->base()->cash
-//        ));         # 返回值
-//    }
-//
-//    /**
-//     * [6801] 关卡挑战1次
-//     */
-//    public static function Arenas_Fight() {
-//        $gateId = req()->paras[0];
-//        list($gateId, $difficulty, $star, $TeamObj) = req()->paras;             # 提取参数: 挑战的关卡Id, 关卡难度(0,1,2), 几星, 队伍, 奖励字符串
-//        my_Assert($gateId > 0, ErrCode::err_arenasgate_indexillegal);           # 关卡id非法
-////        $md5 = gMem()->get(MemKey_User::temp_arenas_pre_reward_md5_str($req->zoneid, $req->uid));
-////        $_md5 = md5($gateId . $difficulty . $rewardStr);
-////        my_Assert($md5 == $_md5, ErrCode::err_arenas_rewardIllegal);            # 奖励不匹配
-//
-//        $smGate = GameConfig::gate_getItem($gateId);                            # 关卡配置数据
-//        switch ($smGate->battleType) {   #(0普通 怪物全部创建 1Boss站 2引导剧情 3竞技场 4非战斗场景)
-//            case 0:                                                             # 普通关卡
-//            case 1:                                                             # 含有boss的关卡(结算时按击杀boss)
-//                return self::_NormalGate();
-//            case 2:                                                             # 剧情引导类关卡
-//                break;
-//            case 3:                                                             # pvp
-//                break;
-//            case 4:                                                             # 大厅/主城/召唤之类的
-//                break;
-//            case 5:                                                             # 材料副本
-//                //副本战斗成功扣体力否则不扣除体力 -2022-11-14
-//                ActiveProc::ChangeTili(-$smGate->tili1);
-//                TaskProc::OnPassGateN($gateId, $difficulty + 1);
-//                $level = substr($gateId, strlen($gateId) - 2);
-//                TaskProc::OnPassMaterialCarbonN($gateId, $level);               # 材料副本
-//                self::_LogMaterialChallenge($gateId);                           # 增加记录逻辑
-//                return self::PassGateSettlement();
-//            case 6:                                                             # 无尽塔
-//                TaskProc::OnPassGateN($gateId, $difficulty + 1);
-//                break;
-//            case 7:                                                             # 世界boss
-//                TaskProc::OnPassWorldBoss($gateId);
-//                break;
-//            case 8:                                                             # 守护战
-//                TaskProc::OnPassGateN($gateId, $difficulty + 1);
-//                return self::PassGateSettlement();
-//            default:
-//                break;
-//        }
-//
-////        $map = new Info_Map();
-////        $map->addBattleRecord($gateId);
-//        //$map->addBattleNumRecord($gateId, $ret);
-//        $user = ctx();
-//        $result = array(
-//            'store' => $user->store,
-//            'heros' => $user->heros,
-//            'gates' => $user->gates,
-//            'tili' => $user->base()->tili,
-//            'time' => $user->privateState->TiliTime,
-//            'gold' => $user->base()->gold,
-//            'resPoint' => $user->base()->resPoint,
-//            'cash' => $user->base()->cash,
-//            'exp' => 0,
-////            'rewardstr' => implode(';', $rewardArr),
-//            'priv' => $user->privateState,
-//            'isFirst' => false,
-//            'prize'=>"",
-//        );
-//        UserProc::updateUserInfo();
-//        return Resp::ok($result);
-//    }
-//
-//    private static function _LogMaterialChallenge($gateId) {
-//        $priv = ctx()->privateState;
-//        my_default_Obj($priv->materialDailyChallengeRecord);                    # 防御代码
-//        if (!CommUtil::isPropertyExists($priv->materialDailyChallengeRecord, $gateId)) {
-//            $priv->materialDailyChallengeRecord->$gateId = 0;
-//        }
-//        $priv->materialDailyChallengeRecord->$gateId++;
-//        ctx()->privateState = $priv;
-////        var_dump($priv);
-//    }
-//
-//    /**
-//     * 通关普通关卡
-//     */
-//    private static function _NormalGate() {
-//        list($gateId, $difficulty, $star, $TeamObj) = req()->paras;             # 提取参数: 挑战的关卡Id, 关卡难度(0,1,2), 几星, 队伍, 奖励字符串
-//        $smGate = GameConfig::gate_getItem($gateId);                            # 关卡配置数据
-//        $isFirst = false;                                                       # 是否首次通关
-//        self::recordFight($gateId, $difficulty, $star, $isFirst);               # 更新挑战记录
-//        $i = $difficulty + 1;                                                   # 按三个难度取不同的值.
-////        $gold = self::getProperty_n($smGate, "gold", $i);
-//        $exp = self::getProperty_n($smGate, "exp", $i);
-//        $firstExp = self::getProperty_n($smGate, "first_exp", $i);
-//        $firstHero = self::getProperty_n($smGate, "first_hero", $i);
-//        $heroExp = self::getProperty_n($smGate, "heroExp", $i);
-//        if ($isFirst) {                                                         # 是否首次通关切换奖励内容
-//            $exp = $firstExp;
-//            if ($firstHero > 0) {                                               # 首次通关解锁英雄
-//                HeroProc::AddHeroWithStar($firstHero, 0);                       # 添加英雄
-//            }
-//        }
-//
-////        $rewardArr = self::SetRewards($req, $rewardStr);                        # 发通关奖励
-////        Data_UserGame::Add_Gold($req->userInfo->game->baseInfo, $gold);         # 发金币
-////        Data_UserGame::Add_Exp(ctx()->baseInfo, $exp);           # 给玩家(指挥官)增加经验
-//        ctx()->base()->Add_Exp($exp);                           # 给玩家(指挥官)增加经验
-//        foreach ($TeamObj as $heroUID) {
-//            if ($heroUID > 0) {
-//                echoLine("$heroUID");
-//                HeroProc::HeroAddEXP($heroUID, $heroExp);                       # 增加英雄经验
-//            }
-//        }
-//        UserProc::updateUserInfo();                                             # 回写玩家数据.
-//
-//        TaskProc::OnPassGateN($gateId, $difficulty + 1);
-//
-//        StatisticsProc::unlockGate($gateId); #统计通关最新关卡
-//        $user = ctx();
-//        $result = array(
-//            'store' => $user->store,
-//            'heros' => $user->heros,
-//            'gates' => $user->gates,
-//            'tili' => $user->base()->tili,
-//            'time' => $user->privateState->TiliTime,
-//            'gold' => $user->base()->gold,
-//            'resPoint' => $user->base()->resPoint,
-//            'cash' => $user->base()->cash,
-//            'exp' => $exp,
-////            'rewardstr' => implode(';', $rewardArr),
-//            'isFirst' => $isFirst,
-//            'prize'=>"",
-//        );
-//        return Resp::ok($result);
-//    }
-//
-//    private static function PassGateSettlement() {
-//        list($gateId, $difficulty, $star, $TeamObj) = req()->paras;             # 提取参数: 挑战的关卡Id, 关卡难度(0,1,2), 几星, 队伍, 奖励字符串
-//        $smGate = GameConfig::gate_getItem($gateId);                            # 关卡配置数据
-//        $isFirst = false;
-//        self::recordFight($gateId, $difficulty, $star, $isFirst);               # 更新挑战记录
-//        $i = $difficulty + 1;                                                   # 按三个难度取不同的值.
-//        $exp = self::getProperty_n($smGate, "exp", $i);
-//        ctx()->base()->Add_Exp($exp);                           # 给玩家(指挥官)增加经验
-//
-//        $prize = "";
-//        if($smGate->battleType == 8){//守护战
-//            $mo = GameConfig::duplicate_defense_getItem($smGate->duplicateDataId);
-//            if($mo != null){
-//                $p = $mo->rewardList;
-//                $arr = explode(',', $p);
-//                $s = "";
-//                foreach ($arr as $val) {
-//                    $aa = explode('_', $val);
-//                    $s = $aa[0].','.$aa[1];
-//                    if($prize == ""){
-//                        $prize = $s;
-//                    } else {
-//                        $prize = $prize.';'.$s;
-//                    }
-//                }
-//
-//            }
-//
-//            StoreProc::AddMultiItemInStore($prize);
-//        }
-//
-//        UserProc::updateUserInfo();                                             # 回写玩家数据.
-//
-//        $user = ctx();
-//        $result = array(
-//            'store' => $user->store,
-//            'heros' => $user->heros,
-//            'gates' => $user->gates,
-//            'tili' => $user->base()->tili,
-//            'time' => $user->privateState->TiliTime,
-//            'gold' => $user->base()->gold,
-//            'resPoint' => $user->base()->resPoint,
-//            'cash' => $user->base()->cash,
-//            'exp' => $exp,
-////            'rewardstr' => implode(';', $rewardArr),
-//            'isFirst' => $isFirst,
-//            'prize'=>$prize,
-//        );
-//        return Resp::ok($result);
-//    }
-//
-//    /**
-//     * 发放奖励串
-//     * @param Req $req
-//     * @param type $rewardStr
-//     */
-//    public static function SetRewards($rewardStr) {
-//        $getedArr = array();                                                    # 统计所获奖励物品
-//        $rewardsArr = explode(";", $rewardStr);
-//        foreach ($rewardsArr as $r) {                                           #
-//            if (strlen($r) > 0) {
-////            $percentStr = explode(',', $r)[2];
-////            $percent = intval(trim($percentStr, "%"));                          # 剔除%
-////            if (CommUtil::randomPercent($percent)) {
-//                $err = StoreProc::AddMultiItemInStore($r);                      # 发放奖励物品
-//                my_Assert($err == ErrCode::ok, $err);                           # 出错了
-//                $getedArr[] = $r;                                               # 剔除最后一段概率字符串
-////            }
-//            }
-//        }
-//        return $getedArr;
-//    }
-//
-//    /**
-//     * 更新战斗记录
-//     * @param type $gateId
-//     * @param type $difficulty
-//     * @param type $star
-//     */
-//    private static function isFirstChallenge($gateId, $difficulty) {
-//        $userGates = ctx()->gates;
-//        if ($difficulty == 0) {                                                 # 按照难度查找
-//            $diffCult = $userGates->normal;
-//        } else if ($difficulty == 1) {
-//            $diffCult = $userGates->hard;
-//        } else if ($difficulty == 2) {
-//            $diffCult = $userGates->elite;
-//        } else {
-//            Err(ErrCode::err_arenas_difficulty);                                # 找不到难度类型
-//        }
-//
-//        $typeId = substr($diffCult->highest, 0, 3);                             # 防御: 分类头不对
-//        if ($typeId != '503') {
-//            $diffCult->highest = 503000;                                        # 设置为关卡第一关
-//        }
-//        if ($gateId > $diffCult->highest + 1) {                                 # 不能跳关
-//            Err(ErrCode::err_arenasgate_indexillegal);
-//        }
-//
-//        $uGate = new Ins_UGate();                                               # 当前关卡的记录数据
-//        if (isset($diffCult->gates->$gateId)) {
-//            $uGate = $diffCult->gates->$gateId;
-//        }
-//
-//        return !$uGate->cleared;
-//    }
-//
-//    /**
-//     * 更新战斗记录
-//     * @param type $gateId
-//     * @param type $difficulty
-//     * @param type $star
-//     */
-//    private static function recordFight($gateId, $difficulty, $star, &$isFirst = false) {
-//        $userGates = ctx()->gates;
-//        if ($difficulty == 0) {                                                 # 按照难度查找
-//            $diffCult = $userGates->normal;
-//        } else if ($difficulty == 1) {
-//            $diffCult = $userGates->hard;
-//        } else if ($difficulty == 2) {
-//            $diffCult = $userGates->elite;
-//        } else {
-//            Err(ErrCode::err_arenas_difficulty);                                # 找不到难度类型
-//        }
-//
-//        $typeId = substr($diffCult->highest, 0, 3);                             # 防御: 分类头不对
-//        if ($typeId != '503') {
-//            if ($diffCult->highest < 503000) {
-//                $diffCult->highest = 503000;                                        # 设置为关卡第一关
-//            }
-//        }
-//
-////        if ($gateId > $diffCult->highest + 1) {                                 # 不能跳关
-////            Err(ErrCode::err_arenasgate_indexillegal);
-////        }
-//
-//        if ($gateId == $diffCult->highest + 1 && $star > 0) {                   # 星级大于等于0,才可以推关
-//            $diffCult->highest += 1;                                            # 更新最高记录
-//            RankProc::recordNewPassGateInfo(req()->uid, $gateId);                # 更新通关记录
-//        }
-//        $diffCult->latest = $gateId;                                            # 记录上次挑战关卡id
-//
-//        $uGate = new Ins_UGate();                                               # 当前关卡的记录数据
-//        if (isset($diffCult->gates->$gateId)) {
-//            $uGate = $diffCult->gates->$gateId;
-//        }
-//        $uGate->challengeTimes++;                                               # 当前关卡挑战次数
-//        $uGate->star |= $star;                                                  # 当前关卡得分评星
-//        if (!$uGate->cleared) {
-//            $uGate->cleared = 1;                                                # 当前关卡是否已通关
-//            $isFirst = true;
-//        }
-//        $diffCult->gates->$gateId = $uGate;                                     # 回写关卡记录
-//
-//        $userGates->TotalNum++;                                                 # 总战斗次数+1
-//        $userGates->Times++;
-//        ctx()->gates = $userGates;                               # 回写数据
-//    }
-//
-//    /**
-//     * 清理每个难度副本的每日战斗次数
-//     */
-//    public static function ClearGateTimes() {
-//        ctx()->gates->Times = 0;
-//    }
-//
-////
-//// <editor-fold defaultstate="collapsed" desc=" 扫荡  ">
-//
-//    /**
-//     * [6802]新扫荡
-//     */
-//    public static function Arenas_NewSweepFight() {
-//        Err(ErrCode::err_method_obsoleted, "reward字段已于2022.1.11被删除,代码需维护!");
-//        Err(ErrCode::err_method_obsoleted);                                     # 没开扫荡功能
-//        list($gateId, $difficulty, $costItemId) = req()->paras;                 # 关卡id, 难度 difficulty, 扫荡券id
-//
-//        $user = ctx();
-//        $smGate = GameConfig::gate_getItem($gateId);
-//        my_default_Obj($user->gates->newGateRecord);                            # 防御未初始化的变量
-//        $gatesRecord = $user->gates->newGateRecord;
-//        my_default_Obj($gatesRecord->record);                                   # 防御未初始化的变量
-//
-//        $i = $difficulty + 1;                                                   // 按三个难度取不同的值.
-//        $tili = self::getProperty_n($smGate, "tili", $i);
-//        $reward = self::getProperty_n($smGate, "reward", $i);
-//        $gold = self::getProperty_n($smGate, "gold", $i);
-//        $exp = self::getProperty_n($smGate, "exp", $i);
-//        $err = StoreProc::removeItemFromStore($user->store, $costItemId, 1);
-//        my_Assert(ErrCode::ok == $err, $err);                                   # 扣除失败
-//        $canfighterr = SweepGatesProc::CanFight($gateId, $difficulty);          # 补充战斗记录
-//        if ($canfighterr) {#不能符合战斗要求
-//            return $canfighterr;
-//        }
-//        $user->gates->newGateRecord = $gatesRecord;                             # 回写数据
-//        ActiveProc::ChangeTili(- $tili);                                        # 扣减体力
-//        $user->gates->TotalNum++;                                               # 更新战斗次数统计
-//        $user->gates->Times++;
-//
-//        $rewardsArr = explode(";", $reward);
-//        $rwds = array();
-//        foreach ($rewardsArr as $r) {                                          // 按照概率规则发放奖品
-//            $arr = explode(',', $r);
-//            $itemid = intval($arr[0]);
-//            $num = intval($arr[1]);
-//            $probability = intval($arr[2]);
-//            if (CommUtil::randomPercent($probability)) {                        # 投色子
-//                $err = StoreProc::AddMultiItemInStore("$itemid,$num");
-//                my_Assert(ErrCode::ok == $err, $err);
-//                $rwds[] = "$itemid,$num";
-//            }
-//        }
-//        $user->base()->Add_Gold($gold);                                         # 发放金币奖励
-//        my_Assert(ErrCode::ok == $err, $err);                                   # 失败
-////        Data_UserGame::Add_Exp($user->baseInfo, $exp);                          # 发放经验奖励
-//        $user->base()->Add_Exp($exp);                                           # 发放经验奖励
-//        UserProc::updateUserInfo();                                             # 在获取战利品哪里已经update了.
-//        $result = array(
-//            'store' => $user->store,
-//            'heros' => $user->heros,
-//            'gates' => $user->gates,
-//            'tili' => $user->base()->tili,
-//            'time' => $user->privateState->TiliTime,
-//            'gold' => $gold,
-//            'exp' => $exp,
-//            'rewardstr' => implode(';', $rwds)
-//        );
-//        return Resp::ok($result);
-//    }
-//
-//    /**
-//     * 是否可以战斗
-//     * @param $gateId
-//     * @param $difficulty
-//     * @return type
-//     */
-//    static function CanFight($gateId, $difficulty) {
-//        $gatesRecord = ctx()->gates->newGateRecord;
-//        $smGate = GameConfig::gate_getItem($gateId);
-//        if (!CommUtil::isPropertyExists($gatesRecord->record, $gateId)) {
-//            $gatesRecord->record->$gateId = ObjectInit();
-//        }
-////        if ($difficulty > 2) {
-////            return Resp::err(ErrCode::err_arenasgate_indexillegal);
-////        }
-//        if ($difficulty == 0) {
-//            if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "normal")) {
-//                return Resp::err(ErrCode::err_arenas_normalgate_numno);
-//            }
-//
-//            if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "normalToday")) {
-//                return Resp::err(ErrCode::err_arenas_normalgate_numno);
-//            }
-//            if ($smGate->cishu1 - $gatesRecord->record->$gateId->normalToday < 1) {
-//                return Resp::err(ErrCode::err_arenas_normalgate_numno);
-//            }
-//            $gatesRecord->record->$gateId->normalToday += 1;
-//        } else if ($difficulty == 1) {
-//
-//            if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "hard")) {
-//                return Resp::err(ErrCode::err_arenas_normalgate_numno);
-//            }
-//            if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "hardToday")) {
-//                return Resp::err(ErrCode::err_arenas_normalgate_numno);
-//            }
-//
-//            if ($smGate->cishu2 - $gatesRecord->record->$gateId->hardToday < 1) {
-//                return Resp::err(ErrCode::err_arenas_normalgate_numno);
-//            }
-//            $gatesRecord->record->$gateId->hardToday += 1;
-//        } else if ($difficulty == 2) {
-//            if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "elite")) {
-//                return Resp::err(ErrCode::err_arenas_normalgate_numno);
-//            }
-//
-//            if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "eliteToday")) {
-//                return Resp::err(ErrCode::err_arenas_normalgate_numno);
-//            }
-//            if ($smGate->cishu3 - $gatesRecord->record->$gateId->eliteToday < 1) {
-//                return Resp::err(ErrCode::err_arenas_normalgate_numno);
-//            }
-//            $gatesRecord->record->$gateId->eliteToday += 1;
-//        }
-//        return null;   // false
-//    }
-//
-//// </editor-fold>
-////
-//// <editor-fold defaultstate="collapsed" desc="    好友租借   ">
-////    /**
-////     * [6805] 查询租借好友记录
-////     * @param Req $req
-////     */
-////    public static function GetBorrowedFriends($req) {
-////// 查询好友借用记录中的数据
-////        $rentedfriends = $req->userInfo->game->privateState->rentedFriends;
-////        if (!$rentedfriends || !is_array($rentedfriends)) {
-////            $rentedfriends = ArrayInit();
-////        }
-////        return Resp::ok(array('ret' => $rentedfriends));
-////    }
-////
-////    /**
-////     * 清理战斗租借好友记录
-////     *
-////     */
-////    public static function ClearFightRentRecord($req) {
-////        $req->userInfo->game->privateState->rentedFriends = ArrayInit();
-////    }
-////
-////    /**
-////     * [6806] 扣除借用好友费用
-////     * @param Req $req
-////     */
-////    public static function ConsumeBorrowFriend($req) {
-////// 提取参数:好友id
-////        $friend_uid = $req->paras[0];
-////// 验证好友关系
-////        if (!FriendProc::isFriendship($req->zoneid, $req->uid, $friend_uid)) {
-////            return Resp::err(ErrCode::friend_no_err);
-////        }
-////// 验证尚未租借过
-////        $rentedfriends = $req->userInfo->game->privateState->rentedFriends;
-////        if (!$rentedfriends || !is_array($rentedfriends)) {
-////            $rentedfriends = ArrayInit();
-////        }
-////        if (in_array($friend_uid, $rentedfriends)) {
-////            return Resp::err(array('err' => -1, 'msg' => 'has rented this player today!'));
-////        }
-////// 验证好友出借英雄
-////        $friend_info = UserProc::getUserInfo(gMem(), $req->zoneid, $friend_uid);
-////        if (!$friend_info) {
-////            return Resp::err(ErrCode::user_no_err, '找不到好友的游戏数据!');
-////        }
-////// todo:啦啦啦... 先不写了,管它用的是哪个英雄呢
-//////
-////// 扣除费用,失败->金币不足
-////        $arr = explode(',', glc()->User_Friends_HireFriendForBattle_Cost);
-////        if (count($arr) < 2) {
-////            return Resp::err(ErrCode::err_const_no);
-////        }
-////        $itemid = $arr[0];   # 道具id
-////        $amt = $arr[1];      # 数量
-////        if ($itemid == META_GOLD_ITEMID) {
-////            $user = $req->userInfo->game;
-////            if ($user->gold < $amt) {
-////                return Resp::err(array('err' => -2, 'msg' => 'gold not enough!'));
-////            }
-////            UserGameModel::Consume_Gold($user, $amt);
-////// todo: 给好友发送金币 邮件
-////            EmailProc::SendHireCoinFromFight($req->zoneid, $friend_uid, #
-////                    $req->userInfo->game->name, $req->uid, $amt); # 好友收益需要扣除系统税率.
-////        } else {
-////            return Resp::err(ErrCode::err_const_no);
-////        }
-////// 添加借用记录
-////        $rentedfriends[] = $friend_uid;
-////        $req->userInfo->game->privateState->rentedFriends = $rentedfriends;
-////// 回写数据
-////        UserProc::updateUserInfo($req);                     // 玩家数据
-//////        UserProc::setUserInfo(global_mem(), $friend_info);  // 好友数据
-////// 返回
-////        return Resp::ok(array('err' => 0, 'curgold' => $user->gold));
-////    }
-//// </editor-fold>
-////
-//// <editor-fold defaultstate="collapsed" desc="黄金挑战">
-////    /**
-////     * [6804] 扣除买buffer的费用
-////     * @param type $req
-////     * @return type
-////     */
-////    public static function ConsumeBufferGold($req) {
-////        $user = $req->userInfo->game; # user引用
-////        $money = $req->paras[0]; //需要的手工费
-////// echo var_dump($money);
-////        $bDeal = UserGameModel::Consume_Gold($user, $money);
-////        if ($bDeal) {
-////            $result = array(
-////                'resp' => "succeed!"
-////            );
-//////  更新数据库数据
-////
-////            $resp = Resp::ok($result);
-////        } else {
-////
-//////   $user->gold=0;
-////            $result = array(
-////                'resp' => "succeed!"
-////            );
-//////  更新数据库数据
-////
-////            $resp = Resp::ok($result);
-////        }
-////        UserProc::updateUserInfo($req);
-////        return $resp;
-////    }
-////    /**
-////     * [6807] 挑战黄金 无穷无尽战斗模式
-////     * @param type $req
-////     */
-////    public static function ChallengeEndlessFightMode_Gold($req) {
-////        $gateForeverId = $req->paras[0];
-////        $difficuty = $req->paras[1];
-////        $bociCount = $req->paras[2];
-//////判断是否已经达到挑战的次数上限
-////        $gates = $req->userInfo->game->gates;
-////
-////        if (!CommUtil::isPropertyExists($gates, "forever_Gold_FightTimes")) {
-////            $gates->forever_Gold_FightTimes = 0;
-////        }
-////
-////        if ($gates->forever_Gold_FightTimes >= glc()->Battle_Forever_MaxCountEveryDay) {
-////            return Resp::err(ErrCode::err_gateForever_countIsFull, '挑战次数已经用尽!');
-////        }
-//////1.取出无尽模式的关卡常量数据
-////        $gateForeverConst = GameConfig::gateforever_getItem($gateForeverId);   // ConstProc::getGold_GateForeverGoldConst($gateForeverId);
-////        $gateBattleBociConst = GameConfig::gatecombat_getItem($gateForeverId);
-////        if (!$gateForeverConst) {
-////            return Resp::err(ErrCode::err_gateForever_const_no);
-////        }
-//////判断次数是否合法
-////        $bociArr = explode(",", $gateBattleBociConst->level);
-////        if ($bociCount > count($bociArr)) {
-////            return Resp::err(ErrCode::err_gateForever_countillegal);
-////        }
-//////2.取出模式下的奖励数据
-////        $rewardStr = $gateForeverConst->reward1;
-////
-////        $arr_reward = explode(";", $rewardStr);
-////        foreach ($arr_reward as $value) {
-////            if (strlen($value) > 0) {
-////
-////                $arr_RealReward = explode(",", $value);
-////                $itemId = $arr_RealReward[0];
-////                $itemNum = $arr_RealReward[1];
-////
-////                $str1 = substr($itemId, 0, 3);
-//////3.根据挑战的波次数据,重复累计获得奖励
-////                for ($i = 0; $i < $bociCount; $i++) {
-////
-////                    switch ($str1) {
-///////怪物卡或者英雄卡牌获取
-////                        case "101":
-////                        case "201":
-//////                            HeroProc::AddHeroTFromStore($req, $itemId);
-////                            break;
-///////装备物品的获取.
-////                        case "301":
-////                        case "302":
-////                        case "303":
-////                            StoreProc::PutEquipInStore($itemId, $req);
-////                            break;
-///////宝石的获取
-////                        case "304":
-////                            StoreProc:: PutOverlyingItemInStore($itemId, $itemNum, $req);
-////                            break;
-//////金币的获取
-////                        case "399":
-////                            if ($itemId == "399002") {
-////                                UserGameModel::Add_Gold($req->mem, $req->userInfo->game, $itemNum);
-////                            }
-////                            break;
-////                        default:
-////                            break;
-////                    }
-////                }
-////            }
-////        }
-//////4、存储玩家的挑战次数
-////        $gates->forever_Gold_FightTimes = $gates->forever_Gold_FightTimes + 1;
-////// 回写数据
-////        UserProc::updateUserInfo($req);
-////        $result = ObjectInit();
-////        $result->result = "succeed";
-////        $result->forever_Gold_FightTimes = $gates->forever_Gold_FightTimes;
-////        $resp = Resp::ok($result);
-////        return $resp;
-////    }
-////    /**
-////     * 清理挑战无尽模式的 次数记录
-////     *
-////     */
-////    public static function ClearGateForeverGold_FightCountEveryDay($req) {
-////        $req->userInfo->game->gates->forever_Gold_FightTimes = 0;
-////    }
-//// </editor-fold>
-////
-//// <editor-fold defaultstate="collapsed" desc="    副本    ">
-////
-////    /**
-////     * [6801] 开启副本
-////     * @param Req $req
-////     * @deprecated since version 0
-////     */
-////    public static function OpenTheCarbon($req) {
-////        $gates = $req->userInfo->game->gates;
-////        $openedcarbons = $gates->carbons->openedCarbons;
-////# 提取参数
-////        $carbonId = $req->paras[0];     # 副本ID
-////        $difficulty = $req->paras[1];   # 难度等级 1,2,3
-////        $key = "$carbonId-$difficulty"; # 键值
-////        if (!($gates && $openedcarbons)) {
-////            return Resp::err(ErrCode::err_innerfault);
-////        }
-////        if ($difficulty > 3 || $difficulty < 1) {
-////            return Resp::err(ErrCode::carbon_wrongdifficult);
-////        }
-////
-////        if (CommUtil::isPropertyExists($openedcarbons, $key)) {
-////            $carbon = $openedcarbons->$key;
-////        } else {
-////            $carbon = new CarbonModel();
-////        }
-////        if ($carbon->closeTs > now()) {
-////            return Resp::err(ErrCode::carbon_opened);
-////        }
-////        $carbonModel = GameConfig::gate_carbon_getItem($carbonId); # 常量
-////# 扣除开启消耗的道具
-////        $keyid = "keyId$difficulty";
-////        $keynum = "keyNum$difficulty";
-////        $costItemId = $carbonModel->$keyid;
-////        $costItemNum = $carbonModel->$keynum;
-////
-////        $err = StoreProc::removeItemFromStore($req->userInfo->game->store, $costItemId, $costItemNum);
-////        if ($err) { # 扣除失败
-////            return Resp::err($err);
-////        }
-////        $carbon->closeTs = now() + $carbonModel->duration;    # 关闭倒计时
-////        $carbon->curIndex = 0;                                # 索引重置为0
-////        $openedcarbons->$key = $carbon;
-////        $req->userInfo->game->gates->carbons->openedCarbons = $openedcarbons;
-////        UserProc::updateUserInfo($req);
-////        return Resp::ok(array('err' => 0, 'carbons' => $openedcarbons));
-////    }
-////    /**
-////     * 挑战副本关卡
-////     * @param Req $req
-////     * @deprecated since version number
-////     */
-////    public static function ChallengeCarbon($req) {
-////        $gates = $req->userInfo->game->gates;
-////        $carbons = $gates->carbons->openedCarbons;
-////# 提取参数
-////        $carbonId = $req->paras[0];     # 副本ID
-////        $difficulty = $req->paras[1];   # 难度等级 1,2,3
-////        $gateindex = $req->paras[2];    # 关卡索引 0,1,2,...
-////        $star = $req->paras[3];         # 战斗评价(几星)
-////        $TeamObj = $req->paras[4];      # 队伍信息
-//////        $bossId = $req->paras[5];       # 本关消灭的bossid (<=0代表本关卡未出现boss)
-////        if ($difficulty > 3 || $difficulty < 1) {
-////            return Resp::err(ErrCode::carbon_wrongdifficult);
-////        }
-////        $key = "$carbonId-$difficulty"; # 键值
-////# 0 当前副本处于开启状态
-////# 1 当前关卡索引,不能跳着打,
-////# 2 记录下战斗评价(几星), 也许以后用得着,比如最后通关后,给个啥奖励
-////# 3 决定掉落物品, 发给客户端
-////# 4 发放对应的经验之类的东西
-////# 5 检查是否最后一个关卡, 是, 关闭副本
-////# 6 回存数据,返回
-////
-////        isEditor() && $carbon = new CarbonModel;
-////        if (CommUtil::isPropertyExists($carbons, $key)) {
-////            $carbon = $carbons->$key;
-////        } else {
-////            $carbon = null;
-////        }
-////        if (!$carbon || $carbon->closeTs < now()) {
-////            return Resp::err(ErrCode::carbon_closed);
-////        }
-////
-////        $carbonModel = GameConfig::gate_carbon_getItem($carbonId); # 副本常量数据
-////        $gateIds = explode(',', $carbonModel->gateids);
-////        if ($gateindex < 0 || $gateindex >= count($gateIds)) {
-////            return Resp::err(ErrCode::carbon_gateIndex);
-////        }
-////        if ($carbon->curIndex == $gateindex || $gateindex == 0) {
-////            $carbon->curIndex += 1; # 更新进度
-////        } else { # 不能跳关
-////            return Resp::err(ErrCode::carbon_gateIndex);
-////        }
-////
-////        $gateId = $gateIds[$gateindex];    # 通过索引获得关卡ID
-////        $tl = "tili$difficulty";           # 体力难度
-////        $rwd = "reward$difficulty";        # 奖励难度
-////        $arr = array("normal", 'hard', 'elite');  # 难度名称
-////        $gt = $arr[$difficulty - 1];       # 关卡分类
-////        $gateModel = GameConfig::gate_carbon_content_getItem($gateId); # 副本关卡常量数据
-////        $tili = $gateModel->$tl;                        # 扣除体力
-////        $reward = $gateModel->$rwd;                     # 获得奖励
-////#
-////# 打副本呢也要扣除体力
-////        ActiveProc::ChangeTili(-$tili, $req);
-////# 扣除多少体力就给账号增加多少经验 -by 李宁, reconfirmed by wg 20170519144109
-////        UserGameModel::Add_Exp($req, $tili);
-////# 增加英雄经验(也是依据扣除的体力数)
-////        foreach ($TeamObj as $heroUID) {
-////            HeroProc::HeroAddEXP($heroUID, $tili, $req);
-////        }
-//////        $carbon->stars;  暂不记录了
-////# 掉落战利品->获取
-////        $err = StoreProc::AddMultiItemInStore($req, $reward);
-////        if ($err) {
-////            return Resp::err($err);
-////        }
-////        if (count($gateIds) == $gateindex + 1) { # 最后一个关卡
-////            unset($carbons->$key);               # 关闭掉关卡,或者是直接删掉
-////        } else {
-////            $carbons->$key = $carbon;            # 回存数据
-////        }
-////        $req->userInfo->game->gates->carbons->openedCarbons = $carbons;
-////        UserProc::updateUserInfo($req); //在获取战利品哪里已经update了.
-////        # Ps.备注,奖品是固定的,所以不必返回
-////        $result = array(
-////            'store' => $req->userInfo->game->store,
-////            'heros' => $req->userInfo->game->heros,
-////            'gates' => $req->userInfo->game->gates,
-////            'tili' => $req->userInfo->game->tili,
-////            'time' => $req->userInfo->game->privateState->TiliTime
-////        );
-////        return Resp::ok($result);
-////    }
-////    /**
-////     * [6809]新版本的挑战 副本胜利
-////     * @param Req $req
-////     * @deprecated since version 0
-////     */
-////    public static function NewChallengeCarbon($req) {
-////        $gates = $req->userInfo->game->gates;
-////        $carbons = $gates->carbons->openedCarbons;
-////# 提取参数
-////        $carbonId = $req->paras[0];     # 副本ID
-////        $gateId = $req->paras[1]; # 关卡ID
-////        $difficulty = $req->paras[2];   # 难度等级 1,2,3
-////
-////        $star = $req->paras[3];         # 战斗评价(几星)
-////        $TeamObj = $req->paras[4];      # 队伍信息
-////
-////        if ($difficulty > 3 || $difficulty < 1) {
-////            return Resp::err(ErrCode::carbon_wrongdifficult);
-////        }
-////        $key = "$carbonId-$difficulty"; # 键值
-////        # 0 当前副本处于开启状态
-////        # 1 战斗胜利之后,副本直接关闭
-////        # 2 记录下战斗评价(几星), 也许以后用得着,比如最后通关后,给个啥奖励
-////        # 3 决定掉落物品, 发给客户端
-////        # 4 发放对应的经验之类的东西
-////        # 5 检查是否最后一个关卡, 是, 关闭副本
-////        # 6 回存数据,返回
-////
-////        isEditor() && $carbon = new CarbonModel;
-////        if (CommUtil::isPropertyExists($carbons, $key)) {
-////            $carbon = $carbons->$key;
-////        } else {
-////            $carbon = null;
-////        }
-////        if (!$carbon || $carbon->closeTs < now()) {
-////            return Resp::err(ErrCode::carbon_closed);
-////        }
-////        unset($carbons->$key);
-////        $tl = "tili$difficulty";           # 体力难度
-////        $rwd = "reward$difficulty";        # 奖励难度
-////
-////        $gateModel = GameConfig::gate_carbon_content_getItem($gateId); # 副本关卡常量数据
-////        $tili = $gateModel->$tl;                        # 扣除体力
-////        $reward = $gateModel->$rwd;                     # 获得奖励
-////        #
-////        # 打副本呢也要扣除体力
-////        ActiveProc::ChangeTili(-$tili, $req);
-////
-////        // 按照概率规则发放奖品
-////        $rewardsArr = explode(";", $reward);
-////        $rwds = array();
-////        foreach ($rewardsArr as $r) {
-////            $arr = explode(',', $r);
-////            $itemid = intval($arr[0]);
-////            $num = intval($arr[1]);
-////            $probability = floatval($arr[2]);                                   # 掉落概率精度精确到±0.01%
-////            if (CommUtil::randomPercent($probability)) {                        # 投色子
-////                $err = StoreProc::AddMultiItemInStore($req, "$itemid,$num");
-////                if ($err) {
-////                    return Resp::err($err);
-////                }
-////                $rwds[] = "$itemid,$num";
-////            }
-////        }
-////
-////        if ($err) {
-////            return Resp::err($err);
-////        }
-////
-////        $req->userInfo->game->gates->carbons->openedCarbons = $carbons;
-////        UserProc::updateUserInfo($req); //在获取战利品哪里已经update了.
-////        # Ps.备注,奖品是固定的,所以不必返回
-////        SystemProc::Carbon_Win($req->zoneid, $req->userInfo->game, $carbonId, $difficulty); # 插入通过副本消息
-////        $result = array(
-////            'store' => $req->userInfo->game->store,
-////            'heros' => $req->userInfo->game->heros,
-////            'gates' => $req->userInfo->game->gates,
-////            'tili' => $req->userInfo->game->tili,
-////            'time' => $req->userInfo->game->privateState->TiliTime,
-////            'gold' => 0,
-////            'exp' => 0,
-////            'rewardstr' => implode(';', $rwds)
-////        );
-////        return Resp::ok($result);
-////    }
-////    /**
-////     * [6816] 挑战剧情关卡
-////     * @param type $req
-////     * @deprecated since version 0
-////     */
-////    public static function ChallengeStoryGate($req) {
-////        $gates = $req->userInfo->game->gates;
-////# 提取参数
-////        $storyId = $req->paras[0];      # 剧情ID
-////        $difficulty = $req->paras[1];   # 难度等级 1,2,3
-////        $star = $req->paras[2];         # 战斗评价(几星)
-////        $TeamObj = $req->paras[3];      # 队伍信息
-////        $bossId = $req->paras[4];       # 本关消灭的bossid (<=0代表本关卡未出现boss)
-//////
-////#1.   判断是否有记录过剧情的战斗信息
-////        if (!CommUtil::isPropertyExists($gates, "story")) {
-////            $gates->story = ObjectInit();
-////            $gates->story->lastFinishedStoryGateId = 0;
-////            $gates->story->allFinishedStoryGateIdList = ArrayInit();
-////        }
-////        $storrRecord = $gates->story;
-////#2.取出模式下的奖励数据
-////        $memStoryModel = GameConfig::gatestory_getItem($storyId);
-////        $tili = 0;
-////        $rewardStr = $memStoryModel->storyGateReward;
-////
-////#3 同步下剧情的推进进度数据
-////        if ($storrRecord->lastFinishedStoryGateId == $storyId || in_array($storyId, $storrRecord->allFinishedStoryGateIdList)) {
-////            return Resp::err(ErrCode::story_repeatfight); #剧情关卡不能重复战斗 只能打一次
-////        } else {
-////            $storrRecord->lastFinishedStoryGateId = $storyId;
-////            $storrRecord->allFinishedStoryGateIdList[] = $storyId;
-////        }
-////#
-////# 4 万一打剧情也扣除体力呢
-////        if ($tili > 0) {
-////            ActiveProc::ChangeTili(-$tili, $req);
-////# 扣除多少体力就给账号增加多少经验 -by 李宁, reconfirmed by wg 20170519144109
-////            UserGameModel::Add_Exp($req, $tili);
-////# 增加英雄经验(也是依据扣除的体力数)
-////            foreach ($TeamObj as $heroUID) {
-////                HeroProc::HeroAddEXP($heroUID, $tili, $req);
-////            }
-////        }# 5 玩家获得 剧情的战斗奖励
-////        $err = StoreProc::AddMultiItemInStore($req, $rewardStr);
-////        if ($err) {
-////            return Resp::err($err);
-////        }# 6 回存玩家的战斗记录
-////        $req->userInfo->game->gates->story = $storrRecord;
-////        UserProc::updateUserInfo($req); //在获取战利品哪里已经update了.
-////        # Ps.备注,奖品是固定的,所以不必返回
-////        $result = array(
-////            'store' => $req->userInfo->game->store,
-////            'heros' => $req->userInfo->game->heros,
-////            'gates' => $req->userInfo->game->gates,
-////            'tili' => $req->userInfo->game->tili,
-////            'time' => $req->userInfo->game->privateState->TiliTime
-////        );
-////        return Resp::ok($result);
-////    }
-////
-//// </editor-fold>
-////
-//}
-//
-///**
-// * 任务/挑战目标达成记录(三星评价)
-// * @author gwang
-// */
-//class GateStar {
-//
-//    /**
-//     * 根据后台记录的数值构造(反向提供给前端显示层)
-//     * @param int $i
-//     */
-//    public function __construct($i) {
-//        $this->S1 = ($i & 1) > 0;
-//        $this->S2 = ($i & 2) > 0;
-//        $this->S3 = ($i & 4) > 0;
-//    }
-//
-//    /**
-//     * @var bool 第一个目标达成
-//     */
-//    public $S1;
-//
-//    /**
-//     * @var bool 第二个目标达成
-//     */
-//    public $S2;
-//
-//    /**
-//     * @var bool 第三个目标达成
-//     */
-//    public $S3;
-//
-//    /**
-//     * 统计总星数
-//     * @return int
-//     */
-//    public function Stars() {
-//        return ($this->S3 ? 1 : 0) + ($this->S2 ? 1 : 0) + ($this->S1 ? 1 : 0);
-//    }
-//
-//}

+ 0 - 35
Gameserver/App/process/PayProc/MLogType.php

@@ -1,35 +0,0 @@
-<?php
-
-//
-//namespace loyalsoft;
-//
-///**
-// * 日志类型
-// * @version
-// *          1.0.0 Created at 2017-1-20. by --gwang
-// * @author gwang (mail@wanggangzero.cn)
-// * @copyright ? 2017-1-20, SJZ LoyalSoft Corporation & gwang. All rights reserved.
-// */
-//class MLogType {
-//
-//    /**
-//     * 游戏内赠送
-//     */
-//    const Present = 1;
-//
-//    /**
-//     * 查询余额操作
-//     */
-//    const Inquire = 2;
-//
-//    /**
-//     * 直接扣除游戏币
-//     */
-//    const Save = 3;
-//
-//    /**
-//     * 商城购物
-//     */
-//    const Shop = 4;
-//
-//}

+ 0 - 230
Gameserver/App/process/PayProc/YuanBaoPayProc.php

@@ -1,230 +0,0 @@
-<?php
-
-//
-//namespace loyalsoft;
-//
-///*
-// * 支付日志模块
-// * 2016.10.13 gwang 提取
-// */
-//
-///**
-// * 支付日志类
-// */
-//class YuanBaoPayProc {
-//
-//    /**
-//     * 【多平台】扣除玩家游戏币(Ps.发货逻辑最后执行此步骤)
-//     * @param int $amt 扣除数量
-//     * @param string $source  (string)备注,扣除来源(模块)
-//     * @return int ErrCode
-//     */
-//    public static function mn_SaveUserYuanbao($amt, $source = "") {
-//        $err = ErrCode::ok;
-//        if ($amt > 0) {  // 防御,数量不可能小于0
-//            $user = ctx()->base();
-//            $zoneid = req()->zoneid;  // 分区Id
-//            if ($user->yuanbao < $amt) { // 余额不足
-//                CLog::err("[Cheating] mn_SaveUserYuanbao:" . req()->uid, __CLASS__);
-//                $err = ErrCode::notenought_yuanbao;
-//            } else {// 更新玩家游戏币余额
-//                $user->yuanbao -= $amt;
-//                self::$m_billno = date("Y-m-d H:i:is");
-//            }
-//            self::_mPayLog($zoneid, req()->uid, MLogType::Save, $err, #
-//                    $amt, $user->yuanbao, $user->cash, $user->gift_cash, $user->charge_amt, $source);
-//        }
-//        return $err;
-//    }
-//
-//    /**
-//     * 新版支付(引入元宝这种货币)
-//     * @param Req $req
-//     * @return type
-//     */
-//    public static function m_payByYuanbao($req) {
-//        $resp = Resp::err(ErrCode::err_method_notimplement);
-////        $user = ctx()->base();                                                  # user引用
-////        $privateState = $req->userInfo->game->privateState;
-////// 客户端参数解析
-////        $paytype = req()->paras[0];  // 付费类型 3.元宝, 2. 钻石, 1. 金币,
-////        $itemId = req()->paras[1];  // 道具ID
-////
-////        $itemModel = CGameConfig::item_getItem($itemId);                        # 取道具的常量数据
-////        if ($itemModel == null) { //1.检测是否存在道具的常量数据
-////            $resp = Resp::err(ErrCode::err_const_no);
-////        } else {
-////            $properties = JsonUtil::decode($itemModel->properties);
-////            if (CommUtil::isPropertyExists($properties, "isActive") # 活动物品
-////                    && StlUtil::arrayIn($privateState->activeList, $properties->isActive)) {
-////                $resp = Resp::err(Errcode::active_hasgetted); # 已领过
-////            } else {
-////                if ($paytype == 3) {# 元宝
-////                    if ($user->yuanbao < $itemModel->cost) { # 元宝不足
-////                        CLog::err("[Cheating] m_payByYuanbao:" . req()->uid, __CLASS__);
-////                        $resp = Resp::err(ErrCode::notenought_yuanbao);
-////                    } else { # 发货
-////                        StoreProc::addSeprateItem($itemModel);
-////                        $amt = $itemModel->cost;
-////                        $source = "商城购买-" . $itemModel->name;
-////                        self::mn_SaveUserYuanbao($amt, $source);                // 更新玩家游戏币余额
-////                        UserProc::updateUserInfo(); // 直接将$user的最新值返回给客户端
-////                        $resp = Resp::ok("success");
-////                    }
-////                } else {                                                        # 钻石、金币
-////                    $prize = JsonUtil::decode($itemModel->prize);               # 价格
-////                    if (property_exists($prize, "c") && $prize->c > 0) {        // 钻石购买
-////                        $amt = self::_getItemCashPrize($itemModel); // 道具价格(钻石)
-////                        if ($amt <= 0) {
-////                            $resp = Resp::err(ErrCode::pay_price_err);
-////                        } else {
-////                            if ($user->cash < $amt) {                           // 余额不足
-////                                $resp = Resp::err(ErrCode::notenough_cash_msg);
-////                            } else { // 发货
-////                                StoreProc::addSeprateItem($itemModel);          // 更新玩家游戏币余额
-//////                                $user->cash -= $amt;
-////                                self::mn_SaveUserCash($req, $amt, "商城购买-花钻", $itemId);
-////                                UserProc::updateUserInfo(); // 直接将$user的最新值返回给客户端
-////                                $resp = Resp::ok($user);
-////                            }
-////                        }
-////                    }// 金币购买
-////                    else if (CommUtil::isPropertyExists($prize, "g") && $prize->g > 0) {
-////                        if ($req->userInfo->game->baseInfo->gold < $prize->g) {
-////                            $resp = Resp::err(ErrCode::notenough_gold_msg);
-////                        } else {// 发货
-////                            StoreProc::addSeprateItem($itemModel); // 更新玩家金币余额
-////                            UserModel::Comsume_Gold($user, $prize->g); // 更新玩家数据信息
-////                            UserProc::updateUserInfo(); // 直接将$user的最新值返回给客户端
-////                            $resp = Resp::ok($user);
-////                        }
-////                    } else { # 未知的支付类型
-////                        $resp = Resp::err(ErrCode::pay_m_type_err);
-////                    }
-////                }
-////            }
-////        }
-////        return $resp;
-//    }
-//
-//    /**
-//     * 缓存一个账单号,如果代码执行过程中出现错误,直接取消扣除游戏币
-//     * 注意,若是逻辑不是在一次Request内完成的,那么次订单号需要进行存储
-//     * @var string
-//     */
-//    static $m_billno;
-//
-//    /**
-//     * 【多平台版】刷新充值订单(领取充值结果)
-//     * @param Req $req
-//     */
-//    public static function m_refreshChargeOrders($req) {
-//        my_Assert($req, ErrCode::err_method_notimplement);
-////        $userinfo = $req->userInfo;
-////        my_Assert($userinfo, ErrCode::user_no_err);
-////        $user = $userinfo->game->baseInfo;
-////        my_Assert($user, ErrCode::user_no_err);
-////// 客户端参数解析
-////        $uid = $req->uid;                                                       // userID
-////        $zoneid = $req->zoneid;                                                 // 分区Id
-////        my_Assert(!empty($uid) && ($zoneid > 0), ErrCode::paras_err);
-////        $mem = gMem();
-////        my_Assert($mem, ErrCode::err_mem);
-////        $orders = $mem->get(MemKey_User::PayOrders($zoneid, $uid));             # 取挂起的订单数据
-////        $amt = 0;
-////        $num = 0;
-////        if ($orders == null) {                                                  # 订单为空
-////            $orders = ArrayInit();
-////        }
-////        foreach ($orders as $order) {                                           # 多张订单合并
-////            $amt += $order->price;
-////            $num += $order->amt;
-////        }
-////
-////        $user->yuanbao += $num;                                                 #
-////        $user->charge_amt += $amt;                                              # 历史充值记录(单位分)
-////
-////        if ($amt > 0                                                            # 充值金额大于0,且首付标志为false才可以
-////                && isset($req->userInfo->game->privateState->firstPayGift)      # 无此字段代表已经领取礼包
-////                && !$req->userInfo->game->privateState->firstPayGift) {
-////            $req->userInfo->game->privateState->firstPayGift = true;
-////        }
-////        $orders = ArrayInit();                                                  # 清空
-////        $mem->set(MemKey_User::PayOrders($zoneid, $uid), $orders);              # 清理已经处理过的订单
-////        UserProc::updateUserInfo();                                             # 更新玩家数据信息
-////        $resp = Resp::ok($user->yuanbao);                                       // 直接将$user的最新值返回给客户端
-////# todo: 这里可以再加一条订单记录
-////        self::_mPayLog($zoneid, $uid, MLogType::Inquire, 0, #
-////                $num, $user->yuanbao, $user->cash, $user->gift_cash, $user->charge_amt, "刷新订单");
-////        return $resp;
-//    }
-//
-//    /**
-//     * 取物品的价格(钻石)
-//     * @param GoodsItemModel $itemModel
-//     */
-//    private static function _getItemCashPrize($itemModel) {
-//        $c = 0;
-//        $prize = JsonUtil::decode($itemModel->prize);
-//        if (CommUtil::isPropertyExists($prize, "c")) {
-//            $c = $prize->c;
-//        }
-//        return $c;
-//    }
-//
-//    /**
-//     * 【移动端】增加玩家游戏币
-//     * @param int $amt 增加数量
-//     * @param string $source  (string)备注,增加来源(模块)
-//     * @return int ErrCode
-//     */
-//    public static function m_AddUserYuanbao($amt, $source = "") {
-//        $err = ErrCode::ok;
-//        if ($amt > 0) {  // 防御,数量不可能小于0
-//            $user = ctx()->base();
-//            $zoneid = req()->zoneid;  // 分区Id
-//            // 更新玩家游戏币余额
-//            $user->yuanbao += $amt;
-//            self::$m_billno = date("Y-m-d H:i:is");
-//
-//            self::_mPayLog($zoneid, req()->uid, MLogType::Present, $err, #
-//                    $amt, $user->yuanbao, $user->cash, $user->gift_cash, $user->charge_amt, $source);
-//        }
-//        return $err;
-//    }
-//
-//// <editor-fold defaultstate="collapsed" desc="====  移动支付 插入日志  ====">
-//
-//    /**
-//     * Sql语句移动支付插入一条log日志。
-//     * @var string
-//     */
-//    const SQL_M_LOG = "INSERT INTO `tab_mpaylog_%s` (zoneid,type,result,amt,balance,cash,giftedcash,chargedcash,source,oid,itemid) VALUES (%d,%d,%d,%d,%d,%d,%d,%d,'%s','%s','%s')";
-//
-//    /**
-//     * 移动支付插入一条记录
-//     * @param int $zoneid
-//     * @param string $oid
-//     * @param int $type
-//     * @param int $amt
-//     * @param int $balance
-//     * @param int $cash 钻石
-//     * @param int $giftedcash
-//     * @param int $chargedcash
-//     * @param int $source
-//     */
-//    public static function _mPayLog($zoneid, $oid, $type, $result, $amt, $balance, $cash, $giftedcash, $chargedcash, $source = "srcUnKnown", $itemid = "") {
-////        $month = date("Ym");
-////        $sql = sprintf(self::SQL_M_LOG, $month, $zoneid, $type, $result, $amt, $balance, $cash, $giftedcash, $chargedcash, $source, $oid, $itemid);
-////        $paydb = CPayInit();
-////        $paydb->query($sql);
-////        $paydb->close();
-//    }
-//
-//    // </editor-fold>
-//    // <editor-fold defaultstate="collapsed" desc="WEB支付日志">
-//    // 在自己的模块里面呆着吧
-//    // </editor-fold>
-//    // <editor-fold defaultstate="collapsed" desc="yyb支付日志">
-//// </editor-fold>
-//}

+ 0 - 514
Gameserver/App/process/PayProc/del_WebPayProc.php

@@ -1,514 +0,0 @@
-<?php
-
-//
-//namespace loyalsoft;
-//
-///**
-// * Qzone页游支付处理代码
-// */
-//class WebPayProc {
-//
-//    const PAY_BILL_SELECT = "SELECT * FROM `tab_billrecord` where `openid`='%s' and `state`='0' order by id;"; // 筛选尚未确认支付的订单
-//    const PAY_BILL_DELETE = "DELETE FROM `tab_billrecord` where id = '%d';";                                   // 删除未确认的支付订单
-//    const PAY_BILL_CONFIRM = "INSERT INTO `tab_billconfirm` (`openid`,`billno`,`amt`,`payitem`,`token`,`state`,`msg`) VALUES ('%s','%s','%d','%s','%s','1','OK');"; // 变更订单确认支付状态字
-//    const PAY_BILL_LOST = "INSERT INTO `tab_billconfirm` (`openid`,`billno`,`amt`,`payitem`,`token`,`state`,`msg`) VALUES ('%s','%s','%d','%s','%s','-1','%s');"; // 变更订单支付丢失状态字
-//    const PAY_LOG_INSERT = "INSERT INTO `tab_paylog` (`msg`) VALUES ('%s');";                                   // 新增支付日志
-//
-//    /**
-//     * 【PC端】购买付费道具
-//     * @param Req $req
-//     * @return type
-//     */
-//
-//    public static function buyGoods($req) {
-//        $resp = new Resp();
-//        $mem = $req->mem;
-//        $v3 = CV3Init();
-//        $private = $req->userInfo->game->privateState;
-////客户端参数解析
-//        $openid = $req->uid;
-//        $zoneid = $req->zoneid;
-//        $openkey = $req->paras[0];
-//        $pf = $req->paras[1];
-//        $pfkey = $req->paras[2];
-//        $itemPriceYuan = $req->paras[3];
-//
-//        //ID=Q点价格=元宝价格
-//        $itemPriceDot = $itemPriceYuan * 10;
-//        $itemID = $itemPriceDot;
-//        $itemPrice = $itemPriceDot;
-//        $itemName = $itemPriceDot . '元宝';
-//        $itemDes = $itemName;
-//
-//        $ts = now();
-//        $goodsurl = self::_getGoodsImgUrl($itemModel);
-//        $v3PayRet = $v3->pay_buy_goods($openid, $openkey, $pf, $pfkey, #
-//                $ts, $itemID, $itemPrice, $itemName, $itemDes, $goodsurl, $zoneid - 1);
-//        if ($v3PayRet->ret == 1002) { //假如玩家未登录
-//            $resp = Resp::err(ErrCode::user_login_err);
-//        } elseif ($v3PayRet->ret != 0) { //
-//            $resp = Resp::err($v3PayRet->ret);
-//            $resp->result = $v3PayRet;
-//        } else {
-//            $tokenInfo = self::getTokenInfo($mem, $zoneid, $openid);
-//            if ($tokenInfo == null) {
-//                $resp = Resp::err(ErrCode::user_no_err);
-//            } else {
-//                self::insToken($tokenInfo, $v3PayRet->token);
-//                self::updateTokenInfo($mem, $zoneid, $openid, $tokenInfo);
-//                $resp = Resp::ok($v3PayRet);
-//            }
-//        }
-//        $v3->close();
-//        return $resp;
-//    }
-//
-//    /**
-//     * 客户端确认支付
-//     * @param type $req
-//     * @return \ResponseVo
-//     */
-//    public static function confirmDelivery($req) {
-//        $resp = new Resp();
-//        $v3 = CV3Init();
-//        self::confirmPay($req, $v3);
-//        $resp = Resp::ok("succeed!");
-//        $v3->close();
-//        return $resp;
-//    }
-//
-//    /**
-//     * 领取首付礼包
-//     * @param Req $req
-//     * @return Resp
-//     */
-//    public static function getFirstPayGift($req) {
-//        $resp = new Resp();
-//        $map = $req->userInfo->game->map;
-//        $privateState = $req->userInfo->game->privateState;
-//
-////  如果已经领取首付礼包
-//        if (!CommUtil::isPropertyExists($privateState, "firstPayGift")) {
-//            $resp = Resp::err(ErrCode::pay_firstpaygetted);
-//        } elseif (!$privateState->firstPayGift) { //  如果尚未完成首付
-//            $resp = Resp::err(ErrCode::pay_firstpayno_err);
-//        } else {
-//            $itemModel = ConstProc::getGoodsItemConst(ITEM_FIRSTPAY);
-////  检测首付礼包是否存在
-//            if ($itemModel == null) {
-//                $resp = Resp::err(ErrCode::err_const_no);
-//            } else {
-//                unset($privateState->firstPayGift); # .剔除首付标志
-//                StoreProc::addSeprateItem($itemModel, $req); #  .发放首付礼包
-//                $result = array(# 把玩家最新的仓库数据发给客户端
-//                    'store' => $map->store,
-//                );
-//// 7.回送成功信息
-//                $resp = Resp::ok($result);
-//// 成就触发--获取金币
-//                AchievementProc::dealAchievementState($req, $resp, AchievementProc::Gold);
-//                UserProc::updateUserInfo($req); # 更新玩家数据
-//            }
-//        }
-//
-//        return $resp;
-//    }
-//
-//    /**
-//     * 获取黄钻新手礼包
-//     * @param Req $req
-//     * @return type
-//     */
-//    public static function getVipNewerGift($req) {
-//        $user = $req->userInfo->game->user;
-//        $map = $req->userInfo->game->map;
-//        $privateState = $req->userInfo->game->privateState;
-////客户端参数解析
-//        $itemId = ITEM_VIPNEWER;  # 新手礼包是个常量
-//        $item = ConstProc::getGoodsItemConst($itemId);
-//
-//        $isYellowYear = $user->is_yellow_year_vip;
-//        $itemYear = null;
-//        if ($isYellowYear) {
-//            $itemIdYear = ITEM_YEARVIPNEWER;
-//            $itemYear = ConstProc::getGoodsItemConst($itemIdYear);
-//            if ($itemYear == null) {
-//                $resp = Resp::err(ErrCode::err_const_no);
-//                return;
-//            }
-//        }
-////1.检测是否存在道具的常量数据
-//        if ($item == null) {
-//            $resp = Resp::err(ErrCode::err_const_no);
-//        } else {//2.检测是否可以领取黄钻新手礼包
-//            if (!WebPayProc::tryVipNewerGift($user, $privateState)) {
-//                $resp = Resp::err(ErrCode::pay_vipnewerno);
-//            } else {
-//                StoreProc::addSeprateItem($item, $req);
-//                if ($itemYear) {
-//                    StoreProc::addSeprateItem($itemYear, $req);
-//                }
-//                $result = array(
-//                    'store' => $map->store,
-//                );
-//                $resp = Resp::ok($result); # 返回值
-////成就触发--获取金币
-//                AchievementProc::dealAchievementState($req, $resp, AchievementProc::Gold);
-//                UserProc::updateUserInfo($req); # 回写数据
-//            }
-//        }
-//        return $resp;
-//    }
-//
-//    /**
-//     * 开通包月送礼包
-//     * @param Req $req
-//     */
-//    public static function getVipOpenGift($req) {
-//        $mem = $req->mem;
-//        $v3 = CV3Init();
-////客户端参数解析
-//        $openid = $req->uid;
-//        $openkey = $req->paras[0];
-//        $pf = $req->paras[1];
-//        $pfkey = $req->paras[2];
-//
-//        $ts = now();
-//        $v3Ret = $v3->pay_gift_get_token($openid, $openkey, $pf, $pfkey, "1", ACT_VIP_OPEN, $ts);
-//        if ($v3Ret->ret == 1001) {
-//            $resp = Resp::err($v3Ret->ret);
-//            $resp->result = $v3Ret->msg;
-//        } elseif ($v3Ret->ret == 1099) {
-//            $resp = Resp::err(ErrCode::pay_systembusy_err);
-//            $resp->result = $v3Ret->msg;
-//        } elseif ($v3Ret->ret != 0) {
-//            $resp = Resp::err(ErrCode::pay_systembusy_err);
-//            $resp->result = $v3Ret;
-//        } else {  //v3成功返回
-//            $tokenInfo = WebPayProc::getTokenInfo($mem, $req->zoneid, $openid);
-//            if ($tokenInfo == null) {
-//                $resp = Resp::err(ErrCode::user_no_err);
-//            } else {
-//                WebPayProc::insToken($tokenInfo, $v3Ret->token);
-//                WebPayProc::updateTokenInfo($mem, $req->zoneid, $openid, $tokenInfo);
-//// 开通包月送礼包活动号,腾讯分配
-//                $v3Ret->actid = ACT_VIP_OPEN;  // 将actid插入返回值中一块儿发送给客户端
-//                $v3Ret->zoneid = 0;            // fusionAPI 需要
-//                $resp = Resp::ok($v3Ret);
-//            }
-//        }
-//        $v3->close();
-//        return $resp;
-//    }
-//
-//    /**
-//     * 领取黄钻每日礼包
-//     * @param Req $req
-//     */
-//    public static function getVipDayGift($req) {
-//        $mem = $req->mem;
-//        $zoneid = $req->zoneid;
-//        $v3 = CV3Init();
-//        $user = $req->userInfo->game->user;
-////客户端参数解析
-//        $openid = $req->uid;
-//        $openkey = $req->paras[0];
-//        $pf = $req->paras[1];
-//        $pfkey = $req->paras[2];
-//
-//        $ts = now();
-//        CLog::giftlog("getVipDayGift $zoneid|$openid|$openkey|$pf");
-//        $v3Ret = $v3->pay_gift_get_token($openid, $openkey, $pf, $pfkey, "1", ACT_VIP_DAY, $ts, $zoneid - 1);
-//        if ($v3Ret->ret == 1001) {
-//            $resp = Resp::err($v3Ret->ret);
-//            $resp->result = $v3Ret->msg;
-//        } elseif ($v3Ret->ret == 1099) {
-//            $resp = Resp::err(ErrCode::pay_systembusy_err);
-//            $resp->result = $v3Ret->msg;
-//        } elseif ($v3Ret->ret != 0) {
-//            $resp = Resp::err(ErrCode::pay_systembusy_err);
-//            $resp->result = $v3Ret;
-//        } else {  //v3成功返回
-//            $tokenInfo = WebPayProc::getTokenInfo($mem, $zoneid, $openid);
-//            if ($tokenInfo == null) {
-//                $resp = Resp::err(ErrCode::user_no_err);
-//            } else {
-//                WebPayProc::insToken($tokenInfo, $v3Ret->token);
-//                if ($user->is_yellow_vip) {
-//                    WebPayProc::insToken($tokenInfo, $v3Ret->token . "-year");
-//                }
-//                WebPayProc::updateTokenInfo($mem, $zoneid, $openid, $tokenInfo);
-//                $v3Ret->actid = ACT_VIP_DAY;  //将actid 插入返回值中一块儿发送给客户端
-//                $resp = Resp::ok($v3Ret);
-//            }
-//        }
-//        $v3->close();
-//        return $resp;
-//    }
-//
-////  ----------------  --------------------
-//    /**
-//     * 领取黄钻升级礼包
-//     * @param type $user
-//     */
-//    public static function getVipLvGift($mem, & $user, &$map) {
-//        
-//    }
-//
-//    /**
-//     * 获取玩家token校验表
-//     * @param type $mem
-//     * @param int $zoneid
-//     * @param type $uid
-//     * @return type
-//     */
-//    public static function getTokenInfo($mem, $zoneid, $uid) {
-//        return $mem->get(MemKey_User::TokenInfo($zoneid, $uid));
-//    }
-//
-//    /**
-//     * 更新玩家token校验表
-//     * @param type $mem
-//     * @param int $zoneid
-//     * @param type $uid
-//     * @param type $tokenInfo
-//     */
-//    public static function updateTokenInfo($mem, $zoneid, $uid, $tokenInfo) {
-//        $mem->set(MemKey_User::TokenInfo($zoneid, $uid), $tokenInfo);
-//    }
-//
-//    /**
-//     * 新增token
-//     * @param type $mem
-//     * @param type $oid
-//     * @param type $token
-//     */
-//    public static function insToken(& $tokenInfo, $token) {
-//        $tokenInfo->$token = now();
-//    }
-//
-//    /**
-//     * 读取token
-//     * @param type $mem
-//     * @param type $oid
-//     * @param type $token
-//     * @return null
-//     */
-//    public static function getToken($tokenInfo, $token) {
-//        if (!CommUtil::isPropertyExists($tokenInfo, $token)) {
-//            return null;
-//        } else {
-//            return $tokenInfo->$token;
-//        }
-//    }
-//
-//    /**
-//     * 删除token
-//     * @param type $mem
-//     * @param type $oid
-//     * @param type $token
-//     */
-//    public static function delToken(& $tokenInfo, $token) {
-//        if (CommUtil::isPropertyExists($tokenInfo, $token)) {
-//            unset($tokenInfo->$token);
-//        }
-//    }
-//
-//    /**
-//     * 添加付费道具到挂起列表
-//     * @param CMemBase $mem
-//     * @param int $zoneid
-//     * @param string $uid
-//     * @param type $itemId
-//     */
-//    public static function addPayStoreItem($mem, $zoneid, $uid, $itemId) {
-//        $payStore = $mem->get(MemKey_User::PayOrders($zoneid, $uid));
-//        if ($payStore == null) {
-//            $payStore = ArrayInit();
-//        }
-//        $payStore[] = $itemId;
-//        $mem->set(MemKey_User::PayOrders($zoneid, $uid), $payStore);
-//    }
-//
-//    /**
-//     * 添加营销礼包到挂起列表
-//     * @param CMemBase $mem
-//     * @param int $zoneid
-//     * @param string $uid
-//     * @param type $itemId
-//     */
-//    public static function addGiftStoreItem($mem, $zoneid, $uid, $itemId) {
-//        $giftStore = $mem->get(MemKey_User::GiftStore($zoneid, $uid));
-//        CLog::pay("WebGift addGiftStoreItem1 giftStore:$giftStore|itemId:$itemId|oid:$uid");
-//        if ($giftStore == null) {
-//            $giftStore = ArrayInit();
-//        }
-//        $giftStore[] = $itemId;
-//        CLog::pay("WebGift addGiftStoreItem1 giftStore:$giftStore|itemId:$itemId|oid:$uid");
-//        $mem->set(MemKey_User::GiftStore($zoneid, $uid), $giftStore);
-//    }
-//
-//    /**
-//     * 刷新挂起列表中的付费道具到仓库
-//     * @param Req $req
-//     */
-//    public static function refreshPayStoreItem($req) {
-//        $mem = $req->mem;
-//        $oid = $req->uid;
-//        $privateState = $req->userInfo->game->privateState;
-//
-//        $payGodpetItems = ArrayInit();
-//        $payStore = $mem->get(MemKey_User::PayOrders($req->zoneid, $oid));
-//        if ($payStore != null) {
-//            foreach ($payStore as $payItemId) {
-//                $itemModel = ConstProc::getGoodsItemConst($payItemId);
-//                if ($itemModel != null) {
-//                    $payGodpetItems[] = $payItemId;
-//                    if (CommUtil::isPropertyExists($privateState, "firstPayGift") //
-//                            && !$privateState->firstPayGift) {
-//                        $privateState->firstPayGift = true;
-//                    }
-//                    $properties = JsonUtil::decode($itemModel->properties);
-//                    if (CommUtil::isPropertyExists($properties, "isActive")) {
-//                        $activeList = $privateState->activeList;
-//                        $activeId = $properties->isActive;
-//                        $activeList[] = $activeId;
-//                        $privateState->activeList = $activeList;
-//                    }
-//                    StoreProc::addSeprateItem($itemModel, $req);
-//                }
-//            }
-//            $mem->delete(MemKey_User::PayOrders($req->zoneid, $oid));
-//        }
-//        return $payGodpetItems;
-//    }
-//
-//    /**
-//     * 刷新挂起列表中的营销礼包到仓库
-//     * @param Req $req
-//     */
-//    public static function refreshGiftStoreItem($req) {
-//        $oid = $req->uid;
-//        $mem = $req->mem;
-//        $giftStore = $mem->get(MemKey_User::GiftStore($req->zoneid, $oid));
-//        CLog::pay("WebGift refreshGiftStoreItem giftStore:$giftStore|oid:$oid");
-//
-//        if ($giftStore != null) {
-//            foreach ($giftStore as $giftItemId) {
-//                $itemModel = ConstProc::getGoodsItemConst($giftItemId);
-//                CLog::pay("WebGift refreshGiftStoreItem2 giftItemId:$giftItemId");
-//
-//                if ($itemModel != null) {
-//                    StoreProc::addSeprateItem($itemModel, $req);
-//                } else {
-//                    CLog::pay("WebGift refreshGiftStoreItem3 ERR giftItemId:$giftItemId");
-//                }
-//            }
-//            $mem->delete(MemKey_User::GiftStore($req->zoneid, $oid));
-//        }
-//    }
-//
-//    /**
-//     * 尝试领取黄钻新手礼包
-//     * @param type $user
-//     * @param type $privateState
-//     * @return boolean
-//     */
-//    public static function tryVipNewerGift($user, &$privateState) {
-////1.检查是否为黄钻
-//        if ($user->is_yellow_vip) {
-//# //2.检查是否含有新手礼包标志
-//            if (CommUtil::isPropertyExists($privateState, "vipNewerGift")) {
-//                if ($privateState->vipNewerGift) {# //3.检查是否能够领取
-//                    unset($privateState->vipNewerGift); # //4.剔除新手礼包标志
-//                    return true; //5.返回成功
-//                }
-//            }
-//        }
-//        return false;
-//    }
-//
-//    /**
-//     * 尝试领取黄钻每日礼包
-//     * @param type $user
-//     * @param type $privateState
-//     * @return boolean
-//     */
-//    public static function tryVipDayGift($user, &$privateState) {
-//        if ($user->is_yellow_vip) {//1.检查是否为黄钻
-//            if (CommUtil::isPropertyExists($privateState, "vipDayGift")) {//2.检查黄钻礼包标志是否为真
-//                if ($privateState->vipDayGift) {//3.检查是否能够领取
-//                    $privateState->vipDayGift = false; //4.修改黄钻每日礼包标志
-//                    return true; //5.返回成功
-//                }
-//            }
-//        }
-//        return false;
-//    }
-//
-//    /**
-//     * 客户端确认支付
-//     * @param type $req
-//     * @return \ResponseVo
-//     */
-//    public static function confirmPay($req, $v3) {
-//        $paydb = CPayInit();
-//        $openid = $req->uid; //客户端参数解析
-//        $billArray = $paydb->fetch_array(sprintf(self::PAY_BILL_SELECT, $openid));
-//        if (count($billArray) > 0) {
-//            foreach ($billArray as $billRecord) {
-//                $id = $billRecord['id'];
-//                $ts = now();
-//                $payitem = $billRecord['payitem'];
-//                $token = $billRecord['token'];
-//                $billno = $billRecord['billno'];
-//                $amt = $billRecord['amt'];
-//                if (GAME_ONLINE) {
-//                    $ret = $v3->pay_confirm_delivery($openid, $openkey, $pf, $ts, //
-//                            $payitem, $token, $billno, $amt);
-//                    if ($ret->ret == 0 || $ret->ret == 1069) {// 订单确认的情况
-//                        $dbRet = $paydb->query(sprintf(self::PAY_BILL_DELETE, $id));
-//                        $sqlConfirm = sprintf(self::PAY_BILL_CONFIRM, $openid, $billno, $amt, $payitem, $token);
-//                        $dbRet = $paydb->query($sqlConfirm); // 写订单支付日志
-//                        $log = $billno . "|" . $ret->msg . "[" . $openid . "]已确认支付!";
-//                        $dbRet = WebPayProc::_paylog($paydb, $log);
-//                    }// 订单丢失的情况
-//                    else if ($ret->ret == 1060 || $ret->ret == 1063 || $ret->ret == 1068) {
-//                        $dbRet = $paydb->query(sprintf(self::PAY_BILL_DELETE, $id));
-//                        $sqlLost = sprintf(self::PAY_BILL_LOST, $openid, $billno, $amt, $payitem, $token, $ret->msg);
-//                        $dbRet = $paydb->query($sqlLost); // 写订单支付日志
-//                        $log = $billno . "|" . $ret->msg . "[" . $openid . "]已确认丢失!";
-//                        $dbRet = WebPayProc::_paylog($paydb, $log);
-//                    }
-//                } else {
-//                    $dbRet = $paydb->query(sprintf(self::PAY_BILL_DELETE, $id));
-//                    $sqlConfirm = sprintf(self::PAY_BILL_CONFIRM, $openid, $billno, $amt, $payitem, $token);
-//                    $dbRet = $paydb->query($sqlConfirm); // 写订单支付日志
-//                    $log = $billno . "|" . $ret->msg . "[" . $openid . "]已确认支付!";
-//                    $dbRet = WebPayProc::_paylog($paydb, $log);
-//                }
-//            }
-//        }
-//        $paydb->close();
-//    }
-//
-//    /**
-//     * 插入日志
-//     * @param CDBUtil $paydb
-//     * @param string $log
-//     * @return mixed
-//     */
-//    static function _paylog($paydb, $log) {
-//        return $paydb->query(sprintf(self::PAY_LOG_INSERT, $log));
-//    }
-//
-//    /**
-//     * 获取指定道具的图片Url
-//     * @param GoodsItemModel $item
-//     * @return String 返回字符串
-//     */
-//    private static function _getGoodsImgUrl($item) {
-//        return CDN_HOST . "res/yuanbao3.png";
-//    }
-//
-//}

+ 0 - 558
Gameserver/App/process/PayProc/del_YYBPay.php

@@ -1,558 +0,0 @@
-<?php
-
-//
-//
-//namespace loyalsoft;
-//
-///**
-// * Description of YYBPay
-// * @version
-// *          1.0.0 Created at 2016-4-20. by --gwang
-// * @author gwang (mail@wanggangzero.cn)
-// * @copyright © 2016-4-20, SJZ LoyalSoft Corporation & gwang. All rights reserved.
-// */
-//class YYBPay {
-////put your code here
-//}
-//
-///**
-// *  移动支付
-// * @history
-// *    1. m_pay m_AddUserCash ... 以 m_ 打头的函数是第一版, 完全按照应用宝官方要求托管游戏币的模式开发的.  * 2015年4月23日
-// *    2. mn_pay mn_AddUserCash ... 以 mn_ 打头的函数是第二版, 修改为伪托管模式,除了充值的时候跟腾讯通讯,其余时间自己管理游戏币:钻石. * 2015年7月23日
-// *    3. 第三版: 独立的游戏币<元宝>, 面向多渠道的充值模式, 拉起充值成功后, 给玩家发放元宝. 游戏内部消费元宝,钻石和金币.
-// *       可以用元宝购买金币和钻石.这一版在上面的PayProc中 * 2015年9月23日
-// *
-// */
-//class MobilePayProc {
-//
-//    /**
-//     * Sql语句移动支付插入一条log日志。
-//     * @var string
-//     */
-//    const SQL_M_LOG = "INSERT INTO `tab_mpaylog_%s` (zoneid,type,result,amt,balance,cash,giftedcash,chargedcash,source,oid,itemid) VALUES (%d,%d,%d,%d,%d,%d,%d,%d,'%s','%s','%s')";
-//
-//    /**
-//     * 【移动端】查询账户游戏币余额(v3)
-//     * @param Req $req
-//     * @param string $source 来源
-//     */
-//    public static function v3_m_get_Balance($req, $source = "") {
-//        if ($req->userInfo->isTest) {
-//            return Resp::myRetResponse($req, $req->userInfo->game->user);
-//        }
-//        $resp = new Resp();
-//        $sdkUser = $req->userInfo->sdkUserKey;
-//        $user = $req->userInfo->game->user;
-//// 客户端参数解析
-//        $openid = $req->uid;  // openid
-//        $zoneid = $req->zoneid;  // 分区Id
-//        $openkey = $sdkUser->access_token;  // openkey|accesstoken
-//        $pf = $sdkUser->pf;       // pf
-//        $pfkey = $sdkUser->pf_key;    // pfkey
-//        $paytoken = $sdkUser->pay_token;  // 手Q客户端获取,微信传空
-//        $v3 = CV3Init();
-//        $appid = V3_APPID;  # 支付模块,微信和手Q统一使用手Q的appid
-//        $ts = now();
-//        $v3PayRet = $v3->m_get_balance($sdkUser->platform, $openid, $openkey, $pf, $paytoken, $appid, $pfkey, $ts, $zoneid);
-//        $v3->close();
-//        $amt = 0;
-//        if ($v3PayRet->ret != 0) { //v3其他错误
-//            $resp = Resp::err($v3PayRet->ret);
-//            $resp->result = $v3PayRet;
-//        } else {
-//            $amt = $v3PayRet->save_amt - $user->charge_amt;  # 本次充值金额
-//            $user->cash = $v3PayRet->balance;
-//            $user->charge_amt = $v3PayRet->save_amt;  # 历史
-//
-//            $user->gift_cash = $v3PayRet->gen_balance;  // 赠送的宝石数量
-//            if ($amt > 0 # 充值金额大于0,且首付标志为false才可以   /* 其实腾讯有返 isfirstpay字段 */
-//                    && isset($req->userInfo->game->privateState->firstPayGift)   # 无此字段代表已经领取礼包
-//                    && !$req->userInfo->game->privateState->firstPayGift) {
-//                $req->userInfo->game->privateState->firstPayGift = true;
-//            }
-////            self::m_FixUserCash($req);  # 修复(特定)用户钻石数据(端午节系统邮件失误)
-//            UserProc::updateUserInfo($req); // 更新玩家数据信息
-//
-//            $resp = Resp::myRetResponse($req, $user); // 直接将$user的最新值返回给客户端
-//        }
-//        self::_mPayLog($zoneid, $openid, MLogType::Inquire, $v3PayRet->ret, #
-//                $amt, $user->yuanbao, $user->cash, $user->gift_cash, $user->charge_amt, $source);
-//        return $resp;
-//    }
-//
-//    /**
-//     * 【移动端】扣除游戏币购买道具(V3)
-//     * @param Req $req
-//     */
-//    public static function v3_m_pay($req) {
-//        $resp = new Resp();
-//        $user = $req->userInfo->game->user; # user引用
-//// 客户端参数解析
-//        $openid = $req->uid;  // openid
-//        $zoneid = $req->zoneid;   // 分区id
-//        $openkey = $req->paras[0];  // openkey|accesstoken
-//        $pf = $req->paras[1];       // pf
-//        $pfkey = $req->paras[2];    // pfkey
-//        $paytoken = $req->paras[3];  // 手Q客户端获取 微信传空
-//        $itemId = $req->paras[4];  // 道具ID
-//
-//        $v3 = CV3Init();
-//        $appid = V3_APPID;  # 支付模块,微信和手Q统一使用手Q的appid
-//        $ts = now();
-//        $itemModel = ConstProc::getGoodsItemConst($itemId);    // 取道具的常量数据
-//        if ($itemModel == null) { //1.检测是否存在道具的常量数据
-//            $resp = Resp::myErrResponse($req, ErrCode::err_const_no);
-//        } else {
-//            $prize = JsonUtil::decode($itemModel->prize); # 价格
-//            if (property_exists($prize, "c") && $prize->c > 0) {// 钻石购买
-//                $amt = self::_getItemCashPrize($itemModel); // 道具价格(钻石)
-//                $remark = $itemModel->name;
-//                if ($amt <= 0) {
-//                    $resp = Resp::myErrResponse($req, ErrCode::pay_vipnewerno);
-//                } else {
-//                    if ($req->userInfo->isTest) {   # 测试用,直接模拟一个支付返回值
-//                        $v3PayRet = json_decode(json_encode(array(
-//                            'ret' => 0,
-//                            'balance' => $user->cash -= $amt
-//                        )));
-//                    } else {
-//                        $v3PayRet = $v3->m_pay($req->userInfo->sdkUserKey->platform, #
-//                                $openid, $openkey, $pf, $paytoken, #
-//                                $appid, $pfkey, $ts, $zoneid, $amt, $itemId, $remark);
-//                    }
-//                    $v3->close();
-//                    if ($v3PayRet->ret == 1004) { // 余额不足
-//                        $resp = Resp::myErrResponse($req, ErrCode::notenough_cash_msg);
-//                    } elseif ($v3PayRet->ret != 0) { //v3其他错误
-//                        $resp = Resp::myErrResponse($req, $v3PayRet->ret);
-//                        $resp->result = $v3PayRet;
-//                    } else { // 发货
-//                        StoreProc::addSeprateItem($itemModel, $req); // 更新玩家游戏币余额
-//                        UserModel::set_Cash($user, $v3PayRet->balance); // 更新玩家数据信息
-//                        UserProc::updateUserInfo($req); // 直接将$user的最新值返回给客户端
-//                        $resp = Resp::myRetResponse($req, $user);
-//                    }
-//                    $source = "商城购买-" . $itemModel->name;
-//                    self::_mPayLog($req->zoneid, $req->uid, MLogType::Shop, $resp->err, #
-//                            $amt, $user->yuanbao, $user->cash, $user->gift_cash, $user->charge_amt, $source, $itemId);
-//                }
-//            }// 金币购买
-//            else if (CommUtil::isPropertyExists($prize, "g") && $prize->g > 0) {
-//                if ($req->userInfo->game->user->gold < $prize->g) {
-//                    $resp = Resp::myErrResponse($req, ErrCode::notenough_gold_msg);
-//                } else {// 发货
-//                    StoreProc::addSeprateItem($itemModel, $req); // 更新玩家金币余额
-//                    UserModel::Comsume_Gold($user, $prize->g); // 更新玩家数据信息
-//                    UserProc::updateUserInfo($req); // 直接将$user的最新值返回给客户端
-//                    $resp = Resp::myRetResponse($req, $user);
-//                }
-//            }// 除了金币和钻石以外还有荣誉点。
-//            else if (CommUtil::isPropertyExists($prize, "h") && $prize->h > 0) {
-//                if ($user->honour < $prize->h) {
-//                    $resp = Resp::myErrResponse($req, ErrCode::notenough_honour);
-//                } else {// 发货
-//                    StoreProc::addSeprateItem($itemModel, $req); // 更新玩家荣誉值余额
-//                    $user->honour -= $prize->h; // 更新玩家数据信息
-//                    UserProc::updateUserInfo($req); // 直接将$user的最新值返回给客户端
-//                    $resp = Resp::myRetResponse($req, $user);
-//                }
-//            }
-//        }
-//        return $resp;
-//    }
-//
-//    /**
-//     * 领取首付礼包
-//     * @param Req $req
-//     * @return Resp
-//     */
-//    public static function m_GetFirstPayGift($req) {
-//        $resp = new Resp();
-//        $privateState = $req->userInfo->game->privateState;
-//# 客户端参数解析
-//        $itemId = glc()->FirstPay_ItemId;
-////  如果已经领取首付礼包
-//        if (!CommUtil::isPropertyExists($privateState, "firstPayGift")) {
-//            $resp = Resp::myErrResponse($req, ErrCode::pay_firstpaygetted);
-//        } elseif ($req->userInfo->game->user->charge_amt <= 0) { //  如果尚未完成首付
-//            $resp = Resp::myErrResponse($req, ErrCode::pay_firstpayno_err);
-//        } else {
-//            $itemModel = ConstProc::getGoodsItemConst($itemId);  # 取物品常量
-//            if ($itemModel == null) {//  检测首付礼包是否存在
-//                $resp = Resp::myErrResponse($req, ErrCode::err_const_no);
-//            } else {
-//                unset($privateState->firstPayGift); # .剔除首付标志
-//                StoreProc::addSeprateItem($itemModel, $req); #  .发放首付礼包
-//                $result = array(# 把玩家最新的仓库数据发给客户端
-//                    'itemid' => $itemId
-//                );
-//// 7.回送成功信息
-//                $resp = Resp::myRetResponse($req, $result);
-//// 成就触发--获取金币
-//                AchievementProc::dealAchievementState($req, $resp, AchievementProc::Gold);
-//                UserProc::updateUserInfo($req); # 更新玩家数据
-//            }
-//        }
-//        return $resp;
-//    }
-//
-////-----------   以下是辅助方法     -------------
-//
-//    /**
-//     * 【移动端】调用V3函数给玩家账号直接增加(赠送)游戏币(钻石),
-//     *   赠送的游戏币不参与分成结算,若是造成收入损失,自负。
-//     * @param Req $req Description
-//     * @param type $amt 数量
-//     * @param string $source 来源
-//     */
-//    public static function v3_m_AddUserCash($req, $amt, $source = "") {
-//        $err = ErrCode::ok;
-//        if ($req->userInfo->isTest) {  // 跳过支付api
-//            $req->userInfo->game->user->cash += $amt;
-//            return $err;
-//        }
-//        if ($amt > 0) {// 防御,若是给出错误数值直接返回
-//            $user = $req->userInfo->game->user;
-//            $sdkUser = $req->userInfo->sdkUserKey;
-//// 参数准备
-//            $zoneid = $req->zoneid; # 分区Id
-//            $openid = $sdkUser->open_id;
-//            $openkey = $sdkUser->access_token;
-//            $pf = $sdkUser->pf;
-//            $paytoken = $sdkUser->pay_token;
-//            $pfkey = $sdkUser->pf_key;
-//
-//            $ts = now();
-//            $v3 = CV3Init();
-//            $appid = V3_APPID;  // 微信和QQ统一使用手Q的appId
-//            $v3PayRet = $v3->m_present($sdkUser->platform, $openid, $openkey, $pf, # 调用后台接口
-//                    $paytoken, $appid, $pfkey, #
-//                    $ts, $zoneid, PAY_PRESENTCASH_ACTID, PAY_PRESENTCSAH_GIFTID, $amt);
-//            $v3->close();
-//            if ($v3PayRet->ret != ErrCode::ok) { //v3其他错误
-//                $err = $v3PayRet->ret;
-//            } else {
-//                self::$m_billno = $v3PayRet->billno;  // 账单号,扣费后其他逻辑失败的话,调用取消扣费接口
-//// 更新玩家游戏币余额, 老版本的文档中有balance字段,新的没有说明
-//                if (isset($v3PayRet->balance)) {
-//                    UserModel::set_Cash($user, $v3PayRet->balance);
-//                } else {
-//                    UserModel::set_Cash($user, $user->cash + $amt);
-//                }
-//# 日志
-//                self::_mPayLog($req->zoneid, $req->uid, MLogType::Present, $err, #
-//                        $amt, $user->yuanbao, $user->cash, $user->gift_cash, $user->charge_amt, $source);
-//            }
-//        }
-//        return $err;
-//    }
-//
-//    /**
-//     * 【移动端】扣除玩家游戏币(V3)(Ps.发货逻辑最后执行此步骤)
-//     * @param Req $req Description
-//     * @param int $amt 扣除数量
-//     * @param string $source  (string)备注,扣除来源(模块)
-//     * @param string $itemid (option)相关物品id
-//     * @return int ErrCode
-//     */
-//    public static function v3_m_SaveUserCash($req, $amt, $source = "", $itemid = "0") {
-//        if ($req->userInfo->isTest) {  # 跳过腾讯api(子豪)
-//            $req->userInfo->game->user->cash -= $amt;
-//            return ErrCode::ok;
-//        }
-//        if ($amt <= 0) {  // 防御,数量不可能小于0
-//            return ErrCode::ok;
-//        }
-//
-//        $user = $req->userInfo->game->user;
-//        $sdkUser = $req->userInfo->sdkUserKey;
-//
-//        $v3 = CV3Init();
-//        $appid = V3_APPID;  # 支付模块,微信和手Q统一使用手Q的appid
-//        $ts = now();
-//        $zoneid = $req->zoneid;  // 分区Id
-//// 调用腾讯api
-//        $v3PayRet = $v3->m_pay($sdkUser->platform, $sdkUser->open_id, $sdkUser->access_token, $sdkUser->pf, //
-//                $sdkUser->pay_token, $appid, $sdkUser->pf_key, $ts, $zoneid, //
-//                $amt, $itemid, $source);
-//        $v3->close(); // 关闭
-//
-//        $err = ErrCode::ok;
-//        if ($v3PayRet->ret == 1004) { // 余额不足
-//            $err = ErrCode::notenough_cash_msg;
-//        } elseif ($v3PayRet->ret != 0) { //v3其他错误
-//            $err = $v3PayRet->ret;
-//        } else {
-//            self::$m_billno = $v3PayRet->billno;  // 账单号,扣费后其他逻辑失败的话,调用取消扣费接口
-//// 更新玩家游戏币余额, 老版本的文档中有balance字段,新的没有说明
-//            if (property_exists($v3PayRet, "balance")) {
-//                UserModel::set_Cash($user, $v3PayRet->balance);
-//            } else {
-//                UserModel::set_Cash($user, $user->cash - $amt);
-//            }
-//            $err = ErrCode::ok;
-//        }
-//        self::_mPayLog($zoneid, $req->uid, MLogType::Save, $err, #
-//                $amt, $user->yuanbao, $user->cash, $user->gift_cash, $user->charge_amt, $source);
-//        return $err;
-//    }
-//
-//    /**
-//     * 缓存一个账单号,如果代码执行过程中出现错误,直接取消扣除游戏币
-//     * 注意,若是逻辑不是在一次Request内完成的,那么次订单号需要进行存储
-//     * @var string
-//     */
-//    static $m_billno;
-//
-//    /**
-//     * 【移动端】取消扣除玩家游戏币(V3)
-//     * @param Req $req
-//     * @param UserModel $user
-//     * @param CstSDK_UserModel $sdkUser
-//     * @param int $amt
-//     * @return int
-//     */
-//    public static function v3_m_CancelConsumCash($req, $amt) {
-//        if ($req->userInfo->isTest) {  // 跳过腾讯api
-//            $user->cash += $amt;
-//            return ErrCode::ok;
-//        }
-//        $user = $req->userInfo->game->user;
-//        $sdkUser = $req->userInfo->sdkUserKey;
-//        $appid = V3_APPID;  # 支付模块,微信和手Q统一使用手Q的appid
-//        $ts = now();
-//        $zoneid = $req->zoneid;  # 分区Id
-//        $v3 = CV3Init();
-//        $v3PayRet = $v3->m_cancel_pay($sdkUser->platform, $sdkUser->open_id, $sdkUser->access_token, #
-//                $sdkUser->pf, $sdkUser->pay_token, $appid, $sdkUser->pf_key, $ts, //
-//                $zoneid, $amt, self::$m_billno);
-//        $v3->close(); // 关闭
-//        if ($v3PayRet->ret != 0) { //v3其他错误
-//            return $v3PayRet->ret;
-//        } else {
-//// 更新玩家游戏币余额, 老版本的文档中有balance字段,新的没有说明
-//            if (property_exists($v3PayRet, "balance")) {
-//                UserModel::set_Cash($user, $v3PayRet->balance);
-//            } else {
-//                UserModel::set_Cash($user, $user->cash + $amt);
-//            }
-//            return ErrCode::ok;
-//        }
-//    }
-//
-//    /**
-//     * 取物品的价格(钻石)
-//     * @param GoodsItemModel $itemModel
-//     */
-//    private static function _getItemCashPrize($itemModel) {
-//        $c = 0;
-//        $prize = JsonUtil::decode($itemModel->prize);
-//        if (CommUtil::isPropertyExists($prize, "c")) {
-//            $c = $prize->c;
-//        }
-//        return $c;
-//    }
-//
-//    /**
-//     * 插入一条记录
-//     * @param int $zoneid
-//     * @param string $oid
-//     * @param int $type
-//     * @param int $amt
-//     * @param int $balance
-//     * @param int $cash 钻石
-//     * @param int $giftedcash
-//     * @param int $chargedcash
-//     * @param int $source
-//     */
-//    public static function _mPayLog($zoneid, $oid, $type, $result, $amt, $balance, $cash, $giftedcash, $chargedcash, $source = "srcUnKnown", $itemid = "") {
-////        var_dump(func_get_args());
-////        CLogUtil::print_stack_trace();
-//        $month = date("Ym");
-//        $sql = sprintf(self::SQL_M_LOG, $month, $zoneid, $type, $result, $amt, $balance, $cash, $giftedcash, $chargedcash, $source, $oid, $itemid);
-//        $paydb = CPayInit();
-//        $paydb->query($sql);
-//        $paydb->close();
-//    }
-//
-//// ----------------new pay proc -------------------------
-////  腾讯支付修改版,不再让钻石存储在腾讯端
-//
-//    /**
-//     * 【移动端】取消扣除玩家游戏币,无v3调用
-//     * @param Req $req
-//     * @param UserModel $user
-//     * @param CstSDK_UserModel $sdkUser
-//     * @param int $amt
-//     * @return int
-//     */
-//    public static function mn_CancelConsumCash($req, $amt) {
-//        $err = ErrCode::ok;
-//        $user = $req->userInfo->game->user;
-//        $zoneid = $req->zoneid;  # 分区Id
-//        if ($amt > 0) { // 更新玩家游戏币余额, 老版本的文档中有balance字段,新的没有说明
-//            UserModel::set_Cash($user, $user->cash + $amt);
-//# 记录日志
-//            self::_mPayLog($zoneid, $user->oId, MLogType::Present, $err, $amt, $user->yuanbao, #
-//                    $user->cash, $user->gift_cash, $user->charge_amt, "<取消订单>" . self::$m_billno);
-//        }
-//        return $err;
-//    }
-//
-//    /**
-//     * 【移动端】扣除玩家游戏币,无V3调用(Ps.发货逻辑最后执行此步骤)
-//     * @param Req $req Description
-//     * @param int $amt 扣除数量
-//     * @param string $source  (string)备注,扣除来源(模块)
-//     * @param string $itemid (option)相关物品id
-//     * @return int ErrCode
-//     */
-//    public static function mn_SaveUserCash($req, $amt, $source = "", $itemid = "0") {
-//        $err = ErrCode::ok;
-//        if ($amt > 0) {  // 防御,数量不可能小于0
-//            $user = $req->userInfo->game->user;
-//            $zoneid = $req->zoneid;  // 分区Id
-//            if ($user->cash < $amt) { // 余额不足
-//                $err = ErrCode::notenough_cash_msg;
-//            } else {// 更新玩家游戏币余额
-//                UserModel::set_Cash($user, $user->cash - $amt);
-//                self::$m_billno = date("Y-m-d H:i:is");
-//            }
-//            self::_mPayLog($zoneid, $req->uid, MLogType::Save, $err, #
-//                    $amt, $user->yuanbao, $user->cash, $user->gift_cash, $user->charge_amt, $source);
-//        }
-//        return $err;
-//    }
-//
-//    /**
-//     * 【移动端】给玩家账号直接增加(赠送)游戏币(钻石)(无V3),
-//     *   赠送的游戏币不参与分成结算,若是造成收入损失,自负。
-//     * @param Req $req Description
-//     * @param type $amt 数量
-//     */
-//    public static function mn_AddUserCash($req, $amt, $source = "") {
-//        $err = ErrCode::ok;
-//        if ($amt > 0) {// 防御,若是给出错误数值直接返回
-//            $user = $req->userInfo->game->user;
-//            UserModel::set_Cash($user, $user->cash + $amt);
-//            if ($user->cash < 0) {
-//                # 输出日志-wqq
-//            }
-//# 记录日志
-//            self::_mPayLog($req->zoneid, $req->uid, MLogType::Present, $err, #
-//                    $amt, $user->yuanbao, $user->cash, $user->gift_cash, $user->charge_amt, $source);
-//        }
-//        return ErrCode::ok;
-//    }
-//
-////    /**
-////     * 【移动端】扣除游戏币购买道具
-////     * @param RequestVo $req
-////     */
-////    static function mn_pay($req) {
-////        $resp = new ResponseVo();
-////        $user = $req->userInfo->user; # user引用
-////// 客户端参数解析
-////        $itemId = $req->paras[4];  // 道具ID
-////
-////        $itemModel = ConstProc::getItemConst($req->mem, $itemId);    // 取道具的常量数据
-////        if ($itemModel == null) { //1.检测是否存在道具的常量数据
-////            $resp = ResponseVo::myErrResponse($req, ErrCode::err_msg_itemnoconst);
-////        } else {
-////            $prize = JsonUtil::decode($itemModel->prize); # 价格
-////            if (property_exists($prize, "c") && $prize->c > 0) {// 钻石购买
-////                $amt = self::_getItemCashPrize($itemModel); // 道具价格(钻石)
-////                if ($amt <= 0) {
-////                    $resp = ResponseVo::myErrResponse($req, ErrCode::err_pay_vipnewerno);
-////                } else {
-////                    if ($user->cash < $amt) { // 余额不足
-////                        $resp = ResponseVo::myErrResponse($req, ErrCode::err_msg_cashnotenough);
-////                    } else { // 发货
-////                        StoreProc::addSeprateItem($itemModel, $req); // 更新玩家游戏币余额
-////                        UserModel::set_Cash($user, $user->cash - $amt); // 更新玩家数据信息
-////                        UserProc::updateUserInfo($req); // 直接将$user的最新值返回给客户端
-////                        $resp = ResponseVo::myRetResponse($req, $user);
-////# 记录日志
-////                        $source = "商城购买-" . $itemModel->name;
-////                        self::_mPayLog($req->zoneid, $req->oid, MLogType::Shop, $resp->err, #
-////                                $amt, $user->yuanbao, $user->cash, $user->gift_cash, $user->charge_amt, $source, $itemId);
-////                    }
-////                }
-////            }// 金币购买
-////            else if (CommUtil::isPropertyExists($prize, "g") && $prize->g > 0) {
-////                if ($req->userInfo->user->gold < $prize->g) {
-////                    $resp = ResponseVo::myErrResponse($req, ErrCode::err_msg_goldnotenough);
-////                } else {// 发货
-////                    StoreProc::addSeprateItem($itemModel, $req); // 更新玩家金币余额
-////                    UserModel::Comsume_Gold($user, $prize->g); // 更新玩家数据信息
-////                    UserProc::updateUserInfo($req); // 直接将$user的最新值返回给客户端
-////                    $resp = ResponseVo::myRetResponse($req, $user);
-////                }
-////            }// 除了金币和钻石以外还有荣誉点。
-////            else if (CommUtil::isPropertyExists($prize, "h") && $prize->h > 0) {
-////                if ($user->honour < $prize->h) {
-////                    $resp = ResponseVo::myErrResponse($req, ErrCode::err_msg_honournotenough);
-////                } else {// 发货
-////                    StoreProc::addSeprateItem($itemModel, $req); // 更新玩家荣誉值余额
-////                    $user->honour-=$prize->h; // 更新玩家数据信息
-////                    UserProc::updateUserInfo($req); // 直接将$user的最新值返回给客户端
-////                    $resp = ResponseVo::myRetResponse($req, $user);
-////                }
-////            }
-////        }
-////        return $resp;
-////    }
-////
-////    /**
-////     * 【移动端】查询账户游戏币余额
-////     * @history
-////     *      2015-7-6 改动思路, 不直接拿api返回值中的balance更新玩家的钻石余额,
-////     *               采用计算相对值的方法计算距离上次更新,玩家是否有新的充值,
-////     *               $amt>0,则代表有新的充值,将$amt更新到玩家账户.
-////     * @param RequestVo $req
-////     * @param string $source 来源
-////     */
-////    static function mn_get_Balance($req, $source = "") {
-////        if ($req->userInfo->isTest) {
-////            return ResponseVo::myRetResponse($req, $req->userInfo->user);
-////        }
-////        $resp = new ResponseVo();
-////        $sdkUser = $req->userInfo->sdkUserKey;
-////        $user = $req->userInfo->user;
-////// 客户端参数解析
-////        $openid = $req->oid;  // openid
-////        $zoneid = $req->zoneid;  // 分区Id
-////        $openkey = $sdkUser->access_token;  // openkey|accesstoken
-////        $pf = $sdkUser->pf;       // pf
-////        $pfkey = $sdkUser->pf_key;    // pfkey
-////        $paytoken = $sdkUser->pay_token;  // 手Q客户端获取,微信传空
-////        $v3 = CV3Init();
-////        $appid = V3_APPID;  # 支付模块,微信和手Q统一使用手Q的appid
-////        $ts = TimeUtil::tsCurrent();
-////        $v3PayRet = $v3->m_get_balance($sdkUser->platform, $openid, $openkey, $pf, $paytoken, $appid, $pfkey, $ts, $zoneid);
-////        $v3->close();
-////        $amt = 0;
-////        if ($v3PayRet->ret != 0) { //v3其他错误
-////            $resp = ResponseVo::errResponse($req->oid, $req->msgid, $v3PayRet->ret);
-////            $resp->result = $v3PayRet;
-////        } else {
-////            $amt = $v3PayRet->save_amt - $user->charge_amt;  # 本次充值金额 = v3提供的历史充值金额 - 玩家记录的历史充值金额
-////            if ($amt > 0) {
-////                $user->cash +=$amt;  # $v3PayRet->balance;
-////                $user->charge_amt = $v3PayRet->save_amt;  # 更新历史充值金额
-////                $user->gift_cash = $v3PayRet->gen_balance;  // 赠送的宝石数量
-////                if (isset($req->userInfo->game->privateState->firstPayGift)   # 无此字段代表已经领取礼包
-////                        && !$req->userInfo->game->privateState->firstPayGift) {
-////                    $req->userInfo->game->privateState->firstPayGift = true;
-////                }
-////            }
-//////            self::m_FixUserCash($req);  # 修复(特定)用户钻石数据(端午节系统邮件失误)
-////            UserProc::updateUserInfo($req); // 更新玩家数据信息
-////            $resp = ResponseVo::myRetResponse($req, $user); // 直接将$user的最新值返回给客户端
-////        }
-////        self::_mPayLog($zoneid, $openid, MLogType::Inquire, $v3PayRet->ret, #
-////                $amt, $user->yuanbao, $user->cash, $user->gift_cash, $user->charge_amt, $source);
-////        return $resp;
-////    }
-//}

+ 0 - 297
Gameserver/App/process/ShopProc.php

@@ -1,297 +0,0 @@
-<?php
-
-//
-//namespace loyalsoft;
-//
-///**
-// * Description of ShopProc
-// * 商城
-// * @author gwang
-// * @version 1.0.0  Created.  2020.8.19 -gwang
-// */
-//class ShopProc {
-//
-//    /**
-//     * 逻辑分发
-//     * 所有的Proc中必须有这样一个方法
-//     */
-//    public static function procMain() {
-//        switch (req()->cmd) {
-//            case CmdCode::shop_limit_maininfo:
-//                return self::GetLimitMainInfo();
-//            case CmdCode::shop_limit_buy:
-//                return self::BuyLimitPackage();
-//            case CmdCode::shop_monthlyVIP_Info:
-//                return self::GetMonthlyVipInfo();
-//            case CmdCode::shop_monthlyVIP_Buy:
-//                return self::BuyMonthlyVip();
-//            case CmdCode::shop_getDaliySpecial:
-//                return self::GetDaliySpecial();
-//            case CmdCode::shop_getRechargeRebate:
-//                return self::GetRechargeRebate();
-//            case CmdCode::shop_dailyShopBuy:
-//                return self::dailyShopBuy();
-//            default:
-//                Err(ErrCode::cmd_err);
-//        }
-//    }
-//
-//    /**
-//     * 购买日常商城
-//     * @return type
-//     */
-//    public static function dailyShopBuy() {
-//        $itemid = req()->paras[0];
-//
-//        $mo = GameConfig::shop_daily_getItem($itemid);
-//        my_Assert($mo != null, ErrCode::err_const_no);
-//
-//        if($mo->pricetype == 1){
-//            my_Assert(ctx()->base(true)->cash >= $mo->price, ErrCode::notenough_cash_msg);
-//            ctx()->base(true)->Consume_Cash($mo->price);
-//        } else if($mo->pricetype == 2){
-//            my_Assert(ctx()->base(true)->gold >= $mo->price, ErrCode::notenough_gold_msg);
-//            ctx()->base(true)->Consume_Gold($mo->price);
-//        }
-//
-//        StoreProc::AddMultiItemInStore($mo->goods);
-//
-//        UserProc::updateUserInfo();
-//
-//        return Resp::ok(array("store" => ctx()->store(), "cash" => ctx()->baseInfo->cash,"gold"=> ctx()->base(true)->gold,));
-//    }
-//
-//
-//    /**
-//     * 限购礼包触发条件检测
-//     */
-//    public function checkLimitTsRandGiftTrigger($typeId, $para) {
-//        $arr = GameConfig::shop_limitTs_Type_getItemArray($typeId);
-//        my_Assert($arr != null, ErrCode::err_const_no);
-//        $giftId = 0;
-//
-//        $giftArr = array();
-//        foreach ($arr as $item) {
-//            if ($item->para <= $para) {
-//                if (!in_array($item->giftId, ctx()->shopdata->limitTsRewardsList)) {
-//                    $giftId = $item->giftId;
-//                    //$giftArr[] = $giftId;
-//                    //没有触发对应的礼包条件
-//                    if ($giftId == 0) {
-//                        continue;
-//                    }
-//                    //已经触发过了但是礼包还没有被领取
-//                    if (count(ctx()->store->triggerLimitTsGift) != 0) {
-//                        foreach (ctx()->store->triggerLimitTsGift as $val) {
-//                            if ($val->giftId == $giftId) {
-//                                continue;
-//                            }
-//                        }
-//                    }
-//
-//                    //触发对应的礼包条件。则将礼包id存储在
-//                    $gift = new Ins_Gift();
-//                    $gift->giftId = $giftId;
-//                    $gift->startTs = now();
-//                    $gift->endTs = now() + GameConfig::shop_limit_getItem($giftId)->limit_ts;
-//                    ctx()->store->triggerLimitTsGift[] = $gift;
-//                }
-//            }
-//        }
-//    }
-//
-//    public static function GetRechargeRebate() {
-//        return Resp::ok(array(
-//                    "shopdata" => ctx()->shopdata
-//        ));
-//    }
-//
-//    //
-//    public static function GetDaliySpecial() {
-//        return Resp::ok(array(
-//                    "shopdata" => ctx()->shopdata
-//        ));
-//    }
-//
-//    /*
-//     * 重置每日特惠信息
-//     */
-//
-//    static function resetDaliySpecialPackages() {
-//        if(!StlUtil::dictHasProperty(ctx()->shopdata, 'daliySpecialClear_ts')){
-//            ctx()->shopdata->daliySpecialClear_ts = now();
-//        }
-//
-//        if (ctx()->shopdata->daliySpecialClear_ts == 0) {
-//            ctx()->shopdata->daliySpecialClear_ts = now();
-//        }
-//        $curDay = TimeUtil::totalDays();
-//        $lastDay = TimeUtil::totalDays(ctx()->shopdata->daliySpecialClear_ts);
-//
-//        if ($curDay - $lastDay == 1 && TimeUtil::Hour(now()) > 5) {//TimeUtil::Hour(ctx()->shopdata->daliySpecialClear_ts) < 5
-//            ctx()->shopdata->daliySpecialClear_ts = now();
-//            ctx()->shopdata->daliySpecialPackages = array();
-//        } else if ($curDay - $lastDay > 1) {
-//            ctx()->shopdata->daliySpecialClear_ts = now();
-//            ctx()->shopdata->daliySpecialPackages = array();
-//        }
-//
-//        if (TimeUtil::totalDays(ctx()->shopdata->daliySpecialClear_ts) == TimeUtil::totalDays() #
-//                && TimeUtil::Hour(ctx()->shopdata->daliySpecialClear_ts) < 5 && TimeUtil::Hour(now()) > 5) {
-//            ctx()->shopdata->daliySpecialClear_ts = now();
-//            ctx()->shopdata->daliySpecialPackages = array();
-//        }
-//    }
-//
-//    /**
-//     * 获取月卡信息
-//     * @return type
-//     */
-//    public static function GetMonthlyVipInfo() {
-//        return Resp::ok(array(
-//                    "shopdata" => ctx()->shopdata
-//        ));
-//    }
-//
-//    /**
-//     * 购买月卡
-//     * @return type
-//     */
-//    public static function BuyMonthlyVip() {
-//        $packageId = req()->paras[0];                                            # 参数; 礼包id
-//        $shopdata = new Info_UserShop(ctx()->shopdata);
-//        $packageCfg = GameConfig::shop_monthVIP_getItem($packageId);
-//        my_Assert(null != $packageCfg, ErrCode::err_const_no);
-//        if ($packageCfg->subType == 4) {
-//            my_Assert($shopdata->monthlyVIP1_ts + $packageCfg->ExpireTs * 3600 * 24 < now(), ErrCode::shop_monthlyvip_buyed);
-//        } elseif ($packageCfg->subType == 5) {
-//            my_Assert($shopdata->monthlyVIP2_ts + $packageCfg->ExpireTs * 3600 * 24 < now(), ErrCode::shop_monthlyvip_buyed);
-//        }
-//        $err = StoreProc::AddMultiItemInStore($packageCfg->pri_reward);         # 发放一次性奖励
-//        my_Assert(ErrCode::ok == $err, $err);
-//        if ($packageCfg->subType == 4) {
-//            $shopdata->monthlyVIP1_ts = 3600 * 24 * (totalDays() + 1) - 1;
-//        } elseif ($packageCfg->subType == 5) {
-//            $shopdata->monthlyVIP2_ts = 3600 * 24 * (totalDays() + 1) - 1;
-//        }
-//
-//        EmailProc::SendMonthlyVIPDailyReward(req()->zoneid, req()->uid, $packageCfg->name, $packageCfg->daily_reward);
-//
-//        ctx()->shopdata = $shopdata;                             # 回写数据
-//        UserProc::updateUserInfo();
-//        $user = ctx();
-//        return Resp::ok(array(
-//                    "reward" => $packageCfg->pri_reward,
-//                    "shopdata" => $shopdata,
-//                    'gold' => $user->baseInfo->gold,
-//                    'cash' => $user->baseInfo->cash,
-//                    'tili' => $user->baseInfo->tili,
-//                    'store' => $user->store,
-//                    'hero' => $user->heros
-//        ));
-//    }
-//
-//    /**
-//     * 【7101】限购礼包主界面
-//     */
-//    public static function GetLimitMainInfo() {
-//        return Resp::ok(array(
-//                    "shopdata" => ctx()->shopdata
-//        ));
-//    }
-//
-//    /**
-//     * 【7102】 购买限购礼包
-//     */
-//    public static function BuyLimitPackage() {
-//        $packageId = req()->paras[0];                                            # 参数; 礼包id
-//        $shopdata = new Info_UserShop(ctx()->shopdata);
-//        $packageCfg = GameConfig::shop_limit_getItem($packageId);
-//        my_Assert(null != $packageCfg, ErrCode::err_const_no);
-//
-//        $arr = array();
-//        switch ((int) $packageCfg->subType) {
-//            case 1:
-//                $shopdata->purchasedDailyLimitPackages[] = $packageId;
-//                $arr = $shopdata->purchasedDailyLimitPackages;
-//                break;
-//            case 2:
-//                $shopdata->purchasedWeeklyLimitPackages[] = $packageId;
-//                $arr = $shopdata->purchasedWeeklyLimitPackages;
-//                break;
-//            case 3:
-//                $shopdata->purchasedMonthlyLimitPackages[] = $packageId;
-//                $arr = $shopdata->purchasedMonthlyLimitPackages;
-//                break;
-//            default:
-//                Err(ErrCode::err_innerfault);
-//        }
-//        $hasN = count(array_filter($arr, function ($val)use ($packageId) {
-//                    return $val == $packageId;
-//                }));
-//        my_Assert($hasN <= $packageCfg->limit_num, ErrCode::shop_limit_max);
-//        $itemid = explode(',', $packageCfg->reward)[0];                         # 奖励礼包Id
-//        $itemMO = GameConfig::item_package_getItem($itemid);
-//        my_Assert(null != $itemMO, ErrCode::err_const_no);
-//        $err = StoreProc::AddMultiItemInStore($itemMO->contents);               # 发放奖励
-//        my_Assert(ErrCode::ok == $err, $err);
-//        ctx()->shopdata = $shopdata;                             # 回写数据
-//        UserProc::updateUserInfo();
-//        $user = ctx();
-//        return Resp::ok(array(
-//                    "reward" => $itemMO->contents,
-//                    "shopdata" => $shopdata,
-//                    'gold' => $user->baseInfo->gold,
-//                    'cash' => $user->baseInfo->cash,
-//                    'tili' => $user->baseInfo->tili,
-//                    'store' => $user->store,
-//                    'hero' => $user->heros
-//        ));
-//    }
-//
-//    /**
-//     * 每日检查
-//     */
-//    static function DailyCheck() {
-//        CLog::info("shop-每日检查-清除每日/周限量礼包购买记录");
-//        $zoneid = req()->zoneid;
-//        $uid = req()->uid;
-//
-//        ctx()->privateState->battleReviveNum = 0;
-//
-//        $shopdata = new Info_UserShop(ctx()->shopdata);
-//
-//
-//        if (TimeUtil::Hour(now()) > 5) {
-//            $shopdata->dayRechargeAmt = 0; //每日每周限购累计金额统计字段重置
-//            $shopdata->dayRechargeReceived = array();
-//
-//            $shopdata->purchasedDailyLimitPackages = array();                   # 每天重置
-//        }
-//
-//        if (date("N") == 1 && TimeUtil::Hour(now()) > 5) {                      # 周一重置
-//            $shopdata->purchasedWeeklyLimitPackages = array();
-//            $shopdata->weekRechargeAmt = 0;
-//            $shopdata->weekRechargeReceived = array();
-//        }
-//        if (date("d") == 1 && TimeUtil::Hour(now()) > 5) {                      # 1号重置
-//            $shopdata->purchasedMonthlyLimitPackages = array();
-//        }
-//
-//        if ($shopdata->monthlyVIP1_ts + 30 * 24 * 3600 > now()) {
-//            $id = 901001;
-//            $card1 = GameConfig::shop_monthVIP_getItem($id);
-//            my_Assert(null != $card1, ErrCode::err_const_no);
-//            EmailProc::SendMonthlyVIPDailyReward($zoneid, $uid, $card1->name, $card1->daily_reward);
-//        }
-//        if ($shopdata->monthlyVIP2_ts + 30 * 24 * 3600 > now()) {
-//            $id = 901002;
-//            $card2 = GameConfig::shop_monthVIP_getItem($id);
-//            my_Assert(null != $card2, ErrCode::err_const_no);
-//            EmailProc::SendMonthlyVIPDailyReward($zoneid, $uid, $card2->name, $card2->daily_reward);
-//        }
-//
-//        ctx()->shopdata = $shopdata;
-//    }
-//
-//}

+ 0 - 592
Gameserver/App/process/SystemProc.php

@@ -1,592 +0,0 @@
-<?php
-
-//
-//namespace loyalsoft;
-//
-//// <editor-fold defaultstate="collapsed" desc="    定义   ">
-//
-///**
-// *   约定好的消息类型
-// */
-//class SysMessageType extends Enum {
-//
-//    /**  (1)XXX(玩家名称)解锁英雄XXX(紫色橙色英雄)  */
-//    const GetHero = 1;
-//
-//    /** (2)XXX(玩家名称)的英雄XXX(紫色橙色英雄)神血升值40%+(40%都有) */
-//    const Hero_purification = 2;
-//
-//    /** (3)XXX 获得XXX(紫色橙色装备) */
-//    const GetEquip = 3;
-//
-//    /** (4)XXX(玩家名称)购买公会钻石礼包 */
-//    const BuyGuild_CashPack = 4;
-//
-//    /** (5)XXX(玩家名称)升到XX级别(20级以上) */
-//    const UserLevelUp = 5;
-//
-//    /** (6)XXX(玩家名称)达到XX段位(黄金以上) */
-//    const PVP_League = 6;
-//
-//    /** (7) XXX(玩家名称)打败噩梦关八岐大蛇,获得铂金宝箱,可喜可贺!
-//     *  通过副本
-//     *  */
-//    const Pass_carbon = 7;
-//
-//    /** (4)装备-强化  */
-//    const Weapon_Promote = 4000;
-//
-//    /**
-//     * (99)玩家自己购买的全服消息(本分区)
-//     */
-//    const UserSendMessage = 99;
-//
-//    /**
-//     * 得到特定品阶的武器
-//     */
-//    const GetSpecialQualityWeapon = 10;
-//
-//    /**
-//     * 得到特定品阶的言灵
-//     */
-//    const GetSpecialQualityYanling = 11;
-//
-//    /**
-//     * 通关无尽塔第X层
-//     */
-//    const PassEndlessTower = 12;
-//
-//    /**
-//     * 完成X个悬赏任务数量
-//     */
-//    const CompleteSpecialNumXuanShangTask = 13;
-//
-//    /**
-//     * 获得X数量的言灵
-//     */
-//    const GetSpecialNumYanling = 14;
-//
-//    /**
-//     * 恭喜XXX消耗60点体力
-//     */
-//    const CostTili = 15;
-//
-//    /**
-//     * 恭喜XXX连续在线20分钟
-//     */
-//    const onlineGiftts = 16;
-//
-//}
-//
-///**
-// * 系统消息对象
-// */
-//class SysMessageModel extends Object_ext {
-//
-//    /** @var SysMessageType */
-//    public $type;
-//
-//    /** @var array 消息数据 */
-//    public $datas;
-//
-//    /** @var int */
-//    public $ts;
-//
-//}
-//
-////
-//// </editor-fold>
-//
-///**
-// * 系统消息逻辑处理流程
-// * @author gwang
-// */
-//class SystemProc {
-//
-//    /**
-//     * 系统消息的过期时间(秒)
-//     * @var int
-//     */
-//    const SYS_MSG_OUTTS = 3600;
-//
-//    /**
-//     * 主逻辑分发
-//     * @param type $req
-//     * @return type
-//     */
-//    static function procMain($req) {
-//        switch (req()->cmd) {
-//            case CmdCode::cmd_system_userSendsysmessage:                        # 6904 玩家发送系统广播
-//                return self::userPushSysMessage();
-//            case CmdCode::cmd_system_getsysmessage:                             # 6901 拉取系统消息
-//                return self::getSysMessage();
-//            case CmdCode::cmd_system_logreport:                                 # 6902 客户端上报日志
-//                return self::logReport();
-//            case CmdCode::cmd_system_clienttick:                                # 6903 客户端心跳包
-//                return self::clientTick();
-//            default :
-//                return Resp::err(ErrCode::cmd_err);
-//        }
-//    }
-//
-////
-//// <editor-fold defaultstate="collapsed" desc=" 暂时不管 ">
-////
-//
-//    /**
-//     * [6903] 客户端心跳包
-//     */
-//    static function clientTick() {
-//        $timespan = now() - ctx()->base()->lastSaveTs;
-//
-//        //$ts = now() - ctx()->privateData()->onlineGiftClearTs;
-//        if ($timespan < 300) {                                                  # 间隔超过5分钟的不算
-//            if ($timespan < 30) {                                               # 心跳包固定30秒1次
-//                $timespan = 30;
-//            }
-//            ctx()->privateData()->onlineGiftts += $timespan;
-//            ctx()->privateData()->onlineTs += $timespan;
-//            self::OnlineGifttsRecord(req()->zoneid, ctx()->baseInfo->name);
-//            UserProc::updateUserInfo();
-//        }
-//        return Resp::ok();
-//    }
-//
-//    /**
-//     * [6902] 客户端日志上报
-//     */
-//    static function logReport() {
-//        list($eventID, $EArgKey, $EArgValue) = req()->paras;                        # 客户端参数解析:
-//        $key = MemKey_GameRun::stat_clientReportLog($eventID);
-//        $logItem = array(#                                                      # 组装对象
-//            'uid' => req()->uid,
-//            'EArgKey' => $EArgKey,
-//            'EArgValue' => $EArgValue,
-//            'ts' => TimeUtil::dtCurrent()
-//        );
-//        gMem()->lpush($key, array($logItem));                                   # 压入日志
-////        $max = 300;
-////        $once = 30;
-////        if (gMem()->llen($key) > $max + $once) {                                # 达到清理条件
-////            gMem()->ltrim($key, 0, -$once);                                     # 缩减记录
-////        }
-//        return Resp::ok("copy!");
-//    }
-//
-////
-////
-//// </editor-fold>
-////
-//
-//    /**
-//     * 玩家通过xx副本消息
-//     * @param type $zoneid
-//     * @param Data_UserGame $user
-//     * @param int $carbonID
-//     *      */
-//    static function Carbon_Win($zoneid, $user, $carbonID, $hardLevel) {
-//        if (512001 == $carbonID) {
-//            self::pushSysMessage($zoneid, SysMessageType::Pass_carbon, array(
-//                $user->name, $carbonID, $hardLevel
-//            ));
-//        }
-//    }
-//
-//    /**
-//     * 玩家pvp段位消息
-//     * @param type $zoneid
-//     * @param Data_UserGame $user
-//     * @param int $leagueID
-//     *      */
-//    static function PVP_league($zoneid, $user, $leagueID) {
-//        if ($leagueID > 10) {
-//            self::pushSysMessage($zoneid, SysMessageType::PVP_League, array(
-//                $user->name, GameConfig::pvp_leaguescore_getItem($leagueID)->leagueName
-//            ));
-//        }
-//    }
-//
-//    /**
-//     * [6901]获取系统广播消息列表
-//     */
-//    static function getSysMessage() {
-//        //客户端参数解析
-//        $ts = req()->paras[0];                                                   # 消息列表有效时间戳
-//        $defaultwaitcont = 60;                                                  # 暂时使用60秒作为频率,若是有压力就调大些. 若是没有问题,可以调小些.
-//        $itemDisplayTime = 7;                                                   # 7秒显示完一条消息
-//
-//        $sysMessage = self::mem_getSysMsg_zset(req()->zoneid, $ts);
-//
-//        $count = count($sysMessage) * $itemDisplayTime;                         # 计算下次取消息的时间
-//        if ($count < $defaultwaitcont) {                                        # 最低刷新时间
-//            $count = $defaultwaitcont;
-//        }
-//        $ret = array(
-//            'sysMessage' => $sysMessage,
-//            'nextFetchTime' => $count
-//        );
-//
-//        return Resp::ok($ret);                                                  # 返回信息
-//    }
-//
-//    /**
-//     * [6904]玩家发送系统广播消息
-//     */
-//    static function userPushSysMessage() {
-//        list($msg, $type) = req()->paras;                                        # 提取参数: 消息内容, 消耗道具类型,1:钻石,2:xx
-//        $uid = req()->uid;
-//        $user = ctx();
-//        $cost = 0;                                                              // 花费
-//        switch ($type) {
-//            case 1:                                                             # 钻石
-//                $cost = glc()->SystemMessage_UserSendToMyZone_Cost;
-//                my_Assert($cost, ErrCode::err_msg_usersnedmsg_errorcost);
-//                my_Assert($user->base()->Consume_Cash($cost), ErrCode::notenough_cash_msg);
-//                break;
-//            default :
-//                Err(ErrCode::paras_err);                                        // 其他类型:参数非法
-//        }
-//        self::pushSysMessage(req()->zoneid, #
-//                SysMessageType::UserSendMessage, array($uid, $user->baseInfo->name, $msg));
-//        UserProc::updateUserInfo();                                             // 回存账号数据
-//        return Resp::ok(array('ret' => "succeed"));                             # 返回值
-//    }
-//
-//    // -----------------辅助方法---------------------
-//    //
-//
-//    /**
-//     * 得到特定品阶的武器
-//     * @param type $zoneid
-//     * @param type $name
-//     * @param type $weaponTypeId
-//     */
-//    static function GetSpecialQualityWeapon($zoneid, $name, $weaponTypeId) {
-//        $mo = GameConfig::item_base_getItem($weaponTypeId);
-//
-//        if ($mo->quality == 5) {
-//            $color = "紫色";
-//            self::pushSysMessage($zoneid, SysMessageType::GetSpecialQualityWeapon, array(
-//                $name, $color, $mo->name
-//            ));
-//        }
-//
-//        if ($mo->quality == 7) {
-//            $color = "橙色";
-//            self::pushSysMessage($zoneid, SysMessageType::GetSpecialQualityWeapon, array(
-//                $name, $color, $mo->name
-//            ));
-//        }
-//    }
-//
-//    /**
-//     * 得到特定品阶的言灵
-//     * @param type $zoneid
-//     * @param type $name
-//     * @param type $yanlingTypeId
-//     */
-//    static function GetSpecialQualityYanling($zoneid, $name, $yanlingTypeId) {
-//        $mo = GameConfig::item_base_getItem($yanlingTypeId);
-//
-//        if ($mo->quality == 5) {
-//            $color = "紫色";
-//            self::pushSysMessage($zoneid, SysMessageType::GetSpecialQualityYanling, array(
-//                $name, $color, $mo->name
-//            ));
-//        }
-//
-//        if ($mo->quality == 7) {
-//            $color = "橙色";
-//            self::pushSysMessage($zoneid, SysMessageType::GetSpecialQualityYanling, array(
-//                $name, $color, $mo->name
-//            ));
-//        }
-//    }
-//
-//    /**
-//     * 通关无尽塔第X层
-//     * @param type $zoneid
-//     * @param type $name
-//     * @param type $gateId
-//     */
-//    static function PassEndlessTower($zoneid, $name, $index) {
-//        $endlessTowerArr = array(10, 20, 30, 40, 50, 60, 70, 80, 90, 100);
-//        if (in_array($index, $endlessTowerArr)) {
-//            self::pushSysMessage($zoneid, SysMessageType::PassEndlessTower, array(
-//                $name, $index
-//            ));
-//        }
-//    }
-//
-//    /**
-//     * 完成X个悬赏任务数量
-//     * @param type $zoneid
-//     * @param type $name
-//     */
-//    static function CompleteSpecialNumXuanShangTask($zoneid, $name) {
-//        $arr = array(10, 20);
-//        if (in_array(ctx()->privateState->shopTaskCompleteNum, $arr)) {
-//            self::pushSysMessage($zoneid, SysMessageType::CompleteSpecialNumXuanShangTask, array(
-//                $name, ctx()->privateState->shopTaskCompleteNum
-//            ));
-//        }
-//    }
-//
-//    /**
-//     * 获得X数量的言灵
-//     * @param type $zoneid
-//     * @param type $name
-//     */
-//    static function GetSpecialNumYanling($zoneid, $name) {
-//        $arr = array(10, 20, 30, 40, 50);
-//        $yanling = ctx()->store->yanling;
-//        $num = count(StlUtil::dictToArray($yanling));
-//
-//        if (in_array($num, $arr)) {
-//            self::pushSysMessage($zoneid, SysMessageType::GetSpecialNumYanling, array(
-//                $name, $num
-//            ));
-//        }
-//    }
-//
-//    /**
-//     *
-//     * @param type $zoneid
-//     * @param type $name
-//     * @param type $useTili
-//     */
-//    static function CostTiliRecord($zoneid, $name, $useTili) {
-//        $arr = array(60, 120, 300);
-//        ctx()->privateData(true)->tiliRecord += abs($useTili);
-//
-//        if (in_array(ctx()->privateData(true)->tiliRecord, $arr)) {
-//            self::pushSysMessage($zoneid, SysMessageType::CostTili, array(
-//                $name, ctx()->privateData(true)->tiliRecord
-//            ));
-//        }
-//    }
-//
-//    /**
-//     * 恭喜XXX连续在线20分钟
-//     * @param type $zoneid
-//     * @param type $name
-//     */
-//    static function OnlineGifttsRecord($zoneid, $name) {
-//        $arr = array(1200, 1800, 3600);
-//        $onlineTs = ctx()->privateState->onlineTs;
-//        $ennVal = $onlineTs;
-//
-//        $tag = false;
-//        if (in_array($ennVal, $arr)) {
-//            $tag = true;
-//        }
-//
-//        if (!$tag) {
-//            $lastVal = 0;
-//            foreach ($arr as $time) {
-//                if ($ennVal < $time) {
-//                    break;
-//                }
-//                $lastVal = $time;
-//            }
-//
-//            if ($lastVal > 0 && $ennVal - $lastVal < 15) {
-//                $ennVal = $lastVal;
-//                $tag = true;
-//            }
-//        }
-//
-//        if ($tag) {
-//            ;
-//            self::pushSysMessage($zoneid, SysMessageType::onlineGiftts, array(
-//                $name, intval($ennVal / 60)
-//            ));
-//        }
-//    }
-//
-//    /**
-//     * 玩家升级消息
-//     * @param type $zoneid
-//     * @param Data_UserGame $user
-//     * @param int $newLevel
-//     *      */
-//    static function UserLevelUp($zoneid, $user, $newLevel) {
-//        if ($newLevel > 20) {
-//            self::pushSysMessage($zoneid, SysMessageType::UserLevelUp, array(
-//                $user->name, $newLevel
-//            ));
-//        }
-//    }
-//
-//    /**
-//     * 插入英雄升阶消息
-//     * @param int $zoneid
-//     * @param string $uid
-//     * @param string $name
-//     * @param string $heroname
-//     * @param int $level
-//     */
-//    static function insertHero_StageUp($zoneid, $uid, $name, $heroname, $level) {
-////        if ($level >= glc()->SystemMessage_HeroStage_Limit_Min) {
-////            self::pushSysMessage($zoneid, SysMessageType::GetEquip, array(
-////                $uid, $name, $heroname, $level
-////            ));
-////        }
-//    }
-//
-//    /**
-//     * 添加购买公会钻石礼包消息
-//     * @param type $zoneid
-//     * @param Data_UserGame $user
-//     * */
-//    static function BuyGuildCashPack($zoneid, $user) {
-//        self::pushSysMessage($zoneid, SysMessageType::BuyGuild_CashPack, array(
-//            $user->name
-//        ));
-//    }
-//
-//    /**
-//     * 添加获得装备消息
-//     * @param type $zoneid
-//     * @param Data_UserGame $user
-//     * @param int $equipModelId
-//     * @deprecated since version 0 待维修 --王刚2020年1月2日21:07:04
-//     *      */
-//    static function GetEquip($zoneid, $user, $equipModelId) {
-//        $equipModel = GameConfig::item_base_getItem($equipModelId);
-//        if ($equipModel && $equipModel->quality > 3) {                          # 紫色橙色装备
-//            self::pushSysMessage($zoneid, SysMessageType::GetEquip, array(
-//                $user->name, $equipModel->name
-//            ));
-//        }
-//    }
-//
-//    /**
-//     * 插入装备强化消息
-//     * @deprecated since version 1.0 装备强化暂不支持了
-//     * @param type $zoneid
-//     * @param type $uid
-//     * @param type $name
-//     * @param type $weaponname
-//     * @param type $level
-//     */
-//    static function insertWeapon_promoteUp($zoneid, $uid, $name, $weaponname, $level) {
-////        if ($level >= glc()->SystemMessage_WeaponLevel_Limit_Min) {
-////            self::pushSysMessage($zoneid, SysMessageType::Weapon_Promote, array(
-////                $uid, $name, $weaponname, $level
-////            ));
-////        }
-//    }
-//
-//////=================////
-//
-//    /**
-//     * 添加获得英雄消息
-//     * @param type $zoneid
-//     * @param Data_UserGame $user
-//     * @param int $heroId
-//     * @return int $err
-//     *      */
-//    static function GetHero($zoneid, $user, $heroId) {
-//        $heroModel = GameConfig::hero_getItem($heroId);
-//        if ($heroModel && $heroModel->zhenxidu > 3) {
-//            self::pushSysMessage($zoneid, SysMessageType::GetHero, array(
-//                $user->name, $heroModel->name
-//            ));
-//        }
-//    }
-//
-//    /**
-//     * 添加英雄血脉提纯消息
-//     * @param type $zoneid
-//     * @param Data_UserGame $user
-//     * @param int $heroId
-//     * @return int $err
-//     *      */
-//    static function Hero_purification($zoneid, $user, $heroId) {
-//        $heroModel = GameConfig::hero_getItem($heroId);
-//        if ($heroModel && $heroModel->zhenxidu > 3) {
-//            self::pushSysMessage($zoneid, SysMessageType::Hero_purification, array(
-//                $user->name, $heroModel->name
-//            ));
-//        }
-//    }
-//
-////
-//// <editor-fold defaultstate="collapsed" desc="    读写memdb   ">
-//
-//    /**
-//     * 取数据
-//     * @param int $zoneid
-//     * @return array
-//     */
-//    private static function mem_getSysMsg_zset($zoneid, $ts) {
-//        $ret = gMem()->zrangebyscore(MemKey_GameRun::Game_SysMsgByZone_zset($zoneid), $ts, now(+1));
-//        //todo:目前是在这里手动解码的, 应该移动到CRedisUtil里面去.
-//        $arr = ArrayInit();
-//        if ($ret) {
-//            foreach ($ret as $msg) {
-//                $arr[] = JsonUtil::decode($msg);
-//            }
-//        }
-//        return $arr;
-//    }
-//
-//    /**
-//     * 回写数据
-//     * @param int $zoneid
-//     * @param SysMessageModel $value
-//     */
-//    private static function mem_addSysMsg_zset($zoneid, $value) {
-//        $ts = $value->ts;
-//        $key = MemKey_GameRun::Game_SysMsgByZone_zset($zoneid);
-//        gMem()->zadd($key, array(json_encode($value) => $ts));                  # 插入消息
-//        gMem()->zremrangebyscore($key, 0, $ts - self::SYS_MSG_OUTTS);           # 清理过期数据
-//    }
-//
-//// </editor-fold>
-////
-//
-//    /**
-//     * 推送系统消息
-//     * @param int $zoneid 分区
-//     * @param SysMessageType $type enum
-//     * @param array $datas
-//     */
-//    static function pushSysMessage($zoneid, $type, $datas) {
-//        $newMsg = new SysMessageModel(array(#                                   # 添加新系统消息
-//            'type' => $type,
-//            'datas' => $datas,
-//            'ts' => now()
-//        ));
-//        self::mem_addSysMsg_zset($zoneid, $newMsg);                             # 写入mem
-//    }
-//
-//// <editor-fold defaultstate="collapsed" desc=" 备用 需修改">
-//
-//    /**
-//     * 添加中奖消息
-//     * @param UserModel $user
-//     * @param int $itemId
-//     * @param string $src 来源: 砸木桶,砸金蛋,公会抽奖,开宝箱,蛋蛋忧伤,...
-//     * @return int $err
-//     *      */
-//    static function insertLotterySysMessage($zoneid, $user, $itemId, $src) {
-//        throw new \Exception("need reimplement");
-//        // 向系统消息区域发送中奖消息.
-//
-//        $broadCastIDs = glc()->broadCastIDs;
-//        if ($broadCastIDs == null) {                                            # 需要广播的道具ID
-//            $err = ErrCode::err_msg_buildrewardnoconst;
-//        } else {
-//            $broadItemArray = JsonUtil::decode($broadCastIDs->content);
-//            if (CommUtil::isPropertyExists($broadItemArray, $itemId)) {# 如果是测试的话,将所有中奖物品加入到系统消息中
-//                self::pushSysMessage($zoneid, SysMessageType::GetHero, #
-//                        array($user->oid, $user->name, $itemId, $src));
-//            }
-//        }
-//        return $err;
-//    }
-//
-//// </editor-fold>
-//}