-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
引入merge_web_param macro rules,兼容支持命名空间操作接口参数从url取 #127
- Loading branch information
Showing
3 changed files
with
51 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#[macro_export] | ||
macro_rules! merge_web_param { | ||
($param:expr,$payload:expr) => {{ | ||
let _body = match crate::common::web_utils::get_req_body($payload).await { | ||
Ok(v) => v, | ||
Err(err) => { | ||
return actix_web::HttpResponse::InternalServerError().body(err.to_string()); | ||
} | ||
}; | ||
let _b = match serde_urlencoded::from_bytes(&_body) { | ||
Ok(v) => v, | ||
Err(err) => { | ||
return actix_web::HttpResponse::InternalServerError().body(err.to_string()); | ||
} | ||
}; | ||
$param.merge(_b) | ||
}}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters