use crate::addon::Plugins;
use br_addon::action::{Action, InterfaceType};
use br_addon::module::Module;
use br_addon::request::Request;
use br_addon::{ApiResponse, Plugin};
use json::{array, object, JsonValue};
use crate::addon::{{plugin}}::{{model_a}}::{{model}};
pub struct {{action}} {
pub module: {{model}},
}
impl Action for {{action}} {
fn author(&self) -> &'static str {
""
}
fn title(&self) -> &'static str { "{{title}}" }
fn tags(&self) -> &'static [&'static str] {
&[]
}
fn icon(&self) -> &'static str {
""
}
fn interface_type(&self) -> InterfaceType {
InterfaceType::MENU
}
fn params(&mut self) -> JsonValue {
self.params_table_menu(object! {})
}
fn index(&mut self, request: Request) -> ApiResponse {
let fields = self.module.fields().clone();
let table_name = self.module._table_name();
let table_info = self.table_menu(
request.body.clone(),
table_name,
fields,
vec![],
vec![],
vec![],
vec![],
);
//table_info["btn_all"].push().unwrap();
//table_info["btn_api"].push().unwrap();
//table_info["btn_ids"].push().unwrap();
table_info["btn_all"] = check_auth(table_info["btn_all"].clone(), request.clone());
table_info["btn_api"] = check_auth(table_info["btn_api"].clone(), request.clone());
table_info["btn_ids"] = check_auth(table_info["btn_ids"].clone(), request.clone());
ApiResponse::success(table_info, "获取成功")
}
}