浏览代码

代码清理

gwang 5 年之前
父节点
当前提交
fb85bdb9e0

+ 1 - 1
Gameserver/Amfphp/base/MemKey_User.php

@@ -53,7 +53,7 @@ class MemKey_User {
      * @param string $uid
      * @return string json
      */
-    public static function Union_PublicState_normal($uid) {
+    public static function Union_PublicState_hash($uid) {
         return self::bUseShort() ? 'u-' . $uid . '-p' : 'user-' . $uid . '-public';
     }
 

+ 0 - 57
Gameserver/Amfphp/model/User/HeroManualModel.php

@@ -1,57 +0,0 @@
-<?php
-
-namespace loyalsoft;
-
-/**
- * 《神兽宝鉴》
- * 玩家的《神兽宝鉴》点亮了多少图标
- */
-class HeroManualModel
-{
-
-    /**
-     * 《玩家宝鉴》的成长度(经验)
-     * 获得新的神兽(蛋)或者神兽升阶的时候增加成长度
-     * @var type
-     */
-    public $exp = 0;
-
-    /**
-     * 神兽图鉴序列
-     * @var stdClass {30100" : [0], "30101" : [0, 1, 2]}
-     */
-    public $godpetDic;
-
-    /**
-     * 神兽星星记录
-     * @var obj {30100" : [0], "30101" : [0, 1, 2]}
-     */
-    public $godpetStarDic;
-
-    /**
-     * 已经领取的奖励记录
-     * @var stdClass {30100" : [0], "30101" : [0, 1, 2]}
-     */
-    public $rewarded;
-
-    /**
-     * 属性套装
-     * @var obj {elements:{e:3,f:3,w:0},extra:{a,d,h,s}}
-     */
-    public $attributeSuits;
-
-    /**
-     * 星套套装
-     * @var obj  {elements:{e:3,f:3,w:0},extra:{a,d,h,s}}
-     */
-    public $starSuits;
-
-    function initInstance()
-    {
-        $this->godpetDic = ObjectInit();
-        $this->rewarded = ObjectInit();
-        $this->attributeSuits = ObjectInit();
-        $this->starSuits = ObjectInit();
-    }
-
-}

+ 0 - 151
Gameserver/Amfphp/model/User/HeroModel.php

@@ -1,151 +0,0 @@
-<?php
-
-namespace loyalsoft;
-
-/**
- * 玩家英雄数据模块
- * 模板数据
- * @author gwang
- */
-class HeroModel
-{
-
-    /**
-     * 英雄原型数据编号
-     * @var string
-     */
-    public $heroId;
-
-    /**
-     *
-     * @var string
-     */
-    public $name;
-
-    /**
-     * 元素
-     */
-    public $yuansu;
-
-    /**
-     * 职业类别
-     */
-    public $zhiye;
-
-    #region  战斗使用属性
-
-    /**
-     * 生命值
-     */
-    public $hp;
-
-    /**
-     *  攻击
-     */
-    public $gongji;
-
-    /**
-     *  魔防御
-     */
-    public $fangyu;
-
-    /**
-     *  敏捷
-     */
-    public $minjie;
-
-    /**
-     *  暴击
-     */
-    public $baoji;
-
-    #endregion
-    #region 各属性的成长系数
-    /**
-     * 生命值
-     */
-    public $hp1;
-
-    /**
-     *  攻击
-     */
-    public $gongji1;
-
-    /**
-     *  魔防御
-     */
-    public $fangyu1;
-
-    /**
-     *  敏捷
-     */
-    public $minjie1;
-
-    /**
-     *  暴击
-     */
-    public $baoji1;
-    #endregion
-    #region   战斗技能
-
-    /**
-     *  普通攻击
-     */
-    public $normalSkill;
-
-    /**
-     *   主动技能1
-     */
-    public $manuSkill1;
-
-    /**
-     * 主动技能2
-     */
-    public $manuSkill2;
-
-    /**
-     * 被动技能
-     */
-    public $manuSkill3;
-
-    /**
-     *  队长技能
-     */
-    public $captainSkill;
-
-    #endregion
-//    /**
-//     * 构造函数
-//     */
-//    public function __construct()
-//    {
-//        $this->level = 1;
-//        $this->quality = 1;
-//    }
-//    /**
-//     * 设置
-//     * @param string $heroID
-//     * @param int $instanceID
-//     * @param int $level
-//     * @param int $quality
-//     */
-//    public function reInit($heroID, $instanceID, $level = 1, $quality = 1)
-//    {
-//        $this->heroId = $heroID;
-//        $this->uid = $instanceID;
-//        $this->level = $level;
-//        $this->quality = $quality;
-//        $this->skills = new HeroSkillModel;
-//    }
-//    /**
-//     * 从一个对象中序列化
-//     * @param type $value
-//     */
-//    function initialize($value)
-//    {
-//        CommUtil::loadObject($value, $this);
-//        $skills = new HeroSkillModel;
-//        CommUtil::loadObject($value->skills, $skills);
-//        $this->skills = $skills;
-//    }
-}

+ 6 - 5
Gameserver/Amfphp/model/User/PublicStateModel.php

@@ -9,8 +9,7 @@ namespace loyalsoft;
  * @author gwang (mail@wanggangzero.cn)
  * @copyright ? 2017-4-19, SJZ LoyalSoft Corporation & gwang. All rights reserved.
  */
-class PublicStateModel extends Object_ext
-{
+class PublicStateModel extends HashSaver {
 
     /**
      * 评过分的英雄id
@@ -21,9 +20,11 @@ class PublicStateModel extends Object_ext
     /**
      * 玩家注册时初始化
      */
-    public function initialize()
-    {
-        $this->scoredheros = ArrayInit();
+    public function __construct($arg = null) {
+        parent::__construct($arg);
+//        if (null == $this->scoredheros) {                                       # 防御空值
+//            $this->scoredheros = ArrayInit();
+//        }
     }
 
 }

+ 0 - 15
Gameserver/Amfphp/model/User/UserFriendsModel.php

@@ -1,15 +0,0 @@
-<?php
-
-namespace loyalsoft;
-
-/**
- * Description of UserFriendsModel
- * @version
- *          1.0.0 Created at 2017-3-6. by --gwang
- * @author gwang (mail@wanggangzero.cn)
- * @copyright ? 2017-3-6, SJZ LoyalSoft Corporation & gwang. All rights reserved.
- */
-class UserFriendsModel
-{
-//put your code here
-}

+ 6 - 4
Gameserver/Amfphp/process/HeroDiscussProc.php

@@ -88,14 +88,15 @@ class HeroDiscussProc {
         $uid = $req->uid;
         list($heroId, $score) = $req->paras;                                    # 提取参数:  英雄ID, 打分值
         my_Assert($score > 0 && $score <= 5, ErrCode::paras_err);               # 参数非法: 打分区间不对
-
-        $pubifno = $req->mem->get(MemKey_User::Union_PublicState_normal($uid)); # 玩家各区共享的数据
+//        $pubifno = $req->mem->get(MemKey_User::Union_PublicState_hash($uid)); # 玩家各区共享的数据
+        $pubifno = new PublicStateModel();                                      # 玩家各区共享的数据
+        $pubifno->readDataFromMem(MemKey_User::Union_PublicState_hash($uid));
         $scoredlist = $pubifno->scoredheros;
         if (is_null($scoredlist) || !is_array($scoredlist)) {
             $scoredlist = ArrayInit();
         }
         if (CommUtil::isInArray($scoredlist, $heroId)) {                        # 判断玩家是否给此英雄打过分了
-            return Resp::ok(array('err' => 1, 'msg' => 'has scored!'));
+            return Resp::ok(array('err' => 1, 'msg' => 'has scored!'));         # -- 业务逻辑内部错误码
         }
         // 添加打分数据,
         // 取英雄的打分数据 {cnt:xxx,totalscore:xxx}
@@ -109,7 +110,8 @@ class HeroDiscussProc {
         $heroscore->totalscore += $score;
         $scoredlist[] = $heroId;                                                # 玩家记录打分记录
         $pubifno->scoredheros = $scoredlist;                                    # 回存数据
-        $req->mem->set(MemKey_User::Union_PublicState_normal($uid), $pubifno);
+        $pubifno->updateData(MemKey_User::Union_PublicState_hash($uid));
+
         $req->mem->set(MemKey_GameRun::HeroDiscusses_userScore_normal($heroId), $heroscore);
         $newscore = $heroscore->amt > 0 ? $heroscore->totalscore / $heroscore->amt : 0;
         return Resp::ok(array('err' => 0, #                                     # 返回

+ 1 - 5
Gameserver/Amfphp/process/StoreProc.php

@@ -586,11 +586,7 @@ class StoreProc {
                         if (property_exists($user->heros, $itemId)) {
                             DebugHelper::var_dump(" 已经有了xxx英雄了.");
                         } else {  # 给玩家创建一个英雄
-                            $hero = new HeroModel();
-                            $instanceID = now();
-                            $heroID = $itemId;
-                            $hero->reInit($heroID, $instanceID);
-                            $user->heros->$heroID = $hero;
+                            HeroProc::AddHeroTFromStore($req, $itemId);
                         }
                         break;
                     case '102': # 碎片

+ 1 - 1
Gameserver/Amfphp/service_call/mergemem/MemKeyList.php

@@ -57,7 +57,7 @@ class MemKeyList {
     }
 
     public static function ItorUserKeys_Union($uid) {
-        yield MemKey_User::Union_PublicState_normal($uid);
+        yield MemKey_User::Union_PublicState_hash($uid);
         yield MemKey_User::Union_PlayedZoneInfo_normal($uid);
     }