push('callback_queue', json_encode(['header'=>$headers,'res'=>$res],320)); } /** 通知接口 * @return array|mixed|string[] */ public function notifyOld() { // 获取所有 HTTP 请求头 $headers = Request::header(); // 获取 JSON 格式的请求体 $jsonData = Request::instance()->getContent(); $data = json_decode($jsonData, true); $this->saveLog('callback_queue回调加密参数原文;header:'.json_encode($headers).',body:'.$jsonData); $appKey = $headers['appKey'] ?? $headers['appkey']; $company = CompanyModel::detail(['appKey' => $appKey]); $crypto = new Crypto($company); $res = $crypto->processResponse(['header'=>$headers,'encryptData'=>$data]); // 记录日志等 $this->saveLog('callback_queue回调参数解密,'.$headers['method'].":".json_encode($res,320)); // 检查 JSON 解码是否成功 if (!$res) { return json(['code' => '03', 'message' => '报文解密异常']); } // 存入队列处理 $queueService = new QueueService(); $queueService->push('callback_queue', json_encode(['header'=>$headers,'res'=>$res],320)); // 返回成功的 JSON 响应 return json(['code' => '00', 'message' => '请求成功']); } /** 分油下单回到 * @return string */ public function notify() { // 获取所有 HTTP 请求头 $headers = Request::header(); // 获取 GET 参数 $data = Request::param(); $this->saveLog('callback_queue回调参数原文;header:'.json_encode($headers).',body:'.json_encode($data)); /*$appKey = $headers['appKey'] ?? $headers['appkey']; $company = CompanyModel::detail(['appKey' => $appKey]); $crypto = new Crypto($company); $res = $crypto->processResponse(['header'=>$headers,'encryptData'=>$data]); // 记录日志等 $this->saveLog('callback_queue回调参数解密,'.$headers['method'].":".json_encode($res,320)); // 检查 JSON 解码是否成功 if (!$res) { return json(['code' => '03', 'message' => '报文解密异常']); }*/ $headers['method'] = 'oil'; // 存入队列处理 $queueService = new QueueService(); $queueService->push('callback_queue', json_encode(['header'=>$headers,'res'=>$data],320)); // 返回成功的 JSON 响应 return 'OK'; } /** 使用结果回调 * @return string */ public function use() { // 获取所有 HTTP 请求头 $headers = Request::header(); // 获取 GET 参数 $data = Request::param(); $this->saveLog('callback_queue回调参数原文;header:'.json_encode($headers).',body:'.json_encode($data)); /*$appKey = $headers['appKey'] ?? $headers['appkey']; $company = CompanyModel::detail(['appKey' => $appKey]); $crypto = new Crypto($company); $res = $crypto->processResponse(['header'=>$headers,'encryptData'=>$data]); // 记录日志等 $this->saveLog('callback_queue回调参数解密,'.$headers['method'].":".json_encode($res,320)); // 检查 JSON 解码是否成功 if (!$res) { return json(['code' => '03', 'message' => '报文解密异常']); }*/ $headers['method'] = 'use'; // 存入队列处理 $queueService = new QueueService(); $queueService->push('callback_queue', json_encode(['header'=>$headers,'res'=>$data],320)); // 返回成功的 JSON 响应 return 'OK'; } /** 分油下单回到 * @return string */ public function partnersNotify() { // 获取所有 HTTP 请求头 $headers = Request::header(); // 获取 GET 参数 $data = Request::param(); $this->saveLog('callback_queue回调参数原文;header:'.json_encode($headers).',body:'.json_encode($data)); $headers['method'] = 'oil_partners'; // 存入队列处理 $queueService = new QueueService(); $queueService->push('callback_queue', json_encode(['header'=>$headers,'res'=>$data],320)); // 返回成功的 JSON 响应 return 'OK'; } /** 使用结果回调 * @return string */ public function partnersUse() { // 获取所有 HTTP 请求头 $headers = Request::header(); // 获取 GET 参数 $data = Request::param(); $this->saveLog('callback_queue回调参数原文;header:'.json_encode($headers).',body:'.json_encode($data)); $headers['method'] = 'use_partners'; // 存入队列处理 $queueService = new QueueService(); $queueService->push('callback_queue', json_encode(['header'=>$headers,'res'=>$data],320)); // 返回成功的 JSON 响应 return 'OK'; } }