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

添加清理指定类型角标的方法.

王刚 3 роки тому
батько
коміт
d99c478d68

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

@@ -72,12 +72,12 @@ class CmdCode {
      *  【移动端】查询付费记录
      */
     const cmd_mpay_getPayRecords = 8812;
-    
+
     /**
      * 临时--正式的要根据具体功能实现
      */
     const cmd_mpay_PayDeliverGoods = 8813;
-    
+
     /**
      * 充值领取奖励
      */
@@ -654,7 +654,7 @@ class CmdCode {
      * 宝石卸下
      */
     const cmd_store_GemRemove = 6427;
-    
+
     /**
      * 背包扩展
      */
@@ -1203,12 +1203,12 @@ class CmdCode {
      * 购买月卡
      */
     const shop_monthlyVIP_Buy = 7104;
-    
+
     /**
      * 获取每日特惠信息
      */
-    const shop_getDaliySpecial = 7105;  
-    
+    const shop_getDaliySpecial = 7105;
+
     /*
      * 获取充值返利信息
      */
@@ -1223,6 +1223,10 @@ class CmdCode {
      */
     const cmd_event_GetNotifications = 7201;
 
+    /**
+     * 清理指定角标
+     */
+    const cmd_event_ClearNotifications = 7202;
 // </editor-fold>
 // <editor-fold defaultstate="collapsed" desc="学院操作码 - 73xx">
 

+ 25 - 9
Gameserver/Amfphp/process/EventProc.php

@@ -15,18 +15,34 @@ class EventProc {
         switch (req()->cmd) {
             case CmdCode::cmd_event_GetNotifications:                           # 7201 拉取角标通知列表
                 return self::GetCornerSignNotifications();
+            case CmdCode::cmd_event_ClearNotifications:                         # 7202 清理指定类型的角标
+                return self::ClearCornerSignNotification();
             default:
                 return Resp::err(ErrCode::cmd_err);
         }
     }
 
     /**
-     * [7201] 拉取角标通知 
+     * [7202] 清理指定类型的角标记录
+     */
+    static function ClearCornerSignNotification() {
+        $ctype =req()->paras[0];
+        $e=new OperateEventType();
+        $e->isValidValue($ctype);
+        unset( req()->userInfo->game->privateState->cornerSignNotifications[$ctype]);
+        UserProc::updateUserInfo();
+        $arr = array_values(array_unique(req()->userInfo->game->privateState->cornerSignNotifications)); # 返回值去重
+        //        req()->userInfo->game->privateState->cornerSignNotifications = [];       # 清理记录
+        return Resp::ok(array("notifications" => $arr));                        # 返回
+    }
+
+    /**
+     * [7201] 拉取角标通知
      */
     static function GetCornerSignNotifications() {
         // 这里直接返回, 将来开发对应的触发逻辑, 给数组中添加相应的值
         $arr = array_values(array_unique(req()->userInfo->game->privateState->cornerSignNotifications)); # 返回值去重
-        req()->userInfo->game->privateState->cornerSignNotifications = [];       # 清理记录
+//        req()->userInfo->game->privateState->cornerSignNotifications = [];       # 清理记录
         UserProc::updateUserInfo();
         return Resp::ok(array("notifications" => $arr));                        # 返回
     }
@@ -39,28 +55,28 @@ class EventProc {
      * 收到请求
      */
     static function OnRequest() {
-        
+
     }
 
     /**
      * 处理完毕准备返回
      */
     static function AfterResponse() {
-        
+
     }
 
     /**
      * 当天第一次登录
      */
     static function OnNewDay() {
-        
+
     }
 
     /**
      * 当周第一次登录(周一)
      */
     static function OnNewWeek() {
-        
+
     }
 
     /**
@@ -76,10 +92,10 @@ class EventProc {
             if (!in_array($id, $ubs)) {                                         # 尚未解锁的建筑,判断,已解锁的跳过
                 if ($b->playerLevelLimit <= $new) {                             # 符合解锁条件
                     req()->userInfo->game->privateState->unlockedBuild[] = $id; # 插入解锁记录
-                    StatisticsProc::TargetStatistics(Enum_TargetStatistics::unlockbuidId,$id);
-                    if($id == 1000){
+                    StatisticsProc::TargetStatistics(Enum_TargetStatistics::unlockbuidId, $id);
+                    if ($id == 1000) {
                         $college = new Info_College();
-                        $college->setFunUnluckTs();                              
+                        $college->setFunUnluckTs();
                     }
                     StatisticsProc::unlockBuild($id);                           # 统计全服玩家解锁建筑
                     NormalEventProc::OnUnlockBuild($id, null);                   # 插入事件

+ 1 - 1
Gameserver/Amfphp/process/EventProc/CornerSignEventProc.php

@@ -5,7 +5,7 @@ namespace loyalsoft;
 /**
  * 枚举: 角标提示类型枚举
  */
-class OperateEventType {
+class OperateEventType extends Enum {
 
     const _Empty = 0;                                                           // 空
     const Task = 1;

+ 5 - 2
Gameserver/Amfphp/test.php

@@ -2,8 +2,9 @@
 
 namespace loyalsoft;
 
-include __DIR__ . '/main.php';
 
+include __DIR__ . '/main.php';
+var_dump(__DIR__);
 echoLine("phpver: " . PHP_VERSION . PHP_EOL);
 echoLine("tsDay:" . tsDay());
 //SelfChecker::CheckAll();
@@ -11,4 +12,6 @@ echoLine("tsDay:" . tsDay());
 //set_time_limit(15);                                                           # 设置执行超时时间
 //
 //
-var_dump(\posix_getuid());
+
+CLog::err("wwww");
+unset($i);

+ 1 - 0
Gameserver/Amfphp/util/CommUtil.php

@@ -264,6 +264,7 @@ class CommUtil {
      * @return 转换后的字符串
      */
     public static function str2UTF8($str) {
+        $str = $str?$str:'';                               # 防空字符串
         if (false !== mb_detect_encoding($str, 'UTF-8', true)) {
             return $str;
         }