From 1507bc220a02de6a51973e8a287223dd3dd155fd Mon Sep 17 00:00:00 2001 From: pjh456 <147148383@qq.com> Date: Wed, 1 Oct 2025 08:31:47 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=85=8D=E7=BD=AE=E4=BA=86=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=95=B0=E6=8D=AE=E5=BA=93=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.json | 22 ++++---- models/model.json | 36 +++++++------ models/ouc_reminder.json | 108 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 139 insertions(+), 27 deletions(-) create mode 100644 models/ouc_reminder.json diff --git a/config.json b/config.json index a02bba1..e7c84b7 100644 --- a/config.json +++ b/config.json @@ -11,7 +11,7 @@ //["Options", "-SessionTicket"], //["Options", "Compression"] ] - }, + },*/ "listeners": [ { //address: Ip address,0.0.0.0 by default @@ -20,7 +20,7 @@ "port": 80, //https: If true, use https for security,false by default "https": false - }, + } /*, { "address": "0.0.0.0", "port": 443, @@ -34,14 +34,14 @@ "ssl_conf": [ //["MinProtocol", "TLSv1.3"] ] - } + }*/ ], "db_clients": [ { //name: Name of the client,'default' by default - "name": "default", + "name": "ouc_reminder_database", //rdbms: Server type, postgresql,mysql or sqlite3, "postgresql" by default - "rdbms": "postgresql", + "rdbms": "mysql", //filename: Sqlite3 db file name //"filename":"", //host: Server address,localhost by default @@ -49,11 +49,11 @@ //port: Server port, 5432 by default "port": 5432, //dbname: Database name - "dbname": "test", + "dbname": "ouc_reminder", //user: 'postgres' by default - "user": "", + "user": "pjh123", //passwd: '' by default - "passwd": "", + "passwd": "123456", //is_fast: false by default, if it is true, the client is faster but user can't call //any synchronous interface of it. "is_fast": false, @@ -73,7 +73,7 @@ //For more information, see https://www.postgresql.org/docs/16/libpq-connect.html#LIBPQ-CONNECT-OPTIONS //"connect_options": { "statement_timeout": "1s" } } - ], + ], /* "redis_clients": [ { //name: Name of the client,'default' by default @@ -108,7 +108,7 @@ "session_timeout": 0, //string value of SameSite attribute of the Set-Cookie HTTP response header //valid value is either 'Null' (default), 'Lax', 'Strict' or 'None' - "session_same_site" : "Null", + "session_same_site": "Null", //session_cookie_key: The cookie key of the session, "JSESSIONID" by default "session_cookie_key": "JSESSIONID", //session_max_age: The max age of the session cookie, -1 by default @@ -347,4 +347,4 @@ ], //custom_config: custom configuration for users. This object can be get by the app().getCustomConfig() method. "custom_config": {} -} +} \ No newline at end of file diff --git a/models/model.json b/models/model.json index c5045ae..9abdf08 100644 --- a/models/model.json +++ b/models/model.json @@ -23,24 +23,28 @@ //convert: the value can be changed by a function call before it is stored into database or //after it is read from database "convert": { - "enabled": false, - "items":[{ - "table": "user", - "column": "password", - "method": { - //after_db_read: name of the method which is called after reading from database, signature: void([const] std::shared_ptr [&]) - "after_db_read": "decrypt_password", - //before_db_write: name of the method which is called before writing to database, signature: void([const] std::shared_ptr [&]) - "before_db_write": "encrypt_password" - }, - "includes": [ - "\"file_local_search_path.h\"","" - ] - }] + "enabled": false, + "items": [ + { + "table": "user", + "column": "password", + "method": { + //after_db_read: name of the method which is called after reading from database, signature: void([const] std::shared_ptr [&]) + "after_db_read": "decrypt_password", + //before_db_write: name of the method which is called before writing to database, signature: void([const] std::shared_ptr [&]) + "before_db_write": "encrypt_password" + }, + "includes": [ + "\"file_local_search_path.h\"", + "" + ] + } + ] }, "relationships": { "enabled": false, - "items": [{ + "items": [ + { "type": "has one", "original_table_name": "products", "original_table_alias": "product", @@ -101,4 +105,4 @@ // generate_base_only: false by default. Set to true to avoid overwriting custom subclasses. "generate_base_only": false } -} +} \ No newline at end of file diff --git a/models/ouc_reminder.json b/models/ouc_reminder.json new file mode 100644 index 0000000..eaa9cd9 --- /dev/null +++ b/models/ouc_reminder.json @@ -0,0 +1,108 @@ +{ + //rdbms: server type, postgresql,mysql or sqlite3 + "rdbms": "postgresql", + //filename: sqlite3 db file name + //"filename":"", + //host: server address,localhost by default; + "host": "127.0.0.1", + //port: server port, 5432 by default; + "port": 5432, + //dbname: Database name; + "dbname": "mysql", + //schema: valid for postgreSQL, "public" by default; + "schema": "public", + //user: User name + "user": "pjh123", + //password or passwd: Password + "password": "123456", + //client_encoding: The character set used by drogon_ctl. it is empty string by default which + //means use the default character set. + //"client_encoding": "", + //table: An array of tables to be modelized. if the array is empty, all revealed tables are modelized. + "tables": [], + //convert: the value can be changed by a function call before it is stored into database or + //after it is read from database + "convert": { + "enabled": false, + "items": [ + { + "table": "user", + "column": "password", + "method": { + //after_db_read: name of the method which is called after reading from database, signature: void([const] std::shared_ptr [&]) + "after_db_read": "decrypt_password", + //before_db_write: name of the method which is called before writing to database, signature: void([const] std::shared_ptr [&]) + "before_db_write": "encrypt_password" + }, + "includes": [ + "\"file_local_search_path.h\"", + "" + ] + } + ] + }, + "relationships": { + "enabled": false, + "items": [ + { + "type": "has one", + "original_table_name": "products", + "original_table_alias": "product", + "original_key": "id", + "target_table_name": "skus", + "target_table_alias": "SKU", + "target_key": "product_id", + "enable_reverse": true + }, + { + "type": "has many", + "original_table_name": "products", + "original_table_alias": "product", + "original_key": "id", + "target_table_name": "reviews", + "target_table_alias": "", + "target_key": "product_id", + "enable_reverse": true + }, + { + "type": "many to many", + "original_table_name": "products", + "original_table_alias": "", + "original_key": "id", + "pivot_table": { + "table_name": "carts_products", + "original_key": "product_id", + "target_key": "cart_id" + }, + "target_table_name": "carts", + "target_table_alias": "", + "target_key": "id", + "enable_reverse": true + } + ] + }, + "restful_api_controllers": { + "enabled": false, + // resource_uri: The URI to access the resource, the default value + // is '/*' in which the asterisk represents the table name. + // If this option is set to a empty string, the URI is composed of the namespaces and the class name. + "resource_uri": "/*", + // class_name: "Restful*Ctrl" by default, the asterisk represents the table name. + // This option can contain namespaces. + "class_name": "Restful*Ctrl", + // filters: an array of filter names. + "filters": [], + // db_client: the database client used by the controller. this option must be consistent with + // the configuration of the application. + "db_client": { + //name: Name of the client,'default' by default + "name": "default", + //is_fast: + "is_fast": false + }, + // directory: The directory where the controller source files are stored. + "directory": "controllers", + // generate_base_only: false by default. Set to true to avoid overwriting custom subclasses. + "generate_base_only": false + } +} \ No newline at end of file