|
@@ -50,54 +50,142 @@ class PayProc {
|
|
|
// <editor-fold defaultstate="collapsed" desc=" 支付新版 2021.11.16 ">
|
|
|
case CmdCode::cmd_mpay_PayDeliverGoods: # 8813
|
|
|
return self::PayDeliverGoods();
|
|
|
+ case CmdCode::cmd_mpay_UserRechargeDrawPrize:
|
|
|
+ return self::UserRechargeDrawPrize();
|
|
|
// </editor-fold>
|
|
|
default:
|
|
|
return Resp::err(ErrCode::cmd_err);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- *
|
|
|
+ * 领取奖励
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ static function UserRechargeDrawPrize() {
|
|
|
+ list($type,$typeId) = req()->paras;
|
|
|
+ $user = req()->userInfo->game;
|
|
|
+
|
|
|
+ switch ($type) {
|
|
|
+ case Enum_Recharge::FirstRecharge://首冲
|
|
|
+ my_Assert($user->pay->firstRechage == 0, ErrCode::shop_firstRechargeNotRepeat);
|
|
|
+
|
|
|
+ StoreProc::AddMultiItemInStore(GameConfig::globalsettings()->firstRechargePrizes);
|
|
|
+ $user->pay->firstRechage = 1;
|
|
|
+ break;
|
|
|
+ case Enum_Recharge::DaliySpecialPackages://每日特惠
|
|
|
+ my_Assert(!in_array($typeId, $user->shopdata->daliySpecialPackages), ErrCode::shop_daliySpecialRewardNotRepeat);
|
|
|
+
|
|
|
+ $mo = GameConfig::shop_limit_getItem($typeId);
|
|
|
+ my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
+ if($mo->price != 0){
|
|
|
+ my_Assert($user->shopdata->daliySpecial_ts!= 0, ErrCode::shop_daliySpecialRewardNotRepeat);
|
|
|
+ $ts = $user->shopdata->daliySpecial_ts + 7*24*60*60;
|
|
|
+ my_Assert(now() < $ts, ErrCode::shop_daliySpecialRewardNotRepeat);
|
|
|
+ }
|
|
|
+
|
|
|
+ //my_Assert($mo->price != 0, ErrCode::shop_daliySpecialRewardNotRepeat);
|
|
|
+ StoreProc::AddMultiItemInStore($mo->reward);
|
|
|
+
|
|
|
+ $shopdata = new Info_UserShop(req()->userInfo->game->shopdata);
|
|
|
+ $shopdata->daliySpecialPackages[] = $typeId;
|
|
|
+ req()->userInfo->game->shopdata = $shopdata;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ req()->userInfo->game = $user;
|
|
|
+
|
|
|
+ UserProc::updateUserInfo();
|
|
|
+ return Resp::ok(array(
|
|
|
+ "pay"=>$user->pay,
|
|
|
+ "shopdata"=>req()->userInfo->game->shopdata,
|
|
|
+ "base" => $user->baseInfo,
|
|
|
+ "store" => $user->store,
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 充值发货
|
|
|
*/
|
|
|
static function PayDeliverGoods() {
|
|
|
list($cpOrderId) = req()->paras;
|
|
|
$user = req()->userInfo->game;
|
|
|
|
|
|
- pay_op::CheckAndDrawOrder(req()->uid,$cpOrderId,array(new PayProc,'distributePayGoods'));
|
|
|
- //记录充值金额amount
|
|
|
- $order = daoInst()->select()->from(self::orderTab) # 取订单数据
|
|
|
- ->where('cpOrderId')->eq($cpOrderId)
|
|
|
- ->limit(1)->fetch();
|
|
|
- my_Assert($order->product_id != null, ErrCode::pay_order_product_id);
|
|
|
-
|
|
|
- $mo = GameConfig::recharge_getItem($order->product_id);
|
|
|
- my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
+ pay_op::CheckAndDrawOrder(req()->uid,$cpOrderId,array(new PayProc,'distributePayGoods'));
|
|
|
|
|
|
- $cash = $mo->rmd *10;
|
|
|
- if($user->baseInfo->charge_amt <= 0){
|
|
|
- $cash = $mo->rmd *10* $mo->firstDouble;
|
|
|
- }
|
|
|
- $user->base()->Add_Cash($cash);
|
|
|
-
|
|
|
- $user->baseInfo->charge_amt += $order->amount;
|
|
|
req()->userInfo->game = $user;
|
|
|
|
|
|
UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
return Resp::ok(array(
|
|
|
+ "pay"=>$user->pay,
|
|
|
"base" => $user->baseInfo,
|
|
|
+ "shopdata"=>$user->shopdata,
|
|
|
"store" => $user->store,
|
|
|
));
|
|
|
}
|
|
|
+
|
|
|
//发货
|
|
|
static function distributePayGoods($order = null) {
|
|
|
- $str = $order->product_id.",".$order->product_count;
|
|
|
- //CLog::pay("支付奖励id".$order->product_id);
|
|
|
- //CLog::pay("支付奖励num".$order->product_count);
|
|
|
- $ret = StoreProc::AddMultiItemInStore($str);
|
|
|
+ my_Assert($order->product_id != null, ErrCode::pay_order_product_id);
|
|
|
+ $user = req()->userInfo->game;
|
|
|
+
|
|
|
+ if ($order->product_id >= 6 && $order->product_id <= 1000) {//充值表
|
|
|
+ $mo = GameConfig::recharge_getItem($order->product_id);
|
|
|
+ my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
+ $cash = $mo->rmd *10;
|
|
|
+ if($user->baseInfo->charge_amt <= 0){
|
|
|
+ $cash = $mo->rmd *10* $mo->firstDouble;
|
|
|
+ }
|
|
|
+ $user->base()->Add_Cash($cash);
|
|
|
+ }
|
|
|
+ elseif ($order->product_id >= 801001 && $order->product_id <= 899999) {//每日特惠
|
|
|
+ $mo = GameConfig::shop_limit_getItem($order->product_id);
|
|
|
+ if($mo == null){
|
|
|
+ $list = GameConfig::shop_limit_type_getItemArray(Enum_Recharge::DaliySpecialPackages);
|
|
|
+ $cur = 0;
|
|
|
+ foreach ($list as $item) {
|
|
|
+ $cur += $item->price;
|
|
|
+ }
|
|
|
+ my_Assert($cur == $order->amount, ErrCode::err_const_no);
|
|
|
+ $user->shopdata->daliySpecial_ts = now();
|
|
|
+ } else {
|
|
|
+ StoreProc::AddMultiItemInStore($mo->reward);
|
|
|
+ $user->shopdata->daliySpecialPackages[] = $mo->typeId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ elseif ($order->product_id >= 901001 && $order->product_id <= 999999) {//月卡
|
|
|
+ $shopdata = new Info_UserShop(req()->userInfo->game->shopdata);
|
|
|
+ $packageCfg = GameConfig::shop_monthVIP_getItem($packageId);
|
|
|
+ my_Assert(null != $packageCfg, ErrCode::err_const_no);
|
|
|
+ if ($packageCfg->subType == 4) {
|
|
|
+ my_Assert($shopdata->monthlyVIP1_ts + $packageCfg->ExpireTs * 3600 * 24 < now(), ErrCode::shop_monthlyvip_buyed);
|
|
|
+ } elseif ($packageCfg->subType == 5) {
|
|
|
+ my_Assert($shopdata->monthlyVIP2_ts + $packageCfg->ExpireTs * 3600 * 24 < now(), ErrCode::shop_monthlyvip_buyed);
|
|
|
+ }
|
|
|
+ $err = StoreProc::AddMultiItemInStore($packageCfg->pri_reward); # 发放一次性奖励
|
|
|
+ my_Assert(ErrCode::ok == $err, $err);
|
|
|
+ if ($packageCfg->subType == 4) {
|
|
|
+ $shopdata->monthlyVIP1_ts = 3600 * 24 * (tsDay() + 1) - 1;
|
|
|
+ } elseif ($packageCfg->subType == 5) {
|
|
|
+ $shopdata->monthlyVIP2_ts = 3600 * 24 * (tsDay() + 1) - 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ EmailProc::SendMonthlyVIPDailyReward(req()->zoneid, req()->uid, $packageCfg->name, $packageCfg->daily_reward);
|
|
|
+
|
|
|
+ req()->userInfo->game->shopdata = $shopdata;
|
|
|
+ }
|
|
|
+ $user->baseInfo->charge_amt += $order->amount;
|
|
|
+
|
|
|
+ req()->userInfo->game = $user;
|
|
|
+
|
|
|
+ return true;
|
|
|
//CLog::pay("支付奖励回存状态".$ret);
|
|
|
- return $ret == ErrCode::ok? true:false;
|
|
|
+ //return $ret == ErrCode::ok? true:false;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 8812 查询充值记录
|
|
|
*/
|