Commit a01b79ad by 王勇飞

add bizchance dev

parent 89468a85
...@@ -50,6 +50,8 @@ class CtlBase { ...@@ -50,6 +50,8 @@ class CtlBase {
credid: req.headers["x-credential-identifier"], credid: req.headers["x-credential-identifier"],
regrole: req.headers["xregrole"], regrole: req.headers["xregrole"],
bizpath: req.headers["xbizpath"], bizpath: req.headers["xbizpath"],
opath: req.headers['xopath'],
ptags: req.headers['xptags'],
} }
if (!req.xctx.appkey) { if (!req.xctx.appkey) {
return [-200, "请求头缺少应用x-app-key"] return [-200, "请求头缺少应用x-app-key"]
......
var system = require("../../../system") var system = require("../../../system");
const http = require("http") const http = require("http");
const querystring = require('querystring'); const querystring = require('querystring');
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base"); const CtlBase = require("../../ctl.base");
const moment = require('moment');
class BizOptCtl extends CtlBase { class BizOptCtl extends CtlBase {
constructor() { constructor() {
super("bizchance", CtlBase.getServiceName(BizOptCtl)); super("bizchance", CtlBase.getServiceName(BizOptCtl));
} }
async findAndCountAll(pobj, qobj, req) {
try {
//TODO 根据业务员id获取该业务员所有列表
//设置查询条件
console.log("pobj--",pobj)
const rs = await this.service.findAndCountAll(pobj);
let rarr = [];
let results = rs.results.rows;
results.forEach(element => {
let robj = {};
robj.demand_code = element.demand_code;
robj.source = element.source;
robj.business_type = element.business_type;
robj.business_info_person = element.business_info.person;
robj.business_info_phone = element.business_info.phone;
robj.business_status = element.business_status;
robj.updated_at = this.timeFormat(element.updated_at);
rarr.push(robj);
});
rs.results.rows = rarr;
return system.getResult(rs);
} catch (error) {
return system.getResultError(error);
}
}
timeFormat(date) {
let localTime = moment.utc(date).toDate();
localTime = moment(localTime).format("YYYY-MM-DD");
return localTime;
}
} }
module.exports = BizOptCtl; module.exports = BizOptCtl;
const system = require("../../../system");
const Dao = require("../../dao.base");
class BizoptDao extends Dao {
constructor() {
super(Dao.getModelName(BizoptDao));
}
extraWhere(qobj, qw, qc) {
qc.raw = true;
qc.where.business_type = qc.where.business_type || {
[this.db.Op.notIn]: ["ICP", "EDI"]
}
return qw;
}
}
module.exports = BizoptDao;
...@@ -22,7 +22,11 @@ module.exports = (db, DataTypes) => { ...@@ -22,7 +22,11 @@ module.exports = (db, DataTypes) => {
allowNull: false, allowNull: false,
type: DataTypes.JSON type: DataTypes.JSON
}, },
sourse_number: { // 来源单号 (下单时产生的编号) source_number: { // 来源单号 (下单时产生的编号)
allowNull: true,
type: DataTypes.STRING
},
source: { //渠道来源
allowNull: true, allowNull: true,
type: DataTypes.STRING type: DataTypes.STRING
}, },
......
...@@ -10,7 +10,7 @@ module.exports = (db, DataTypes) => { ...@@ -10,7 +10,7 @@ module.exports = (db, DataTypes) => {
allowNull: false, allowNull: false,
type: DataTypes.STRING type: DataTypes.STRING
}, },
sourse_number: { // 来源单号 (订单编号) source_number: { // 来源单号 (订单编号)
allowNull: false, allowNull: false,
type: DataTypes.STRING type: DataTypes.STRING
}, },
......
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