|
@@ -23,20 +23,21 @@ class CollegeProc {
|
|
|
*/
|
|
|
public static function procMain() {
|
|
|
switch (req()->cmd) {
|
|
|
- case CmdCode::cmd_college_ActiveTaskCard: # 7301 激活任务卡
|
|
|
+ case CmdCode::cmd_college_ActiveTaskCard://废弃 # 7301 激活任务卡
|
|
|
return CollegeProc::ActiveTaskCard();
|
|
|
case CmdCode::cmd_college_ReceiveCollegeReward: # 7302 领取年级奖励
|
|
|
return CollegeProc::ReceiveCollegeReward();
|
|
|
case CmdCode::cmd_college_ReceiveCourseReward: # 7303 领取课程奖励
|
|
|
return CollegeProc::ReceiveCourseReward();
|
|
|
-
|
|
|
+ case cmd_college_ScoreExchangeItem: #7304 积分兑换道具
|
|
|
+ return CollegeProc::ScoreExchangeItem();
|
|
|
default:
|
|
|
Err(ErrCode::cmd_err);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 7301 激活
|
|
|
+ * 7301 激活---废弃
|
|
|
*/
|
|
|
public static function ActiveTaskCard() {
|
|
|
$req = req();
|
|
@@ -86,25 +87,35 @@ class CollegeProc {
|
|
|
*/
|
|
|
public static function ReceiveCollegeReward() {
|
|
|
$req = req();
|
|
|
+ list($collegeId) = $req->paras;
|
|
|
+
|
|
|
$collegeInfo = $req->userInfo->game->college;
|
|
|
- $dic = GameConfig::college_getItem($collegeInfo->collegeId);
|
|
|
- $tag = true;
|
|
|
- $cList = explode(',', $dic->cList);
|
|
|
- foreach ($cList as $cId) {
|
|
|
- if (!in_array($cId, $collegeInfo->comCourseList)) {
|
|
|
- $tag = false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (!$tag) {
|
|
|
- return Resp::err(ErrCode::college_courseNumError);
|
|
|
- }
|
|
|
- StoreProc::AddMultiItemInStore(GameConfig::course_getItem($collegeInfo->courseId)->prize); # 发放奖励
|
|
|
-
|
|
|
- $college = new Info_College($req->userInfo->game->college);
|
|
|
- $college->updataCourseNew();
|
|
|
-
|
|
|
- $req->userInfo->game->college = $college;
|
|
|
+ $mo = GameConfig::college_getItem($collegeId);
|
|
|
+ my_Assert(count($collegeInfo->comCourseList) == count(explode(',', $mo->cList)), ErrCode::college_courseNumError);
|
|
|
+
|
|
|
+ StoreProc::AddMultiItemInStore($mo->prize); # 发放奖励
|
|
|
+
|
|
|
+ $collegeInfo->collegeRewardList[] = $collegeId;
|
|
|
+
|
|
|
+// $collegeInfo = $req->userInfo->game->college;
|
|
|
+// $dic = GameConfig::college_getItem($collegeInfo->collegeId);
|
|
|
+// $tag = true;
|
|
|
+// $cList = explode(',', $dic->cList);
|
|
|
+// foreach ($cList as $cId) {
|
|
|
+// if (!in_array($cId, $collegeInfo->comCourseList)) {
|
|
|
+// $tag = false;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (!$tag) {
|
|
|
+// return Resp::err(ErrCode::college_courseNumError);
|
|
|
+// }
|
|
|
+// StoreProc::AddMultiItemInStore($dic->prize); # 发放奖励
|
|
|
+//
|
|
|
+// $college = new Info_College($req->userInfo->game->college);
|
|
|
+// $college->updataCourseNew();
|
|
|
+
|
|
|
+ $req->userInfo->game->college = $collegeInfo;
|
|
|
UserProc::updateUserInfo();
|
|
|
|
|
|
return Resp::ok(array('store' => $req->userInfo->game->store,
|
|
@@ -119,28 +130,44 @@ class CollegeProc {
|
|
|
*/
|
|
|
public static function ReceiveCourseReward() {
|
|
|
$req = req();
|
|
|
- //list($taskCardId) = $req->paras;
|
|
|
+ list($courseId) = $req->paras;
|
|
|
+
|
|
|
$collegeInfo = $req->userInfo->game->college;
|
|
|
-
|
|
|
- $tag = true;
|
|
|
- foreach ($collegeInfo->compMissCardDic as $key => $value) {
|
|
|
- if ($value->type != Enum_TaskCardStateType::drawed) {
|
|
|
- $tag = false;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (!$tag) {
|
|
|
- return Resp::err(ErrCode::college_taskCardNumError);
|
|
|
+ my_Assert(!in_array($courseId, $collegeInfo->comCourseList), ErrCode::college_CourseRewardRepeatReceive);
|
|
|
+
|
|
|
+ $mo = GameConfig::course_getItem($courseId);
|
|
|
+ $list = explode(',', $mo->misslist);
|
|
|
+
|
|
|
+ my_Assert(StlUtil::dictHasProperty($collegeInfo->ingTaskCardDic, $courseId), ErrCode::college_CourseNotUnlocked);
|
|
|
+
|
|
|
+ foreach ($list as $id) {
|
|
|
+ my_Assert(StlUtil::dictHasProperty($collegeInfo->ingTaskCardDic->$courseId, $id) && $collegeInfo->ingTaskCardDic->$courseId->$id->type == Enum_TaskCardStateType::drawed, ErrCode::college_TaskCardStateError);
|
|
|
}
|
|
|
-
|
|
|
- StoreProc::AddMultiItemInStore(GameConfig::course_getItem($collegeInfo->courseId)->prize); # 发放奖励
|
|
|
- TaskProc::OnFinishAllSchoolTaskOfGrade($collegeInfo->courseId);
|
|
|
-
|
|
|
- $college = new Info_College($req->userInfo->game->college);
|
|
|
- $college->updataCourse();
|
|
|
-
|
|
|
- $req->userInfo->game->college = $college;
|
|
|
+
|
|
|
+ StoreProc::AddMultiItemInStore($mo->prize); # 发放奖励
|
|
|
+ TaskProc::OnFinishAllSchoolTaskOfGrade($courseId);
|
|
|
+
|
|
|
+ $collegeInfo->comCourseList[] = $courseId;
|
|
|
+
|
|
|
+// $tag = true;
|
|
|
+// foreach ($collegeInfo->compMissCardDic as $key => $value) {
|
|
|
+// if ($value->type != Enum_TaskCardStateType::drawed) {
|
|
|
+// $tag = false;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (!$tag) {
|
|
|
+// return Resp::err(ErrCode::college_taskCardNumError);
|
|
|
+// }
|
|
|
+//
|
|
|
+// StoreProc::AddMultiItemInStore(GameConfig::course_getItem($collegeInfo->courseId)->prize); # 发放奖励
|
|
|
+// TaskProc::OnFinishAllSchoolTaskOfGrade($collegeInfo->courseId);
|
|
|
+//
|
|
|
+// $college = new Info_College($req->userInfo->game->college);
|
|
|
+// $college->updataCourse();
|
|
|
+
|
|
|
+ $req->userInfo->game->college = $collegeInfo;
|
|
|
UserProc::updateUserInfo();
|
|
|
|
|
|
return Resp::ok(array('store' => $req->userInfo->game->store,
|
|
@@ -151,4 +178,26 @@ class CollegeProc {
|
|
|
));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 7304 积分兑换道具
|
|
|
+ */
|
|
|
+ public static function ScoreExchangeItem() {
|
|
|
+ $req = req();
|
|
|
+ list($id) = $req->paras;
|
|
|
+
|
|
|
+ $scoreRewardList = $req->userInfo->game->college->scoreRewardList;
|
|
|
+ my_Assert(in_array($id,$scoreRewardList), ErrCode::college_taskScoreRewardRepeatReceive);
|
|
|
+
|
|
|
+ $score = $req->userInfo->game->college->score;
|
|
|
+ my_Assert($score >= $id, ErrCode::college_taskScoreRewardRepeatReceive);
|
|
|
+
|
|
|
+ $mo = GameConfig::score_getItem($id);
|
|
|
+ $req->userInfo->game->college->scoreRewardList[] = $id;
|
|
|
+ StoreProc::AddMultiItemInStore($mo->items);
|
|
|
+ UserProc::updateUserInfo();
|
|
|
+
|
|
|
+ return Resp::ok(array('store' => $req->userInfo->game->store,
|
|
|
+ 'college' => $req->userInfo->game->college,
|
|
|
+ ));
|
|
|
+ }
|
|
|
}
|