Interface | Description |
---|---|
/api/xiang/import/<table_name>/setting | Get the Setting of the table |
/api/xiang/import/<table_name>/mapping | Get the mapping field of the table |
/api/xiang/import/<table_name>/mapping/setting | Get the mapping field setting of the table |
/api/xiang/import/<table_name>/data | Get data |
/api/xiang/import/<table_name>/data/setting | setting to get data |
/api/xiang/import/<table_name> | Import data interface |
{"setting": "/api/xiang/import/ticket/setting","mapping": "/api/xiang/import/ticket/mapping","mapping_setting": "/api/xiang/import/ticket/mapping/setting","preview": "/api/xiang/import/ticket/data","preview_setting": "/api/xiang/import/ticket/data/setting","import": "/api/xiang/import/ticket"}
Add the models directory file /models/ticket.mod.json
:
Add the table directory file /tables/ticket.tab.json
:
Import the Excel file and add the directory file /imports/ticket.imp.json
:
Application directory structure:
├── apis # Used to store interface description files│├──tables| └──ticket.tab.json #import excel table|├── models # Used to store data model description files│├── db└── imports #map file for importing data| └── ticket.imp.json||──scripts| └──imports| └──ticket.js||└── app.json
Write the code ticket.imp.json
:
Write the code /scripts/imports/ticket.js
:
function Import(columns, data) {// todo handles import logic// print the implicit relationconsole.log(columns);// print the obtained dataconsole.log(data);var success = 0;var fail = 0;return [success, fail];}function Output(data) {// todo handles the logic after import, this function will be called automatically after import: "output": "scripts.imports.ticket.Output",return data;}
The import method is divided into three steps:
/api/xiang/storage/upload
Parameter Name | Required | Type | Description |
---|---|---|---|
file | yes | file | file name |
"20220411/0C3A5E7FCA0FE897710DE2CA00240FFE.xlsx"
/api/xiang/import/ticket/mapping
Parameter Name | Required | Type | Description |
---|---|---|---|
file | yes | string | file name url |
/api/xiang/import/ticket
Parameter Name | Required | Type | Description |
---|---|---|---|
file | yes | string | file name |
mapping | yes | string | mapping relation returns all data |
Interface | Description |
---|---|
/api/xiang/import/<table_name>/setting | Get the Setting of the table |
/api/xiang/import/<table_name>/mapping | Get the mapping field of the table |
/api/xiang/import/<table_name>/mapping/setting | Get the mapping field setting of the table |
/api/xiang/import/<table_name>/data | Get data |
/api/xiang/import/<table_name>/data/setting | setting to get data |
/api/xiang/import/<table_name> | Import data interface |
{"setting": "/api/xiang/import/ticket/setting","mapping": "/api/xiang/import/ticket/mapping","mapping_setting": "/api/xiang/import/ticket/mapping/setting","preview": "/api/xiang/import/ticket/data","preview_setting": "/api/xiang/import/ticket/data/setting","import": "/api/xiang/import/ticket"}
Add the models directory file /models/ticket.mod.json
:
Add the table directory file /tables/ticket.tab.json
:
Import the Excel file and add the directory file /imports/ticket.imp.json
:
Application directory structure:
├── apis # Used to store interface description files│├──tables| └──ticket.tab.json #import excel table|├── models # Used to store data model description files│├── db└── imports #map file for importing data| └── ticket.imp.json||──scripts| └──imports| └──ticket.js||└── app.json
Write the code ticket.imp.json
:
Write the code /scripts/imports/ticket.js
:
function Import(columns, data) {// todo handles import logic// print the implicit relationconsole.log(columns);// print the obtained dataconsole.log(data);var success = 0;var fail = 0;return [success, fail];}function Output(data) {// todo handles the logic after import, this function will be called automatically after import: "output": "scripts.imports.ticket.Output",return data;}
The import method is divided into three steps:
/api/xiang/storage/upload
Parameter Name | Required | Type | Description |
---|---|---|---|
file | yes | file | file name |
"20220411/0C3A5E7FCA0FE897710DE2CA00240FFE.xlsx"
/api/xiang/import/ticket/mapping
Parameter Name | Required | Type | Description |
---|---|---|---|
file | yes | string | file name url |
/api/xiang/import/ticket
Parameter Name | Required | Type | Description |
---|---|---|---|
file | yes | string | file name |
mapping | yes | string | mapping relation returns all data |