1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use df_fields::Field;
use json::{JsonValue, object};
use df_cache::Cache;
use df_db::db::ModeDb;
use df_kafka::Kafka;
use crate::{Action, Response};
use crate::tests::test::TestModel;

pub struct TestAction {
    pub model: TestModel,
}

impl Action for TestAction {
    fn title(&mut self) -> String { "测试动作".to_string() }
    fn name(&mut self) -> String { "tests.test.test".to_string() }
    fn method(&mut self) -> String {
        "post".to_string()
    }
    fn params(&mut self) -> JsonValue {
        let mut params = object! {};
        // params["str"] = df_fields::str::Str::new(true, "str", "字符串", 15, "").field();
        // params["int"] = df_fields::int::Int::new(true, "int", "整数", 20, 0).field();
        return params;
    }
    fn index(&mut self, header: JsonValue, request: JsonValue, _db: ModeDb, _cache: Cache, _kafka: Kafka) -> Response {
        self.fail(-1, request, "动作不存在")
    }
}