|
@@ -322,17 +322,13 @@ pub(crate) mod balance {
|
|
|
|
|
|
/// FSCG 回调
|
|
/// FSCG 回调
|
|
pub(crate) mod callback {
|
|
pub(crate) mod callback {
|
|
- use std::{fmt::Display, sync::Arc};
|
|
|
|
|
|
+ use std::{fmt::Display, sync::Arc, any};
|
|
|
|
|
|
use anyhow::Context;
|
|
use anyhow::Context;
|
|
use axum::{Extension, Json};
|
|
use axum::{Extension, Json};
|
|
use tracing::Instrument;
|
|
use tracing::Instrument;
|
|
|
|
|
|
- use crate::{
|
|
|
|
- backend,
|
|
|
|
- config::Config,
|
|
|
|
- sd_model, Verify,
|
|
|
|
- };
|
|
|
|
|
|
+ use crate::{backend, config::Config, sd_model, Verify};
|
|
|
|
|
|
#[tracing::instrument(name="HandlerCallback", ret(Debug), fields(Request=?req), skip_all )]
|
|
#[tracing::instrument(name="HandlerCallback", ret(Debug), fields(Request=?req), skip_all )]
|
|
|
|
|
|
@@ -382,12 +378,15 @@ pub(crate) mod callback {
|
|
|
|
|
|
match serde_json::from_str::<sd_model::PubRespHead>(&callback_data)
|
|
match serde_json::from_str::<sd_model::PubRespHead>(&callback_data)
|
|
.context("serde_json::from_str::<sd_model::PubRespHead>")
|
|
.context("serde_json::from_str::<sd_model::PubRespHead>")
|
|
- .and_then(|o| serde_json::from_str(&o.data).context(""))
|
|
|
|
- {
|
|
|
|
|
|
+ .and_then(|o| {
|
|
|
|
+ if o.code != "0000" {
|
|
|
|
+ Err(anyhow::Error::msg(format!("PubRespHead: {}", callback_data)))
|
|
|
|
+ } else {
|
|
|
|
+ serde_json::from_str(&o.data).context("CallbackRespBody")
|
|
|
|
+ }
|
|
|
|
+ }) {
|
|
Ok(o) => Json(to_backend_callback_resp(o, req)),
|
|
Ok(o) => Json(to_backend_callback_resp(o, req)),
|
|
- Err(e) => {
|
|
|
|
- Json(err_resp(e, "99", "请求错误", req, &config))
|
|
|
|
- }
|
|
|
|
|
|
+ Err(e) => Json(err_resp(e, "99", "请求错误", req, &config)),
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|