|
@@ -48,19 +48,51 @@ class ActiveProc {
|
|
|
return self::GetTodayOnlineInfos();
|
|
|
case CmdCode::cmd_active_draw_onlinegift: # 6112 领取在线(时长)礼包
|
|
|
return self::DrawOnlineGift();
|
|
|
-
|
|
|
+ case CmdCode::cmd_active_YanBaoBuyItemActive_drawReward:
|
|
|
+ return self::YanBaoBuyItemActive_drawReward();
|
|
|
default:
|
|
|
Err(ErrCode::cmd_err);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * [6112] 领取连续在线礼包
|
|
|
+ */
|
|
|
+ static function YanBaoBuyItemActive_drawReward() {
|
|
|
+ list($typeId) = req()->paras; # 提取参数: 礼包的编号
|
|
|
+
|
|
|
+ $Mo = GameConfig::activity_cashmall_getItem($typeId); # 常量数据
|
|
|
+ my_Assert(null != $Mo, ErrCode::err_const_no); # 防御找不到配置数据
|
|
|
+
|
|
|
+ $rewardArr = ctx()->privateState->YuanbaoBuy_RewardRecord;
|
|
|
+ $count = array_count_values($rewardArr)[$typeId];
|
|
|
+ my_Assert($count < $Mo->limitNum, ErrCode::user_shop_LimitNum);
|
|
|
+
|
|
|
+// my_Assert(!in_array($typeId, ctx()->privateData()->YuanbaoBuy_RewardRecord), # # 判断礼包ID是否已经领取
|
|
|
+// ErrCode::active_hasgetted);
|
|
|
+ $err = StoreProc::AddMultiItemInStore($Mo->reward); # 发放奖励
|
|
|
+ my_Assert(ErrCode::ok == $err, $err); # 发放奖励失败
|
|
|
+ ctx()->privateData(true)->YuanbaoBuy_RewardRecord[] = $typeId; # 记录已领礼包ID
|
|
|
+
|
|
|
+ UserProc::updateUserInfo(); # 回写用户数据
|
|
|
+ return Resp::ok(array(
|
|
|
+ "reward" => StoreProc::$reward,
|
|
|
+ "reward_Gem" => StoreProc::$reward_Gem,
|
|
|
+ "reward_equip" => StoreProc::$reward_equip,
|
|
|
+ 'gold' => ctx()->base()->gold,
|
|
|
+ 'cash' => ctx()->base()->cash,
|
|
|
+ 'store' => ctx()->store(),
|
|
|
+ 'heros' => ctx()->heros()
|
|
|
+ )); # 设置返回值
|
|
|
+ }
|
|
|
+
|
|
|
public static function GetTodayOnlineInfos() {
|
|
|
return Resp::ok(array(
|
|
|
'onlineGiftts' => ctx()->privateState->onlineGiftts,
|
|
|
'onlineGiftIDs' => ctx()->privateState->onlineGiftIDs,
|
|
|
));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 清理/重置 在线礼包时间戳
|
|
|
*/
|
|
@@ -68,6 +100,13 @@ class ActiveProc {
|
|
|
ctx()->privateState->onlineGiftts = 1;
|
|
|
ctx()->privateState->onlineGiftIDs = array();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 清理/重置 元宝商城购买记录
|
|
|
+ */
|
|
|
+ public static function ClearYanBaoBuyItemActive_drawReward() {
|
|
|
+ ctx()->privateState->YuanbaoBuy_RewardRecord = array();
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* [6112] 领取连续在线礼包
|