Commit 11a7a065 by 王栋源

Merge branch 'igirl-channel' of gitlab.gongsibao.com:jiangyong/zhichan into igirl-channel

parents fc15badb e08a9709
#!/bin/bash #!/bin/bash
FROM registry.cn-beijing.aliyuncs.com/hantang/node105:v2 FROM registry.cn-beijing.aliyuncs.com/hantang2/node105:v2
MAINTAINER jy "jiangyong@gongsibao.com" MAINTAINER jy "jiangyong@gongsibao.com"
ADD igirl-channel /apps/igirl-channel/ ADD igirl-channel /apps/igirl-channel/
WORKDIR /apps/igirl-channel/ WORKDIR /apps/igirl-channel/
......
...@@ -8,6 +8,7 @@ class APIBase { ...@@ -8,6 +8,7 @@ class APIBase {
this.cacheManager = system.getObject("db.common.cacheManager"); this.cacheManager = system.getObject("db.common.cacheManager");
this.logCtl = system.getObject("web.common.oplogCtl"); this.logCtl = system.getObject("web.common.oplogCtl");
this.oplogSve = system.getObject("service.common.oplogSve"); this.oplogSve = system.getObject("service.common.oplogSve");
this.toolSve = system.getObject("service.trademark.toolSve");
this.exTime = 2 * 3600;//缓存过期时间,2小时 this.exTime = 2 * 3600;//缓存过期时间,2小时
} }
getUUID() { getUUID() {
...@@ -60,6 +61,7 @@ class APIBase { ...@@ -60,6 +61,7 @@ class APIBase {
var fullname = gname + "." + methodname; var fullname = gname + "." + methodname;
var lst = [ var lst = [
"test.test", "test.test",
"testApiT.test",
"auth.getToken", "auth.getToken",
"auth.getJdSign" "auth.getJdSign"
]; ];
...@@ -93,12 +95,12 @@ class APIBase { ...@@ -93,12 +95,12 @@ class APIBase {
// return system.getResultFail(system.signFail, signResult.msg); // return system.getResultFail(system.signFail, signResult.msg);
// } // }
if (pobj.isUser && pobj.isUser == "yes") { if (pobj.isUser && pobj.isUser == "yes") {
var channelUserId = pobj.actionBody.channelUserId || ""; var channelUserId = pobj.channelUserId ? pobj.channelUserId : pobj.actionBody.channelUserId || "";
if (!channelUserId && pobj.actionBody.channelUser) { if (!channelUserId && pobj.actionBody.channelUser) {
channelUserId = pobj.actionBody.channelUser.channelUserId; channelUserId = pobj.actionBody.channelUser.channelUserId;
} }
if (!channelUserId) { if (!channelUserId) {
return system.getResult(null, "base verify channelUserId is not empty"); return system.getResult(null, "base verify channelUserId is empty");
} }
var userCacheKey = selfAppInfo.data.uappKey + "_" + channelUserId; var userCacheKey = selfAppInfo.data.uappKey + "_" + channelUserId;
var userInfo = await this.cacheManager["ApiUserCache"].cache(userCacheKey, channelUserId, var userInfo = await this.cacheManager["ApiUserCache"].cache(userCacheKey, channelUserId,
...@@ -121,12 +123,28 @@ class APIBase { ...@@ -121,12 +123,28 @@ class APIBase {
req.headers["request-id"] = requestid; req.headers["request-id"] = requestid;
} }
try { try {
if (pobj.actionType == "createChannelUser") {
if (!pobj.isUser) {
system.getResult(null, "isUser is empty");
}
if (pobj.isUser != "yes") {
system.getResult(null, "isUser value must yes");
}
}
//验证accesskey或验签 //验证accesskey或验签
var isPassResult = await this.checkAcck(gname, methodname, pobj, query, req); var isPassResult = await this.checkAcck(gname, methodname, pobj, query, req);
if (isPassResult.status != 0) { if (isPassResult.status != 0) {
isPassResult.requestId = ""; isPassResult.requestId = "";
return isPassResult; return isPassResult;
} }
if (pobj.actionType == "createChannelUser") {
var encryptResult = await this.toolSve.encryptStr(req.app, req.user.channelUserId);
if (encryptResult.status != 0) {
system.getResult(null, "encrypt channelUserId is error");
}
req.user.encryptChannelUserId = encryptResult.data;
return system.getResultSuccess(req.user);
}//创建用户
req.requestId = requestid; req.requestId = requestid;
var rtn = await this[methodname](pobj, query, req); var rtn = await this[methodname](pobj, query, req);
if (rtn && !rtn.requestId) { if (rtn && !rtn.requestId) {
......
...@@ -51,14 +51,31 @@ class TmOrderAPI extends APIBase { ...@@ -51,14 +51,31 @@ class TmOrderAPI extends APIBase {
// action_body.user = { id: 6, app_id: 2, nickname: "测试用户",channelUserId:"testUserId01" }; // action_body.user = { id: 6, app_id: 2, nickname: "测试用户",channelUserId:"testUserId01" };
var opResult = null; var opResult = null;
if (["subTmOrder", "getTmOrderList", "getTmOrderInfo", "getTmApplyInfo", "getTmNclList", "getNeedInfo", if (["subTmOrder", "getTmOrderList", "getTmOrderInfo", "getTmApplyInfo", "getTmNclList", "getNeedInfo",
"tmConfirm", "updateTmInfo", "updateNclInfo", "updateContacts", "updateCustomerInfo", "tmConfirm", "updateTmInfo", "updateNclInfo", "updateContacts",
"updateCustomerInfo"].indexOf(action_type) >= 0) { "updateCustomerInfo", "addOrderAndDelivery", "updateOrderPayStatus"].indexOf(action_type) >= 0) {
if (!action_body.channelUserId) { if (!action_body.channelUserId) {
return system.getResult(null, "verify channelUserId is not empty"); return system.getResult(null, "verify channelUserId is empty");
} }
} }
switch (action_type) { switch (action_type) {
// sy // sy
case "againPushFqBusiness"://再次推送商机
opResult = await this.orderSve.againPushFqBusiness(pobj, req);
break;
case "updateOrderStatus"://更新订单状态
opResult = await this.orderSve.updateOrderStatus(action_body, pobj, req);
break;
case "updateOrderPayStatus"://更新订单付款状态
opResult = await this.orderSve.updateOrderPayStatus(action_body, pobj, req);
if (opResult.status == 0) {
pobj.actionBody["deliveryOrderNo"] = opResult.data.deliveryOrderNo;
var url = this.pushFqbossDataUrl + "api/channelaccessApi/updateChannelPayStatus";
await this.pushData2(opResult, req, pobj, url);
}
break;
case "addOrderAndDelivery"://创建订单和交付单
opResult = await this.orderSve.addOrderAndDelivery(action_body, pobj, req);
break;
case "clearAllCache": case "clearAllCache":
await this.cacheManager["MagCache"].clearAll(); await this.cacheManager["MagCache"].clearAll();
opResult = system.getResultSuccess(null, "清理缓存成功"); opResult = system.getResultSuccess(null, "清理缓存成功");
...@@ -102,6 +119,7 @@ class TmOrderAPI extends APIBase { ...@@ -102,6 +119,7 @@ class TmOrderAPI extends APIBase {
} }
} }
pobj.actionBody["deliveryOrderNo"] = opResult.data.deliveryOrderNo; pobj.actionBody["deliveryOrderNo"] = opResult.data.deliveryOrderNo;
pobj.actionBody["itemCode"] = opResult.data.channelItemCode;
// await this.pushData(opResult, req, pobj); // await this.pushData(opResult, req, pobj);
var url = this.pushFqbossDataUrl + "api/channelaccessApi/createChannelOrder" var url = this.pushFqbossDataUrl + "api/channelaccessApi/createChannelOrder"
await this.pushData2(opResult, req, pobj, url); await this.pushData2(opResult, req, pobj, url);
...@@ -121,13 +139,18 @@ class TmOrderAPI extends APIBase { ...@@ -121,13 +139,18 @@ class TmOrderAPI extends APIBase {
} }
} }
pobj.actionBody["deliveryOrderNo"] = opResult.data.deliveryOrderNo; pobj.actionBody["deliveryOrderNo"] = opResult.data.deliveryOrderNo;
pobj.actionBody["itemCode"] = opResult.data.channelItemCode;
// await this.pushData(opResult, req, pobj); // await this.pushData(opResult, req, pobj);
var url = this.pushFqbossDataUrl + "api/channelaccessApi/createChannelOrder" var url = this.pushFqbossDataUrl + "api/channelaccessApi/createChannelOrder"
await this.pushData2(opResult, req, pobj, url); await this.pushData2(opResult, req, pobj, url);
} }
break; break;
case "getTmOrderList"://商标交付列表 case "getTmOrderList"://商标交付列表
opResult = await this.ordertmproductSve.getTmOrderList(action_body, req); opResult = await this.ordertmproductSve.getTmOrderList(action_body, pobj, req);
break;
case "getTmOrderListAdmin"://商标交付列表
action_body.getListType = "getTmOrderListAdmin";
opResult = await this.ordertmproductSve.getTmOrderList(action_body, pobj, req);
break; break;
case "getTmOrderInfo"://商标交付信息 case "getTmOrderInfo"://商标交付信息
opResult = await this.ordertmproductSve.getTmOrder(action_body); opResult = await this.ordertmproductSve.getTmOrder(action_body);
...@@ -186,7 +209,7 @@ class TmOrderAPI extends APIBase { ...@@ -186,7 +209,7 @@ class TmOrderAPI extends APIBase {
} }
break; break;
case "pushFqBusiness"://推送商机到峰擎 case "pushFqBusiness"://推送商机到峰擎
opResult = await this.orderSve.pushFqBusiness(action_body, pobj, req); opResult = await this.orderSve.push1688FqBusiness(action_body, pobj, req);
break; break;
case "getProductDetail"://根据渠道产品码获取产品详情 case "getProductDetail"://根据渠道产品码获取产品详情
opResult = await this.appProductSve.findByChannelItemCode(action_body); opResult = await this.appProductSve.findByChannelItemCode(action_body);
...@@ -237,8 +260,12 @@ class TmOrderAPI extends APIBase { ...@@ -237,8 +260,12 @@ class TmOrderAPI extends APIBase {
var rc = system.getObject("util.execClient"); var rc = system.getObject("util.execClient");
var obj = pobj.actionBody; var obj = pobj.actionBody;
var user = obj.user; var user = obj.user;
if (obj.app) {
obj.app = null;
}
obj["channelUserId"] = obj.channelUserId; obj["channelUserId"] = obj.channelUserId;
obj["channelCode"] = pobj.actionProcess; obj["channelCode"] = pobj.actionProcess;
obj["appid"] = "2e787bbaacda4c6488b9fae58fff30ba";
var rtn = null; var rtn = null;
try { try {
var requestId = opResult.requestId || req.requestId; var requestId = opResult.requestId || req.requestId;
......
var APIBase = require("../../api.base"); var APIBase = require("../../api.base");
var system = require("../../../system"); var system = require("../../../system");
const { Signer, Context } = require('jdcloud-sdk-signer')
class jdAuthAPI extends APIBase { class jdAuthAPI extends APIBase {
constructor() { constructor() {
super(); super();
...@@ -17,78 +16,5 @@ class jdAuthAPI extends APIBase { ...@@ -17,78 +16,5 @@ class jdAuthAPI extends APIBase {
console.log("qobj......payOrderInfo..........:\n", qobj); console.log("qobj......payOrderInfo..........:\n", qobj);
return { payOrderInfo: "ok" }; return { payOrderInfo: "ok" };
} }
async getJdSign(pobj, qobj, req) {
try {
let ctx = new Context('x3k0s704lfun-test.cn-north-1.jdcloud-api.net', '/market/order/order-inner/submit', 'POST', null, 'empty');
ctx.regionId = 'cn-north-1'
ctx.headers.set('content-type', 'text/plain')
let credentials = {
accessKeyId: 'C6D680733C19362B5DF478207D6A90A4', //替换自己的AK
secretAccessKey: 'EB9AFEE49CE41700CADD5F2EE3B2122C' //替换自己的SK--jd>>>>>>>
}
//测试报文:
//GET
// ctx.body = "pin=jcloud_pRiHQTd&serviceId=580010&itemCode=FW_GOODS-580010-1&platform=6"
//POST
var qs = require('querystring');
var post_data = { pin="jcloud_pRiHQTd", serviceId=580010, itemCode="FW_GOODS-580010-1", platform=6 };//这是需要提交的数据
var tmpContent = JSON.stringify(post_data);
var content = qs.stringify(post_data);
ctx.body = content;
ctx.method = 'POST'
var signer = new Signer(ctx, credentials)
var dd = new Date()
ctx.headers.set('Content-Length', ctx.body.length)
ctx.buildNonce()
var auth = signer.sign(dd);
console.log("POST签名为:", auth)
ctx.headers.set('Authorization', auth)
////////////////////////////////////////////////////////////////////////////////////////////////////////////
var http = require('https');
// var content = ctx.body;
var options = {
host: 'x3k0s704lfun-test.cn-north-1.jdcloud-api.net',
port: 443,
path: '/market/order/order-inner/submit',
method: 'POST',
headers: {
}
};
for (let [key, value] of ctx.headers) {
options.headers[key] = value
}
console.log("post options:\n", options);
//console.log("content:",content);
//console.log("\n");
var req = http.request(options, function (res) {
console.log("--jd>>>>>>>>>>>>>statusCode: ", res.statusCode);
console.log("--jd>>>>>>>>>>>>>headers: ", res.headers);
var _data = '';
res.on('data', function (chunk) {
_data += chunk;
});
res.on('end', function () {
console.log("\n---jd>>>>>>>>>>>>>.>>\nresult:", _data)
});
});
req.on('error', (e) => {
console.error(`--jd>>>>>>>>>>>>>请求遇到问题: ${e.message}`);
});
req.write(content);
req.end();
} catch (errorMsg) {
console.log(errorMsg, "--jd>>>>>>>errorMsg..............................>>>>>>");
}
}
} }
module.exports = jdAuthAPI; module.exports = jdAuthAPI;
\ No newline at end of file
var APIBase = require("../../api.base");
var system = require("../../../system");
var moment = require("moment");
class TestAPI extends APIBase {
constructor() {
super();
this.orderSve = system.getObject("service.dborder.orderSve");
}
async test(pobj, query, req) {
// var rc = system.getObject("util.aliyunClient");
// var param = pobj;
// try {
// var body = {
// idempotentId: "fzsbzc",// 是 业务 ID
// idempotentSource: param.appSourceCode || "tm_1688",// 是 业务来源(ali、jd)
// idempotentSourceName: param.name || "1688应用",// 是 阿里,京东
// city: "",// 否 所属城市
// phone:"15010929366",// 是 手机号
// userId: "channelUserIdtest01",// 否 用户 ID
// companyName: "",// 否 公司名称
// orderPrice: 899,// 是 订单金额
// productId: "5dc936eb296d1572b9bc5b8d",// 是 产品 ID
// productQuantity: 1,// 是 产品数量
// };
// var submitTm = await rc.post("https://yunfuapi.gongsibao.com/crm/order/submit", body);
// return { code: 200, message: "ok", data: submitTm };
// } catch (e) {
// //日志记录
// logCtl.error({
// optitle: "查询阿里商标状态异常---error",
// op: "base/api/impl/tmsub/queryAliTmStatus",
// content: e.stack,
// clientIp: ""
// });
// }
var body = { channelItemCode: "1329709" };
returnRuslt={
"returnValue": [
{
"bizStatusExt": "service",
"memberId": "b2b-****02",
"productName": "商机**",
"gmtCreate": "20171231200252000+0800",
"gmtServiceEnd": "20190101000000000+0800",
"bizStatus": "S",
"paymentAmount": 420,
"executePrice": 420,
"orderItemNum": "W1712*****_1",
"gmtServiceBegin": "20171231000000000+0800",
"gmtConfirm": "20171231200329000+0800",
"settleItemDtos": [
],
"payCustomerUid": "12345678990000",
"signCustomerUid": "12345678990000"
}
],
"successed": true
};
var tmpreq={app:};
this.orderSve.addOrderNeed()
return system.getResultSuccess({ req: "ok" });
}
}
module.exports = TestAPI;
\ No newline at end of file
...@@ -9,6 +9,11 @@ class Dao { ...@@ -9,6 +9,11 @@ class Dao {
preCreate(u) { preCreate(u) {
return u; return u;
} }
/**
*
* @param {*} u 对象
* @param {*} t 事务对象t
*/
async create(u, t) { async create(u, t) {
var u2 = this.preCreate(u); var u2 = this.preCreate(u);
if (t) { if (t) {
...@@ -64,7 +69,7 @@ class Dao { ...@@ -64,7 +69,7 @@ class Dao {
//return {"key":"include","value":{model:this.db.models.app}}; //return {"key":"include","value":{model:this.db.models.app}};
return [["created_at", "DESC"]]; return [["created_at", "DESC"]];
} }
buildAttributes(){ buildAttributes() {
return []; return [];
} }
buildQuery(qobj) { buildQuery(qobj) {
...@@ -127,8 +132,8 @@ class Dao { ...@@ -127,8 +132,8 @@ class Dao {
qc[extraFilter.key] = extraFilter.value; qc[extraFilter.key] = extraFilter.value;
} }
var attributesObj = this.buildAttributes(); var attributesObj = this.buildAttributes();
if(attributesObj && attributesObj.length>0){ if (attributesObj && attributesObj.length > 0) {
qc.attributes=attributesObj; qc.attributes = attributesObj;
} }
console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"); console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm");
console.log(qc); console.log(qc);
......
...@@ -16,7 +16,9 @@ class AppProductDao extends Dao { ...@@ -16,7 +16,9 @@ class AppProductDao extends Dao {
"itemName", // 产品名称 "itemName", // 产品名称
"picUrl", // 产品图片地址 "picUrl", // 产品图片地址
"channelItemCode", // 渠道产品编码 "channelItemCode", // 渠道产品编码
"channelItemName", // 渠道产品名称 "channelItemName", // 渠道产品名称
"serviceItemCode",
"pushServiceItemCode",
"status", // 状态 0禁用 1启用 "status", // 状态 0禁用 1启用
"verifyPrice", // 是否验证价格 0不验证 1验证 "verifyPrice", // 是否验证价格 0不验证 1验证
"proPrice", // 产品价格 "proPrice", // 产品价格
...@@ -43,7 +45,9 @@ class AppProductDao extends Dao { ...@@ -43,7 +45,9 @@ class AppProductDao extends Dao {
"itemName", // 产品名称 "itemName", // 产品名称
"picUrl", // 产品图片地址 "picUrl", // 产品图片地址
"channelItemCode", // 渠道产品编码 "channelItemCode", // 渠道产品编码
"channelItemName", // 渠道产品名称 "channelItemName", // 渠道产品名称
"serviceItemCode",
"pushServiceItemCode",
"status", // 状态 0禁用 1启用 "status", // 状态 0禁用 1启用
"verifyPrice", // 是否验证价格 0不验证 1验证 "verifyPrice", // 是否验证价格 0不验证 1验证
"proPrice", // 产品价格 "proPrice", // 产品价格
...@@ -71,7 +75,8 @@ class AppProductDao extends Dao { ...@@ -71,7 +75,8 @@ class AppProductDao extends Dao {
"picUrl", // 产品图片地址 "picUrl", // 产品图片地址
"channelItemCode", // 渠道产品编码 "channelItemCode", // 渠道产品编码
"channelItemName", // 渠道产品名称 "channelItemName", // 渠道产品名称
"serviceItemCode", "serviceItemCode",
"pushServiceItemCode",
"deliveryUrl", "deliveryUrl",
"status", // 状态 0禁用 1启用 "status", // 状态 0禁用 1启用
"verifyPrice", // 是否验证价格 0不验证 1验证 "verifyPrice", // 是否验证价格 0不验证 1验证
......
...@@ -43,19 +43,19 @@ class OrderDao extends Dao { ...@@ -43,19 +43,19 @@ class OrderDao extends Dao {
var orderObj = { var orderObj = {
app_id: user.app_id,// app_id: user.app_id,//
orderNo: ordercode,// 订单号 orderNo: ordercode,// 订单号
channelServiceNo: channelOrder.channelServiceNo,// 渠道服务单号 channelServiceNo: channelOrder.channelServiceNo || "",// 渠道服务单号
channelOrderNo: channelOrder.channelOrderNo,//渠道订单号列表,多个以,隔开 channelOrderNo: channelOrder.channelOrderNo || "",//渠道订单号列表,多个以,隔开
payTime: channelOrder.payTime || null, payTime: channelOrder.payTime || null,
itemCode: productItem.itemCode,// itemCode: productItem.itemCode,//
itemName: productItem.itemName,// itemName: productItem.itemName,//
channelItemCode: productItem.channelItemCode,// 渠道产品编码 channelItemCode: productItem.channelItemCode,// 渠道产品编码
channelItemName: productItem.channelItemName,// 渠道产品名称 channelItemName: productItem.channelItemName,// 渠道产品名称
salesNum: channelOrder.quantity,//项目订单数量(即服务项目的倍数,默认值为1) salesNum: channelOrder.quantity || 1,//项目订单数量(即服务项目的倍数,默认值为1)
salesDiliverNum: channelOrder.salesDiliverNum,//项目订单交付数量(即与项目订单数量相对应) salesDiliverNum: channelOrder.salesDiliverNum || 0,//项目订单交付数量(即与项目订单数量相对应)
minitermNum: channelOrder.nclCount || 10 * channelOrder.quantity,//订单小项数量 minitermNum: channelOrder.nclCount || 10 * channelOrder.quantity,//订单小项数量
minitermDiliverNum: channelOrder.minitermDiliverNum,//订单小项交付数量 minitermDiliverNum: channelOrder.minitermDiliverNum || 0,//订单小项交付数量
orderType: orderType || "dkxd",// 订单类型,zzdd: 自主订单,dkxd: 代客下单 orderType: orderType || "dkxd",// 订单类型,zzdd: 自主订单,dkxd: 代客下单
orderPayStatus: channelOrder.payStatus,// 订单付款状态dfk: 待付款, zfpz: 已上传支付凭证, yfk: 已付款, ddqx: 订单取消, tkclz: 退款处理中, bfytk: 部分已退款, ytk: 已退款,zfshbtg:支付审核不通过 orderPayStatus: channelOrder.payStatus || "dfk",// 订单付款状态dfk: 待付款, zfpz: 已上传支付凭证, yfk: 已付款, ddqx: 订单取消, tkclz: 退款处理中, bfytk: 部分已退款, ytk: 已退款,zfshbtg:支付审核不通过
totalServiceCharge: orderAmount.totalServiceCharge || 0,// 服务费总额(产品配置的服务费*订单件数) totalServiceCharge: orderAmount.totalServiceCharge || 0,// 服务费总额(产品配置的服务费*订单件数)
totalPublicExpense: orderAmount.totalPublicExpense || 0,// 官费总额(产品配置的官费*订单件数) totalPublicExpense: orderAmount.totalPublicExpense || 0,// 官费总额(产品配置的官费*订单件数)
totalDiscounts: orderAmount.totalDiscounts,// 优惠总额((服务费总额+官费总额)-订单总额(产品价格×优惠费率×订单件数)>0则有优惠额度) totalDiscounts: orderAmount.totalDiscounts,// 优惠总额((服务费总额+官费总额)-订单总额(产品价格×优惠费率×订单件数)>0则有优惠额度)
...@@ -82,7 +82,9 @@ class OrderDao extends Dao { ...@@ -82,7 +82,9 @@ class OrderDao extends Dao {
serviceItemSnapshot: JSON.stringify(productItem),//产品快照 serviceItemSnapshot: JSON.stringify(productItem),//产品快照
}; };
var order = await this.create(orderObj, t); var order = await this.create(orderObj, t);
return system.getResultSuccess(order); var tmpResult = system.getResultSuccess(order);
tmpResult.addOrder = true;
return tmpResult;
} }
async putOrder(setObj, whereObj, t) { async putOrder(setObj, whereObj, t) {
return this.updateByWhere(setObj, whereObj, t) return this.updateByWhere(setObj, whereObj, t)
......
...@@ -21,6 +21,40 @@ class OrderTmProductDao extends Dao { ...@@ -21,6 +21,40 @@ class OrderTmProductDao extends Dao {
raw: true raw: true
}); });
} }
async getItemByNeedNoOrderNo(needNoOrderNo, appId, t) {
var sqlWhere = {
where: {
needNoOrderNo: needNoOrderNo,
app_id: appId
},
raw: true
};
if (t) {
sqlWhere.transaction = t;
}
sqlWhere.attributes = ["id",
"deliveryOrderNo",
"needNo",
"sourceOrderNo",
"tmName",
"tmType",
"tmFormType",
"nclOneCodes",
"deliveryStatus",
"picUrl",
"colorizedPicUrl",
"sywjUrl",
"gzwtsUrl",
"nclCount",
"smwjUrl",
"updateuser_id",
"updateuser",
"notes",
"nclOneCount"
];
return this.model.findOne(sqlWhere);
}
async getItemByChannelServiceNo(channelServiceNo, appId, t) { async getItemByChannelServiceNo(channelServiceNo, appId, t) {
var sqlWhere = { var sqlWhere = {
where: { where: {
......
...@@ -14,14 +14,14 @@ class ReceiptVoucherDao extends Dao { ...@@ -14,14 +14,14 @@ class ReceiptVoucherDao extends Dao {
} }
async addReceiptvoucher(orderParams, req, t) { async addReceiptvoucher(orderParams, req, t) {
var param = { var param = {
app_id: req.app.id,// app_id: orderParams.app_id,//
totalSum: orderParams.totalSum || 0,// 订单总额(产品价格×优惠费率×订单件数) totalSum: orderParams.totalSum || 0,// 订单总额(产品价格×优惠费率×订单件数)
channelServiceNo: orderParams.channelServiceNo,// 渠道服务单号 channelServiceNo: orderParams.channelServiceNo,// 渠道服务单号
auditStatus: "tg", auditStatus: "tg",
sourceType: "order", sourceType: "order",
sourceOrderNo: orderParams.orderNo,// 来源订单号 sourceOrderNo: orderParams.orderNo,// 来源订单号
payDate: orderParams.payTime,// payDate: orderParams.payTime,//
createuser_id: req.user.id, createuser_id: orderParams.createuser_id,
creator: orderParams.creator || "", creator: orderParams.creator || "",
accountType: "other", accountType: "other",
}; };
......
...@@ -34,7 +34,7 @@ module.exports = { ...@@ -34,7 +34,7 @@ module.exports = {
//订单服务付款状态 //订单服务付款状态
"order_service_pay_status": { "dfk": "待付款", "yfk": "已付款" }, "order_service_pay_status": { "dfk": "待付款", "yfk": "已付款" },
//商标交付状态 //商标交付状态
"delivery_status": { "dqrfa": "待确认方案", "fabtg": "方案不通过", "dsccl": "待上传材料", "dsh": "待审核", "ddj": "待递交", "ydj": "已递交", "ywc": "已完成" }, "delivery_status": { "dqrfa": "待确认方案", "fabtg": "方案不通过", "dfwsfw": "待服务", "dsccl": "待上传材料", "dsh": "待审核", "ddj": "待递交", "ydj": "已递交", "ywc": "已完成" },
//商标类型 //商标类型
"tm_type": { "p": "普通商标", "j": "集体商标", "z": "证明商标", "t": "特殊商标" }, "tm_type": { "p": "普通商标", "j": "集体商标", "z": "证明商标", "t": "特殊商标" },
//商标类型形式 //商标类型形式
......
...@@ -3,13 +3,14 @@ const settings = require("../../../../config/settings"); ...@@ -3,13 +3,14 @@ const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey); const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => { module.exports = (db, DataTypes) => {
return db.define("appproduct", { return db.define("appproduct", {
app_id :DataTypes.STRING(50),// 应用id app_id :DataTypes.STRING(50),// 应用id
itemCode :DataTypes.STRING(100),// 产品编码 itemCode :DataTypes.STRING(100),// 产品编码
itemName :DataTypes.STRING(100),// 产品名称 itemName :DataTypes.STRING(100),// 产品名称
picUrl :DataTypes.STRING(500),// 产品图片地址 picUrl :DataTypes.STRING(500),// 产品图片地址
channelItemCode :DataTypes.STRING(100),// 渠道产品编码 channelItemCode :DataTypes.STRING(100),// 渠道产品编码
channelItemName :DataTypes.STRING(100),// 渠道产品名称 channelItemName :DataTypes.STRING(100),// 渠道产品名称
serviceItemCode :DataTypes.STRING(100),// 服务商产品编码 serviceItemCode :DataTypes.STRING(100),// 服务商产品编码
pushServiceItemCode :DataTypes.STRING(100),// 推送到服务商的产品编码
status :DataTypes.BOOLEAN,// 状态 0禁用 1启用 status :DataTypes.BOOLEAN,// 状态 0禁用 1启用
verifyPrice :DataTypes.BOOLEAN,// 是否验证价格 0不验证 1验证 verifyPrice :DataTypes.BOOLEAN,// 是否验证价格 0不验证 1验证
proPrice :DataTypes.DOUBLE,// 产品价格 proPrice :DataTypes.DOUBLE,// 产品价格
......
...@@ -55,6 +55,7 @@ module.exports = (db, DataTypes) => { ...@@ -55,6 +55,7 @@ module.exports = (db, DataTypes) => {
invoiceApplyStatus :DataTypes.STRING(10),// 发票状态:00: 未申请, 10: 已申请,20:已开票 invoiceApplyStatus :DataTypes.STRING(10),// 发票状态:00: 未申请, 10: 已申请,20:已开票
channelUserId :DataTypes.STRING(64), // 渠道用户ID channelUserId :DataTypes.STRING(64), // 渠道用户ID
needNo :DataTypes.STRING(64), // 需求单号 needNo :DataTypes.STRING(64), // 需求单号
needNoOrderNo :DataTypes.STRING(64), // 需求订单号
sourceType: DataTypes.STRING(10),//来源类型:00订单,10需求需要用户确认方案 sourceType: DataTypes.STRING(10),//来源类型:00订单,10需求需要用户确认方案
picUrl :DataTypes.STRING(500),// 产品图片地址 picUrl :DataTypes.STRING(500),// 产品图片地址
productType_id :DataTypes.INTEGER, //产品类型Id productType_id :DataTypes.INTEGER, //产品类型Id
......
...@@ -50,6 +50,7 @@ module.exports = (db, DataTypes) => { ...@@ -50,6 +50,7 @@ module.exports = (db, DataTypes) => {
channelServiceNo: DataTypes.STRING(64),//渠道服务单号 channelServiceNo: DataTypes.STRING(64),//渠道服务单号
channelOrderNo: DataTypes.STRING(1024),//渠道订单号列表,多个以,隔开 channelOrderNo: DataTypes.STRING(1024),//渠道订单号列表,多个以,隔开
needNo: DataTypes.STRING(64),//需求单号 needNo: DataTypes.STRING(64),//需求单号
needNoOrderNo :DataTypes.STRING(64), // 需求订单号
sourceType: DataTypes.STRING(10),//来源类型:00订单,10需求需要用户确认方案 sourceType: DataTypes.STRING(10),//来源类型:00订单,10需求需要用户确认方案
picUrl: DataTypes.STRING(500), //商标图样 picUrl: DataTypes.STRING(500), //商标图样
colorizedPicUrl: DataTypes.STRING(500),//商标彩色图样 colorizedPicUrl: DataTypes.STRING(500),//商标彩色图样
......
...@@ -212,6 +212,7 @@ class OrderInfoService extends ServiceBase { ...@@ -212,6 +212,7 @@ class OrderInfoService extends ServiceBase {
} }
var requestid=self.getUUID(); var requestid=self.getUUID();
if(productItem && productItem.deliveryUrl){ if(productItem && productItem.deliveryUrl){
obj["orderNo"]=order.orderNo;
self.pushData(requestid,obj,productItem.deliveryUrl,req); self.pushData(requestid,obj,productItem.deliveryUrl,req);
} }
return system.getResultSuccess({ return system.getResultSuccess({
......
...@@ -6,6 +6,7 @@ class CustomerContactsService extends ServiceBase { ...@@ -6,6 +6,7 @@ class CustomerContactsService extends ServiceBase {
constructor() { constructor() {
super("dborder", ServiceBase.getDaoName(CustomerContactsService)); super("dborder", ServiceBase.getDaoName(CustomerContactsService));
this.ordertmproductSve = system.getObject("service.dborder.ordertmproductSve"); this.ordertmproductSve = system.getObject("service.dborder.ordertmproductSve");
this.orderflowDao = system.getObject("db.dborder.orderflowDao");
} }
/** /**
* 修改商标交付单联系人(订单详情页面) * 修改商标交付单联系人(订单详情页面)
...@@ -16,16 +17,20 @@ class CustomerContactsService extends ServiceBase { ...@@ -16,16 +17,20 @@ class CustomerContactsService extends ServiceBase {
*/ */
async updateContacts(obj){ async updateContacts(obj){
var user = obj.user; var user = obj.user;
var app = obj.app;
if(!user || !user.id){ if(!user || !user.id){
return system.getResultFail(-100, "未知用户"); return system.getResultFail(-100, "未知用户");
} }
if (!app || !app.id) {
return system.getResultFail(-100, "未知渠道");
}
var deliveryOrderNo = obj.deliveryOrderNo; var deliveryOrderNo = obj.deliveryOrderNo;
if(!deliveryOrderNo){ if(!deliveryOrderNo){
return system.getResultFail(-101, "deliveryOrderNo参数错误"); return system.getResultFail(-101, "deliveryOrderNo参数错误");
} }
// 1.获取交付单信息 // 1.获取交付单信息
var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({ var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({
where:{deliveryOrderNo:deliveryOrderNo}, where:{deliveryOrderNo:deliveryOrderNo,app_id:app.id},
raw:true raw:true
}); });
if(!ordertmproduct || !ordertmproduct.id){ if(!ordertmproduct || !ordertmproduct.id){
...@@ -55,7 +60,9 @@ class CustomerContactsService extends ServiceBase { ...@@ -55,7 +60,9 @@ class CustomerContactsService extends ServiceBase {
contactsObj["tel"]=obj.tel; contactsObj["tel"]=obj.tel;
} }
//修改联系人信息 //修改联系人信息
await self.dao.model.update(contactsObj, { where: { deliveryOrderNo:deliveryOrderNo }, transaction: t }); await self.dao.model.update(contactsObj, { where: { deliveryOrderNo:deliveryOrderNo,app_id: app.id }, transaction: t });
var logMsg = { sourceOrderNo: deliveryOrderNo, opContent: "修改订单信息", app_id: app.id, isShow: 1 };
await self.orderflowDao.create(logMsg, t);
return system.getResultSuccess(); return system.getResultSuccess();
}) })
} }
......
...@@ -7,6 +7,7 @@ class CustomerInfoService extends ServiceBase { ...@@ -7,6 +7,7 @@ class CustomerInfoService extends ServiceBase {
super("dborder", ServiceBase.getDaoName(CustomerInfoService)); super("dborder", ServiceBase.getDaoName(CustomerInfoService));
this.ordertmproductSve = system.getObject("service.dborder.ordertmproductSve"); this.ordertmproductSve = system.getObject("service.dborder.ordertmproductSve");
this.trademarkDao = system.getObject("db.dbtrademark.trademarkDao"); this.trademarkDao = system.getObject("db.dbtrademark.trademarkDao");
this.orderflowDao = system.getObject("db.dborder.orderflowDao");
} }
/** /**
* 修改申请人信息(订单详情页面使用) * 修改申请人信息(订单详情页面使用)
...@@ -25,16 +26,20 @@ class CustomerInfoService extends ServiceBase { ...@@ -25,16 +26,20 @@ class CustomerInfoService extends ServiceBase {
*/ */
async updateCustomerInfo(obj){ async updateCustomerInfo(obj){
var user = obj.user; var user = obj.user;
var app = obj.app;
if(!user || !user.id){ if(!user || !user.id){
return system.getResultFail(-100, "未知用户"); return system.getResultFail(-100, "未知用户");
} }
if (!app || !app.id) {
return system.getResultFail(-100, "未知渠道");
}
var deliveryOrderNo = obj.deliveryOrderNo; var deliveryOrderNo = obj.deliveryOrderNo;
if(!deliveryOrderNo){ if(!deliveryOrderNo){
return system.getResultFail(-101, "deliveryOrderNo参数错误"); return system.getResultFail(-101, "deliveryOrderNo参数错误");
} }
// 1.获取交付单信息 // 1.获取交付单信息
var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({ var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({
where:{deliveryOrderNo:deliveryOrderNo}, where:{deliveryOrderNo:deliveryOrderNo,app_id:app.id},
raw:true raw:true
}); });
if(!ordertmproduct || !ordertmproduct.id){ if(!ordertmproduct || !ordertmproduct.id){
...@@ -50,7 +55,7 @@ class CustomerInfoService extends ServiceBase { ...@@ -50,7 +55,7 @@ class CustomerInfoService extends ServiceBase {
} }
var customerinfo = await this.dao.model.findOne({ var customerinfo = await this.dao.model.findOne({
where:{ where:{
deliveryOrderNo:deliveryOrderNo deliveryOrderNo:deliveryOrderNo,app_id:app.id
}, },
raw:true raw:true
}); });
...@@ -102,8 +107,10 @@ class CustomerInfoService extends ServiceBase { ...@@ -102,8 +107,10 @@ class CustomerInfoService extends ServiceBase {
if(ordertmproduct.deliveryStatus=="dsccl"){ if(ordertmproduct.deliveryStatus=="dsccl"){
await self.ordertmproductSve.update({id:ordertmproduct.id,deliveryStatus:"dsh"},t); await self.ordertmproductSve.update({id:ordertmproduct.id,deliveryStatus:"dsh"},t);
} }
await self.trademarkDao.model.update({officialType:"dsh"},{where:{deliveryOrderNo:deliveryOrderNo},transaction:t}); await self.trademarkDao.model.update({officialType:"dsh"},{where:{deliveryOrderNo:deliveryOrderNo,app_id:app.id},transaction:t});
} }
var logMsg = { sourceOrderNo: deliveryOrderNo, opContent: "修改订单信息", app_id: app.id , isShow: 1};
await self.orderflowDao.create(logMsg, t);
return system.getResultSuccess(); return system.getResultSuccess();
}) })
} }
...@@ -121,16 +128,20 @@ class CustomerInfoService extends ServiceBase { ...@@ -121,16 +128,20 @@ class CustomerInfoService extends ServiceBase {
*/ */
async updateOfficial(obj){ async updateOfficial(obj){
var user = obj.user; var user = obj.user;
var app = obj.app;
if(!user || !user.id){ if(!user || !user.id){
return system.getResultFail(-100, "未知用户"); return system.getResultFail(-100, "未知用户");
} }
if (!app || !app.id) {
return system.getResultFail(-100, "未知渠道");
}
var deliveryOrderNo = obj.deliveryOrderNo; var deliveryOrderNo = obj.deliveryOrderNo;
if(!deliveryOrderNo){ if(!deliveryOrderNo){
return system.getResultFail(-101, "deliveryOrderNo参数错误"); return system.getResultFail(-101, "deliveryOrderNo参数错误");
} }
// 1.获取交付单信息 // 1.获取交付单信息
var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({ var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({
where:{deliveryOrderNo:deliveryOrderNo}, where:{deliveryOrderNo:deliveryOrderNo,app_id:app.id},
raw:true raw:true
}); });
if(!ordertmproduct || !ordertmproduct.id){ if(!ordertmproduct || !ordertmproduct.id){
...@@ -146,7 +157,7 @@ class CustomerInfoService extends ServiceBase { ...@@ -146,7 +157,7 @@ class CustomerInfoService extends ServiceBase {
} }
var customerinfo = await this.dao.model.findOne({ var customerinfo = await this.dao.model.findOne({
where:{ where:{
deliveryOrderNo:deliveryOrderNo deliveryOrderNo:deliveryOrderNo,app_id:app.id
}, },
raw:true raw:true
}); });
...@@ -196,6 +207,8 @@ class CustomerInfoService extends ServiceBase { ...@@ -196,6 +207,8 @@ class CustomerInfoService extends ServiceBase {
} }
await self.ordertmproductSve.update(otpObj,t);//商标交付单 修改盖章委托书、说明文件 await self.ordertmproductSve.update(otpObj,t);//商标交付单 修改盖章委托书、说明文件
var logMsg = { sourceOrderNo: deliveryOrderNo, opContent: "修改订单信息", app_id: app.id, isShow: 1 };
await self.orderflowDao.create(logMsg, t);
return system.getResultSuccess(); return system.getResultSuccess();
}) })
} }
......
...@@ -51,16 +51,20 @@ class TradeMarkService extends ServiceBase { ...@@ -51,16 +51,20 @@ class TradeMarkService extends ServiceBase {
*/ */
async updateTmInfo(obj) { async updateTmInfo(obj) {
var user = obj.user; var user = obj.user;
var app = obj.app;
if (!user || !user.id) { if (!user || !user.id) {
return system.getResultFail(-100, "未知用户"); return system.getResultFail(-100, "未知用户");
} }
if (!app || !app.id) {
return system.getResultFail(-100, "未知渠道");
}
var deliveryOrderNo = obj.deliveryOrderNo; var deliveryOrderNo = obj.deliveryOrderNo;
if (!deliveryOrderNo) { if (!deliveryOrderNo) {
return system.getResultFail(-101, "deliveryOrderNo参数错误"); return system.getResultFail(-101, "deliveryOrderNo参数错误");
} }
// 1.获取交付单信息 // 1.获取交付单信息
var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({ var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({
where: { deliveryOrderNo: deliveryOrderNo }, where: { deliveryOrderNo: deliveryOrderNo,app_id:app.id },
raw: true raw: true
}); });
if (!ordertmproduct || !ordertmproduct.id) { if (!ordertmproduct || !ordertmproduct.id) {
...@@ -98,6 +102,8 @@ class TradeMarkService extends ServiceBase { ...@@ -98,6 +102,8 @@ class TradeMarkService extends ServiceBase {
otpObj["notes"] = obj.notes; otpObj["notes"] = obj.notes;
} }
await self.ordertmproductSve.dao.update(otpObj, t);//商标交付单 修改商标图样 await self.ordertmproductSve.dao.update(otpObj, t);//商标交付单 修改商标图样
var logMsg = { sourceOrderNo: deliveryOrderNo, opContent: "修改订单信息", app_id: app.id, isShow: 1 };
await self.orderflowDao.create(logMsg, t);
return system.getResultSuccess(); return system.getResultSuccess();
}) })
} }
...@@ -113,17 +119,21 @@ class TradeMarkService extends ServiceBase { ...@@ -113,17 +119,21 @@ class TradeMarkService extends ServiceBase {
*/ */
async updateNclInfo(obj) { async updateNclInfo(obj) {
var user = obj.user; var user = obj.user;
var app = obj.app;
var self = this; var self = this;
if (!user || !user.id) { if (!user || !user.id) {
return system.getResultFail(-100, "未知用户"); return system.getResultFail(-100, "未知用户");
} }
if (!app || !app.id) {
return system.getResultFail(-100, "未知渠道");
}
var deliveryOrderNo = obj.deliveryOrderNo; var deliveryOrderNo = obj.deliveryOrderNo;
if (!deliveryOrderNo) { if (!deliveryOrderNo) {
return system.getResultFail(-101, "deliveryOrderNo参数错误"); return system.getResultFail(-101, "deliveryOrderNo参数错误");
} }
// 1.获取交付单信息 // 1.获取交付单信息
var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({ var ordertmproduct = await this.ordertmproductSve.dao.model.findOne({
where: { deliveryOrderNo: deliveryOrderNo }, where: { deliveryOrderNo: deliveryOrderNo,app_id:app.id },
raw: true raw: true
}); });
if (!ordertmproduct || !ordertmproduct.id) { if (!ordertmproduct || !ordertmproduct.id) {
...@@ -192,6 +202,8 @@ class TradeMarkService extends ServiceBase { ...@@ -192,6 +202,8 @@ class TradeMarkService extends ServiceBase {
updateuser: user.nickname updateuser: user.nickname
}; };
await self.ordertmproductSve.dao.update(otpObj, t);//商标交付单 修改大类列表 await self.ordertmproductSve.dao.update(otpObj, t);//商标交付单 修改大类列表
var logMsg = { sourceOrderNo: deliveryOrderNo, opContent: "修改订单信息", app_id: app.id, isShow: 1 };
await self.orderflowDao.create(logMsg, t);
return system.getResultSuccess(); return system.getResultSuccess();
}) })
} }
......
...@@ -96,6 +96,9 @@ class ToolService { ...@@ -96,6 +96,9 @@ class ToolService {
}; };
//加密信息 //加密信息
async encryptStr(app, opStr) { async encryptStr(app, opStr) {
if (!opStr) {
return system.getResult(null, "opStr is empty");
}
let keyHex = cryptoJS.enc.Utf8.parse(app.uappKey); let keyHex = cryptoJS.enc.Utf8.parse(app.uappKey);
let ivHex = cryptoJS.enc.Utf8.parse(app.appSecret.substring(0, 8)); let ivHex = cryptoJS.enc.Utf8.parse(app.appSecret.substring(0, 8));
var cipherStr = cryptoJS.TripleDES.encrypt(opStr, keyHex, { iv: ivHex }).toString(); var cipherStr = cryptoJS.TripleDES.encrypt(opStr, keyHex, { iv: ivHex }).toString();
...@@ -103,6 +106,9 @@ class ToolService { ...@@ -103,6 +106,9 @@ class ToolService {
} }
//解密信息 //解密信息
async decryptStr(app, opStr) { async decryptStr(app, opStr) {
if (!opStr) {
return system.getResult(null, "opStr is empty");
}
let keyHex = cryptoJS.enc.Utf8.parse(app.uappKey); let keyHex = cryptoJS.enc.Utf8.parse(app.uappKey);
let ivHex = cryptoJS.enc.Utf8.parse(app.appSecret.substring(0, 8)); let ivHex = cryptoJS.enc.Utf8.parse(app.appSecret.substring(0, 8));
var bytes = cryptoJS.TripleDES.decrypt(opStr, keyHex, { var bytes = cryptoJS.TripleDES.decrypt(opStr, keyHex, {
......
...@@ -141,11 +141,11 @@ class System { ...@@ -141,11 +141,11 @@ class System {
var bucketlist = notice_count.buckets; var bucketlist = notice_count.buckets;
var bucklist = []; var bucklist = [];
bucketlist.forEach(function (d) { bucketlist.forEach(function (d) {
var notice_issue=d.key; var notice_issue = d.key;
var date=d.date_max.value; var date = d.date_max.value;
var data={ var data = {
notice_issue:notice_issue, notice_issue: notice_issue,
date:date date: date
} }
bucklist.push(data); bucklist.push(data);
}) })
...@@ -200,7 +200,7 @@ class System { ...@@ -200,7 +200,7 @@ class System {
var objabspath = classpath + "/" + filename + ".js"; var objabspath = classpath + "/" + filename + ".js";
if (System.objTable[objabspath] != null) { if (System.objTable[objabspath] != null) {
console.log(objabspath,"get cached obj...."); console.log(objabspath, "get cached obj....");
return System.objTable[objabspath]; return System.objTable[objabspath];
} else { } else {
console.log("no cached..."); console.log("no cached...");
...@@ -309,4 +309,7 @@ System.signFail = 1300; ...@@ -309,4 +309,7 @@ System.signFail = 1300;
//获取访问token失败 //获取访问token失败
System.getAppInfoFail = 1130; System.getAppInfoFail = 1130;
//已经存在信息
System.existData = 1400;
module.exports = System; module.exports = System;
\ No newline at end of file
...@@ -2,8 +2,8 @@ const Client = require('aliyun-api-gateway').Client; ...@@ -2,8 +2,8 @@ const Client = require('aliyun-api-gateway').Client;
var RPCClient = require('@alicloud/pop-core').RPCClient; var RPCClient = require('@alicloud/pop-core').RPCClient;
// const client = new Client('203756805', 'crkyej0xlmqa6bmvqijun6ltxparllyn'); // const client = new Client('203756805', 'crkyej0xlmqa6bmvqijun6ltxparllyn');//开发
const client = new Client('203763771', 'e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu'); const client = new Client('203763771', 'e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu');//线上
class aliyunClient { class aliyunClient {
constructor() { constructor() {
// this.aliReqUrl = "https://aliapi.gongsibao.com/tm/springboard"; // this.aliReqUrl = "https://aliapi.gongsibao.com/tm/springboard";
......
...@@ -7,30 +7,57 @@ bluebird.promisifyAll(redis); ...@@ -7,30 +7,57 @@ bluebird.promisifyAll(redis);
class RedisClient { class RedisClient {
constructor() { constructor() {
const redisConfig = settings.redis(); const redisConfig = settings.redis();
this.client = redis.createClient({ this.client = null;
host: redisConfig.host, if (!redisConfig.password) {
port: redisConfig.port, this.client = redis.createClient({
password: redisConfig.password, host: redisConfig.host,
db: redisConfig.db, port: redisConfig.port,
retry_strategy: function (options) { db: redisConfig.db,
// if (options.error && options.error.code === 'ECONNREFUSED') { retry_strategy: function (options) {
// // End reconnecting on a specific error and flush all commands with // if (options.error && options.error.code === 'ECONNREFUSED') {
// // a individual error // // End reconnecting on a specific error and flush all commands with
// return new Error('The server refused the connection'); // // a individual error
// } // return new Error('The server refused the connection');
if (options.total_retry_time > 1000 * 60 * 60) { // }
// End reconnecting after a specific timeout and flush all commands if (options.total_retry_time > 1000 * 60 * 60) {
// with a individual error // End reconnecting after a specific timeout and flush all commands
return new Error('Retry time exhausted'); // with a individual error
return new Error('Retry time exhausted');
}
if (options.attempt > 10) {
// End reconnecting with built in error
return 10000;
}
// reconnect after
return Math.min(options.attempt * 100, 3000);
} }
if (options.attempt > 10) { });
// End reconnecting with built in error } else {
return 10000; this.client = redis.createClient({
host: redisConfig.host,
port: redisConfig.port,
password: redisConfig.password,
db: redisConfig.db,
retry_strategy: function (options) {
// if (options.error && options.error.code === 'ECONNREFUSED') {
// // End reconnecting on a specific error and flush all commands with
// // a individual error
// return new Error('The server refused the connection');
// }
if (options.total_retry_time > 1000 * 60 * 60) {
// End reconnecting after a specific timeout and flush all commands
// with a individual error
return new Error('Retry time exhausted');
}
if (options.attempt > 10) {
// End reconnecting with built in error
return 10000;
}
// reconnect after
return Math.min(options.attempt * 100, 3000);
} }
// reconnect after });
return Math.min(options.attempt * 100, 3000); }
}
});
// return client.multi().get('foo').execAsync().then(function(res) { // return client.multi().get('foo').execAsync().then(function(res) {
// console.log(res); // => 'bar' // console.log(res); // => 'bar'
......
...@@ -60,56 +60,56 @@ module.exports = function (app) { ...@@ -60,56 +60,56 @@ module.exports = function (app) {
res.end(JSON.stringify(r)); res.end(JSON.stringify(r));
}); });
}); });
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"]) {
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));
}); // });
}); // });
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;
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.query); // params.push(req.query);
params.push(req.body); // params.push(req.body);
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"]) {
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));
}); // });
}); // });
}; };
...@@ -51,19 +51,11 @@ var settings = { ...@@ -51,19 +51,11 @@ var settings = {
}, },
pushFqbossDataUrl: function () { pushFqbossDataUrl: function () {
if (this.env == "dev") { if (this.env == "dev") {
return "http://192.168.18.78:3000/";//localsettings.reqEsDevUrl; return "http://192.168.18.141:3000/";//localsettings.reqEsDevUrl;
} else { } else {
return "https://fqgirl.gongsibao.com/"; return "https://fqgirl.gongsibao.com/";
} }
}, },
reqEsAddrIc: function () {
if (this.env == "dev") {
var localsettings = require("./localsettings");
return "http://43.247.184.94:9200/";//localsettings.reqEsDevUrl;
} else {
return "http://43.247.184.94:9200/";
}
},
apiconfig: { apiconfig: {
opLogUrl: function () { opLogUrl: function () {
return settings.reqEsAddr() + "bigdata_zc_op_log/_doc?pretty"; return settings.reqEsAddr() + "bigdata_zc_op_log/_doc?pretty";
...@@ -71,182 +63,6 @@ var settings = { ...@@ -71,182 +63,6 @@ var settings = {
opLogEsIsAdd: function () { opLogEsIsAdd: function () {
return 1; return 1;
}, },
zxyTransferAppId: function () {//智薪云应用id
// return "1103817785";//线上
// return "1108171693022142467";//bpo-ceshi
return "1129284115540267010";
},
zxyTransferMchtId: function () {//智薪云商户id
// return "1103817785420820481";//线上
// return "2";//bpo-ceshi
return "1127840460046393345";
},
zxyMainId: function () {//智薪云用户签约mainId ==签约主体id
// return "57731585";//线上
// return "3";//bpo-ceshi
return "57731587";
},
zxyAppSecretKey: function () {//智薪云appSecretKey
// return "ca47edd3ae8bac3f7a68d8126d891f52";//线上
// return "ef1cd7146c1234d47f6bb4e49edfe";//bpo-ceshi
return "ea4eafab8be1d0242399f39649bfabe0";
},
zxyUserSignUrl: function () {//智薪云用户签约接口地址
return "https://payadmin.gongsibao.com";//线上
// return "http://39.106.185.66:80";
},
zxyTransferUrl: function () {//智薪云转账接口地址
return "https://pay.gongsibao.com";//线上
// return "http://39.106.185.66:80";
},
imageQueryKey: "4S3ypgaRq19bhKwB",
byslTmUrl: function () {
return settings.reqEsAddr() + "bigdata_business_gsb_no_accepted_business/_search";
},
byslDetailUrl: function () {
return settings.reqEsAddr() + "bigdata_business_gsb_no_accepted_business/_search";
},
tmSearchUrl: function () {
return settings.reqEsAddr() + "bigdata_middle_gsb_tm_info/_search";
},
tmFlowUrl: function () {
return settings.reqEsAddr() + "bigdata_middle_gsb_tm_flow/_search";
},
tmNclUrl: function () {
return settings.reqEsAddr() + "bigdata_bdc_ncl_info/_search";
},
opTmTransactionUrl: function () {//商标交易添加
return settings.reqEsAddr() + "bigdata_trademark_transaction/_doc?pretty";
},
tmTransactionUrl: function () {//商标交易检索
return settings.reqEsAddr() + "bigdata_trademark_transaction/_search";
},
tmTransactionUpdateUrl: function () {//商标交易检索更新
return settings.reqEsAddr() + "bigdata_trademark_transaction/_doc/_update_by_query";
},
agencycompanySearchUrl: function () {//代理机构名称查询
return settings.reqEsAddr() + "bigdata_agency_company/_search";
},
yyDetailSearchUrl: function () {//商标异议详情查询
return settings.reqEsAddr() + "bigdata_business_gsb_dissent_business/_search";
},
bgDetailSearchUrl: function () {//商标变更详情查询
return settings.reqEsAddr() + "bigdata_business_gsb_tm_change_business/_search";
},
nclUrl: function () {
return settings.reqEsAddr() + "bigdata_bdc_gsb_tm_ncl/_search";
},
imageQueryUrl: function () {//商标图像检索
if (settings.env == "dev") {
return "http://43.247.184.92:8004/gsb/api/v1";
} else {
return "http://43.247.184.92:8004/gsb/api/v1";
}
},
tmncloneQueryUrl: function () {//计算通过率
if (settings.env == "dev") {
return "http://192.168.18.44:7000/tmnclone?appKey=343aff200d18be6637d&nclonecode={nclonecode}&tmName={tmName}";
} else {
return "http://43.247.184.92:8007/tmnclone?appKey=343aff200d18be6637d&nclonecode={nclonecode}&tmName={tmName}";
}
},
ichemingUrl: function () {//工商核名接口
if (settings.env == "dev") {
return "http://43.247.184.92:8100/heming/";
} else {
return "http://43.247.184.92:8100/heming/";
}
},
// imageQueryKey:"4S3ypgaRq19bhKwB",
MgphoneSearchUrl: function () {
return settings.reqMgAddr() + "phones"
},
xzAllCompanySearchUrl: function () {
return settings.reqEsAddr() + "bigdata_business_gsb_tm_company_op/_search";
},
//作品版权
icworksCopyrightSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_works_copyright_op/_search";
},
//专利查询
paSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_patent_op/_search";
},
icmemberSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_ic_gsb_member_op/_search";
},
icshareholderSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_ic_gsb_shareholder_op/_search";
},
icinvestSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_ic_gsb_invest_op/_search";
},
icchangeSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_ic_gsb_change_op/_search";
},
iccompanynameSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_ic_gsb_company_op/_search";
},
agencynameSearchUrl: function () {
return settings.reqEsAddr() + "bigdata_agency_company/_search";
},
iccompanycodeSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_ic_gsb_company_op/_search";
},
iccompanyNumSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_ic_gsb_company_op/_search";
},
icbranchSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_ic_gsb_branch_op/_search";
},
magicSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_magic_ic_op/_search";
},
xzCompanySearchUrl: function () {
return settings.reqEsAddr() + "bigdata_business_gsb_tm_company/_search";
},
xzDetailSearchUrl: function () {
return settings.reqEsAddr() + "bigdata_business_gsb_renewals_business/_search";
},
qcurl: "http://59.110.124.51:8250/qc?detailLink={address}",
bzLicenseForTMUrl: "http://bigdata.gongsibao.com/api/imghandle/bzLicenseForTmByUrl",
bzLicenseForTMUrl_back: "http://bigdata.gongsibao.com/api/imghandle/bzLicenseForTM",
wtsUrl: "http://bigdata.gongsibao.com/api/imghandle/deleForTM",
adjustTMSizeUrl: "http://bigdata.gongsibao.com/api/imghandle/adjustTMSize",
onLineMakeTMUrl: "http://bigdata.gongsibao.com/api/imghandle/onLineMakeTM",
toblackUrl: "https://bigdata.gongsibao.com/api/imghandle/toblack",
uploadStandardTmUrl: "https://bigdata.gongsibao.com/api/imghandle/uploadStandardTm",
makeDeleForTMUrl: "http://boss.gongsibao.com/api/imghandle/deleForTmByUrl",
makeDeleForTMUrl_back: "http://boss.gongsibao.com/api/imghandle/makeDeleForTM",
LbsAddressUrl: "http://43.247.184.92:8880/lbs/api/addresssearch",//地址查询
LbsLalUrl: "http://43.247.184.92:8889/lbs/api/lalsearch",//坐标查询
LbsCityUrl: "http://43.247.184.92:8886/lbs/api/cityseicsoftwareCopyrightSearchUrlarch",//城市查询
pdf2wordUrl: function () {
if (settings.env == "dev") {
return "http://59.110.125.77:3000/api/pdf2word/pdf2word";
} else {
return "http://59.110.125.77:3000/api/pdf2word/pdf2word";
}
},
tmZntjQueryUrl: function () {//商标智能推荐
if (settings.env == "dev") {
return "http://192.168.18.123:8005/companybusiness?appKey=343aff200d18be6637d&name={companyName}";
} else {
return "http://43.247.184.92:8005/companybusiness?appKey=343aff200d18be6637d&name={companyName}";
}
},
tmtjdlQueryUrl: function () {//根据经营范围推荐
if (settings.env == "dev") {
return "http://192.168.18.181:7000/companynclone?appKey=343aff200d18be6637d&name={companyName}&tmName={tmName}";
} else {
return "http://43.247.184.92:8006/companynclone?appKey=343aff200d18be6637d&name={companyName}&tmName={tmName}";
}
},
}, },
homePage: function () { homePage: function () {
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
"express": "^4.16.2", "express": "^4.16.2",
"express-session": "^1.15.6", "express-session": "^1.15.6",
"gm": "^1.23.1", "gm": "^1.23.1",
"jdcloud-sdk-signer": "^2.0.0",
"marked": "^0.7.0", "marked": "^0.7.0",
"method-override": "^2.3.10", "method-override": "^2.3.10",
"mongoose": "^5.7.1", "mongoose": "^5.7.1",
......
示例:----------------------------------开始--------------------------------------------------------------------
示例:----------------------------------开始--------------------------------------------------------------------
ALTER TABLE p_channel ADD COLUMN totalChannelProfit DECIMAL(12,2) DEFAULT 0 COMMENT '渠道总利润';
ALTER TABLE h_page_statistics ADD COLUMN isRead int default 0 COMMENT '是否阅读,0未,1是';
ALTER TABLE b_customer_roll_pic ADD COLUMN picCategory ENUM('ip','ic','pa','icbc','common') DEFAULT 'ip';
ALTER TABLE p_customer_info DROP COLUMN customerContact;
ALTER TABLE biz_receiptvoucher modify COLUMN receiptType ENUM('sk','tk','zz','csrz','ptdsk','ptzz') DEFAULT 'sk';
示例:----------------------------------结束--------------------------------------------------------------------
ALTER TABLE c_app_product ADD COLUMN pushServiceItemCode VARCHAR(100) DEFAULT NULL COMMENT '推送到服务商的产品编码';
ALTER TABLE b_order ADD COLUMN needNoOrderNo VARCHAR(64) DEFAULT NULL COMMENT '需求订单号';
ALTER TABLE b_order_tm_product ADD COLUMN needNoOrderNo VARCHAR(64) DEFAULT NULL COMMENT '需求订单号';
ALTER TABLE b_order_tm_product modify COLUMN deliveryStatus ENUM('dqrfa','fabtg','dfwsfw','dsccl','dsh','ddj','ydj','ywc') DEFAULT 'dfwsfw';
\ 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