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

背包扩容问题和充值商场

cyzhao 3 жил өмнө
parent
commit
b9109342a9

+ 6 - 1
Gameserver/Amfphp/base/CmdCode.php

@@ -1207,7 +1207,12 @@ class CmdCode {
     /**
      * 获取每日特惠信息
      */
-    const shop_getDaliySpecial = 7105;    
+    const shop_getDaliySpecial = 7105;  
+    
+    /*
+     * 获取充值返利信息
+     */
+    const shop_getRechargeRebate = 7106;
 //
 // </editor-fold>
 //

+ 10 - 0
Gameserver/Amfphp/base/ErrCode.php

@@ -1514,6 +1514,16 @@ class ErrCode {
     const shop_daliySpecialRewardNotRepeat = 4903;
     
     const shop_firstRechargeNotRepeat = 4904;
+    
+    /**
+     * 充值返利奖励不能重复领取
+     */
+    const shop_RechargeRebateRewardNotRepeat = 4905;
+    
+    /**
+     * 不足
+     */
+    const shop_RechargeRebateRmbNotEnough = 4906;
 // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="   学院错误码 51xx">
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-10 11:44:57
+ // 日期: 2021-12-15 17:53:55
 ////////////////////
 namespace loyalsoft;
 /**
@@ -1608,6 +1608,54 @@ class GameConfig {
         return self::get_hash_item('shop_limit_type', $key);
     }
     /**
+    * 累计充值返利
+    * @return \rechargeRebate
+    */
+    public static function rechargeRebate()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'rechargeRebate');
+    }
+    /**
+    * @return \sm_rechargeRebate rechargeRebate item数据 
+    */
+    public static function rechargeRebate_getItem($itemid)
+    { 
+        return self::get_hash_item('rechargeRebate', $itemid);
+    }
+    /**
+    * 限时
+    * @return \shop_limitTs
+    */
+    public static function shop_limitTs()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'shop_limitTs');
+    }
+    /**
+    * @return \sm_shop_limitTs shop_limitTs item数据 
+    */
+    public static function shop_limitTs_getItem($itemid)
+    { 
+        return self::get_hash_item('shop_limitTs', $itemid);
+    }
+    /**
+    * 限时类型区别
+    * @return \shop_limitTs_Type
+    */
+    public static function shop_limitTs_Type()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'shop_limitTs_Type');
+    }
+    /**
+    * @return \sm_shop_limitTs_Type shop_limitTs_Type itemArray 
+    */
+    public static function shop_limitTs_Type_getItemArray($key)
+    { 
+        return self::get_hash_item('shop_limitTs_Type', $key);
+    }
+    /**
     * 当前版本(时间戳)
     * @return \ver
     */

+ 49 - 1
Gameserver/Amfphp/model/Const/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-10 11:44:57
+ // 日期: 2021-12-15 17:53:55
 ////////////////////
 
 /**
@@ -1608,6 +1608,54 @@ class GameConfig {
         return self::get_hash_item('shop_limit_type', $key);
     }
     /**
+    * 累计充值返利
+    * @return \rechargeRebate
+    */
+    public static function rechargeRebate()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'rechargeRebate');
+    }
+    /**
+    * @return \sm_rechargeRebate rechargeRebate item数据 
+    */
+    public static function rechargeRebate_getItem($itemid)
+    { 
+        return self::get_hash_item('rechargeRebate', $itemid);
+    }
+    /**
+    * 限时
+    * @return \shop_limitTs
+    */
+    public static function shop_limitTs()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'shop_limitTs');
+    }
+    /**
+    * @return \sm_shop_limitTs shop_limitTs item数据 
+    */
+    public static function shop_limitTs_getItem($itemid)
+    { 
+        return self::get_hash_item('shop_limitTs', $itemid);
+    }
+    /**
+    * 限时类型区别
+    * @return \shop_limitTs_Type
+    */
+    public static function shop_limitTs_Type()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'shop_limitTs_Type');
+    }
+    /**
+    * @return \sm_shop_limitTs_Type shop_limitTs_Type itemArray 
+    */
+    public static function shop_limitTs_Type_getItemArray($key)
+    { 
+        return self::get_hash_item('shop_limitTs_Type', $key);
+    }
+    /**
     * 当前版本(时间戳)
     * @return \ver
     */

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-08 17:58:37
+ // 日期: 2021-12-15 11:49:32
 ////////////////////
 
 
@@ -470,5 +470,15 @@ class globalsettings
     */
     public $Item_Packet_InitNum_New;
 
