Commit 4ad5c853 by 王勇飞

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

parents b240f394 faa8e59e
...@@ -55,7 +55,27 @@ module.exports = (db, DataTypes) => { ...@@ -55,7 +55,27 @@ module.exports = (db, DataTypes) => {
regiontags: { regiontags: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
}// 区域标签 },// 区域标签
openid: {
type: DataTypes.STRING,
allowNull: true,
},
unid: {
type: DataTypes.STRING,
allowNull: true,
},
isDelivery: {
type: DataTypes.BOOLEAN,
defaultValue: false
},
isSalesman: {
type: DataTypes.BOOLEAN,
defaultValue: false
},
isAllArea: {
type: DataTypes.BOOLEAN,
defaultValue: false
}
}, { }, {
paranoid: true,//假的删除 paranoid: true,//假的删除
underscored: true, underscored: true,
......
...@@ -392,7 +392,7 @@ class UserService extends ServiceBase { ...@@ -392,7 +392,7 @@ class UserService extends ServiceBase {
*/ */
async getBizUserForBizChance (clientMobile, spName, productCatName, regionName) { async getBizUserForBizChance (clientMobile, spName, productCatName, regionName) {
var self = this var self = this
clientMobile = clientMobile + "_" + spName + "_" + regionName clientMobile = clientMobile + "_" + spName + "_" + regionName + "_" + productCatName
//按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称 //按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称
return this.db.transaction(async function (t) { return this.db.transaction(async function (t) {
//先检查缓存是否存在bizuser //先检查缓存是否存在bizuser
...@@ -420,13 +420,13 @@ class UserService extends ServiceBase { ...@@ -420,13 +420,13 @@ class UserService extends ServiceBase {
let users = companyFind.us let users = companyFind.us
let cansels = users.filter(u => { let cansels = users.filter(u => {
if (regionName && regionName != "" && u.regiontags) { if (regionName && regionName != "" && u.regiontags) {
if (u.isAllocated && u.skilltags.indexOf(productCatName) >= 0 && u.regiontags.indexOf(regionName) >= 0) { if (u.isAllocated && u.isSalesman && u.skilltags.indexOf(productCatName) >= 0 && u.regiontags.indexOf(regionName) >= 0) {
return true return true
} else { } else {
return false return false
} }
} else { } else {
if (u.isAllocated && u.skilltags.indexOf(productCatName) >= 0) { if (u.isAllocated && u.isSalesman && u.isAllArea && u.skilltags.indexOf(productCatName) >= 0) {
return true return true
} else { } else {
return false return false
...@@ -471,7 +471,7 @@ class UserService extends ServiceBase { ...@@ -471,7 +471,7 @@ class UserService extends ServiceBase {
* @param {*} regionName 区域 * @param {*} regionName 区域
*/ */
async getBizUserForDelivery (xclientMobile, spName, productCatName, skucode, regionName) { async getBizUserForDelivery (xclientMobile, spName, productCatName, skucode, regionName) {
let clientMobile = 'fordeliver' + xclientMobile + "_" + spName + "_" + regionName let clientMobile = 'fordeliver' + xclientMobile + "_" + spName + "_" + regionName + "_" + productCatName
var self = this var self = this
//按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称 //按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称
return this.db.transaction(async function (t) { return this.db.transaction(async function (t) {
...@@ -519,13 +519,13 @@ class UserService extends ServiceBase { ...@@ -519,13 +519,13 @@ class UserService extends ServiceBase {
let users = companyFind.us let users = companyFind.us
let cansels = users.filter(u => { let cansels = users.filter(u => {
if (regionName && regionName != "" && u.regiontags) { if (regionName && regionName != "" && u.regiontags) {
if (u.isAllocated && u.skilltags.indexOf(productCatName) >= 0 && u.regiontags.indexOf(regionName) >= 0) { if (u.isAllocated && u.isDelivery && u.skilltags.indexOf(productCatName) >= 0 && u.regiontags.indexOf(regionName) >= 0) {
return true return true
} else { } else {
return false return false
} }
} else { } else {
if (u.isAllocated && u.skilltags.indexOf(productCatName) >= 0) { if (u.isAllocated && u.isDelivery && u.isAllArea && u.skilltags.indexOf(productCatName) >= 0) {
return true return true
} else { } else {
return false return false
......
var url = require("url"); var url = require("url");
var System = require("../../base/system"); var System = require("../../base/system");
const chnelapi=System.getObject("api.common.channels") const chnelapi = System.getObject("api.common.channels")
var channelCache = {}
module.exports = function (app) { module.exports = function (app) {
app.all("*",async function(req, res,next){ app.get("/autologin", (req, res, next) => {
try{ //读取cookie,获取cookie值,
let channel=await chnelapi.getChannels(req.headers["x-forwarded-host"]) //Authorization:
if(!channel){ //Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImRjMmM1MzMwMjNhMTExZTlhOTU3NjliODBiNDI4Y2QxIn0.eyJpZCI6IjViZDk2MWJkZWQxN2E5MmI1MDFjZWQ0ZCIsIm5hbWUiOiLpnZLph4kxMSIsImVtcGxveWVlIjoiNWQ5ZWNlODc1Zjk3ZGQzMzEwNzI4ZjY4IiwicGhvbmUiOiI3TFlYZ29ySkdGM2hBbHdqQTZGelFnPT0iLCJvcmdpZCI6IjViY2ZlOTVjYjBhMDFmMDAwOTI4NGJjMyIsInBsYXRmb3JtIjoiZDVmYTU4Yjk3NGExMjBlZTYxMTMzM2MwMDNjOWZlYzAiLCJ1bmlvbmlkIjoib2RuWjR0OERoV1V0N0lXT09maEF0UTdqM1docyIsImp0aSI6Imo3R0hLRGFzNDEzQTQ2OGkiLCJleHAiOjE1OTYwODEzMTEsImlhdCI6MTU5NTQ3NjUxMX0.I196XbcCR3k7r1O8uwoI2HUhow0UhGHKzii5wOR39vLmuNOUatNY7ccQTCHijqysbSCePP43Iuglrl2gLQASf5uAr9uqTzhTc3O4Z5iF3oR2qR1vlBxrzTDF8xuhKHQ4tO6Hbsib0FdOYVeU8fe0g_GZiIcuYIv-f8VsiAGMF9TEES129CDwZacJfVViw4EXVnXSivAzQG4JgGSwUACvPT140bCZ1XPeHi0GXmgtEN77NjWfOGI5RYGC0Gq3CGevlSWERjb3mUscAIjoXsOxlWNwy7dc1u1A7uX1a6bUhLU1wtiQ6md4TnyeR5OdYeVqGlIe3hZGcH_E3QrQMq988Q
})
app.all("*", async function (req, res, next) {
try {
let channel = null
let hostaddr = req.headers["x-forwarded-host"]
if (!channelCache[hostaddr]) {
channel = await chnelapi.getChannels(req.headers["x-forwarded-host"])
channelCache[hostaddr] = channel
} else {
channel = channelCache[hostaddr]
}
if (!channel) {
next() next()
}else{ } else {
let rtn=await chnelapi.channelHandle(channel,req.path+"/"+ req.body.actionType,req.body) let rtn = await chnelapi.channelHandle(channel, req.path + "/" + req.body.actionType, req.body)
if(rtn!=null){ if (rtn != null) {
res.end(JSON.stringify(rtn)); res.end(JSON.stringify(rtn));
}else{ } else {
res.end(JSON.stringify({status:-1,message:"fail"})); res.end(JSON.stringify({ status: -1, message: "fail" }));
} }
} }
}catch(e){ } catch (e) {
console.log(e) console.log(e)
res.end(JSON.stringify({status:-1,message:e})); res.end(JSON.stringify({ status: -1, message: e }));
} }
}) })
app.get('/api/:gname/:qname/:method', function (req, res) { app.get('/api/: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 tClientIp = System.get_client_ip(req); var tClientIp = System.get_client_ip(req);
req.clientIp = tClientIp; req.clientIp = tClientIp;
req.uagent= req.headers["user-agent"]; req.uagent = req.headers["user-agent"];
// req.classname=classPath; // req.classname=classPath;
var params = []; var params = [];
params.push(gname); params.push(gname);
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("api." + classPath); var invokeObj = System.getObject("api." + classPath);
if (invokeObj["doexec"]) { if (invokeObj["doexec"]) {
...@@ -47,22 +61,22 @@ module.exports = function (app) { ...@@ -47,22 +61,22 @@ module.exports = function (app) {
}); });
app.post('/api/:gname/:qname/:method', function (req, res) { app.post('/api/: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"];
var params = []; var params = [];
classPath=gname+"."+classPath; classPath = gname + "." + classPath;
console.log("===================="); console.log("====================");
console.log(classPath); console.log(classPath);
var tClientIp = System.get_client_ip(req); var tClientIp = System.get_client_ip(req);
req.clientIp = tClientIp; req.clientIp = tClientIp;
req.uagent= req.headers["user-agent"]; req.uagent = req.headers["user-agent"];
// req.classname=classPath; // req.classname=classPath;
params.push(gname); params.push(gname);
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("api." + classPath); var invokeObj = System.getObject("api." + classPath);
if (invokeObj["doexec"]) { if (invokeObj["doexec"]) {
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
"node-cron": "^2.0.1", "node-cron": "^2.0.1",
"node-uuid": "^1.4.8", "node-uuid": "^1.4.8",
"pdfcrowd": "^4.2.0", "pdfcrowd": "^4.2.0",
"pem-jwk": "^2.0.0",
"pinyin": "^2.8.3", "pinyin": "^2.8.3",
"qr-image": "^3.2.0", "qr-image": "^3.2.0",
"request": "^2.88.2", "request": "^2.88.2",
......
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