Bläddra i källkod

公告、体力

cyzhao 1 år sedan
förälder
incheckning
1f4f9bdc17

+ 7 - 0
Gameserver/App/base/CmdCode.php

@@ -91,6 +91,8 @@ class CmdCode {
      *  走完片头后给值 1
      */
     const cmd_user_setAnimation = 6004;
+    
+    const cmd_user_readAnnouncement = 6005;
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="活动操作码 - 61xx">
 
@@ -207,6 +209,11 @@ class CmdCode {
      * 商城购买东西
      */
     const cmd_shop_BuyGift = 6501;
+    
+    /**
+     * 购买体力
+     */
+    const cmd_shop_BuyTili = 6502;
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="英雄模块操作码 - 66xx">
     //

+ 2 - 0
Gameserver/App/base/ErrCode.php

@@ -414,6 +414,8 @@ class ErrCode {
     
     const user_shop_FreeNumLimit = 3404;
     
+    const user_shop_buyTiliNumLimit = 3405;
+    const user_shop_GuanggaoGetTiliNumLimit = 3406;
 // </editor-fold>
 //
     

+ 17 - 1
Gameserver/App/model/Const/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-05-10 09:57:33
+ // 日期: 2024-05-10 17:03:56
 ////////////////////
 
 /**
@@ -573,6 +573,22 @@ class GameConfig {
         return self::get_hash_item('activity', $itemid);
     }
     /**
+    * 公告
+    * @return \announcement
+    */
+    public static function announcement()
+    { 
+        static $a = null; 
+        return self::initValue($a, 'announcement');
+    }
+    /**
+    * @return \sm_announcement announcement item数据 
+    */
+    public static function announcement_getItem($itemid)
+    { 
+        return self::get_hash_item('announcement', $itemid);
+    }
+    /**
     * 当前版本(时间戳)
     * @return \ver
     */

+ 57 - 0
Gameserver/App/model/Const/sm_announcement.php

@@ -0,0 +1,57 @@
+<?php
+////////////////////
+ // 由CodeGenerator创建。
+ // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
+ // author: gwang 
+ // 日期: 2024-05-10 14:36:02
+////////////////////
+
+
+/**
+ * Static Model announcement 公告
+ */
+class sm_announcement
+{
+
+    /**
+    * @var Int32 用途未知!!请到数据库中添加字段注释。  
+    */
+    public $id;
+
+    /**
+    * @var String 公告名称  
+    */
+    public $name;
+
+    /**
+    * @var String 公告开始日期  
+    */
+    public $startTs;
+
+    /**
+    * @var String 结束时间  
+    */
+    public $endTs;
+
+    /**
+    * @var String 公告内容  
+    */
+    public $content;
+
+    /**
+    * @var String 公告使用的图片  
+    */
+    public $image;
+
+    /**
+    * @var String 公告链接地址  
+    */
+    public $url;
+
+    /**
+    * @var Int32 是否开启 default(1) 
+    */
+    public $ison;
+
+}
+

+ 21 - 1
Gameserver/App/model/Const/sm_globalsettings.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-05-09 17:20:16
+ // 日期: 2024-05-10 16:52:52
 ////////////////////
 
 
@@ -123,5 +123,25 @@ class sm_globalsettings
     */
     public $XILianGemlNeedXILianStone;
 
+    /**
+    * @var string 每日购买体力最大次数  
+    */
+    public $BuyTili_DailyMaxNum;
+
+    /**
+    * @var string   
+    */
+    public $GuanggaoGetTili;
+
+    /**
+    * @var string 每日广告得到体力次数  
+    */
+    public $GuanggaoGetTili_DailyMaxNum;
+
+    /**
+    * @var string 购买体力 60个元宝15个体力  
+    */
+    public $BuyTiliCost;
+
 }
 

+ 1 - 1
Gameserver/App/model/Const/sm_hero.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-04-22 17:07:06
+ // 日期: 2024-05-10 11:02:56
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_item.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-04-30 10:26:42
+ // 日期: 2024-05-10 16:26:44
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_predicate.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-05-10 09:32:56
+ // 日期: 2024-05-10 14:02:56
 ////////////////////
 
 

+ 19 - 0
Gameserver/App/model/User/Info_PrivateState.php

@@ -183,6 +183,25 @@ class Info_PrivateState extends Object_ext {
      */
     public $honourCardShop_ts = 0;
     
+    /**
+     * 
+     * @var type
+     */
+    #[ArrayType]
+    public $announcement = array();
+
+    /**
+     * 关看广告得到体力次数
+     * @var type
+     */
+    public $guanggaoGetTiliNum = 0;
+
+    /**
+     * 每日购买体力的次数
+     * @var type
+     */
+    public $buyTiliNum = 0;
+
     public function initialize() {
         $this->junbeiShopNumRecord = new \stdClass();
         $this->junbeiShop_AllNumRecord = new \stdClass();

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

@@ -24,10 +24,34 @@ class ShopProc {
         switch ($req->cmd) {
             case CmdCode::cmd_shop_BuyGift:                                     # 6501 商城购买东西
                 return ShopProc::ShopBuyGift();
+            case CmdCode::cmd_shop_BuyTili:                                     # 6502 买体力
+                return ShopProc::BuyTili();    
             default:
                 Err(ErrCode::cmd_err);
         }
     }
+    
+    public static function BuyTili() {
+        list($type) = req()->paras;
+        
+        if($type == 1){//广告
+            $maxNum = glc()->GuanggaoGetTili_DailyMaxNum;                       
+            my_Assert(ctx()->privateState->guanggaoGetTiliNum < $maxNum, ErrCode::user_shop_GuanggaoGetTiliNumLimit); 
+            
+            ctx()->baseInfo->Add_tili(glc()->GuanggaoGetTili);
+        } else {
+            $maxNum = glc()->BuyTili_DailyMaxNum;                       
+            my_Assert(ctx()->privateState->buyTiliNum < $maxNum, ErrCode::user_shop_buyTiliNumLimit); 
+            
+            $arr = explode(',', glc()->BuyTiliCost); 
+            my_Assert(ctx()->baseInfo->cash >= $arr[0], ErrCode::user_shop_NotRepeatBuy); 
+            
+            ctx()->baseInfo->Add_tili($arr[1]);
+        }
+        
+        UserProc::updateUserInfo();
+        return Resp::ok(array());
+    }
 
     /**
      * 商城购买东西

+ 18 - 0
Gameserver/App/process/UserProc.php

@@ -28,10 +28,28 @@ class UserProc {
                 return UserProc::downloadConstInfo();
             case CmdCode::cmd_user_setAnimation:                                # 6004 片头播放记录
                 return UserProc::setAnimation();
+            case CmdCode::cmd_user_readAnnouncement:                            # 6005 
+                return UserProc::readAnnouncement();
             default:
                 Err(ErrCode::cmd_err);
         }
     }
+    
+    /**
+     * 6005
+     * @return type
+     */
+    public static function readAnnouncement() {
+        list($id) = req()->paras;
+
+        if(!in_array($id, ctx()->privateState->announcement) ){
+            ctx()->privateState->announcement[] = $id;
+        }        
+        
+        UserProc::updateUserInfo();
+        $ret = array();
+        return Resp::ok($ret);
+    }
 
     /**
      * 6004 设置片头播放记录