27 lines
768 B
JavaScript
27 lines
768 B
JavaScript
|
module.exports = {
|
||
|
name: 'query',
|
||
|
dependencies: ["conf", "db"],
|
||
|
actions: {
|
||
|
"exec": {
|
||
|
cache: false,
|
||
|
params: {
|
||
|
"key": {
|
||
|
"type": "string",
|
||
|
"optional": false,
|
||
|
"convert": true
|
||
|
},
|
||
|
"params": {
|
||
|
"type": "object",
|
||
|
"optional": true,
|
||
|
"convert": true
|
||
|
}
|
||
|
},
|
||
|
async handler(ctx) {
|
||
|
let key = ctx.params.key;
|
||
|
let sql = await this.broker.call("conf.get", {path: "sqls", key: key});
|
||
|
return this.broker.call("db.exec", {...sql, params: ctx.params.params});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|