Commit a35917aa by 宋毅

tj

parent a4504078
......@@ -30,9 +30,12 @@ class APIBase {
//-----------------------新的模式------------------开始
async doexecMethod(gname, methodname, pobj, query, req) {
if (req.body.Action && this.userCenterAction[req.body.Action]) {
req.body.actionType = this.userCenterAction[req.body.Action];
req.body.actionBody = req.body.ActionBody;
var action = this.userCenterAction[req.body.Action];
if (req.body.Action && action) {
var userId = req.body["SubAccountUin"] || req.body["Uin"];
req.body.UserId = userId || "100000013569";
req.body.actionType = action;
req.body.actionBody = req.body;
}
var param = {
pobj: pobj,
......@@ -48,7 +51,6 @@ class APIBase {
result.requestId = result.requestId || uuid.v1();
if (req.body.Action && this.userCenterAction[req.body.Action]) {
result = await this.handleTxResult(result);
delete req.body["ActionBody"];
delete req.body["Action"];
}//处理tx返回数据
return result;
......
......@@ -122,7 +122,7 @@ class OrderInfoDao extends Dao{
}
//获取产品详情
async selPrice2TX(obj) {
var sql = "select product_icon,path_name,servicer_code,servicer_name from x_product "
var sql = "select xp.product_icon product_icon, xp.path_name path_name, xp.servicer_code servicer_code, xp.servicer_name servicer_name,xs.push_domain_addr push_domain_addr from x_product xp JOIN x_service_info xs ON xp.servicer_code=xs.servicer_code "
sql += "where path_code=:path_code and region_id=:region_id ";
try {
var list = await this.customQuery(sql, obj);
......@@ -132,6 +132,7 @@ class OrderInfoDao extends Dao{
rtn.product_type_name = list[0].path_name;
rtn.servicer_code = list[0].servicer_code;
rtn.servicer_name = list[0].servicer_name;
rtn.push_domain_addr = list[0].push_domain_addr;
return system.getResultSuccess(rtn);
} else {
return system.getResultFail(-203, "servicer is empty");
......
const system = require("../../../system");
const {PDICT} = require("../../../../config/platform");
const { PDICT } = require("../../../../config/platform");
module.exports = (db, DataTypes) => {
return db.define("needInfo", {
need_num: DataTypes.STRING(100),
......@@ -10,6 +10,8 @@ module.exports = (db, DataTypes) => {
region_id: DataTypes.STRING(100), //region_id 地区id
region_name: DataTypes.STRING(100), //region_name 地区名称
consult_type: DataTypes.STRING(100), //consult_type 需求类型(产品二类id)
wechat_no: DataTypes.STRING(100),//微信号
email: DataTypes.STRING(100),//邮箱
consult_type_name: DataTypes.STRING(255), //consult_type_name 需求类型名称(产品二类名称)
status: //status 需求状态:1.已提交、2.待顾问反馈、3.待用户确认、4.已完成、5.已关闭
{
......@@ -24,50 +26,50 @@ module.exports = (db, DataTypes) => {
close_reason: DataTypes.STRING(255), //关闭原因
need_info: DataTypes.JSON, //need_info 需求信息(往服务商那边推送的信息)
servicer_code: DataTypes.STRING(100), //服务商
servicer_name:DataTypes.STRING(100),
servicer_name: DataTypes.STRING(100),
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
// updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_need_info',
validate: {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
// updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_need_info',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
const system = require("../../../system");
const {PDICT} = require("../../../../config/platform");
const { PDICT } = require("../../../../config/platform");
module.exports = (db, DataTypes) => {
return db.define("orderDelivery", {
order_num: DataTypes.STRING,
tx_orders_num: DataTypes.STRING,
user_id: DataTypes.STRING,
user_name: DataTypes.STRING,
wechat_no: DataTypes.STRING(100),//微信号
email: DataTypes.STRING(100),//邮箱
deliver_content: DataTypes.JSON, //交付内容
delivery_status://交付状态 order_delivery_status:{"1":"已接单","10":"收集工商注册材料","11":"工商审核环节","12":"刻章环节","13":"证件邮寄环节","14":"您已签收"},
{
......@@ -18,14 +20,14 @@ module.exports = (db, DataTypes) => {
delivery_status_name: DataTypes.STRING,//交付状态名称 utf8mb4 utf8mb4_german2_ci 0 0 0 0 0 0 0
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
// updatedAt: true,
// createdAt: true,
tableName: 'b_order_delivery',
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
// updatedAt: true,
// createdAt: true,
tableName: 'b_order_delivery',
});
});
}
......@@ -80,6 +80,7 @@ class NeedInfoService extends ServiceBase {
}
actionBody.ServicerCode = serviceinfo.data.servicer_code;
actionBody.ServicerName = serviceinfo.data.servicer_name;
//需求创建
var need_num = await this.getBusUid("n");
var datavalue = {
......@@ -112,7 +113,7 @@ class NeedInfoService extends ServiceBase {
"actionBody": {
notifyUrl: "http://brguser.brg.tencentyun.com/api/receive/notifyApi/springBoard",
actionType: "needSubmit",
pushUrl: settings.deliveryUrl() + "/entService/consultation/springBoard",
pushUrl: serviceinfo.data.push_domain_addr + "/entService/consultation/springBoard",
messageBody: actionBody,
identifyCode: "needSubmit"
}
......
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
const {PDICT,MsgTemplate} = require("../../../../config/platform");
const { PDICT, MsgTemplate } = require("../../../../config/platform");
class NeedSolutionService extends ServiceBase {
constructor() {
super("need", ServiceBase.getDaoName(NeedSolutionService));
......@@ -16,42 +16,42 @@ class NeedSolutionService extends ServiceBase {
* @param {*} consultName 产品类型名称
* @param {*} status 状态
*/
async sendSmsNotification(mobile,userId,consultType,consultName,status){
async sendSmsNotification(mobile, userId, consultType, consultName, status) {
try {
var nameArr = consultName?consultName.split("/"):[];
var nameArr = consultName ? consultName.split("/") : [];
var productName = null;
if(nameArr && nameArr.length==4){
if (nameArr && nameArr.length == 4) {
productName = nameArr[2];
}
var params = {phoneNumber:mobile,messageBody:null};
var webinfoParams = {"title":null,"subAccount":userId,"messageBody":null};//站内信通知参数
var params = { phoneNumber: mobile, messageBody: null };
var webinfoParams = { "title": null, "subAccount": userId, "messageBody": null };//站内信通知参数
var messageBody = null;
var webinfoMessageBody = null;
if(consultType.indexOf("/ic/")>=0){//工商产品
messageBody=MsgTemplate.ic.need[status] && MsgTemplate.ic.need[status].sms?MsgTemplate.ic.need[status].sms:"";
messageBody = messageBody.replace(/{productName}/g,productName);
webinfoMessageBody=MsgTemplate.ic.need[status] && MsgTemplate.ic.need[status].webinfo?MsgTemplate.ic.need[status].webinfo:"";
webinfoMessageBody = webinfoMessageBody.replace(/{productName}/g,productName);
webinfoParams.title = MsgTemplate.ic.need[status] && MsgTemplate.ic.need[status].webinfotitle?MsgTemplate.ic.need[status].webinfotitle:"";
if (consultType.indexOf("/ic/") >= 0) {//工商产品
messageBody = MsgTemplate.ic.need[status] && MsgTemplate.ic.need[status].sms ? MsgTemplate.ic.need[status].sms : "";
messageBody = messageBody.replace(/{productName}/g, productName);
webinfoMessageBody = MsgTemplate.ic.need[status] && MsgTemplate.ic.need[status].webinfo ? MsgTemplate.ic.need[status].webinfo : "";
webinfoMessageBody = webinfoMessageBody.replace(/{productName}/g, productName);
webinfoParams.title = MsgTemplate.ic.need[status] && MsgTemplate.ic.need[status].webinfotitle ? MsgTemplate.ic.need[status].webinfotitle : "";
}
if(consultType.indexOf("/qcfw/")>=0){//资质证照产品
if (consultType.indexOf("/qcfw/") >= 0) {//资质证照产品
}
// console.log(messageBody,"ddddddddd");
if(userId && webinfoParams.title && messageBody && messageBody.indexOf("{")<0 && messageBody.indexOf("}")<0 && webinfoMessageBody && webinfoMessageBody.indexOf("{")<0 && webinfoMessageBody.indexOf("}")<0 ){
params.messageBody =messageBody;
if (userId && webinfoParams.title && messageBody && messageBody.indexOf("{") < 0 && messageBody.indexOf("}") < 0 && webinfoMessageBody && webinfoMessageBody.indexOf("{") < 0 && webinfoMessageBody.indexOf("}") < 0) {
params.messageBody = messageBody;
webinfoParams.messageBody = webinfoMessageBody;
// await this.utilsMsgSendSve.sendMessageByPhone(params);//发送短信
await this.utilsMsgSendSve.sendMessageVerify({phoneList:[params],subAccountList:[webinfoParams]});
await this.utilsMsgSendSve.sendMessageVerify({ phoneList: [params], subAccountList: [webinfoParams] });
}
return;
return;
} catch (e) {
this.execClient.execLogs("needSolutionSve.js/sendSmsNotification(发送短信通知)方法出现异常", {mobile:mobile,consultType:consultType,consultName:consultName,status:status}, "", null, e.stack);
this.execClient.execLogs("needSolutionSve.js/sendSmsNotification(发送短信通知)方法出现异常", { mobile: mobile, consultType: consultType, consultName: consultName, status: status }, "", null, e.stack);
return;
}
}
//服务商提交/修改方案
async submitSolution(pobj) {
......@@ -101,7 +101,7 @@ class NeedSolutionService extends ServiceBase {
await self.dao.update(updateObj, t);
await self.needInfoDao.update({ id: needinfo.id, status: "3" }, t);
//发送短信通知
self.sendSmsNotification(needinfo.contacts_mobile,needinfo.user_id,needinfo.consult_type,needinfo.consult_type_name,3);
self.sendSmsNotification(needinfo.contacts_mobile, needinfo.user_id, needinfo.consult_type, needinfo.consult_type_name, 3);
return system.getResultSuccess();
});
......@@ -127,7 +127,7 @@ class NeedSolutionService extends ServiceBase {
await self.dao.create(createObj, t);
//发送短信通知
// self.sendSmsNotification(needinfo.contacts_mobile,needinfo.consult_type,needinfo.consult_type_name,3);
self.sendSmsNotification(needinfo.contacts_mobile,needinfo.user_id,needinfo.consult_type,needinfo.consult_type_name,3);
self.sendSmsNotification(needinfo.contacts_mobile, needinfo.user_id, needinfo.consult_type, needinfo.consult_type_name, 3);
return system.getResultSuccess(solution_num);
});
......@@ -156,6 +156,15 @@ class NeedSolutionService extends ServiceBase {
if (!solutionInfo) {
return system.getResultFail(-102, "solutionInfo is empty");
}
var urlobj = {
path_code: needInfo.dataValues.consult_type,
region_id: needInfo.dataValues.region_id
}
var serviceinfo = await this.needInfoDao.findServiceByProductType(urlobj);
if (serviceinfo.status < 0) {
return system.getResultFail(-203, "servicer is empty");
}
//生产者------方案反馈
var pushobj = {
......@@ -163,7 +172,7 @@ class NeedSolutionService extends ServiceBase {
"actionBody": {
notifyUrl: "",
actionType: "needClose",
pushUrl: settings.deliveryUrl() + "/entService/consultation/springBoard",
pushUrl: serviceinfo.data.push_domain_addr + "/entService/consultation/springBoard",
messageBody: actionBody,
identifyCode: "needClose"
}
......
......@@ -50,8 +50,8 @@ class OrderInfoService extends ServiceBase {
return system.getResultFail(-300, "未知订单信息");
}
var relatedProductsList = [];
if(orderinfo.tx_orders_num){
relatedProductsList = await this.getRelatedProductsList(orderinfo.tx_orders_num,ab.UserId,ab.OrderNum);
if (orderinfo.tx_orders_num) {
relatedProductsList = await this.getRelatedProductsList(orderinfo.tx_orders_num, ab.UserId, ab.OrderNum);
}
orderinfo["relatedProductsList"] = relatedProductsList;
var deliveryParams = {
......@@ -71,18 +71,18 @@ class OrderInfoService extends ServiceBase {
return system.getResultSuccess(orderinfo);
}
//获取关联产品列表
async getRelatedProductsList(TxOrdersNum,UserId,OrderNum){
async getRelatedProductsList(TxOrdersNum, UserId, OrderNum) {
var whereObj = {
tx_orders_num:TxOrdersNum,user_id:UserId
tx_orders_num: TxOrdersNum, user_id: UserId
};
if(OrderNum){
if (OrderNum) {
whereObj["order_num"] = { [this.db.Op.ne]: OrderNum };
}
// orderdetail.tx_orders_num,orderdetail.order_num
var relatedProductsList = await this.orderProductDao.model.findAll({
attributes:["product_type","product_type_name"],
where:whereObj,
raw:true
attributes: ["product_type", "product_type_name"],
where: whereObj,
raw: true
});
return relatedProductsList;
}
......@@ -114,9 +114,9 @@ class OrderInfoService extends ServiceBase {
var result = await this.dao.getQcOrderList(ab);
return result;
}
//发货回调
async orderPayNotify(pobj) {
async orderPayNotifydev(pobj) {
if (!pobj.actionBody.interface || !pobj.actionBody.interface.para) {
return system.getResultFail(-101, "参数错误");
}
......@@ -146,7 +146,7 @@ class OrderInfoService extends ServiceBase {
"spanId": "https://buy.qcloud.com;61911"
}
var txorderinfo = await this.execPostByTimeOut(selobj, "http://trade.sandbox.com/interfaces/interface.php");
if (txorderinfo.status < 0) {
return system.getResultFail(-101, "post is error");
}
......@@ -270,7 +270,7 @@ class OrderInfoService extends ServiceBase {
"actionBody": {
notifyUrl: "",
actionType: "orderSubmit",
pushUrl: settings.deliveryUrl() + "/entService/order/springBoard",
pushUrl: txorderdetail.goodsDetail.product.pushDomainAddr + "/entService/order/springBoard",
messageBody: {
"txOrderNum": pobj.actionBody.interface.para.bigDealId,
"orderNum": pobj.actionBody.interface.para.dealName,
......@@ -297,7 +297,7 @@ class OrderInfoService extends ServiceBase {
return corder;
}
async orderPayNotifydev(pobj) {
async orderPayNotify(pobj) {
if (!pobj.actionBody.interface || !pobj.actionBody.interface.para) {
return system.getResultFail(-101, "参数错误");
}
......@@ -327,7 +327,7 @@ class OrderInfoService extends ServiceBase {
"spanId": "https://buy.qcloud.com;61911"
}
// var txorderinfo = await this.execPostByTimeOut(selobj, "http://trade.sandbox.com/interfaces/interface.php");
// if (txorderinfo.status < 0) {
// return system.getResultFail(-101, "post is error");
// }
......@@ -529,7 +529,7 @@ class OrderInfoService extends ServiceBase {
"actionBody": {
notifyUrl: "",
actionType: "orderSubmit",
pushUrl: settings.deliveryUrl() + "/entService/order/springBoard",
pushUrl: txorderdetail.goodsDetail.product.pushDomainAddr + "/entService/order/springBoard",
messageBody: {
"txOrderNum": pobj.actionBody.interface.para.bigDealId,
"orderNum": pobj.actionBody.interface.para.dealName,
......@@ -706,6 +706,7 @@ class OrderInfoService extends ServiceBase {
productTypeName: txproductinfo.data.product_type_name,
servicerCode: txproductinfo.data.servicer_code,
servicerName: txproductinfo.data.servicer_name,
pushDomainAddr: txproductinfo.data.push_domain_addr,
txPriceCode: billingcode
},
productSnapshot: txobj.interface.para.resInfo[0].goodsDetail
......@@ -809,11 +810,11 @@ class OrderInfoService extends ServiceBase {
}
}
}
var a=await this.execPostByTimeOut(p, "http://192.168.1.113:4011/api/action/txapi/springBoard");
var a = await this.execPostByTimeOut(p, "http://192.168.1.113:4011/api/action/txapi/springBoard");
if (pobj.itemDetails.raw_goodsData.length == 2) {
p.interface.para.dealName = Date.now();
p.interface.para.goodsDetail = pobj.itemDetails.raw_goodsData[1].goodsDetail;
var b=await this.execPostByTimeOut(p, "http://192.168.1.113:4011/api/action/txapi/springBoard");
var b = await this.execPostByTimeOut(p, "http://192.168.1.113:4011/api/action/txapi/springBoard");
}
if (pobj.itemDetails.raw_goodsData.length == 3) {
p.interface.para.dealName = Date.now();
......
ALTER TABLE b_need_info ADD COLUMN wechat_no VARCHAR(100) DEFAULT NULL COMMENT '微信号';
ALTER TABLE b_need_info ADD COLUMN wechat_no VARCHAR(100) DEFAULT NULL COMMENT '微信号';
ALTER TABLE b_need_info ADD COLUMN email VARCHAR(100) DEFAULT NULL COMMENT '邮箱';
ALTER TABLE b_order_delivery ADD COLUMN wechat_no VARCHAR(100) DEFAULT NULL COMMENT '微信号';
ALTER TABLE b_order_delivery ADD COLUMN email VARCHAR(100) DEFAULT NULL COMMENT '邮箱';
\ No newline at end of file
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