|
@@ -95,19 +95,41 @@ class ActiveProc {
|
|
|
));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 元宝兑换寻宝券
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
public static function lottery_Tree_cashExchange() {
|
|
|
list($num) = req()->paras;//抽奖次数 1 10
|
|
|
|
|
|
+ $cost ="";
|
|
|
+ if($num == 1){
|
|
|
+ $cost = glc()->activity_lottery_tree_one_cost;
|
|
|
+ } else {
|
|
|
+ $cost = glc()->activity_lottery_tree_ten_cost;
|
|
|
+ }
|
|
|
+ my_Assert($cost != "",ErrCode::active_lotteryCostErr);
|
|
|
+ $costArr = explode(',', $cost);
|
|
|
+ $item = ctx()->store->items;
|
|
|
+ $costId = $costArr[0];
|
|
|
+ $costNum = $costArr[1];
|
|
|
+
|
|
|
+ $selfNum = 0;
|
|
|
+ if(StlUtil::dictHasProperty($item, $costId)){
|
|
|
+ $selfNum = $item->$costId;
|
|
|
+ }
|
|
|
+ my_Assert($selfNum >= $costNum,ErrCode::active_lottery_unwantedExchange);
|
|
|
+
|
|
|
+ $costNum -= $selfNum;
|
|
|
+ $cash = glc()->activity_lottery_oneCost_cash * $costNum;
|
|
|
+ my_Assert(ctx()->baseInfo->cash >= $cash,ErrCode::notenough_cash_msg);
|
|
|
+ ctx()->baseInfo->Consume_Cash($cash);
|
|
|
+ StoreProc::AddMultiItemInStore($costId.','.$costNum);
|
|
|
+
|
|
|
UserProc::updateUserInfo();
|
|
|
return Resp::ok(array(
|
|
|
- "store" => ctx()->store,
|
|
|
- 'reward' => StoreProc::$reward,
|
|
|
- 'reward_Gem' => StoreProc::$reward_Gem,
|
|
|
- 'gold' => ctx()->baseInfo->gold,
|
|
|
- 'cash' => ctx()->baseInfo->cash,
|
|
|
- 'lotteryNum'=> ctx()->privateState->lotteryNum,
|
|
|
- 'indexReward'=> $rewardList,
|
|
|
-
|
|
|
+ "store" => ctx()->store,
|
|
|
+ 'cash' => ctx()->baseInfo->cash,
|
|
|
));
|
|
|
}
|
|
|
|