pay_order($userId, $payAmt, $userPhone, $userEmail, $userName, $GiftsID, $buyIP, $AdId, $eventType, $pay_method); } catch (\Throwable $exception) { Redis::set('PayErro_CoinPay', 1, 'EX', 600); Util::WriteLog('CoinPay_error', $exception->getMessage()); TelegramBot::getDefault()->sendProgramNotify('CoinPay pay error', $exception->getMessage(), $exception); return apiReturnFail($logic->getError()); } if (isset($res['code']) && (int)$res['code'] === 0) { $data = [ 'content' => $res['data']['url'] ?? '', 'money' => $payAmt, 'prdOrdNo' => $res['data']['orderNo'] ?? '', ]; return apiReturnSuc($data); } if ($res === false) { return apiReturnFail($logic->getError()); } if ($this->retryTimes > 0) { Redis::set('PayErro_CoinPay', 1, 'EX', 600); return apiReturnFail($logic->getError()); } $this->retryTimes++; return $this->pay_order($userId, $payAmt, $userName, $userEmail, $userPhone, $GiftsID, $buyIP, $AdId, $eventType, $pay_method); } public function notify(Request $request) { $post = $request->all(); Util::WriteLog('CoinPay', 'pay notify: ' . json_encode($post, JSON_UNESCAPED_UNICODE)); $service = new CoinPay(); if (!$service->verify($post)) { Util::WriteLog('CoinPay', 'pay notify verify failed'); return 'fail'; } $logic = new CoinPayLogic(); try { return $logic->notify($post); } catch (\Throwable $exception) { Redis::set('PayErro_CoinPay', 1, 'EX', 600); return '{"success":false,"message":"internal error"}'; } } public function sync_notify(Request $request) { Util::WriteLog('CoinPay', 'sync callback: ' . json_encode($request->all(), JSON_UNESCAPED_UNICODE)); return 'success'; } public function cash_notify(Request $request) { $post = $request->all(); Util::WriteLog('CoinPay', 'cash notify: ' . json_encode($post, JSON_UNESCAPED_UNICODE)); $service = new CoinPay('CoinPayOut'); if (!$service->verify($post)) { Util::WriteLog('CoinPay', 'cash notify verify failed'); return 'fail'; } $logic = new CoinPayCashierLogic(); try { return $logic->notify($post); } catch (\Throwable $exception) { return '{"success":false,"message":"internal error"}'; } } }