|
@@ -20,7 +20,7 @@ require_once __DIR__ . '/../service_call/pay/official/pay_op.php';
|
|
|
*/
|
|
|
class PayProc {
|
|
|
|
|
|
- const orderTab = 'tpl_order_tab';
|
|
|
+ const orderTab = 'tab_order_tab';
|
|
|
|
|
|
/**
|
|
|
* 逻辑分发
|
|
@@ -334,7 +334,7 @@ class PayProc {
|
|
|
|
|
|
$result = pay_op::CheckAndDrawOrder(req()->uid, $cpOrderId, array(new PayProc, 'distributePayGoods'));
|
|
|
CLog::pay($result);
|
|
|
- my_Assert($result->err == 0, ErrCode::pay_fail);
|
|
|
+ my_Assert($result->err == 0, $result->err); # 发货失败
|
|
|
|
|
|
$user = ctx();
|
|
|
NormalEventProc::OnPaySuccess();
|
|
@@ -398,106 +398,6 @@ class PayProc {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // <editor-fold defaultstate="collapsed" desc="已废弃逻辑">
|
|
|
-// else if ($order->product_id == 1) {
|
|
|
-// $user->base(true)->Add_Cash($order->product_count);
|
|
|
-// self::$retArr[] = "2," . $order->product_count;
|
|
|
-// } else if ($order->product_id >= 6 && $order->product_id <= 1000) {//充值表
|
|
|
-// $mo = GameConfig::recharge_getItem($order->product_id);
|
|
|
-// my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
-//
|
|
|
-// if (!StlUtil::dictHasProperty($user->shopdata, 'rechargeRecordList')) {
|
|
|
-// $user->shopdata->rechargeRecordList = array();
|
|
|
-// }
|
|
|
-//
|
|
|
-// $cash = $mo->rmd * 10;
|
|
|
-// if (!in_array($order->product_id, $user->shopdata->rechargeRecordList)) {
|
|
|
-// $cash = $mo->rmd * 10 * $mo->firstDouble;
|
|
|
-// $user->shopdata->rechargeRecordList[] = $order->product_id;
|
|
|
-// }
|
|
|
-// $user->base(true)->Add_Cash($cash);
|
|
|
-// self::$retArr[] = "2," . $cash;
|
|
|
-// } elseif ($order->product_id >= 801001 && $order->product_id <= 803999) {//限购
|
|
|
-// self::checklimitBuyRecharge($order->product_id);
|
|
|
-//
|
|
|
-// $mo = GameConfig::shop_limit_getItem($order->product_id);
|
|
|
-// if ($mo->subType == 1) {
|
|
|
-// $user->shopdata->dayRechargeAmt += $order->amount;
|
|
|
-// } else if ($mo->subType == 2) {
|
|
|
-// $user->shopdata->weekRechargeAmt += $order->amount;
|
|
|
-// }
|
|
|
-// } elseif ($order->product_id >= 804001 && $order->product_id <= 804999) {//每日特惠
|
|
|
-// $mo = GameConfig::shop_limit_getItem($order->product_id);
|
|
|
-// my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
-// if ($mo->price == 60) {
|
|
|
-// $user->shopdata->daliySpecial_ts = now();
|
|
|
-// } else {
|
|
|
-// $itemid = explode(',', $mo->reward)[0];
|
|
|
-// $itemMO = GameConfig::item_package_getItem($itemid);
|
|
|
-// my_Assert(null != $itemMO, ErrCode::err_const_no);
|
|
|
-// StoreProc::AddMultiItemInStore($itemMO->contents);
|
|
|
-// $user->shopdata->daliySpecialPackages[] = $mo->typeId;
|
|
|
-// self::$retArr[] = $itemMO->contents;
|
|
|
-// }
|
|
|
-// } elseif ($order->product_id >= 805001 && $order->product_id <= 805999) {//限时
|
|
|
-// $mo = GameConfig::shop_limit_getItem($order->product_id);
|
|
|
-// my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
-// my_Assert(!in_array($order->product_id, $user->shopdata->limitTsActiveRewardsList), ErrCode::err_const_no);
|
|
|
-//
|
|
|
-// $user->shopdata->limitTsActiveRewardsList[] = $mo->typeId;
|
|
|
-// $itemid = explode(',', $mo->reward)[0];
|
|
|
-// $itemMO = GameConfig::item_package_getItem($itemid);
|
|
|
-// my_Assert(null != $itemMO, ErrCode::err_const_no);
|
|
|
-// StoreProc::AddMultiItemInStore($itemMO->contents); //领取奖励
|
|
|
-// self::$retArr[] = $itemMO->contents;
|
|
|
-// } elseif ($order->product_id >= 806001 && $order->product_id <= 806999) {//首充【2022-10-19新的首充功能】
|
|
|
-// $mo = GameConfig::shop_accumulating_getItem($order->product_id);
|
|
|
-// my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
-// $shopdata = new Info_UserShop(ctx()->shopdata);
|
|
|
-// $amount = $mo->amount;
|
|
|
-// if (!StlUtil::dictHasProperty($shopdata->fRechargeTime, $amount)) {
|
|
|
-// $shopdata->fRechargeTime->$amount = TimeUtil::tsDay();
|
|
|
-// }
|
|
|
-// $cost = 0;
|
|
|
-// $dic = GameConfig::shop_accumulating();
|
|
|
-// foreach ($dic as $k => $item) {
|
|
|
-// if ($cost <= $item->amount) {
|
|
|
-// $cost = $item->amount;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if ($cost <= $amount && $shopdata->suitGiftStartTs == 0) {
|
|
|
-// $shopdata->suitGiftStartTs = now();
|
|
|
-// }
|
|
|
-// ctx()->shopdata = $shopdata;
|
|
|
-// //self::$retArr[] = $mo->goods;
|
|
|
-// } elseif ($order->product_id >= 807001 && $order->product_id <= 807999) {//终身礼包
|
|
|
-// self::checklimitBuyRecharge($order->product_id);
|
|
|
-// } elseif ($order->product_id >= 808001 && $order->product_id <= 808999) {//套装礼包
|
|
|
-// self::checklimitBuyRecharge($order->product_id);
|
|
|
-// } elseif ($order->product_id >= 901001 && $order->product_id <= 999999) {//月卡
|
|
|
-// $shopdata = new Info_UserShop(ctx()->shopdata);
|
|
|
-// $packageCfg = GameConfig::shop_monthVIP_getItem($order->product_id);
|
|
|
-// 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); # 发放一次性奖励
|
|
|
-// self::$retArr[] = $packageCfg->pri_reward;
|
|
|
-// my_Assert(ErrCode::ok == $err, $err);
|
|
|
-// if ($packageCfg->subType == 4) {
|
|
|
-// $shopdata->monthlyVIP1_ts = 3600 * 24 * (totalDays() + 1) - 1;
|
|
|
-// } elseif ($packageCfg->subType == 5) {
|
|
|
-// $shopdata->monthlyVIP2_ts = 3600 * 24 * (totalDays() + 1) - 1;
|
|
|
-// }
|
|
|
-//
|
|
|
-// EmailProc::SendMonthlyVIPDailyReward(req()->zoneid, req()->uid, $packageCfg->name, $packageCfg->daily_reward);
|
|
|
-//
|
|
|
-// ctx()->shopdata = $shopdata;
|
|
|
-// }
|
|
|
-// </editor-fold>
|
|
|
-
|
|
|
$user->baseInfo->charge_amt += $order->amount; # 统计下累充金额
|
|
|
|
|
|
if ($order->amount > 0) {
|
|
@@ -580,8 +480,7 @@ class PayProc {
|
|
|
*/
|
|
|
static function GetPayRecoreds() {
|
|
|
$uid = req()->uid;
|
|
|
- $table = "tpl_order_tab";
|
|
|
- $arr = daoInst()->select(" cpOrderId as '订单' ,product_name as '道具',amount as '金额' ,from_unixtime(order_ts) as '时间' ")->from($table)
|
|
|
+ $arr = daoInst()->select(" cpOrderId as '订单' ,product_name as '道具',amount as '金额' ,from_unixtime(order_ts) as '时间' ")->from(self::orderTab)
|
|
|
->where("uid")->eq($uid)
|
|
|
->andWhere("status")->eq(1)
|
|
|
->fetchall();
|
|
@@ -593,6 +492,7 @@ class PayProc {
|
|
|
|
|
|
/**
|
|
|
* 刷新充值订单(领取充值结果)
|
|
|
+ * @deprecated since version 2024.12.20
|
|
|
*/
|
|
|
public static function m_refreshChargeOrders() {
|
|
|
# 客户端参数解析
|
|
@@ -694,65 +594,37 @@ class PayProc {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 检查异常订单, 补发道具
|
|
|
+ * [8811] 检查异常订单, 补发道具
|
|
|
*/
|
|
|
public static function selfhelpCheckOrders() {
|
|
|
$uid = req()->uid;
|
|
|
$orders = daoInst()->select()
|
|
|
- ->from('tpl_order_tab')
|
|
|
+ ->from(self::orderTab)
|
|
|
->where('uid')->eq($uid)
|
|
|
->andWhere('status')->eq(1)
|
|
|
->andWhere('drawed_ts')->le(0)
|
|
|
->fetchAll();
|
|
|
if (count($orders) > 0) {
|
|
|
foreach ($orders as $order) {
|
|
|
- // 准备补发
|
|
|
- $product_id = $order->product_id;
|
|
|
- $product_count = $order->product_count;
|
|
|
- $typid = substr("$product_id", 0, 3); # 提取商品编号前缀
|
|
|
- $goods = '';
|
|
|
- switch ($typid) {
|
|
|
- case '802': # 神秘商城物品
|
|
|
- $item = GameConfig::secretshop_typeId_getItem($product_id);
|
|
|
- break;
|
|
|
- case '801': # 商城物品
|
|
|
- $item = GameConfig::shop_getItem($product_id);
|
|
|
- break;
|
|
|
- default :
|
|
|
- return Resp::err(ErrCode::pay_systembusy_err);
|
|
|
- }
|
|
|
- if (!$item) {
|
|
|
- return Resp::err(ErrCode::pay_shopItem_cosnt_goods_err);
|
|
|
- }
|
|
|
- if ($item->pricetype != 0) { # 并非人民币定价
|
|
|
- CLog::pay(" 道具付费类型异常:" . $product_id);
|
|
|
- return Resp::err(ErrCode::pay_m_type_err);
|
|
|
- }
|
|
|
- for ($i = 0; $i < $product_count; $i++) { # 默认为1,还没有设计为n的情况
|
|
|
- StoreProc::AddMultiItemInStore($item->goods, 5); # 发货
|
|
|
- }
|
|
|
- $goods .= $item->goods;
|
|
|
- $n = daoInst()->update(self::orderTab) # 更新订单状态
|
|
|
- ->data(array('drawed_ts' => now()))
|
|
|
- ->where('cpOrderId')->eq($order->cpOrderId)
|
|
|
- ->exec();
|
|
|
- if (!$n) { # 影响条数应为1
|
|
|
- CLog::pay(req()->uid . ' 登录补发订单失败 ' . $order->cpOrderId);
|
|
|
- return Resp::err(ErrCode::err_db); # 数据库操作失败
|
|
|
- }
|
|
|
- ctx()->baseInfo->charge_amt += $order->amount; # 历史充值记录(单位分)
|
|
|
+ $result = pay_op::CheckAndDrawOrder(req()->uid, $order->cpOrderId, array(new PayProc, 'distributePayGoods'));
|
|
|
+ CLog::pay($result);
|
|
|
+ my_Assert($result->err == 0, $result->err); # 发货失败
|
|
|
+
|
|
|
UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
CLog::pay(req()->uid . ' 登录补发订单 ' . $order->cpOrderId);
|
|
|
}
|
|
|
- return Resp::ok(# 返回
|
|
|
- array('cash' => ctx()->baseInfo->cash, # # 直接将游戏币的最新值返回给客户端
|
|
|
- 'store' => ctx()->store, # # 背包
|
|
|
- 'goods' => $goods, # # 发货内容
|
|
|
- 'count' => count($orders), # # 发货数量
|
|
|
- 'msg' => "找到并处理" . count($orders) . "条未发货订单."
|
|
|
- ));
|
|
|
}
|
|
|
- return Resp::ok('ok'); # everything is ok!
|
|
|
+ return Resp::ok(array(
|
|
|
+ "ret" => self::$retArr, # # 奖励串
|
|
|
+ "mod" => '', # # 商品刷新模块名
|
|
|
+ "baseInfo" => ctx()->baseInfo,
|
|
|
+// "shopdata" => $user->shopdata,
|
|
|
+ "store" => ctx()->store,
|
|
|
+ 'task' => ctx()->task,
|
|
|
+ 'heros' => ctx()->heros,
|
|
|
+ 'privateState' => ctx()->privateState,
|
|
|
+ ));
|
|
|
+// return Resp::ok('ok'); # everything is ok!
|
|
|
}
|
|
|
|
|
|
// </editor-fold>
|