Переглянути джерело

mod: 拿订单号来请求发货,返回值附带商品所属模块信息mod

wanggangzero 7 місяців тому
батько
коміт
ca4231791b

+ 105 - 99
Gameserver/App/process/PayProc.php

@@ -375,7 +375,7 @@ class PayProc {
         UserProc::updateUserInfo();                                             # 回写玩家数据
         return Resp::ok(array(
                     "ret" => self::$retArr, #                                   # 奖励串
-//                    "pay" => $user->pay,
+                    "mod" => $result->ret, #                                    # 商品刷新模块名
                     "baseInfo" => $user->baseInfo,
 //                    "shopdata" => $user->shopdata,
                     "store" => $user->store,
@@ -396,6 +396,7 @@ class PayProc {
         self::$retArr = array();
 
         $shopItem = GameConfig::shop_getItem($order->product_id);               # 商城总表中查找下配置数据
+        $mod = "";
         if (null != $shopItem) {
             switch ($shopItem->shopItemType) {
                 case 'cash':                                                    # 充值二级货币
@@ -419,108 +420,113 @@ class PayProc {
                     my_Assert(false, "该道具并非现金充值类!");
                     break;
             }
-        } else if ($order->product_id == 1) {
-            $user->base(true)->Add_Cash($order->product_count);
-            self::$retArr[] = "2," . $order->product_count;
-        } else if ($order->product_id >= 6 && $order->product_id <= 1000) {//充值表
-            $mo = GameConfig::recharge_getItem($order->product_id);
-            my_Assert($mo != null, ErrCode::err_const_no);
-
-            if (!StlUtil::dictHasProperty($user->shopdata, 'rechargeRecordList')) {
-                $user->shopdata->rechargeRecordList = array();
-            }
-
-            $cash = $mo->rmd * 10;
-            if (!in_array($order->product_id, $user->shopdata->rechargeRecordList)) {
-                $cash = $mo->rmd * 10 * $mo->firstDouble;
-                $user->shopdata->rechargeRecordList[] = $order->product_id;
-            }
-            $user->base(true)->Add_Cash($cash);
-            self::$retArr[] = "2," . $cash;
-        } elseif ($order->product_id >= 801001 && $order->product_id <= 803999) {//限购
-            self::checklimitBuyRecharge($order->product_id);
-
-            $mo = GameConfig::shop_limit_getItem($order->product_id);
-            if ($mo->subType == 1) {
-                $user->shopdata->dayRechargeAmt += $order->amount;
-            } else if ($mo->subType == 2) {
-                $user->shopdata->weekRechargeAmt += $order->amount;
-            }
-        } elseif ($order->product_id >= 804001 && $order->product_id <= 804999) {//每日特惠
-            $mo = GameConfig::shop_limit_getItem($order->product_id);
-            my_Assert($mo != null, ErrCode::err_const_no);
-            if ($mo->price == 60) {
-                $user->shopdata->daliySpecial_ts = now();
-            } else {
-                $itemid = explode(',', $mo->reward)[0];
-                $itemMO = GameConfig::item_package_getItem($itemid);
-                my_Assert(null != $itemMO, ErrCode::err_const_no);
-                StoreProc::AddMultiItemInStore($itemMO->contents);
-                $user->shopdata->daliySpecialPackages[] = $mo->typeId;
-                self::$retArr[] = $itemMO->contents;
-            }
-        } elseif ($order->product_id >= 805001 && $order->product_id <= 805999) {//限时
-            $mo = GameConfig::shop_limit_getItem($order->product_id);
-            my_Assert($mo != null, ErrCode::err_const_no);
-            my_Assert(!in_array($order->product_id, $user->shopdata->limitTsActiveRewardsList), ErrCode::err_const_no);
-
-            $user->shopdata->limitTsActiveRewardsList[] = $mo->typeId;
-            $itemid = explode(',', $mo->reward)[0];
-            $itemMO = GameConfig::item_package_getItem($itemid);
-            my_Assert(null != $itemMO, ErrCode::err_const_no);
-            StoreProc::AddMultiItemInStore($itemMO->contents); //领取奖励
-            self::$retArr[] = $itemMO->contents;
-        } elseif ($order->product_id >= 806001 && $order->product_id <= 806999) {//首充【2022-10-19新的首充功能】
-            $mo = GameConfig::shop_accumulating_getItem($order->product_id);
-            my_Assert($mo != null, ErrCode::err_const_no);
-            $shopdata = new Info_UserShop(ctx()->shopdata);
-            $amount = $mo->amount;
-            if (!StlUtil::dictHasProperty($shopdata->fRechargeTime, $amount)) {
-                $shopdata->fRechargeTime->$amount = TimeUtil::tsDay();
-            }
-            $cost = 0;
-            $dic = GameConfig::shop_accumulating();
-            foreach ($dic as $k => $item) {
-                if ($cost <= $item->amount) {
-                    $cost = $item->amount;
-                }
-            }
-            if ($cost <= $amount && $shopdata->suitGiftStartTs == 0) {
-                $shopdata->suitGiftStartTs = now();
-            }
-            ctx()->shopdata = $shopdata;
-            //self::$retArr[] = $mo->goods;
-        } elseif ($order->product_id >= 807001 && $order->product_id <= 807999) {//终身礼包
-            self::checklimitBuyRecharge($order->product_id);
-        } elseif ($order->product_id >= 808001 && $order->product_id <= 808999) {//套装礼包
-            self::checklimitBuyRecharge($order->product_id);
-        } elseif ($order->product_id >= 901001 && $order->product_id <= 999999) {//月卡
-            $shopdata = new Info_UserShop(ctx()->shopdata);
-            $packageCfg = GameConfig::shop_monthVIP_getItem($order->product_id);
-            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);     # 发放一次性奖励
-            self::$retArr[] = $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;
+            $mod = $shopItem->shopItemType;
         }
 
-        $user->baseInfo->charge_amt += $order->amount;
+        // <editor-fold defaultstate="collapsed" desc="已废弃逻辑">
+//        else if ($order->product_id == 1) {
+//            $user->base(true)->Add_Cash($order->product_count);
+//            self::$retArr[] = "2," . $order->product_count;
+//        } else if ($order->product_id >= 6 && $order->product_id <= 1000) {//充值表
+//            $mo = GameConfig::recharge_getItem($order->product_id);
+//            my_Assert($mo != null, ErrCode::err_const_no);
+//
+//            if (!StlUtil::dictHasProperty($user->shopdata, 'rechargeRecordList')) {
+//                $user->shopdata->rechargeRecordList = array();
+//            }
+//
+//            $cash = $mo->rmd * 10;
+//            if (!in_array($order->product_id, $user->shopdata->rechargeRecordList)) {
+//                $cash = $mo->rmd * 10 * $mo->firstDouble;
+//                $user->shopdata->rechargeRecordList[] = $order->product_id;
+//            }
+//            $user->base(true)->Add_Cash($cash);
+//            self::$retArr[] = "2," . $cash;
+//        } elseif ($order->product_id >= 801001 && $order->product_id <= 803999) {//限购
+//            self::checklimitBuyRecharge($order->product_id);
+//
+//            $mo = GameConfig::shop_limit_getItem($order->product_id);
+//            if ($mo->subType == 1) {
+//                $user->shopdata->dayRechargeAmt += $order->amount;
+//            } else if ($mo->subType == 2) {
+//                $user->shopdata->weekRechargeAmt += $order->amount;
+//            }
+//        } elseif ($order->product_id >= 804001 && $order->product_id <= 804999) {//每日特惠
+//            $mo = GameConfig::shop_limit_getItem($order->product_id);
+//            my_Assert($mo != null, ErrCode::err_const_no);
+//            if ($mo->price == 60) {
+//                $user->shopdata->daliySpecial_ts = now();
+//            } else {
+//                $itemid = explode(',', $mo->reward)[0];
+//                $itemMO = GameConfig::item_package_getItem($itemid);
+//                my_Assert(null != $itemMO, ErrCode::err_const_no);
+//                StoreProc::AddMultiItemInStore($itemMO->contents);
+//                $user->shopdata->daliySpecialPackages[] = $mo->typeId;
+//                self::$retArr[] = $itemMO->contents;
+//            }
+//        } elseif ($order->product_id >= 805001 && $order->product_id <= 805999) {//限时
+//            $mo = GameConfig::shop_limit_getItem($order->product_id);
+//            my_Assert($mo != null, ErrCode::err_const_no);
+//            my_Assert(!in_array($order->product_id, $user->shopdata->limitTsActiveRewardsList), ErrCode::err_const_no);
+//
+//            $user->shopdata->limitTsActiveRewardsList[] = $mo->typeId;
+//            $itemid = explode(',', $mo->reward)[0];
+//            $itemMO = GameConfig::item_package_getItem($itemid);
+//            my_Assert(null != $itemMO, ErrCode::err_const_no);
+//            StoreProc::AddMultiItemInStore($itemMO->contents); //领取奖励
+//            self::$retArr[] = $itemMO->contents;
+//        } elseif ($order->product_id >= 806001 && $order->product_id <= 806999) {//首充【2022-10-19新的首充功能】
+//            $mo = GameConfig::shop_accumulating_getItem($order->product_id);
+//            my_Assert($mo != null, ErrCode::err_const_no);
+//            $shopdata = new Info_UserShop(ctx()->shopdata);
+//            $amount = $mo->amount;
+//            if (!StlUtil::dictHasProperty($shopdata->fRechargeTime, $amount)) {
+//                $shopdata->fRechargeTime->$amount = TimeUtil::tsDay();
+//            }
+//            $cost = 0;
+//            $dic = GameConfig::shop_accumulating();
+//            foreach ($dic as $k => $item) {
+//                if ($cost <= $item->amount) {
+//                    $cost = $item->amount;
+//                }
+//            }
+//            if ($cost <= $amount && $shopdata->suitGiftStartTs == 0) {
+//                $shopdata->suitGiftStartTs = now();
+//            }
+//            ctx()->shopdata = $shopdata;
+//            //self::$retArr[] = $mo->goods;
+//        } elseif ($order->product_id >= 807001 && $order->product_id <= 807999) {//终身礼包
+//            self::checklimitBuyRecharge($order->product_id);
+//        } elseif ($order->product_id >= 808001 && $order->product_id <= 808999) {//套装礼包
+//            self::checklimitBuyRecharge($order->product_id);
+//        } elseif ($order->product_id >= 901001 && $order->product_id <= 999999) {//月卡
+//            $shopdata = new Info_UserShop(ctx()->shopdata);
+//            $packageCfg = GameConfig::shop_monthVIP_getItem($order->product_id);
+//            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);     # 发放一次性奖励
+//            self::$retArr[] = $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;
+//        }
+// </editor-fold>
+
+        $user->baseInfo->charge_amt += $order->amount;                          # 统计下累充金额
         ctx($user);
 
-        return true;
+        return [true, $mod];
     }
 
     static function suitGiftCheck() {

+ 2 - 2
Gameserver/App/service_call/pay/official/pay_op.php

@@ -69,7 +69,7 @@ class pay_op {
             return Resp::err(6, "发货函数不可调用!");
         }
 
-        $bOk = call_user_func($deliverFunc, $order);                            # 调用游戏发货逻辑, 要求游戏逻辑返回true/false
+        [$bOk, $mod] = call_user_func($deliverFunc, $order);                    # 调用游戏发货逻辑, 要求游戏逻辑返回true/false, $mod
         if (!$bOk) {
             CLog::pay("订单发货失败: $cpOrderId");
             return Resp::err(7, "游戏发货逻辑执行失败");
@@ -84,7 +84,7 @@ class pay_op {
         }
 
         CLog::pay("订单发货成功: $cpOrderId");
-        return Resp::ok("");
+        return Resp::ok($mod);
     }
 
     /**