gwang 5 lat temu
rodzic
commit
4e9a08de87
2 zmienionych plików z 26 dodań i 47 usunięć
  1. 16 22
      Gameserver/Amfphp/process/StoreProc.php
  2. 10 25
      Gameserver/Amfphp/test.php

+ 16 - 22
Gameserver/Amfphp/process/StoreProc.php

@@ -667,8 +667,8 @@ class StoreProc {
         $ary = explode(";", $goodsStr);
         foreach ($ary as $value) {
             $val = explode(",", $value);
-            $itemId = $val[0];
-            $num = $val[1]; //数量
+            my_Assert(count($val) > 1, "解析奖励字符串出错");
+            list( $itemId, $num) = $val;                                        # ID, 数量
             $smItem = GameConfig::item_base_getItem($itemId);                   # 道具mo
             switch ($smItem->subType) {                                         # 根据类型分别添加到容器中
                 case 1:                                                         # 金币
@@ -690,10 +690,8 @@ class StoreProc {
                     StoreProc::PutYanLingInStore($itemId, $req);
                     break;
                 case 201:                                                       # 碎片
-                    StoreProc::PutOverlyingItemInStore($itemId, $num);
-                    break;
                 case 311:                                                       # 基因(经验丹)
-                    StoreProc::PutOverlyingItemInStore($itemId, $num);
+                    StoreProc::PutOverlyingItemInStore($itemId, $num);          # 直接进包裹items
                     break;
                 case 341:                                                       # 战场中掉落,不会进入包裹
                 case 342:
@@ -702,33 +700,29 @@ class StoreProc {
                     break;
             }
         }
-
-//        //  更新数据库数据
-        UserProc::updateUserInfo(); ////这行不要注释掉,除非在邮件和任务领奖那里加入更新(在调用addmultiInstore函数的后面加入updateuserinfo的话,就可以注销到这行代码)
-        return ErrCode::ok;     // 返回
+        UserProc::updateUserInfo();
+        return ErrCode::ok;                                                     // 返回
     }
 
     /// 物品类型,物品typeid,物品数量
-    public static function AddItemInStore($req) {
-        $itemType = $req->paras[0];
-        $itemId = $req->paras[1];
-        $num = $req->paras[2]; //数量
 
+    /**
+     * 向包裹中添加物品
+     * @param req $req
+     * @return type
+     */
+    public static function AddItemInStore($req) {
+        Err(ErrCode::err_innerfault, "功能待开发 -王刚 2020年1月17日14:36:01");
+        list($itemType, $itemId, $num) = $req->paras;                           # 提取参数: 道具类型, 道具ID, 数量
         if ($itemType < 4) {
             StoreProc::PutEquipInStore($itemId, $req);
         } else if ($itemType == 4) {
             StoreProc:: PutOverlyingItemInStore($itemId, $num);
         } else if ($itemType == 10) {
-            StoreProc:: PutOverlyingItemInStore($itemId, $num); ///准备添加其他
+            StoreProc:: PutOverlyingItemInStore($itemId, $num);                 ///准备添加其他
         }
-
-        //  更新数据库数据
-        UserProc::updateUserInfo();
-        // 返回
-
-        $ret = array('resp' => "succeed!");
-        $resp = Resp::ok($ret); //返回必须是object
-        return $resp;
+        UserProc::updateUserInfo();                                             //  更新数据库数据 
+        return Resp::ok(array('resp' => "succeed!"));                           //返回必须是object
     }
 
     /**

+ 10 - 25
Gameserver/Amfphp/test.php

@@ -8,32 +8,17 @@ include __DIR__ . '/main.php';
 //set_time_limit(15);                                                           # 设置执行超时时间
 echoLine("phpver:" . PHP_VERSION);
 
-class ABC {
 
-    public $age;
-    public $name = "wg";
-    static $_ins;
 
-    public static function Ins() {
-        if (null == self::$_ins) {
-            self::$_ins = new ABC();
-        }
-        return self::$_ins;
+for ($i = 0; $i < 5; $i++) {
+    switch ($i) {
+        case 1:
+        case 3:
+        case 5:
+            echoLine($i . " is 奇数");
+            break;
+        default :
+            echoLine($i . " is 偶数");
+            break;
     }
-
-}
-
-$abc = new ABC();
-$abc->age = 33;
-
-function Get() {
-    return ABC::Ins();
 }
-
-$ref = Get();
-$ref->name = "中国年";
-$ref = $abc;
-$ref->name = "王刚";
-
-var_dump($ref);
-var_dump(ABC::Ins());