Commit 8657e712 by 宋毅

tj

parent 179b856a
......@@ -27,8 +27,6 @@ class OrderAPI extends APIBase {
switch (action_type) {
case "addOrder"://创建订单
opResult = await this.addOrder(pobj, pobj.actionBody);
await this.pushInfo(orderResult, pobj, pobj.actionBody, "pushOrder");
await this.pushInfo(orderResult, pobj, pobj.actionBody, "pushBusiness");
break;
case "getOrderInfo"://获取订单列表信息
opResult = await this.orderinfoSve.getOrderInfo(pobj, pobj.actionBody);
......@@ -81,30 +79,11 @@ class OrderAPI extends APIBase {
if (!interface_info.interface_url) {
return system.getResult(null, "产品接口地址信息有误,20080");
}
var opResult = await this.reflexAction(interface_info, pobj);
return opResult;
}
async pushOrder(orderResult, pobj, actionBody, opType) {
if (opResult.status != 0) {
return "";
}
var interface_list = actionBody.product_info.interface_info;
if (!interface_list) {
return "";
}
var interface_info = null;
var interface_list_temp = interface_list.filter(f => f.op_type == opType)
if (interface_list_temp && interface_list_temp.length > 0) {
interface_info = interface_list_temp[0];
}
if (!interface_info) {
return "";
}
pobj.orderResult = orderResult;
var opResult = this.reflexAction(interface_info, pobj);
return opResult;
var refOpResult = await this.reflexAction(interface_info, pobj);
return refOpResult;
}
async reflexAction(interface_info, pobj) {
var refResult = null;
if (interface_info.interface_type == "bd") {
if (!interface_info.method_name) {
return system.getResult(null, "产品接口参数信息有误,20110");
......@@ -115,12 +94,12 @@ class OrderAPI extends APIBase {
}
pobj.interface_params = interface_info.params;
var params = [pobj];
opResult = await invokeObj[interface_info.method_name].apply(invokeObj, params);
refResult = await invokeObj[interface_info.method_name].apply(invokeObj, params);
}
else if (interface_info.interface_type == "yc") {
}
return opResult;
return refResult;
}
}
......
const CacheBase = require("../cache.base");
const system = require("../../system");
const settings = require("../../../config/settings");
class AppTokenByHostsCache extends CacheBase {
constructor() {
super();
this.restClient = system.getObject("util.restClient");
}
desc() {
return "应用中缓存访问token";
}
prefix() {
return settings.cacheprefix + "_accesskey:";
}
async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
var actionBody = val;
var acckapp = await this.restClient.execPost(actionBody, settings.centerAppUrl() + "auth/accessAuth/getTokenByHosts");
var result = acckapp.stdout;
console.log(acckapp.stdout, "AppTokenByHostsCache............. acckapp.stdout..........")
if (result) {
var tmp = JSON.parse(result);
return tmp;
}
return system.getResult(null, "data is empty");
}
}
module.exports = AppTokenByHostsCache;
const CacheBase = require("../cache.base");
const system = require("../../system");
const settings = require("../../../config/settings");
class AppUserPinByChannelUserId extends CacheBase {
constructor() {
super();
this.restClient = system.getObject("util.restClient");
}
desc() {
return "应用中缓存访问token";
}
prefix() {
return settings.cacheprefix + "_userPin:";
}
async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
var acckapp = await this.restClient.execPost(val, settings.centerAppUrl() + "auth/accessAuth/loginUserByChannelUserId");
var result = acckapp.stdout;
if (result) {
var tmp = JSON.parse(result);
return tmp;
}
return system.getResult(null, "data is empty");
}
}
module.exports = AppUserPinByChannelUserId;
const CacheBase = require("../cache.base");
const system = require("../../system");
const settings = require("../../../config/settings");
class AppUserPinByLoginPwdCache extends CacheBase {
constructor() {
super();
this.restClient = system.getObject("util.restClient");
}
desc() {
return "应用中缓存访问token";
}
prefix() {
return settings.cacheprefix + "_userPin:";
}
async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
var acckapp = await this.restClient.execPost(val, settings.centerAppUrl() + "auth/accessAuth/login");
var result = acckapp.stdout;
if (result) {
var tmp = JSON.parse(result);
return tmp;
}
return system.getResult(null, "data is empty");
}
}
module.exports = AppUserPinByLoginPwdCache;
const CacheBase = require("../cache.base");
const system = require("../../system");
const settings = require("../../../config/settings");
class AppUserPinByLoginVcodeCache extends CacheBase {
constructor() {
super();
this.restClient = system.getObject("util.restClient");
}
desc() {
return "应用中缓存访问token";
}
prefix() {
return settings.cacheprefix + "_userPin:";
}
async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
var acckapp = await this.restClient.execPost(val, settings.centerAppUrl() + "auth/accessAuth/loginByVerifyCode");
var result = acckapp.stdout;
if (result) {
var tmp = JSON.parse(result);
return tmp;
}
return system.getResult(null, "data is empty");
}
}
module.exports = AppUserPinByLoginVcodeCache;
......@@ -28,7 +28,7 @@ module.exports = {
//订单类型
"order_type": { "zzdd": "自主订单", "dkxd": "代客下单" },
//订单付款状态
"order_status": { 1: "待付款", 2: "已付款", 4: "待服务", 8: "已完成" },
"order_status": { 1: "待付款", 2: "已付款", 4: "服务中", 8: "已完成" },
//帐户类型( 支付类型)
"pay_account_type": { "cash": "现金", "bank": "银行", "wx": "微信", "alipay": "支付宝", "other": "其它" },
//订单服务付款状态
......
......@@ -7,6 +7,7 @@ module.exports = (db, DataTypes) => {
orderNo :DataTypes.STRING(64),// 订单号
channelServiceNo :DataTypes.STRING(64),// 渠道服务单号
channelOrderNo :DataTypes.STRING(1024),// 渠道订单号列表,多个以,隔开
needNo :DataTypes.STRING(64), //需求号--用于服务商或需求表中创建订单
channelUserId :DataTypes.STRING(64), // 渠道用户ID
ownerUserId :DataTypes.STRING(20),// 拥有渠道用户ID
payTime :DataTypes.DATE,// 渠道有支付时间则用渠道的支付时间
......
......@@ -4,7 +4,7 @@ const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("needinfo", {
uapp_id:DataTypes.INTEGER,
needNo:DataTypes.STRING,
needNo:DataTypes.STRING(64),
channelUserId:DataTypes.INTEGER,//发布者id
publisherName:DataTypes.STRING,//发布者姓名
publisherOnlyCode:DataTypes.STRING(50),//发布者唯一码
......
var system = require("../../../system");
var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base");
const logCtl = system.getObject("service.common.oplogSve");
const aliyunClient = system.getObject("util.aliyunClient");
// //aliyunClient
// this.fqReqUrl = "https://yunfuapi.gongsibao.com";//线上域名
// // this.fqReqUrl = "https://yunfuapi-dev.gongsibao.com";//dev域名
// // const client = new Client('203756805', 'crkyej0xlmqa6bmvqijun6ltxparllyn');//开发
// const client = new Client('203763771', 'e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu');//线上
class UtilsFqAliyunSve extends AppServiceBase {
constructor() {
super();
}
async pushBusinessDev(pobj) {
this.logCtl.info({
appid: req.app.id,
appkey: req.app.uappKey,
requestId: req.requestId || "",
op: "center-order/service/impl/utilsSve/utilsFqAliyunSve.js/pushBusinessDev",
content: "请求地址:" + reqUrl + ",参数:" + JSON.stringify(body) + ",返回结果:" + JSON.stringify(rtn),
clientIp: pobj.clientIp,
optitle: "推送订单商机到FQ信息--again",
});
}
async pushBusinessOnline(pobj) {
this.logCtl.info({
appid: req.app.id,
appkey: req.app.uappKey,
requestId: req.requestId || "",
op: "center-order/service/impl/utilsSve/utilsFqAliyunSve.js/pushBusinessOnline",
content: "请求地址:" + reqUrl + ",参数:" + JSON.stringify(body) + ",返回结果:" + JSON.stringify(rtn),
clientIp: pobj.clientIp,
optitle: "推送订单商机到FQ信息--again",
});
}
async opAliyunClientPost(pobj) {
try {
} catch (e) {
//日志记录
this.logCtl.error({
appid: pobj.appInfo.uapp_id,
appkey: pobj.appInfo.uappKey,
requestId: req.requestId || "",
op: "igirl-channel/app/base/service/impl/dborder/orderSve/againPushFqBusiness",
content: "error:" + e.stack,
clientIp: pobj.clientIp,
optitle: "推送订单商机到FQ出错--again",
});
}
}
// var rc = system.getObject("util.aliyunClient");
// var rtn = null;
// var reqUrl = this.fqReqUrl + "/crm/order/submit";
// var body = pobj.actionBody;
// try {
// rtn = await rc.post(reqUrl, body);
// this.logCtl.info({
// appid: req.app.id,
// appkey: req.app.uappKey,
// requestId: req.requestId || "",
// op: "igirl-channel/app/base/service/impl/dborder/orderSve/againPushFqBusiness",
// content: "请求地址:" + reqUrl + ",参数:" + JSON.stringify(body) + ",返回结果:" + JSON.stringify(rtn),
// clientIp: pobj.clientIp,
// optitle: "推送订单商机到FQ信息--again",
// });
// if (rtn.code != 200 && rtn.success != true) {
// return system.getResult(null, "推送失败,失败原因:" + rtn.errorMsg + ",selfrequestId=" + req.requestId + ",requestId=" + rtn.requestId);
// }
// return system.getResultSuccess(null, "推送成功");
// } catch (e) {
// //日志记录
// this.logCtl.error({
// appid: req.app.id,
// appkey: req.app.uappKey,
// requestId: req.requestId || "",
// op: "igirl-channel/app/base/service/impl/dborder/orderSve/againPushFqBusiness",
// content: "error:" + e.stack,
// clientIp: pobj.clientIp,
// optitle: "推送订单商机到FQ出错--again",
// });
// }
}
module.exports = UtilsFqAliyunSve;
const Client = require('aliyun-api-gateway').Client;
class aliyunClient {
constructor() {
}
async post(aliReqUrl, key, secret, actionBody) {
const client = new Client(key, secret);
var param = {
data: actionBody,
timeout: 20000,
headers: {
accept: 'application/json'
}
};
console.log(JSON.stringify(param), "______________峰擎---阿里云参数_______");
var result = await client.post(aliReqUrl, param);
console.log(JSON.stringify(result), "______________峰擎---阿里云返回结果_______");
return result;
}
//阿里接口
async reqbyget(obj, cbk) {
const aliclient = new RPCClient({
accessKeyId: 'LTAI4FmyipY1wuLHjLhMWiPa',
accessKeySecret: 'hp4FF18IDCSym1prqzxrAjnnhNH3ju',
endpoint: 'https://trademark.aliyuncs.com',
apiVersion: '2018-07-24'
});
var action = obj.action;
var reqbody = obj.reqbody;
return this.aliclient.request(action, reqbody, {
timeout: 3000, // default 3000 ms
formatAction: true, // default true, format the action to Action
formatParams: true, // default true, format the parameter name to first letter upper case
method: 'GET', // set the http method, default is GET
headers: {}, // set the http request headers
});
}
}
module.exports = aliyunClient;
......@@ -20,20 +20,6 @@ var settings = {
usertimeout: 3600,//单位秒
basepath: path.normalize(path.join(__dirname, '../..')),
port: process.env.NODE_PORT || 4011,
paasUrl: function () {
if (this.env == "dev") {
return "http://p.apps.com:4001/";
} else {
return "https://open.gongsibao.com/";
}
},
centerAppUrl: function () {
if (this.env == "dev") {
return "http://centerapp.apps.com:4010/";
} else {
return "http://center-app-service/";
}
},
reqTransferurl: function () {
if (this.env == "dev") {
return "http://192.168.18.61:3003/";
......@@ -49,20 +35,6 @@ var settings = {
return "http://43.247.184.94:7200/";
}
},
reqZcApi: function () {
if (this.env == "dev") {
return "http://zcapi.apps.com:4002/";//localsettings.reqEsDevUrl;
} else {
return "http://zcapi-service/";//k8s服务名称
}
},
pushFqbossDataUrl: function () {
if (this.env == "dev") {
return "http://192.168.18.141:3000/";//localsettings.reqEsDevUrl;
} else {
return "https://fqgirl.gongsibao.com/";
}
},
apiconfig: {
opLogUrl: function () {
return settings.reqEsAddr() + "bigdata_zc_op_log/_doc?pretty";
......@@ -71,7 +43,7 @@ var settings = {
return 1;
},
},
homePage: function () {
if (this.env == "dev") {
var localsettings = require("./localsettings");
......
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