+    /**
+    * @var Object 限时活动礼包开始时间  
+    */
+    public $limitTsActiveGiftStartTs;
+
+    /**
+    * @var Object 限时活动礼包结束时间  
+    */
+    public $limitTsActiveGiftEndTs;
+
 }
 

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_drop.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-02 17:34:13
+ // 日期: 2021-12-15 10:55:53
 ////////////////////
 
 

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_gate.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-02 09:45:45
+ // 日期: 2021-12-15 10:57:12
 ////////////////////
 
 

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_item_base.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-10 11:38:24
+ // 日期: 2021-12-14 16:43:15
 ////////////////////
 
 

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_item_yanling.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-02 12:14:13
+ // 日期: 2021-12-13 14:21:42
 ////////////////////
 
 

+ 57 - 0
Gameserver/Amfphp/model/Const/sm_rechargeRebate.php

@@ -0,0 +1,57 @@
+<?php
+////////////////////
+ // 由CodeGenerator创建。
+ // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
+ // author: gwang 
+ // 日期: 2021-12-14 11:12:18
+////////////////////
+
+
+/**
+ * Static Model rechargeRebate 累计充值返利
+ */
+class sm_rechargeRebate
+{
+
+    /**
+    * @var Int32 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $tid;
+
+    /**
+    * @var Int32 人民币 default(0) 
+    */
+    public $rmb;
+
+    /**
+    * @var String 充值返利奖品  
+    */
+    public $rewards;
+
+    /**
+    * @var Int32 言灵庭院等级 default(0) 
+    */
+    public $yardLevel;
+
+    /**
+    * @var String 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $yardName;
+
+    /**
+    * @var String 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $icon;
+
+    /**
+    * @var String 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $desc;
+
+    /**
+    * @var String 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $etc;
+
+}
+

+ 7 - 2
Gameserver/Amfphp/model/Const/sm_shop_limit.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-10 11:43:52
+ // 日期: 2021-12-15 11:26:24
 ////////////////////
 
 
@@ -54,7 +54,7 @@ class sm_shop_limit
     public $reward;
 
     /**
-    * @var String 商品类型分类: 1,限购礼包,2 月卡, 3 充值,4,每日特惠  
+    * @var String 商品类型分类: 1,限购礼包,2 月卡, 3 充值,4,每日特惠,5:限时活动礼包,6:限时随机礼包  
     */
     public $goodsType;
 
@@ -83,6 +83,11 @@ class sm_shop_limit
     */
     public $limit_num;
 
+    /**
+    * @var Int32 用途未知!!请到数据库中添加字段注释。 default(0) 
+    */
+    public $limit_ts;
+
     /**
     * @var Int32 标签: 1 免费,2 特价, 3 超值 default(0) 
     */

+ 47 - 0
Gameserver/Amfphp/model/Const/sm_shop_limitBuy.php

@@ -0,0 +1,47 @@
+<?php
+////////////////////
+ // 由CodeGenerator创建。
+ // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
+ // author: gwang 
+ // 日期: 2021-12-15 17:30:30
+////////////////////
+
+
+/**
+ * Static Model shop_limitBuy 限购
+ */
+class sm_shop_limitBuy
+{
+
+    /**
+    * @var Int32 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $tid;
+
+    /**
+    * @var Int32 触发条件类型id default(0) 
+    */
+    public $typeId;
+
+    /**
+    * @var String 参数  
+    */
+    public $para;
+
+    /**
+    * @var String 类型描述信息  
+    */
+    public $name;
+
+    /**
+    * @var String 礼包id;对应cfg_shop_limit表id  
+    */
+    public $giftId;
+
+    /**
+    * @var String 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $etc;
+
+}
+

+ 47 - 0
Gameserver/Amfphp/model/Const/sm_shop_limitTs.php

@@ -0,0 +1,47 @@
+<?php
+////////////////////
+ // 由CodeGenerator创建。
+ // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
+ // author: gwang 
+ // 日期: 2021-12-15 17:51:27
+////////////////////
+
+
+/**
+ * Static Model shop_limitTs 限时
+ */
+class sm_shop_limitTs
+{
+
+    /**
+    * @var Int32 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $tid;
+
+    /**
+    * @var Int32 触发条件类型id default(0) 
+    */
+    public $typeId;
+
+    /**
+    * @var String 参数  
+    */
+    public $para;
+
+    /**
+    * @var String 类型描述信息  
+    */
+    public $name;
+
+    /**
+    * @var String 礼包id;对应cfg_shop_limit表id  
+    */
+    public $giftId;
+
+    /**
+    * @var String 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $etc;
+
+}
+

+ 47 - 0
Gameserver/Amfphp/model/Const/sm_shop_limitTs_Type.php

@@ -0,0 +1,47 @@
+<?php
+////////////////////
+ // 由CodeGenerator创建。
+ // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
+ // author: gwang 
+ // 日期: 2021-12-15 17:51:27
+////////////////////
+
+
+/**
+ * Static Model shop_limitTs_Type 限时类型区别
+ */
+class sm_shop_limitTs_Type
+{
+
+    /**
+    * @var Int32 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $tid;
+
+    /**
+    * @var Int32 触发条件类型id default(0) 
+    */
+    public $typeId;
+
+    /**
+    * @var String 参数  
+    */
+    public $para;
+
+    /**
+    * @var String 类型描述信息  
+    */
+    public $name;
+
+    /**
+    * @var String 礼包id;对应cfg_shop_limit表id  
+    */
+    public $giftId;
+
+    /**
+    * @var String 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $etc;
+
+}
+

+ 7 - 2
Gameserver/Amfphp/model/Const/sm_shop_limit_type.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-12-10 11:43:52
+ // 日期: 2021-12-15 11:26:24
 ////////////////////
 
 
@@ -54,7 +54,7 @@ class sm_shop_limit_type
     public $reward;
 
     /**
-    * @var String 商品类型分类: 1,限购礼包,2 月卡, 3 充值,4,每日特惠  
+    * @var String 商品类型分类: 1,限购礼包,2 月卡, 3 充值,4,每日特惠,5:限时活动礼包,6:限时随机礼包  
     */
     public $goodsType;
 
@@ -88,6 +88,11 @@ class sm_shop_limit_type
     */
     public $limit_num;
 
+    /**
+    * @var Int32 用途未知!!请到数据库中添加字段注释。 default(0) 
+    */
+    public $limit_ts;
+
     /**
     * @var Int32 标签: 1 免费,2 特价, 3 超值 default(0) 
     */

+ 1 - 1
Gameserver/Amfphp/model/Const/sm_yanlingextra_level.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-09-26 11:49:18
+ // 日期: 2021-12-14 15:29:15
 ////////////////////
 
 

+ 23 - 1
Gameserver/Amfphp/model/User/Enum_Recharge.php

@@ -14,9 +14,31 @@ class Enum_Recharge extends Enum {
      */
     const FirstRecharge = 1;
     
+    /*
+     * 月卡
+     */
     const monthRecharge = 2;
+    
+    /*
+     * 充值
+     */
     const recharge = 3;
           
+    /*
+     * 每日特惠
+     */
     const DaliySpecialPackages = 4;
-
+       
+    //限时活动礼包
+    const limitTsActiveGift = 5;
+    
+    /*
+     * 限时随机礼包
+     */
+    const limitTsRandGift = 6;
+    
+    /*
+     * 充值返利
+     */
+    const RechargeRebate = 7;
 }

+ 6 - 0
Gameserver/Amfphp/model/User/Info_Store.php

@@ -44,6 +44,12 @@ class Info_Store extends Object_ext {
      * @deprecated since version 0
      */
     public $segement;
+    
+    /**
+     * 触发限时随机礼包的记录
+     * @var type
+     */
+    public $triggerLimitTsGift = array();
         
     /**
      * 玩家注册时初始化

+ 11 - 0
Gameserver/Amfphp/model/User/Info_UserShop.php

@@ -55,4 +55,15 @@ class Info_UserShop extends Object_ext {
      * @var type
      */
     public $daliySpecial_ts = 0;
+    
+    /*
+     * 充值返利奖品记录
+     */
+    public $rechargeRebateRewardsList = array();
+    
+    /*
+     * 限时活动--礼包领取记录
+     */
+    public $limitTsRewardsList = array();
+       
 }

+ 37 - 0
Gameserver/Amfphp/model/User/Ins_Gift.php

@@ -0,0 +1,37 @@
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+namespace loyalsoft;
+
+/**
+ * Description of Ins_Gift
+ *
+ * @author cyzhao
+ */
+class Ins_Gift extends Object_ext{
+    /**
+     * 礼包id
+     * @var type
+     */
+    public $giftId = 0;
+
+    /**
+     * 开始时间
+     * @var type
+     */
+    public $startTs = 0;
+    
+    /*
+     * 结束时间
+     */
+    public $endTs = 0;
+
+    public function __construct($args = null) {
+        parent::__construct($args);
+    }
+}

+ 18 - 3
Gameserver/Amfphp/process/PayProc.php

@@ -91,6 +91,14 @@ class PayProc {
                 $shopdata->daliySpecialPackages[] = $typeId;
                 req()->userInfo->game->shopdata = $shopdata;
                 break;
+            case Enum_Recharge::RechargeRebate://充值返利
+                $mo = GameConfig::rechargeRebate_getItem($typeId);
+                my_Assert($mo != null, ErrCode::err_const_no);
+                my_Assert($user->baseInfo->charge_amt >= $mo->rmb, ErrCode::shop_RechargeRebateRmbNotEnough);
+                my_Assert(!in_array($typeId, $user->shopdata->rechargeRebateRewardsList) , ErrCode::shop_RechargeRebateRewardNotRepeat);
+                
+                StoreProc::AddMultiItemInStore($mo->rewards);                               
+                break; 
             default:
                 break;
         }
@@ -141,7 +149,7 @@ class PayProc {
             }
             $user->base()->Add_Cash($cash);                       
         }          
-        elseif ($order->product_id >= 801001 && $order->product_id <= 899999) {//每日特惠
+        elseif ($order->product_id >= 801001 && $order->product_id <= 801999) {//每日特惠
             $mo = GameConfig::shop_limit_getItem($order->product_id);
             if($mo == null){
                 $list = GameConfig::shop_limit_type_getItemArray(Enum_Recharge::DaliySpecialPackages);
@@ -155,8 +163,15 @@ class PayProc {
                 StoreProc::AddMultiItemInStore($mo->reward);
                 $user->shopdata->daliySpecialPackages[] = $mo->typeId;
             }                     
-        }
-        elseif ($order->product_id >= 901001 && $order->product_id <= 999999) {//月卡
+        } elseif ($order->product_id >= 805001 && $order->product_id <= 805999) {//限时
+            $mo = GameConfig::shop_limit_getItem($order->product_id);
+            my_Assert($mo, ErrCode::err_const_no);
+            my_Assert(!in_array($order->product_id, $user->shopdata->limitTsActiveRewardsList), ErrCode::err_const_no);
+            
+            $user->shopdata->limitTsActiveRewardsList[] = $mo->typeId;
+            StoreProc::AddMultiItemInStore($mo->reward);//领取奖励
+            
+        } elseif ($order->product_id >= 901001 && $order->product_id <= 999999) {//月卡
             $shopdata = new Info_UserShop(req()->userInfo->game->shopdata);
             $packageCfg = GameConfig::shop_monthVIP_getItem($packageId);
             my_Assert(null != $packageCfg, ErrCode::err_const_no);

+ 44 - 0
Gameserver/Amfphp/process/ShopProc.php

@@ -26,10 +26,54 @@ class ShopProc {
                 return self::BuyMonthlyVip();
             case CmdCode::shop_getDaliySpecial:
                 return self::GetDaliySpecial();
+            case CmdCode::shop_getRechargeRebate:
+                return self::GetRechargeRebate();
             default:
                 Err(ErrCode::cmd_err);
         }
     }
+    
+    /*
+     * 限购礼包触发条件检测
+     */
+    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, req()->userInfo->game->shopdata->limitTsRewardsList)){
+                    $giftId = $item->giftId;
+                    $giftArr[] = $giftId;
+                }
+            } 
+        }
+        
+        //没有触发对应的礼包条件
+        if($giftId == 0){
+            return;
+        }
+        //已经领取礼包,不能重复领取
+        if(in_array($giftId, req()->userInfo->game->shopdata->limitTsRewardsList)){
+            return;
+        }          
+        
+        //触发对应的礼包条件。则将礼包id存储在
+        $gift = new Ins_Gift();
+        $gift->giftId = $giftId;
+        $gift->startTs = now();
+        $gift->endTs = now() + GameConfig::shop_limit_getItem($giftId)->limit_ts;
+        req()->userInfo->game->store->triggerLimitTsGift[] = $gift;
+    }
+    
+    public static function GetRechargeRebate() {
+        return Resp::ok(array(
+                    "shopdata" => req()->userInfo->game->shopdata
+        ));
+    }
+    
     //
     public static function GetDaliySpecial() {
         return Resp::ok(array(

+ 24 - 6
Gameserver/Amfphp/process/StoreProc.php

@@ -767,13 +767,31 @@ class StoreProc {
 
     public static function countStoreNum() {
         $user = req()->userInfo->game;
-        $num = 0;
-        $num += count((array)$user->store->items);
-        //$num += count((array)$user->store->taskcards);
-        $num += count((array)$user->store->equipment);
-        $num += count((array)$user->store->yanling);    
+        //$num = 0;
+        $itemDic = $user->store->items;
+        //$num += count((array)$user->store->items);
+        $itemNum = 0;
+        foreach ($itemDic as $key => $num) {
+            if($num == 0){
+                continue;
+            }
+            
+            if($num > 99999){
+                $itemNum += 2;
+            } else {
+                $itemNum += 1;
+            }
+        }              
         
-        return $num;
+        //var_dump($num);
+        //var_dump('-----------------');
+      
+        $itemNum += count((array)$user->store->equipment);
+        //var_dump($num);
+        //var_dump('-----------------');
+        $itemNum += count((array)$user->store->yanling);    
+        //var_dump($itemNum);
+        return $itemNum;
     }
 
      /**