mirror of
https://gitee.com/vben/vben-app.git
synced 2026-10-06 14:13:09 +08:00
初始化
This commit is contained in:
Generated
+1
@@ -4316,6 +4316,7 @@ dependencies = [
|
||||
"rust-embed",
|
||||
"sea-orm",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 2.0.21",
|
||||
"tokio",
|
||||
"tower-http",
|
||||
|
||||
@@ -17,6 +17,7 @@ tracing = { version = "0.1.41", features = ["async-await"] }
|
||||
tracing-subscriber = { version = "0.3.19", features = ["env-filter", "chrono"] }
|
||||
config = { version = "0.15.11", features = ["yaml"] }
|
||||
serde = { version = "1.0.219", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
anyhow = "1.0.98"
|
||||
sea-orm = { version = "2.0.4", features = ["schema-sync", "entity-registry","with-chrono", "debug-print", "sqlx-postgres","sqlx-mysql", "with-rust_decimal", "runtime-tokio"] }
|
||||
num_cpus = "1.16.0"
|
||||
|
||||
@@ -33,4 +33,27 @@ pub struct LoginVo {
|
||||
|
||||
//用户 openid
|
||||
pub openid: String,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct UserVo {
|
||||
pub useid: String,
|
||||
pub usena: String,
|
||||
pub nicna: String,
|
||||
pub usety: Option<String>,
|
||||
pub orgid: String,
|
||||
pub orgna: String,
|
||||
pub tenid: Option<String>,
|
||||
pub email: Option<String>,
|
||||
pub monum: String,
|
||||
pub gender: String,
|
||||
pub avatar: Option<String>,
|
||||
pub avtag: Option<String>,
|
||||
pub loip: Option<String>,
|
||||
pub lotim: Option<String>,
|
||||
pub notes: Option<String>,
|
||||
pub crtim: Option<String>,
|
||||
pub roids: Option<String>,
|
||||
pub poids: Option<String>,
|
||||
pub rolid: Option<String>,
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
use std::collections::HashMap;
|
||||
use serde_json::{Value, json};
|
||||
use crate::app::AppState;
|
||||
use crate::app::error::{ApiResult};
|
||||
use crate::app::response::ApiResponse;
|
||||
use crate::modules::auth::captcha::model::{AuthCaptchaVo, LoginVo};
|
||||
use crate::modules::auth::captcha::model::{AuthCaptchaVo, LoginVo, UserVo};
|
||||
use axum::{Router, debug_handler, routing};
|
||||
|
||||
pub fn create_auth_router() -> Router<AppState> {
|
||||
@@ -43,15 +45,32 @@ pub async fn login() -> ApiResult<ApiResponse<LoginVo>> {
|
||||
}
|
||||
|
||||
#[debug_handler]
|
||||
pub async fn user() -> ApiResult<ApiResponse<LoginVo>> {
|
||||
let vo = LoginVo {
|
||||
access_token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJzeXNfdXNlcjp1MSIsInJuU3RyIjoiZ1RxUHRRZmZLYm4xcmdzSzZkWTc2Qzh4cFoxV01KZUkiLCJjbGllbnRpZCI6ImU1Y2Q3ZTQ4OTFiZjk1ZDFkMTkyMDZjZTI0YTdiMzJlIiwidXNlcklkIjoidTEiLCJ1c2VyTmFtZSI6ImFkbWluIiwib3JnaWQiOiJvMTAwMCIsIm9yZ25hIjoiWFjnp5HmioAifQ.a5eDnQTXcQ5D34_FaOFsJZB_yYwRkRAKwstwhqLjpVc".to_string(),
|
||||
refresh_token: "".to_string(),
|
||||
expire_in: 604800,
|
||||
refresh_expire_in: 604800,
|
||||
client_id: "".to_string(),
|
||||
scope: "".to_string(),
|
||||
openid: "".to_string(),
|
||||
pub async fn user() -> ApiResult<ApiResponse<HashMap<String, Value>>> {
|
||||
let vo = UserVo {
|
||||
useid: "u1".to_string(),
|
||||
usena: "admin".to_string(),
|
||||
nicna: "管理员".to_string(),
|
||||
usety: None,
|
||||
orgid: "o1000".to_string(),
|
||||
orgna: "XX科技".to_string(),
|
||||
tenid: None,
|
||||
email: None,
|
||||
monum: "13812345678".to_string(),
|
||||
gender: "1".to_string(),
|
||||
// avatar: Some("https://unpkg.com/@vbenjs/static-source@0.1.7/source/avatar-v1.webp".to_string()),
|
||||
avatar: Some("/api/tool/oss/show?id=2015240095127236608".to_string()),
|
||||
avtag: None,
|
||||
loip: None,
|
||||
lotim: None,
|
||||
notes: None,
|
||||
crtim: None,
|
||||
roids: None,
|
||||
poids: None,
|
||||
rolid: None,
|
||||
};
|
||||
Ok(ApiResponse::ok("ok", Some(vo)))
|
||||
let mut map: HashMap<String, Value> = HashMap::new();
|
||||
map.insert("user".to_string(), json!(vo));
|
||||
map.insert("perms".to_string(), json!(["*:*:*"]));
|
||||
map.insert("roles".to_string(), json!(["superadmin"]));
|
||||
Ok(ApiResponse::ok("操纵成功", Some(map)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user