$orderSn], true); if (empty($renew)) { $msg = "没有找到续费订单 orderSn:{$orderSn}"; noticeUtil::push($msg, '15280215347'); util::fail($msg); } if ($renew->actPrice != $totalFee) { $msg = "续费订单金额与回调通知金额不一致 orderSn:{$orderSn} {$renew->actPrice} {$totalFee}"; noticeUtil::push($msg, '15280215347'); util::fail($msg); } if ($renew->status == 1) { $msg = '续费订单已付款,重复通知 orderSn:' . $orderSn; noticeUtil::push($msg, '15280215347'); util::fail($msg); } $attachParams = []; if (!empty($attach)) { parse_str($attach, $attachParams); } $applyId = (int) ($attachParams['applyId'] ?? 0); $isRegisterMember = $applyId > 0; $shopId = $renew->shopId ?? 0; $shop = ShopClass::getById($shopId, true); if (empty($shop)) { $msg = '续费订单没有找到门店 orderSn:' . $orderSn; noticeUtil::push($msg, '15280215347'); util::fail($msg); } $mainId = $shop->mainId ?? 0; $before = $shop->deadline ?? ''; $beforeTime = strtotime($before); if ($renew->type == 2) { //购买设备,不需要有操作 } else { //每次续费一年 $time = $beforeTime + 31536000; $newDate = date("Y-m-d H:i:s", $time); $renew->deadline = $newDate; $renew->beforeDeadline = $before; $shopList = ShopClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true); if (!empty($shopList)) { foreach ($shopList as $myShop) { $myShop->beforeDeadline = $before; $myShop->deadline = $newDate; $myShop->hasRenew = 1; $myShop->needRenew = 0; $myShop->save(); } } } $renew->returnCode = $transactionId; $renew->payTime = date("Y-m-d H:i:s"); $renew->status = 1; $renew->save(); if ($isRegisterMember) { $apply = ApplyClass::getById($applyId); if (!empty($apply)) { MainInviteClass::grantInviterCommission( $apply, (int) $mainId, trim((string) ($apply['name'] ?? '')), trim((string) ($apply['mobile'] ?? '')), round((float) ($renew->prePrice ?? 0), 2), round((float) ($renew->actPrice ?? 0), 2) ); } } return true; } }