|
@@ -0,0 +1,15 @@
|
|
|
+use crate::{
|
|
|
+ CmdResult, CmdState,
|
|
|
+ service::category::{Category, CategoryWithSpu},
|
|
|
+};
|
|
|
+
|
|
|
+#[tauri::command]
|
|
|
+pub async fn get_category(app_state: CmdState<'_>) -> CmdResult<Vec<CategoryWithSpu>> {
|
|
|
+ let category = Category::new(app_state.conn.clone());
|
|
|
+ let categories = category.get_category_commodity().await;
|
|
|
+ match categories {
|
|
|
+ Ok(categories) => Ok(categories),
|
|
|
+ Err(e) => Err(format!("请求分类失败{:?}", e)),
|
|
|
+ }
|
|
|
+ // Ok("111".into())
|
|
|
+}
|