Kaynağa Gözat

学院新需求增加

cyzhao 4 yıl önce
ebeveyn
işleme
fa72c75c43

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

@@ -3,7 +3,6 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2021-04-22 16:39:20
 ////////////////////
 
 /**

+ 31 - 0
Gameserver/Amfphp/model/User/Enum_College.php

@@ -0,0 +1,31 @@
+<?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 Enum_College
+ *
+ * @author cyzhao
+ */
+class Enum_College extends Enum{
+    /**
+     * 
+     */
+    const none = 0;
+
+    /**
+     * 
+     */
+    const update = 1;
+
+    /**
+     * 
+     */
+    const finish= 2;
+}

+ 28 - 3
Gameserver/Amfphp/model/User/Info_College.php

@@ -48,6 +48,12 @@ class Info_College extends Object_ext{
      */
     public $collegeRewardList = array();
     
+    /**
+     * 
+     * @var type
+     */
+    public $maskCollege = 0;
+
     /**
      * 构造函数
      * @param type $args
@@ -108,9 +114,16 @@ class Info_College extends Object_ext{
         $this->collegeRewardList[] = $this->collegeId;
         $this->collegeId += 1;    
         $newCollegeDic = GameConfig::college_getItem($this->collegeId);  
-        $cList = explode(',', $newCollegeDic->cList);
-        $this->courseId = $cList[0];
-        $this->initCompMissCardDic();           
+        if($newCollegeDic == null){
+            $this->maskCollege = Enum_College::finish;
+            $this->collegeId -= 1;
+        } elseif ($newCollegeDic != null && $newCollegeDic->cList == null) {
+            $this->maskCollege = Enum_College::update;
+        } else {
+            $cList = explode(',', $newCollegeDic->cList);
+            $this->courseId = $cList[0];
+            $this->initCompMissCardDic();   
+        }                    
 //        }                  
     }
     
@@ -137,5 +150,17 @@ class Info_College extends Object_ext{
 //        }                  
     }
     
+    public function checkCollege() {
+        if($this->maskCollege == Enum_College::update){
+            $dic = GameConfig::college_getItem($this->collegeId);
+            if($dic != null && $dic->cList != null){
+                $this->maskCollege = 0;
+                $cList = explode(',', $dic->cList);
+                $this->courseId = $cList[0];
+                $this->initCompMissCardDic();
+            }                               
+        }           
+    }
+    
     
 }

+ 11 - 3
Gameserver/Amfphp/process/CollegeProc.php

@@ -77,15 +77,23 @@ class CollegeProc {
     }
     
     /**
-     * 
+     * 领取一个年级的奖励
      * @param Req $req
      */
     public static function ReceiveCollegeReward($req) {
         $collegeInfo = $req->userInfo->game->college;
         $dic = GameConfig::college_getItem($collegeInfo->collegeId);
-        if(count(explode(',', $dic->cList)) != count($collegeInfo->comCourseList)){
-            return Resp::err(ErrCode::college_courseNumError); 
+        $tag = true;
+        $cList = explode(',', $newCollegeDic->cList);
+        foreach ($cList as $cId) {
+            if(!in_array($cId,$collegeInfo->comCourseList)){
+                $tag = false; 
+            }
         }
+        
+        if(!$tag){
+            return Resp::err(ErrCode::college_courseNumError); 
+        }                 
         StoreProc::AddMultiItemInStore($req, GameConfig::course_getItem($collegeInfo->courseId)->prize);      # 发放奖励
         
         $college = new Info_College($req->userInfo->game->college);