Commit 3576ff32 by 王勇飞

Merge branch 'center-manage' of gitlab.gongsibao.com:jiangyong/zhichan into center-manage

parents cc79359e 7589c3d2
...@@ -91,6 +91,9 @@ class ProductpriceService extends ServiceBase { ...@@ -91,6 +91,9 @@ class ProductpriceService extends ServiceBase {
return false return false
} }
}) })
if (["北京市", "天津市", "上海市", "重庆市"].includes(area)) {
areaCode[0].code = `${areaCode[0].code}01`
}
areaCode = `${areaCode[0].code}00`; areaCode = `${areaCode[0].code}00`;
result.push({ result.push({
area, area,
...@@ -109,7 +112,7 @@ class ProductpriceService extends ServiceBase { ...@@ -109,7 +112,7 @@ class ProductpriceService extends ServiceBase {
return item.area.indexOf(region) >= 0 return item.area.indexOf(region) >= 0
}) })
} }
return result return result || []
} }
async updownProduct(uid) { async updownProduct(uid) {
let p = await this.dao.findById(uid) let p = await this.dao.findById(uid)
......
...@@ -90,7 +90,8 @@ module.exports = function (app) { ...@@ -90,7 +90,8 @@ module.exports = function (app) {
p = invokeObj["doexec"].apply(invokeObj, params); p = invokeObj["doexec"].apply(invokeObj, params);
} }
p.then(r => { p.then(r => {
res.end(JSON.stringify(r)); // res.end(JSON.stringify(r));
res.json(r);
}); });
}); });
}; };
var url = require("url"); var url = require("url");
var system = require("../../base/system"); var system = require("../../base/system");
var metaCtl=system.getObject("web.common.metaCtl"); var metaCtl = system.getObject("web.common.metaCtl");
module.exports = function (app) { module.exports = function (app) {
app.get('/web/:gname/:qname/:method', function (req, res) { app.get('/web/:gname/:qname/:method', function (req, res) {
var classPath = req.params["qname"]; var classPath = req.params["qname"];
var methodName = req.params["method"]; var methodName = req.params["method"];
var gname=req.params["gname"]; var gname = req.params["gname"];
classPath=gname+"."+classPath; classPath = gname + "." + classPath;
var params = []; var params = [];
params.push(methodName); params.push(methodName);
params.push(req.body); params.push(req.body);
params.push(req.query); params.push(req.query);
params.push(req); params.push(req);
var p = null; var p = null;
var invokeObj = system.getObject("web." + classPath); var invokeObj = system.getObject("web." + classPath);
if (invokeObj["doexec"]) { if (invokeObj["doexec"]) {
...@@ -24,25 +24,26 @@ module.exports = function (app) { ...@@ -24,25 +24,26 @@ module.exports = function (app) {
app.post('/web/:gname/:qname/:method', function (req, res) { app.post('/web/:gname/:qname/:method', function (req, res) {
req.codepath = req.headers["codepath"]; req.codepath = req.headers["codepath"];
var classPath = req.params["qname"]; var classPath = req.params["qname"];
var methodName = req.params["method"]; var methodName = req.params["method"];
var gname=req.params["gname"]; var gname = req.params["gname"];
var params = []; var params = [];
classPath=gname+"."+classPath; classPath = gname + "." + classPath;
var tClientIp = system.get_client_ip(req); var tClientIp = system.get_client_ip(req);
req.body.clientIp = tClientIp; req.body.clientIp = tClientIp;
req.body.agent= req.headers["user-agent"]; req.body.agent = req.headers["user-agent"];
req.body.classname=classPath; req.body.classname = classPath;
params.push(methodName); params.push(methodName);
params.push(req.body); params.push(req.body);
params.push(req.query); params.push(req.query);
params.push(req); params.push(req);
var p = null; var p = null;
var invokeObj = system.getObject("web." + classPath); var invokeObj = system.getObject("web." + classPath);
if (invokeObj["doexec"]) { if (invokeObj["doexec"]) {
p = invokeObj["doexec"].apply(invokeObj, params); p = invokeObj["doexec"].apply(invokeObj, params);
} }
p.then(r => { p.then(r => {
res.end(JSON.stringify(r)); // res.end(JSON.stringify(r));
res.json(r);
}); });
}); });
}; };
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