$this->mall_id, ]))->getSetting(); try { $reqStr = Des3Utils::decrypt($msg, $config['secret']); Yii::error('$reqStr' . $reqStr); $respData = Json::decode($reqStr); Yii::error('$respData' . $respData); // 添加日志 $this->addFileLog($msg, $config['secret'], $respData); // 处理支付回调 if ($type == 'pay') { $service = new PayService(['mall_id' => $this->mall_id]); return $service->notify($respData); } // 处理代付回调 if ($type == 'agent') { $service = new AgentService(['mall_id' => $this->mall_id]); return $service->notify($respData); } if ($type == 'refund') { $service = new RefundService(['mall_id' => $this->mall_id]); return $service->notify($respData); } } catch (Exception $e) { Yii::error('银典支付回调异常: ' . $e->getMessage()); return $this->error($e->getMessage()); } } /** * 添加文件日志 * * @param string $msg * @param string $secret * @param array $data * @return void */ public function addFileLog(string $msg, string $secret, array $data) { file_put_contents('./yunfast.log', Json::encode([ 'mall_id' => $this->mall_id, 'msg' => $msg, 'secret' => $secret, 'data' => $data, ]) . "\r", FILE_APPEND); } }