Commit 59339dd2 by 王栋源

wdy

parents 571eea34 0ce71e28
......@@ -60,7 +60,8 @@ class APIBase {
var fullname = gname + "." + methodname;
var lst = [
"test.test",
"auth.getToken"
"auth.getToken",
"auth.getJdSign"
];
var x = lst.indexOf(fullname);
return x >= 0;
......
......@@ -48,6 +48,15 @@ class ReceiveDataAPI extends APIBase {
// action_body.user = req.user;
// action_body.app = { id: 1, appPayType: "00", appDataOpType: "00" };
// action_body.user = { id: 1, app_id: 1, nickname: "测试用户",channelUserId:"channelUserIdtest01" };
var logParam = {
appid: req.app.id,
appkey: req.app.uappKey,
requestId: req.requestId || "",
op: "/igirl-channel/zhichan/igirl-channel/app/base/api/impl/action/receiveData.js/opActionProcess",
content: "参数信息:" + JSON.stringify(action_body),
clientIp: pobj.clientIp,
optitle: "接收推送过来的数据处理=>action_type=" + action_type,
};
var opResult = null;
switch (action_type) {
// sy
......@@ -71,6 +80,8 @@ class ReceiveDataAPI extends APIBase {
opResult = system.getResult(null, "action_type参数错误");
break;
}
logParam.resultInfo = JSON.stringify(opResult);
this.logCtl.info(logParam);
return opResult;
}
......
......@@ -14,6 +14,7 @@ class TmOrderAPI extends APIBase {
this.pushFqbossDataUrl = settings.pushFqbossDataUrl();
this.pushlogSve = system.getObject("service.common.pushlogSve");
this.toolSve = system.getObject("service.trademark.toolSve");
this.appProductSve = system.getObject("service.dbapp.appproductSve");
}
/**
* 接口跳转-POST请求
......@@ -174,6 +175,15 @@ class TmOrderAPI extends APIBase {
case "pushFqBusiness"://推送商机到峰擎
opResult = await this.orderSve.pushFqBusiness(action_body, pobj, req);
break;
case "getProductDetail"://根据渠道产品码获取产品详情
opResult = await this.appProductSve.findByChannelItemCode(action_body);
break;
case "getProductListByTypeOneCode"://获取产品列表(根据产品一类编码获取)
opResult = await this.appProductSve.findByProductOneTypeCode(action_body);
break;
case "getProductListByTypeCode"://获取产品列表(根据父类产品编码获取)
opResult = await this.appProductSve.findByProductTypeCode(action_body);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -3,9 +3,9 @@ var system = require("../../../system");
class TmQueryAPI extends APIBase {
constructor() {
super();
this.tmqueryApi = system.getObject("api.trademark.tmqueryApi");
// this.tmqueryApi = system.getObject("api.trademark.tmqueryApi");
this.tmquerySve = system.getObject("service.trademark.tmquerySve");
this.toolApi = system.getObject("api.tool.toolApi");
// this.toolApi = system.getObject("api.tool.toolApi");
this.toolSve = system.getObject("service.trademark.toolSve");
}
/**
......@@ -99,6 +99,9 @@ class TmQueryAPI extends APIBase {
// opResult = await this.toolApi.bycznfx(action_body);
opResult = system.getResultSuccess(null, "商标方案确认成功");
break;
case "icheming"://商标智能分析 -----
opResult = await this.toolSve.icheming(action_body, req);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
var APIBase = require("../../api.base");
var system = require("../../../system");
const { Signer, Context } = require('jdcloud-sdk-signer')
class jdAuthAPI extends APIBase {
constructor() {
super();
}
async getUser(pobj, qobj, req) {
console.log(pobj, "pobj...................................jd............");
console.log(qobj, "qobj...................................jd............");
return {tm:"ok"};
console.log("pobj......getUser..........:\n", pobj);
console.log("qobj......getUser..........:\n", qobj);
return { getUser: "ok" };
}
async payOrderInfo(pobj, qobj, req) {
console.log("pobj......payOrderInfo..........:\n", pobj);
console.log("qobj......payOrderInfo..........:\n", qobj);
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..............................>>>>>>");
}
}
}
......
......@@ -4,6 +4,33 @@ class AppProductDao extends Dao {
constructor() {
super(Dao.getModelName(AppProductDao));
}
async findOneByServiceItemCode(itemCode, appId) {
return this.model.findOne({
where: {
serviceItemCode: itemCode,
app_id: appId
},
attributes: ["id",
"app_id", // 应用id
"itemCode", // 产品编码
"itemName", // 产品名称
"picUrl", // 产品图片地址
"channelItemCode", // 渠道产品编码
"channelItemName", // 渠道产品名称
"status", // 状态 0禁用 1启用
"verifyPrice", // 是否验证价格 0不验证 1验证
"proPrice", // 产品价格
"serviceCharge", // 服务费
"publicExpense", // 官费
"rateConfig", // 税率
"discountsRateConfig",// 优惠税率
"channelProfitRate",// 渠道利润分成比率(只分订单中毛利润总额的分成)
"sort",
"productType_id",
"productOneType_id"],
raw: true
});
}
async findOneByCode(itemCode, appId) {
return this.model.findOne({
where: {
......
......@@ -114,38 +114,6 @@ class OrderDao extends Dao {
"appPayType",
"payTime",
"itemCode",
"itemName"
],
raw: true
});
}
async getItemByChannelServiceNo(channelServiceNo, appId) {//通过订单号查询订单
return this.model.findOne({
where: {
channelServiceNo: channelServiceNo,
app_id: appId
},
attributes: ["id",
"orderNo",
"channelUserId",
"channelServiceNo",
"channelOrderNo",
"needNo",
"invoiceApplyStatus",
"orderType",
"salesNum",
"salesDiliverNum",
"minitermNum",
"minitermDiliverNum",
"orderPayStatus",
"notes",
"totalServiceCharge",
"totalPublicExpense",
"totalTaxes",
"totalSum",
"appPayType",
"payTime",
"itemCode",
"itemName",
"buyerMoblie"
],
......
......@@ -10,6 +10,7 @@ class OrderFlowDao extends Dao {
sourceOrderNo: sourceOrderNo,
isShow: 1
},
order:[["created_at", 'desc']],
raw: true
});
}
......
......@@ -34,7 +34,7 @@ module.exports = {
//订单服务付款状态
"order_service_pay_status": { "dfk": "待付款", "yfk": "已付款" },
//商标交付状态
"delivery_status": {"dqrfa":"待确认方案", "dsccl": "待上传材料", "dsh": "待审核", "ddj": "待递交", "ydj": "已递交", "ywc": "已完成" },
"delivery_status": { "dqrfa": "待确认方案", "fabtg": "方案不通过", "dsccl": "待上传材料", "dsh": "待审核", "ddj": "待递交", "ydj": "已递交", "ywc": "已完成" },
//商标类型
"tm_type": { "p": "普通商标", "j": "集体商标", "z": "证明商标", "t": "特殊商标" },
//商标类型形式
......@@ -50,14 +50,14 @@ module.exports = {
"1": "商标注册申请书", "2": "商标注册申请补正通知书", "3": "商标注册申请受理通知书", "4": "商标注册申请不予受理通知书", "5": "商标注册同日申请补送使用证据通知书",
"6": "商标注册同日申请协商通知书商标注册同日申请抽签通知书", "7": "商标驳回通知书", "8": "商标部分驳回通知书", "9": "商标注册申请初步审定公告通知书",
"10": "商标异议答辩通知书", "11": "异议裁定书", "12": "纸质版商标注册证", "13": "电子版商标注册证",
"dsccl": "待上传材料", "dsh": "待审核", "shbtg": "审核不通过", "ddj": "待递交", "ydj": "已递交", "djyc": "递交异常"
"dsccl": "待上传材料", "dqrfa": "待确认方案", "fabtg": "方案不通过", "dsh": "待审核", "shbtg": "审核不通过", "ddj": "待递交", "ydj": "已递交", "djyc": "递交异常"
},
//申请企业类型
"customer_type": { "ent": "企业", "person": "个人" },
//附件类型
"stuff_type": { "csty": "彩色图样", "wts": "委托书", "gzwts": "盖章委托书", "ty": "图样", "sywj": "声音文件", "smwj": "说明文件" },
//来源类型
"source_type": { "order": "订单", "expensevoucher": "费用单", "receiptvoucher": "收款单", "refundvoucher": "退款单", "trademark": "商标单" },
"source_type": { "childorders": "子订单", "expensevoucher": "费用单" },
//审核状态
"audit_status": { "dsh": "待审核", "btg": "不通过", "tg": "通过" },
//收款类型
......@@ -65,10 +65,10 @@ module.exports = {
//退款类型
"refund_type": { "tk": "退款", "ptdtk": "平台代退款" },
//费用类型
"expense_type": { "gf": "官费", "sxf": "手续费", "tax": "税金", "salary": "薪酬", "sale": "销售费用", "mag": "管理费用", "channelSettleProfit": "订单渠道分润结算" },
"expense_type": { "gf": "官费", "tax": "税金", "channelSettleProfit": "订单渠道分润结算" },
//凭单类型
"direction_type": { "sr": "收", "zc": "支" },
"push_return_type":{"0":"推送失败","1":"推送成功"},
"push_return_type": { "0": "推送失败", "1": "推送成功" },
},
}
}
\ No newline at end of file
......@@ -8,7 +8,8 @@ module.exports = (db, DataTypes) => {
itemName :DataTypes.STRING(100),// 产品名称
picUrl :DataTypes.STRING(500),// 产品图片地址
channelItemCode :DataTypes.STRING(100),// 渠道产品编码
channelItemName :DataTypes.STRING(100),// 渠道产品名称
channelItemName :DataTypes.STRING(100),// 渠道产品名称
serviceItemCode :DataTypes.STRING(100),// 服务商产品编码
status :DataTypes.BOOLEAN,// 状态 0禁用 1启用
verifyPrice :DataTypes.BOOLEAN,// 是否验证价格 0不验证 1验证
proPrice :DataTypes.DOUBLE,// 产品价格
......
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("childorders", {
uapp_id :DataTypes.INTEGER,//
sourceOrderNo: DataTypes.STRING(64), // 来源单号
childOrderNo :DataTypes.STRING(64),// 子订单号
appPayType :{
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.app_pay_type),
},// 支付类型:00第三方支付,10平台代收款
totalServiceCharge :DataTypes.DECIMAL(12, 2),// 服务费总额(产品配置的服务费*订单件数)
totalPublicExpense :DataTypes.DECIMAL(12, 2),// 官费总额(产品配置的官费*订单件数)
totalTaxes :DataTypes.DECIMAL(12, 2),// 税费总额(订单总额-(订单总额/(1+产品费率)))
totalSum :DataTypes.DECIMAL(12, 2),// 订单总额(产品价格×优惠费率×订单件数)
refundSum :DataTypes.DECIMAL(12, 2),// 退款金额
totalProfitSum :DataTypes.DECIMAL(12, 2),// 订单毛利润总额(订单总额-官费总额)
totalDiscounts :DataTypes.DECIMAL(12, 2),// 优惠总额((服务费总额+官费总额)-订单总额(产品价格×优惠费率×订单件数)>0则有优惠额度)
pfProfitSum :DataTypes.DECIMAL(12, 2),// 订单平台毛利润总额(订单毛利润总额-订单渠道分成毛利润总额)
channelProfitSum :DataTypes.DECIMAL(12, 2),// 订单渠道分成毛利润总额((订单总额-官费总额)*渠道利润分成比率)
pfSettleProfit :DataTypes.INTEGER,// 平台结算渠道利润,0否,1是
invoiceApplyStatus :DataTypes.STRING(10),// 发票状态:00: 未申请, 10: 已申请,20:已开票
opPayType :DataTypes.STRING(10),// 操作付款类型:00: 收款, 10: 退款
accountType: {
//帐户类型( 支付类型):"cash": "现金", "bank": "银行" ,"wx":"微信","alipay":"支付宝","other":"其它"
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.pay_account_type),
set: function (val) {
this.setDataValue("accountType", val);
this.setDataValue("accountTypeName", uiconfig.config.pdict.pay_account_type[val]);
}
},
accountTypeName: {//帐户类型名称
type: DataTypes.STRING,
},
certifyFileUrl: DataTypes.STRING(500), //支付证明文件Url
wxPayOrderCode: DataTypes.STRING(50),//业务微信支付订单号
aliPayOrderCode: DataTypes.STRING(50),//业务支付宝支付订单号
busPayOrderCode: DataTypes.STRING(50),//业务支付订单号
auditStatusName: {
type: DataTypes.STRING(50),
defaultValue: "待审核",
},
auditStatus: {//审核状态"dsh": "待审核", "btg": "不通过", "tg": "通过"
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.audit_status),
set: function (val) {
this.setDataValue("auditStatus", val);
this.setDataValue("auditStatusName", uiconfig.config.pdict.audit_status[val]);
},
defaultValue: "dsh",
},
notes :DataTypes.STRING,// 备注
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'c_child_orders',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("flowlog", {
uapp_id: DataTypes.INTEGER, //
sourceOrderNo: DataTypes.STRING(64), // 来源单号
opContent: DataTypes.STRING(1024), // 操作描述
notes: DataTypes.STRING, // 备注
isShow: {//是否显示
type: DataTypes.BOOLEAN,
defaultValue: false,
},
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'c_flow_log',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("ordercontacts", {
uapp_id :DataTypes.INTEGER, //
sourceOrderNo :DataTypes.STRING(64),//来源单号
contactName :DataTypes.STRING(1000), // 联系人
mobile :DataTypes.STRING(20), //
email :DataTypes.STRING(50), //
tel :DataTypes.STRING(20), //
fax :DataTypes.STRING(50), //
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'c_order_contacts',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("orderinfo", {
uapp_id :DataTypes.INTEGER,//
orderNo :DataTypes.STRING(64),// 订单号
channelServiceNo :DataTypes.STRING(64),// 渠道服务单号
channelOrderNo :DataTypes.STRING(1024),// 渠道订单号列表,多个以,隔开
channelUserId :DataTypes.STRING(64), // 渠道用户ID
ownerUserId :DataTypes.STRING(20),// 拥有渠道用户ID
needNo :DataTypes.STRING(64), // 需求单号
payTime :DataTypes.DATE,// 渠道有支付时间则用渠道的支付时间
salesNum :DataTypes.INTEGER,// 项目订单数量(即服务项目的倍数,默认值为1)
salesDiliverNum :DataTypes.INTEGER,// 项目订单交付数量(即与项目订单数量相对应)
minitermNum :DataTypes.INTEGER,// 订单小项数量
minitermDiliverNum :DataTypes.INTEGER,// 订单小项交付数量
orderPayStatusName: DataTypes.STRING(50),//
orderPayStatus :{
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.order_pay_status),
set: function (val) {
this.setDataValue("orderPayStatus", val);
this.setDataValue("orderPayStatusName", uiconfig.config.pdict.order_pay_status[val]);
}
},// 订单付款状态dfk: 待付款, zfpz: 已上传支付凭证, yfk: 已付款, ddqx: 订单取消, tkclz: 退款处理中, bfytk: 部分已退款, ytk: 已退款,zfshbtg:支付审核不通过
totalSum :DataTypes.DECIMAL(12, 2),// 订单总额(产品价格×优惠费率×订单件数)
refundSum :DataTypes.DECIMAL(12, 2),// 退款金额
opNotes :DataTypes.STRING,// 备注
notes :DataTypes.STRING,// 备注
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'c_order_info',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("orderproduct", {
uapp_id: DataTypes.INTEGER,//
sourceOrderNo :DataTypes.STRING(64),//来源单号
productType_id :DataTypes.INTEGER,//产品类型Id
productOneType_id :DataTypes.INTEGER,//产品大类Id
itemCode :DataTypes.STRING(64),//产品编码
itemName :DataTypes.STRING(100),//产品名称
channelItemCode :DataTypes.STRING(100),// 渠道产品编码
channelItemName :DataTypes.STRING(100),// 渠道产品名称
serviceItemCode :DataTypes.STRING(100),// 服务商产品编码
picUrl :DataTypes.STRING(500),// 产品图片地址
proPrice :DataTypes.DOUBLE, // 产品价格
serviceItemSnapshot :DataTypes.TEXT, //产品快照
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'c_order_product',
validate: {
},
indexes: [
]
});
}
const system = require("../../system");
const settings = require("../../../config/settings");
const uiconfig = system.getUiConfig2(settings.wxconfig.appId);
module.exports = (db, DataTypes) => {//费用单:
return db.define("expensevoucher", {
uapp_id: DataTypes.INTEGER, //
sourceOrderNo: DataTypes.STRING(64), // 来源单号
childOrderNo: DataTypes.STRING(64),// 子订单号
expenseTypeName: DataTypes.STRING,
expenseType: {//收款类型,gf: 官费, tax: 税金, channelSettleProfit: 订单渠道分润结算
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.expense_type),
set: function (val) {
this.setDataValue("expenseType", val);
this.setDataValue("expenseTypeName", uiconfig.config.pdict.expense_type[val]);
}
},
totalSum: DataTypes.DECIMAL(12, 3),//总额
notes: DataTypes.STRING,//备注
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'biz_expensevoucher',
validate: {
}
});
}
const system = require("../../system");
const settings = require("../../../config/settings");
const uiconfig = system.getUiConfig2(settings.wxconfig.appId);
module.exports = (db, DataTypes) => {
return db.define("moneyjourney", {
uapp_id: DataTypes.INTEGER, //
sourceOrderNo: DataTypes.STRING(64), // 来源单号
childOrderNo: DataTypes.STRING(64),// 子订单号
channelUserId: DataTypes.STRING(64), // 渠道用户ID
ownerUserId: DataTypes.STRING(20),// 拥有渠道用户ID
accountType: {
//帐户类型( 支付类型):"cash": "现金", "bank": "银行" ,"wx":"微信","alipay":"支付宝","other":"其它"
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.pay_account_type),
set: function (val) {
this.setDataValue("accountType", val);
this.setDataValue("accountTypeName", uiconfig.config.pdict.pay_account_type[val]);
}
},
accountTypeName: {//帐户类型名称
type: DataTypes.STRING,
},
directionTypeName: DataTypes.STRING,
directionType: {//凭单类型,"sr": "收","zc": "支"
type: DataTypes.STRING,
},
voucherDate: DataTypes.DATE,//凭单时间
recvAmount: DataTypes.DECIMAL(12, 3),//收总额
payAmount: DataTypes.DECIMAL(12, 3),//支总额
sourceTypeName: DataTypes.STRING,
sourceType: {//来源类型 "childorders": "子订单","expensevoucher": "费用单"
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.source_type),
set: function (val) {
this.setDataValue("sourceType", val);
this.setDataValue("sourceTypeName", uiconfig.config.pdict.source_type[val]);
}
},
notes: DataTypes.STRING,//备注
opNotes: DataTypes.STRING,//操作备注
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'biz_moneyjourney',
validate: {
}
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("orderreceiptvoucher", {//收款单:
uapp_id: DataTypes.INTEGER, //
sourceOrderNo: DataTypes.STRING(64), // 来源单号
childOrderNo :DataTypes.STRING(64),// 子订单号
busPayOrderCode: DataTypes.STRING(100),//业务支付订单号
accountType: {
//帐户类型( 支付类型):"cash": "现金", "bank": "银行" ,"wx":"微信","alipay":"支付宝","other":"其它"
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.pay_account_type),
set: function (val) {
this.setDataValue("accountType", val);
this.setDataValue("accountTypeName", uiconfig.config.pdict.pay_account_type[val]);
}
},
accountTypeName: {//帐户类型名称
type: DataTypes.STRING,
},
payDate: DataTypes.DATE,//支付时间
totalSum: DataTypes.DECIMAL(12, 3),//订单总额(平台费用+服务费+官费+发票税费+个人利润+平台利润)
certifyFileUrl: DataTypes.STRING(500), //证明文件Url
payOrderNo: DataTypes.STRING, //支付凭证流水单号,如:微信支付凭证单号
buyerOpenId: DataTypes.STRING,//用户在支付商户appid下的唯一标识或买家在支付宝的用户id
passTradeNo: DataTypes.STRING,//通道的统一订单号
buyerAliLogonId: DataTypes.STRING,//买家支付宝账号
notes: DataTypes.STRING,//备注
opNotes: DataTypes.STRING,//操作备注
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'c_order_receiptvoucher',
validate: {
}
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("orderrefundvoucher", {//退款单:
uapp_id: DataTypes.INTEGER, //
sourceOrderNo: DataTypes.STRING(64), // 来源单号
childOrderNo :DataTypes.STRING(64),// 子订单号
busPayOrderCode: DataTypes.STRING(100),//业务支付订单号
accountType: {
//帐户类型( 支付类型):"cash": "现金", "bank": "银行" ,"wx":"微信","alipay":"支付宝","other":"其它"
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.pay_account_type),
set: function (val) {
this.setDataValue("accountType", val);
this.setDataValue("accountTypeName", uiconfig.config.pdict.pay_account_type[val]);
}
},
accountTypeName: {//帐户类型名称
type: DataTypes.STRING,
},
payDate: DataTypes.DATE,//支付时间
totalSum: DataTypes.DECIMAL(12, 3),//订单总额(平台费用+服务费+官费+发票税费+个人利润+平台利润)
certifyFileUrl: DataTypes.STRING(500), //证明文件Url
payOrderNo: DataTypes.STRING, //支付凭证流水单号,如:微信支付凭证单号
buyerOpenId: DataTypes.STRING,//用户在支付商户appid下的唯一标识或买家在支付宝的用户id
passTradeNo: DataTypes.STRING,//通道的统一订单号
buyerAliLogonId: DataTypes.STRING,//买家支付宝账号
notes: DataTypes.STRING,//备注
opNotes: DataTypes.STRING,//操作备注
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'c_order_refundvoucher',
validate: {
}
});
}
......@@ -6,5 +6,90 @@ class AppProductService extends ServiceBase {
constructor() {
super("dbapp", ServiceBase.getDaoName(AppProductService));
}
//根据渠道产品码获取产品详情
async findByChannelItemCode(obj){
// var user = obj.user;
var app = obj.app;
// if(!user){
// return system.getResultFail(-101, "未知用户");
// }
if(!app){
return system.getResultFail(-102, "未知渠道");
}
var channelItemCode = obj.channelItemCode;
if(!channelItemCode){
return system.getResultFail(-103, "渠道产品编码不能为空");
}
var product = await this.dao.model.findOne({
where:{channelItemCode:channelItemCode,app_id:app.id,status:1},
attributes:["id","app_id","itemCode","itemName","picUrl","channelItemCode","channelItemName",
"serviceItemCode","proPrice","serviceCharge","publicExpense","rateConfig","discountsRateConfig"],
raw:true
});
if(!product){
return system.getResultFail(-104, "未知产品");
}
return system.getResultSuccess(product);
}
//获取产品列表(根据父类产品编码获取)
async findByProductTypeCode(obj){
// var user = obj.user;
var app = obj.app;
// if(!user){
// return system.getResultFail(-101, "未知用户");
// }
if(!app){
return system.getResultFail(-102, "未知渠道");
}
var itemCode = obj.itemCode;
if(!itemCode){
return system.getResultFail(-103, "渠道产品编码不能为空");
}
var pProduct = await this.dao.model.findOne({
where:{itemCode:itemCode,app_id:app.id,status:1},
attributes:["id","app_id","itemCode","itemName"],
raw:true
});
if(!pProduct || !pProduct.id){
return system.getResultFail(-104, "未知产品");
}
var pList = await this.dao.model.findAll({
where:{productType_id:pProduct.id,app_id:app.id,status:1},
attributes:["id","app_id","itemCode","itemName","picUrl","channelItemCode","channelItemName",
"serviceItemCode","proPrice","serviceCharge","publicExpense","rateConfig","discountsRateConfig"],
raw:true
});
return system.getResultSuccess(pList);
}
//获取产品列表(根据产品一类编码获取)
async findByProductOneTypeCode(obj){
// var user = obj.user;
var app = obj.app;
// if(!user){
// return system.getResultFail(-101, "未知用户");
// }
if(!app){
return system.getResultFail(-102, "未知渠道");
}
var itemCode = obj.itemCode;
if(!itemCode){
return system.getResultFail(-103, "渠道产品编码不能为空");
}
var pProduct = await this.dao.model.findOne({
where:{itemCode:itemCode,app_id:app.id,status:1},
attributes:["id","app_id","itemCode","itemName"],
raw:true
});
if(!pProduct || !pProduct.id){
return system.getResultFail(-104, "未知产品");
}
var pList = await this.dao.model.findAll({
where:{productOneType_id:pProduct.id,productType_id:{ [this.db.Op.ne]: 0 },app_id:app.id,status:1},
attributes:["id","app_id","itemCode","itemName","picUrl","channelItemCode","channelItemName",
"serviceItemCode","proPrice","serviceCharge","publicExpense","rateConfig","discountsRateConfig"],
raw:true
});
return system.getResultSuccess(pList);
}
}
module.exports = AppProductService;
......@@ -97,9 +97,11 @@ class CustomerInfoService extends ServiceBase {
},
raw:true
});
if(ordertmproduct.gzwtsUrl && customerinfo2.businessLicensePdf && customerinfo2.identityCardPdf){
if(ordertmproduct.gzwtsUrl && customerinfo2.businessLicensePdf && (customerinfo2.customerType=="ent" || customerinfo2.identityCardPdf)){
// otpObj["deliveryStatus"]="dsh";
await self.ordertmproductSve.update({id:ordertmproduct.id,deliveryStatus:"dsh"},t);
if(ordertmproduct.deliveryStatus=="dsccl"){
await self.ordertmproductSve.update({id:ordertmproduct.id,deliveryStatus:"dsh"},t);
}
await self.trademarkDao.model.update({officialType:"dsh"},{where:{deliveryOrderNo:deliveryOrderNo},transaction:t});
}
return system.getResultSuccess();
......@@ -186,8 +188,10 @@ class CustomerInfoService extends ServiceBase {
if(obj.smwjUrl){
otpObj["smwjUrl"]=obj.smwjUrl;
}
if((ordertmproduct.gzwtsUrl || otpObj["gzwtsUrl"]) && customerinfo2.businessLicensePdf && customerinfo2.identityCardPdf){
otpObj["deliveryStatus"]="dsh";
if((ordertmproduct.gzwtsUrl || otpObj["gzwtsUrl"]) && customerinfo2.businessLicensePdf && (customerinfo2.customerType=="ent" || customerinfo2.identityCardPdf)){
if(ordertmproduct.deliveryStatus=="dsccl"){
otpObj["deliveryStatus"]="dsh";
}
await self.trademarkDao.model.update({officialType:"dsh"},{where:{deliveryOrderNo:deliveryOrderNo},transaction:t});
}
......
......@@ -49,7 +49,7 @@ class OrderService extends ServiceBase {
async op1688ChannelPushOrderTest(action_body, pobj, req) {
try {
var returnValue = [
var returnValue = [
{
"bizStatusExt": "service",
"memberId": "b2b-****02",
......@@ -448,29 +448,27 @@ class OrderService extends ServiceBase {
serviceItemSnapshot: JSON.stringify(productItem),//产品快照
};
var orderItem = await self.dao.create(orderParams, t);//创建订单
var receiptvoucherItem = await self.receiptvoucherDao.addReceiptvoucher(orderParams, req, t);//创建订单支付信息
if (productItem.itemCode == "zzsbzc") {
var orderProductObj = {
app_id: req.app.id,//
productType_id: productItem.productType_id,//产品类型Id
productOneType_id: productItem.productOneType_id,//产品大类Id
itemCode: productItem.itemCode,//
itemName: productItem.itemName,//
orderServicePayStatus: "yfk",//支付状态:dfk: 待付款, yfk: 已支付
appDataOpType: req.app.appDataOpType,// 应用数据操作类型:00独立,10全委托,20部分委托
sourceOrderNo: ordercode,//来源单号
deliveryOrderNo: await self.getBusUid("jf"),
channelServiceNo: element.orderItemNum || null,// 渠道服务单号
needNo: element.orderItemNum || null,//需求单号
sourceType: "00",
channelUserId: req.user.channelUserId || "",// 渠道用户id
createuser_id: req.user.id,//
createuser: req.user.nickname,//
};
//创建服务单
var orderTm = await self.ordertmproductDao.create(orderProductObj, t);//创建商标订单
}
var orderProductObj = {
app_id: req.app.id,//
productType_id: productItem.productType_id,//产品类型Id
productOneType_id: productItem.productOneType_id,//产品大类Id
itemCode: productItem.itemCode,//
itemName: productItem.itemName,//
orderServicePayStatus: "yfk",//支付状态:dfk: 待付款, yfk: 已支付
appDataOpType: req.app.appDataOpType,// 应用数据操作类型:00独立,10全委托,20部分委托
sourceOrderNo: ordercode,//来源单号
deliveryOrderNo: await self.getBusUid("jf"),
channelServiceNo: element.orderItemNum || null,// 渠道服务单号
needNo: element.orderItemNum || null,//需求单号
sourceType: "00",
channelUserId: req.user.channelUserId || "",// 渠道用户id
createuser_id: req.user.id,//
createuser: req.user.nickname,//
};
//创建服务单
var orderTm = await self.ordertmproductDao.create(orderProductObj, t);//创建订单交付流程
});
}
}
......@@ -493,7 +491,7 @@ class OrderService extends ServiceBase {
var reqUrl = "https://yunfuapi.gongsibao.com/crm/order/submit";
try {
var body = {
idempotentId: item.orderNo,// 是 业务 ID
idempotentId: item.channelServiceNo,// 是 业务 ID
idempotentSource: req.app.appSourceCode ? "tm_" + req.app.appSourceCode : "tm_1688",// 是 业务来源(ali、jd)
idempotentSourceName: req.app.name || "1688应用",// 是 阿里,京东
city: "",// 否 所属城市
......@@ -501,7 +499,7 @@ class OrderService extends ServiceBase {
userId: item.channelUserId,// 否 用户 ID
companyName: "",// 否 公司名称
orderPrice: item.totalSum,// 是 订单金额
productId: "5dc936eb296d1572b9bc5b8d",// 是 产品 ID
productId: "5dd513db4f3b08000a6fc082",// 是 产品 ID
productQuantity: item.salesNum,// 是 产品数量
};
rtn = await rc.post(reqUrl, body);
......
......@@ -60,7 +60,11 @@ class ToolService {
var url = this.zcApiUrl + "api/tool/toolApi/adjustWTSSize";
return await this.opReqResult(url, queryobj, req);
}
//工商核名
async icheming(queryobj, req) {
var url = this.zcApiUrl + "api/trademark/tmqueryApi/icheming";
return await this.opReqResult(url, queryobj, req);
}
async opReqResult(reqUrl, queryobj, req) {
var rtn = await this.execClient.execPushDataPost(queryobj, reqUrl, req.headers["token"], req.headers["request-id"]);
var data = JSON.parse(rtn.stdout);
......
const Client = require('aliyun-api-gateway').Client;
var RPCClient = require('@alicloud/pop-core').RPCClient;
// const client = new Client('203727307', 'b6za34qem6k9a3s3jguvh24nc3ridlnh');
const client = new Client('203756805', 'crkyej0xlmqa6bmvqijun6ltxparllyn');
// const client = new Client('203756805', 'crkyej0xlmqa6bmvqijun6ltxparllyn');
const client = new Client('203763771', 'e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu');
class aliyunClient {
constructor() {
// this.aliReqUrl = "https://aliapi.gongsibao.com/tm/springboard";
......
......@@ -34,7 +34,7 @@ module.exports = function (app) {
});
});
app.get('/doc/:forder/:fileName', function (req, res) {
app.get('/doc/api/:forder/:fileName', function (req, res) {
var forder = req.params["forder"];
var fileName = req.params["fileName"] || "README.md";
var path = process.cwd() + "/app/front/entry/public/apidoc";
......
......@@ -24,7 +24,7 @@ var settings = {
if (this.env == "dev") {
return "http://p.apps.com:4001/";
} else {
return "http://open.gongsibao.com/";
return "https://open.gongsibao.com/";
}
},
reqTransferurl: function () {
......
......@@ -10,12 +10,12 @@
</head>
<body >
<body>
<div style="width:100%;text-align: center;font-size: 20px;">
薪果果个体工商户API文档
渠道接入API文档
</div>
<div class="markdown-body" style="margin-left:40px;" id="doc-page">
<%- str%>
<%- str%>
</div>
</body>
......
## 1. 调用接口需要开通app应用
  1 [获取app信息](doc/api/appDesc/demoDesc.md)
## 1. 用户相关接口
  1 [用户中心](doc/user/user.md)
  2 [获取token信息](doc/api/appDesc/demoDesc.md)
## 2. 商户相关接口
  1 [商户接口](doc/merchant/merchant.md)
## 2. 订单相关接口
  1 [订单](doc/order/order.md)
  2 [个体工商户](doc/order/businessmen.md)
## 3. 发票接口
  1 [发票](gongsibao-er/README.md)
  3 [通用接口示例](doc/api/appDesc/demoDesc.md)
## 2. 商标操作相关接口
  1 [商标操作中心](doc/api/opTrademark/opTm.md)
## 3. 商标检索相关接口
  1 [商标检索中心](doc/api/opTrademark/opTm.md)
<a name="menu" href="/doc">返回主目录</a>
1. [开通app参数](#appParams)
1. [获取token](#getToken)
1. [通用接口示例](#demo)
## **<a name="appParams"> 开通app参数</a>**
[返回到目录](#menu)
#### 请求接口之前需要向合作方获取如下参数:
#### appkey:2019090811
#### secret:f99d413b767f09b5dff0b3610366cc46
#### 参数说明:appkey、secret为获取请求头token的参数。
## **<a name="getToken"> 获取token</a>**
[返回到目录](#menu)
##### URL
[/auth/accessAuth/getToken]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"appkey": "2019090811", //Y string appkey
"secret": "f99d413b767f09b5dff0b3610366cc46"//Y string 密钥
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"token": "40d64e586551405c9bcafab87266bc04" //token用于其他接口请求时,放在请求头中
},
"requestId": "2016c54abe7249a2a1195d236b333f79"
}
```
## **<a name="demo"> 通用接口示例</a>**
[返回到目录](#menu)
##### URL
[/auth/accessAuth]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
所有请求接口在请求前,必须获取token,并把token放在请求头Headers中,无特殊说明请求方式统一为POST请求。
通用请求接口示例:
请求头中需要传递的参数:tokenrequest-id
请求参数:
{
"actionProcess": "jd", //Y string 执行的渠道名称
"actionType": "demo", //Y string 渠道执行的类型
"actionBody": { //N JSON 要传递的body信息
"userId": "019101116473600000", //N string 用户ID
"userName": "张三" //N string 用户名称
}
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"opDesc": "京东云合作"
},
"requestId": "2016c54abe7249a2a1195d236b333f79"
}
返回值参数说明:
status 返回状态,0为成功,否则为失败
msg 成功或失败信息描述
data 接口返回的数据信息
requestId 请求头中的request-id,作为接口调用跟踪
```
<a name="menu" href="/doc">返回主目录</a>
1. [尼斯查询(一)](#getNcl)
1. [尼斯查询(二)](#getNclTwo)
## **<a name="getNcl"> 尼斯查询(一)</a>**
[返回到目录](#menu)
##### URL
[/action/tmTools/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:getNcl
``` javascript
{
"nclcode": "01" //Y string 尼斯编号(尼斯大类类别获取群组类别)
}
```
#### 返回结果
```javascript
{
"status": 0,//操作状态0:操作成功-1:操作失败
"msg": "操作成功",//操作信息
"data": [
{
"code": "01",//尼斯大类编码
"name": "",//大类名称
"pcode": "",//父类编码 大类要为父类则为空
"type": 1,
"children": [//尼斯群组信息
{
"code": "0106",//群组编码
"name": "化学试剂",//群组名称
"pcode": "01",//群组父类编码 即其所属大类编码
"type": 1,
"children": [//尼斯小类
{
"code": "010122",//小类编码
"name": "生物化学催化剂",//小类名称
"pcode": "0106"//小类父类编码 即其所属群组编码
}
]
}
]
},
{
"code": "42",
"name": "",
"pcode": "",
"type": 1,
"children": [
{
"code": "4211",
"name": "提供化学研究服务",
"pcode": "42",
"type": 1,
"children": [
{
"code": "",
"name": "生物化学研究和分析",
"pcode": "4211"
}
]
}
]
}
],
"requestId": "8cd7e91ec607453c805da8302f3e068c"
}
```
## **<a name="getNclTwo"> 尼斯查询(二)</a>**
[返回到目录](#menu)
##### URL
[/action/tmTools/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:getNcl
``` javascript
{
"name": "生物化学",//Y strin 尼斯名称
"ncls ": ["01"]//N List 尼斯大类编码列表
}
```
#### 返回结果
```javascript
{
"status": 0,//操作状态0:操作成功-1:操作失败
"msg": "操作成功",//操作信息
"data": [
{
"code": "01",//尼斯大类编码
"name": "",//大类名称
"pcode": "",//父类编码 大类要为父类则为空
"type": 1,
"children": [//尼斯群组信息
{
"code": "0106",//群组编码
"name": "化学试剂",//群组名称
"pcode": "01",//群组父类编码 即其所属大类编码
"type": 1,
"children": [//尼斯小类
{
"code": "010122",//小类编码
"name": "生物化学催化剂",//小类名称
"pcode": "0106"//小类父类编码 即其所属群组编码
}
]
}
]
},
{
"code": "42",
"name": "",
"pcode": "",
"type": 1,
"children": [
{
"code": "4211",
"name": "提供化学研究服务",
"pcode": "42",
"type": 1,
"children": [
{
"code": "",
"name": "生物化学研究和分析",
"pcode": "4211"
}
]
}
]
}
],
"requestId": "8cd7e91ec607453c805da8302f3e068c"
}
```
<a name="menu">目录</a>
1. [图片验证码](#captcha)
1. [短信验证码](#smsCode)
1. [登录](#login)
1. [当前用户信息查询](#loginUser)
1. [获取菜单](#getMenu)
## **<a name="captcha"> 图片验证码</a>**
[返回到目录](#menu)
##### URL
[/web/auth/userCtl/captcha]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
| 参数 | 必选 | 类型 | 说明|
| -------- | -------- | ------------|---------|
| **width** | 否 | int | 图片验证码宽度 默认120px|
| **height** | 否 | int | 图片验证码高度 默认32px |
| **background** | 否 | String | 背景色颜色值,默认#E8E8E8 |
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"key": "381c1fc567c746d0a4aa33892239cef0", // 图片验证码key
"captcha": "...." // 图片
}
}
```
## **<a name="smsCode"> 短信验证码</a>**
[返回到目录](#menu)
##### URL
[/web/auth/userCtl/smsCode]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
| 参数 | 必选 | 类型 | 说明|
| -------- | -------- | ------------|---------|
| **mobile** | 是 | String | 手机号码|
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
}
```
## **<a name="login"> 登录</a>**
[返回到目录](#menu)
##### URL
[/web/auth/userCtl/login]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
| 参数 | 必选 | 类型 | 说明|
| -------- | -------- | ------------|---------|
| **loginName** | 是 | String | 登录名|
| **password** | 是 | String | 密码 |
| **captchaKey** | 是 | String | 图片验证码key |
| **captchaCode** | 是 | String | 图片验证码填入值 |
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
"data": {
"xggadminsid": "3cb49932-fa02-44f0-90db-9f06fe02e5c7" // 登录key
}
}
```
## **<a name="currentUser"> 当前用户信息查询</a>**
[返回到目录](#menu)
##### URL
[/web/auth/userCtl/currentUser]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
}
```
## **<a name="getMenu"> 获取菜单</a>**
[返回到目录](#menu)
##### URL
[/web/auth/userCtl/getMenu]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 返回结果
```javascript
[
{
"name": "首页",
"path": "/",
"submenu": []
},
{
"name": "商户中心",
"path": "/merchants",
"submenu": [
{
"name": "客户管理",
"team": [
{
"name": "商户信息",
"path": "/merchants/businessInformation"
},
...
]
}
]
},
...
]
```
......@@ -32,6 +32,7 @@
"express": "^4.16.2",
"express-session": "^1.15.6",
"gm": "^1.23.1",
"jdcloud-sdk-signer": "^2.0.0",
"marked": "^0.7.0",
"method-override": "^2.3.10",
"mongoose": "^5.7.1",
......
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