Commit 818016cf authored by tywldx's avatar tywldx

f

parent 359750dd
...@@ -249,7 +249,18 @@ require_module["xml2json"] = require('xml2json'); ...@@ -249,7 +249,18 @@ require_module["xml2json"] = require('xml2json');
let custom_app = new koa(); let custom_app = new koa();
function requestPromise(option) {
return new Promise(function (resolve, reject) {
request(option, function (err, res, body) {
if (err) {
resolve({ code: "0001", err: err })
// reject()
} else {
resolve(body)
}
})
})
}
custom_app.use(Middles.compress()); custom_app.use(Middles.compress());
custom_app.use(Middles.body()); custom_app.use(Middles.body());
custom_app.use(async function (ctx, next) { custom_app.use(async function (ctx, next) {
...@@ -306,7 +317,8 @@ custom_app.use(async function (ctx, next) { ...@@ -306,7 +317,8 @@ custom_app.use(async function (ctx, next) {
call_back: Bp_modules.call_back, call_back: Bp_modules.call_back,
have_device_template:device_template,//true/false have_device_template:device_template,//true/false
templageRoute:templateRoute, templageRoute:templateRoute,
require_module: require_module require_module: require_module,
requestPromise: requestPromise
}) })
// script.call(ctx,{ // script.call(ctx,{
// params: path_parse,//路径中包含的参数 // params: path_parse,//路径中包含的参数
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment