Commit 1f8d0bbc by 王栋源

wdy

parent 10be319b
const system = require("../system"); const system = require("../system");
const settings = require("../../config/settings"); const settings = require("../../config/settings");
const DocBase = require("./doc.base"); // const DocBase = require("./doc.base");
const uuidv4 = require('uuid/v4'); const uuidv4 = require('uuid/v4');
const md5 = require("MD5"); const md5 = require("MD5");
class APIBase { class APIBase {
......
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class PaymentAPI extends APIBase {
constructor() {
super();
this.needinfoSve = system.getObject("service.dbneed.needinfoSve");
}
/**
* 接口跳转-POST请求
* actionProcess 执行的流程
* actionType 执行的类型
* actionBody 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionProcess) {
return system.getResult(null, "actionProcess参数不能为空");
}
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = await this.opActionProcess(pobj, pobj.actionType, pobj.actionBody, req);
return result;
}
async opActionProcess(pobj, action_type, action_body, req) {
var opResult = null;
switch (action_type) {
// sy
case "needinfo2fq"://pc端订单支付二维码生成
opResult = await this.needinfoSve.needinfo2fq(pobj);
break;
// case "flowinfo"://pc端订单支付二维码生成
// opResult = await this.needinfoSve.flowinfo(needinfo);
// break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = PaymentAPI;
\ No newline at end of file
const system=require("../../../system");
const Dao=require("../../dao.base");
class NeedinfoDao extends Dao{
constructor(){
super(Dao.getModelName(NeedinfoDao));
}
extraWhere(obj,w){
if(obj.codepath && obj.codepath!=""){
if(obj.codepath.indexOf("calculateprice")>0){
w["user_id"]=obj.uid;
}
}
return w;
}
}
module.exports=NeedinfoDao;
...@@ -69,6 +69,7 @@ module.exports = { ...@@ -69,6 +69,7 @@ module.exports = {
//凭单类型 //凭单类型
"direction_type": { "sr": "收", "zc": "支" }, "direction_type": { "sr": "收", "zc": "支" },
"push_return_type": { "0": "推送失败", "1": "推送成功" }, "push_return_type": { "0": "推送失败", "1": "推送成功" },
"push_chance_type": { "wts": "未推送", "yts": "已推送", "ygj": "已跟进", "ycd": "已成单" },
}, },
} }
} }
\ No newline at end of file
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("needinfo", {
uapp_id:DataTypes.INTEGER,
needNo:DataTypes.STRING,
channelUserId:DataTypes.INTEGER,//发布者id
publisherName:DataTypes.STRING,//发布者姓名
publisherOnlyCode:DataTypes.STRING(50),//发布者唯一码
publishContent:DataTypes.STRING,//发布内容
publishMobile:DataTypes.STRING,//发布者手机号
followManUserId:DataTypes.INTEGER,//跟进人id
followManName:DataTypes.STRING,//跟进人姓名
followManMobile:DataTypes.STRING,//跟进人手机号(合伙人)
followManOnlyCode:DataTypes.STRING(50),//跟进者唯一码
followContent:DataTypes.STRING,//跟进内容
chanceType_code:DataTypes.STRING,// 商机类型
productOneType_id:DataTypes.STRING,//产品大类Id
productType_id:DataTypes.STRING,//产品类型Id
notes:DataTypes.STRING,//备注
disposeNotes:DataTypes.STRING,//处理的备注
status:{
//wts未推送,yts已推送,ygj已跟进,ycd已成单
type:DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.push_chance_type),
set:function(val){
this.setDataValue("chanceType",val);
this.setDataValue("chanceTypeName",uiconfig.config.pdict.push_chance_type[val]);
}
},
city:DataTypes.STRING(50), // 城市
province:DataTypes.STRING(50), // 省份
},{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'n_need_info',
validate: {
},
indexes:[
]
});
}
const uuidv4 = require('uuid/v4');
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class NeedinfoService extends ServiceBase {
constructor() {
super("dbneed", ServiceBase.getDaoName(NeedinfoService));
this.execlient = system.getObject("util.execClient");
}
async needinfo2fq(pobj) {
pobj.actionBody.needNo=await this.getBusUid("n");
pobj.actionBody.uapp_id=pobj.appInfo.id;
var needinfo = await this.dao.create(pobj.actionBody);
var pobj = {
"idempotentId": needinfo.needNo,
"idempotentSource": needinfo.chanceType_code,
"idempotentSourceName": pobj.appInfo.app_name+"_"+pobj.actionBody.chanceTypeName,
"phone": needinfo.publishMobile,
"remark": needinfo.notes,
"customerName": needinfo.publishName
};
var rc = system.getObject("util.aliyunClient");
var rtn = await rc.post("https://yunfuapi-dev.gongsibao.com/crm/opportunity/submit", pobj);
console.log(rtn)
return system.getResultSuccess();
// var opResultstr = await this.execlient.execPost(pobj, "https://yunfuapi-dev.gongsibao.com/crm/opportunity/submit");
// opResult = JSON.parse(opResultstr.stdout)
// if (opResultstr) {
// return system.getResultSuccess();
// }
}
async flowinfo(obj) {
}
}
module.exports = NeedinfoService;
var a=new NeedinfoService();
a.needinfo2fq();
\ No newline at end of file
...@@ -6,12 +6,12 @@ var settings={ ...@@ -6,12 +6,12 @@ var settings={
db:8, db:8,
}, },
database:{ database:{
dbname : "center_channel", dbname : "center_order",
user: "write", user: "write",
password: "write", password: "write",
config: { config: {
host: '192.168.18.237', host: '43.247.184.35',
port: 3306, port: 8899,
dialect: 'mysql', dialect: 'mysql',
operatorsAliases: false, operatorsAliases: false,
pool: { pool: {
......
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