Commit bf9f1979 by linboxuan

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

parents 654250ec cb038ba0
...@@ -118,6 +118,9 @@ class AccessAuthAPI extends WEBBase { ...@@ -118,6 +118,9 @@ class AccessAuthAPI extends WEBBase {
case "getLoginInfo"://通过userpin获取用户登录信息 case "getLoginInfo"://通过userpin获取用户登录信息
opResult = await this.utilsAuthSve.getLoginInfo(pobj, pobj.actionBody); opResult = await this.utilsAuthSve.getLoginInfo(pobj, pobj.actionBody);
break; break;
case "channelUserLogin":
opResult = await this.utilsAuthSve.channelUserLogin(pobj,pobj.actionBody,req);
break;
case "logout"://用户退出 case "logout"://用户退出
opResult = await this.utilsAuthSve.userLogout(pobj, pobj.actionBody); opResult = await this.utilsAuthSve.userLogout(pobj, pobj.actionBody);
break; break;
......
...@@ -39,9 +39,9 @@ class PaymentAPI extends WEBBase { ...@@ -39,9 +39,9 @@ class PaymentAPI extends WEBBase {
case "queryOrderStatus"://通联支付查询 case "queryOrderStatus"://通联支付查询
opResult = await this.utilsOrderSve.queryOrderStatus(pobj, pobj.actionBody); opResult = await this.utilsOrderSve.queryOrderStatus(pobj, pobj.actionBody);
break; break;
case "getQrCode"://获取pc端支付二维码--不跟订单关联 // case "getQrCode"://获取pc端支付二维码--不跟订单关联
opResult = await this.utilsOrderSve.getQrCode(pobj, pobj.actionBody); // opResult = await this.utilsOrderSve.getQrCode(pobj, pobj.actionBody);
break; // break;
case "queryOrder"://通联支付查询 case "queryOrder"://通联支付查询
opResult = await this.utilsOrderSve.queryOrder(pobj, pobj.actionBody); opResult = await this.utilsOrderSve.queryOrder(pobj, pobj.actionBody);
break; break;
......
...@@ -306,7 +306,8 @@ class CenterorderService extends AppServiceBase { ...@@ -306,7 +306,8 @@ class CenterorderService extends AppServiceBase {
orderNo: pobj.actionBody.channelOrder.channelOrderNo, orderNo: pobj.actionBody.channelOrder.channelOrderNo,
orderPrice: Number(pobj.actionBody.orderPrice / 100), orderPrice: Number(pobj.actionBody.orderPrice / 100),
phone: pobj.actionBody.publishMobile, phone: pobj.actionBody.publishMobile,
needId: solutiondata.data.channelNeedNo needId: solutiondata.data.channelNeedNo,
companyName:solutiondata.data.solutionContent.solution.CompanyName || ''
}, },
appInfo: pobj.appInfo appInfo: pobj.appInfo
} }
......
...@@ -84,7 +84,7 @@ class ToolService extends AppServiceBase { ...@@ -84,7 +84,7 @@ class ToolService extends AppServiceBase {
} }
async getOssConfig(pobj, req) {//获取oss信息 async getOssConfig(pobj, req) {//获取oss信息
var reqUrl = settings.centerAppUrl() + "auth/accessAuth/getOssInfo"; var reqUrl = settings.reqZcApi() + "api/tool/toolApi/getOssConfig";
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
return result; return result;
} }
......
...@@ -159,5 +159,48 @@ class UtilsAuthService extends AppServiceBase { ...@@ -159,5 +159,48 @@ class UtilsAuthService extends AppServiceBase {
return applogout; return applogout;
} }
/**
* 官网首页跳转自主注册
* @param pobj
* @param actionBody
* @param req
* @returns {Promise<void>}
*/
async channelUserLogin(pobj,actionBody,req){
//官网登录地址
let skipUrl = 'http://gsbweb.qifu.gongsibao.com';
let opResult = system.getResult(null, "req Failure");
//----通过Authorization 获取用户信息
let Authorization = req.headers["authorization"] || "";
if(!Authorization){
opResult =system.getResultFail(-99,'用户未登录',{redirectUrl:'skipUrl'});
return opResult;
}
let icCompanyUrl = 'https://icompanytest.gongsibao.com/api/tUserInfo/info';
let subData = {
Authorization:Authorization
}
let rtn = await this.execClient.execFqGet(subData,icCompanyUrl);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost data is empty");
}
var userInfo = JSON.parse(rtn.stdout);
//----结束
//---渠道用户登录,有则返回userpin ,没有则注册用户并返回userpin
let channelUserId = userInfo.mobile;
actionBody.channelUserId = channelUserId;
let loginRt = await this.getLoginByUserName(pobj,actionBody);
if (loginRt.status != 0 && loginRt.status != 2060) {
return loginRt;
}
opResult.data={ userpin: pobj.actionBody.userpin }
if (loginRt.status == 2060) {
opResult.msg = loginRt.msg;
opResult.data.userpin = loginRt.data.userpin;
}
return opResult;
}
} }
module.exports = UtilsAuthService; module.exports = UtilsAuthService;
var system = require("../../../system"); var system = require("../../../system");
const AppServiceBase = require("../../app.base"); const AppServiceBase = require("../../app.base");
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
const { json } = require("sequelize");
//此类用来db中配置来进行调用-主要功能是推送蜂擎业务 //此类用来db中配置来进行调用-主要功能是推送蜂擎业务
class UtilsFqAliyunService extends AppServiceBase { class UtilsFqAliyunService extends AppServiceBase {
...@@ -9,6 +10,7 @@ class UtilsFqAliyunService extends AppServiceBase { ...@@ -9,6 +10,7 @@ class UtilsFqAliyunService extends AppServiceBase {
this.ucommuneOperatorPhone = settings.ucommuneOperatorPhone() this.ucommuneOperatorPhone = settings.ucommuneOperatorPhone()
} }
async pushOrderBusinessByProductCode2Fq(pobj) {//推送自定义产品码的订单商机到峰擎(订单已经支付成功才推送) async pushOrderBusinessByProductCode2Fq(pobj) {//推送自定义产品码的订单商机到峰擎(订单已经支付成功才推送)
console.log(JSON.stringify(pobj),".................pushOrderBusinessByProductCode2Fq...............pobj");
var verifyResult = await this.verifyParam(pobj); var verifyResult = await this.verifyParam(pobj);
var orderInfo = pobj.actionBody.order_info; var orderInfo = pobj.actionBody.order_info;
var orderContact = pobj.actionBody.order_contact ? pobj.actionBody.order_contact : pobj.actionBody.delivery_content.orderContact; var orderContact = pobj.actionBody.order_contact ? pobj.actionBody.order_contact : pobj.actionBody.delivery_content.orderContact;
...@@ -33,7 +35,8 @@ class UtilsFqAliyunService extends AppServiceBase { ...@@ -33,7 +35,8 @@ class UtilsFqAliyunService extends AppServiceBase {
} }
var interface_params_info = verifyResult.data; var interface_params_info = verifyResult.data;
console.log("推送的业务员手机号为:",this.ucommuneOperatorPhone) var ucommuneOperatorPhone = pobj.appInfo && pobj.appInfo.contact_mobile ? pobj.appInfo.contact_mobile : this.ucommuneOperatorPhone
console.log("推送的业务员手机号为:", ucommuneOperatorPhone)
var params = { var params = {
idempotentId: orderInfo.orderNo,// 是 业务 ID idempotentId: orderInfo.orderNo,// 是 业务 ID
idempotentSource: productInfo.service_business_code,// 是 业务来源(ic_jdyun、ic_ali) idempotentSource: productInfo.service_business_code,// 是 业务来源(ic_jdyun、ic_ali)
...@@ -45,13 +48,13 @@ class UtilsFqAliyunService extends AppServiceBase { ...@@ -45,13 +48,13 @@ class UtilsFqAliyunService extends AppServiceBase {
orderPrice: orderInfo.totalSum,// 是 订单金额 orderPrice: orderInfo.totalSum,// 是 订单金额
productId: productInfo.price_item.service_code,// 是 产品 ID productId: productInfo.price_item.service_code,// 是 产品 ID
productQuantity: orderInfo.quantity,// 是 产品数量 productQuantity: orderInfo.quantity,// 是 产品数量
operator_phone: this.ucommuneOperatorPhone, // 2020 0704 推送fq 必填字段 这里以下为新增 7.7修改由写死改为从settings获取 operator_phone: ucommuneOperatorPhone, // 2020 0704 推送fq 必填字段 这里以下为新增 7.7修改由写死改为从settings获取
createdat: orderInfo.created_at,// 2020 0722 lin新增 张超推送文档新增必填字段 createdat: orderInfo.created_at,// 2020 0722 lin新增 张超推送文档新增必填字段
thirdPartyCustomerId: orderInfo.channelUserId, thirdPartyCustomerId: orderInfo.channelUserId,
pay_flow_no: orderInfo.pay_flow_no,// 支付流水号 pay_flow_no: orderInfo.pay_flow_no,// 支付流水号
pay_channel: orderInfo.pay_channel,// 支付渠道(微信、支付宝)(必填) pay_channel: orderInfo.pay_channel,// 支付渠道(微信、支付宝)(必填)
pay_time: orderInfo.pay_time,//付款时间 pay_time: orderInfo.pay_time,//付款时间
pay_payer_bank_no:orderInfo.pay_payer_bank_no//付款人账号 pay_payer_bank_no: orderInfo.pay_payer_bank_no//付款人账号
}; };
// var result = await this.opAliyunClientPost(pobj, "pushOrderBusiness", interface_params_info.opUrl, interface_params_info.key, interface_params_info.secret, params); // var result = await this.opAliyunClientPost(pobj, "pushOrderBusiness", interface_params_info.opUrl, interface_params_info.key, interface_params_info.secret, params);
var result = await this.opAliyunClientPost(pobj, interface_params_info.opUrl, interface_params_info.key, interface_params_info.secret, params); var result = await this.opAliyunClientPost(pobj, interface_params_info.opUrl, interface_params_info.key, interface_params_info.secret, params);
......
...@@ -53,6 +53,7 @@ class UtilsPushService extends AppServiceBase { ...@@ -53,6 +53,7 @@ class UtilsPushService extends AppServiceBase {
} }
async pushBusInfo(pobj, opType, isDelProductInfo) {//推送业务总入口,不在db中做配置进行调用 async pushBusInfo(pobj, opType, isDelProductInfo) {//推送业务总入口,不在db中做配置进行调用
console.log(JSON.stringify(pobj),".......pushBusInfo.........................");
var interface_list = pobj.interface_info ? pobj.interface_info : pobj.actionBody.product_info.interface_info; var interface_list = pobj.interface_info ? pobj.interface_info : pobj.actionBody.product_info.interface_info;
if (!interface_list) { if (!interface_list) {
return system.getResult(null, "暂无推送配置"); return system.getResult(null, "暂无推送配置");
......
...@@ -77,6 +77,12 @@ class ExecClient { ...@@ -77,6 +77,12 @@ class ExecClient {
console.log(cmd); console.log(cmd);
return cmd; return cmd;
} }
FetchFqGetCmd(subData, url) {
var cmd = this.cmdFeishuGetPattern.replace(/\{url\}/g, url).replace(/\{Authorization\}/g, "Bearer "+subData.Authorization);
console.log(cmd);
return cmd;
}
//飞书小程序GET请求 //飞书小程序GET请求
FetchFeishuGetCmd(subData, url) { FetchFeishuGetCmd(subData, url) {
var cmd = this.cmdFeishuGetPattern.replace( var cmd = this.cmdFeishuGetPattern.replace(
...@@ -96,6 +102,14 @@ class ExecClient { ...@@ -96,6 +102,14 @@ class ExecClient {
var result = await this.exec(cmd); var result = await this.exec(cmd);
return result; return result;
} }
async execFqGet(subData,url){
let cmd = this.FetchFqGetCmd(subData,url);
console.log(cmd);
var result = await this.exec(cmd);
return result;
}
async execGet2(subData, url) { async execGet2(subData, url) {
let cmd = this.FetchGetCmd(subData, url); let cmd = this.FetchGetCmd(subData, url);
console.log(cmd); console.log(cmd);
......
...@@ -200,7 +200,7 @@ module.exports = function (app) { ...@@ -200,7 +200,7 @@ module.exports = function (app) {
}); });
app.use('/orderNotify/channelPayNotify', async function (req, res) { app.use('/orderNotify/channelPayNotify', async function (req, res) {
try{ try {
var client_ip = system.get_client_ip(req); var client_ip = system.get_client_ip(req);
var result = await utilsOrderSve.channelPayNotify(req.body, client_ip); var result = await utilsOrderSve.channelPayNotify(req.body, client_ip);
logCtl.info({ logCtl.info({
...@@ -213,7 +213,7 @@ module.exports = function (app) { ...@@ -213,7 +213,7 @@ module.exports = function (app) {
return res.end("FAIL"); return res.end("FAIL");
} }
return res.end("success"); return res.end("success");
}catch (e) { } catch (e) {
var client_ip = system.get_client_ip(req); var client_ip = system.get_client_ip(req);
logCtl.error({ logCtl.error({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "渠道订单支付通知处理异常", optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "渠道订单支付通知处理异常",
...@@ -237,8 +237,15 @@ module.exports = function (app) { ...@@ -237,8 +237,15 @@ module.exports = function (app) {
return; return;
} }
// 2020 0812 lin 只去掉了check,因为要记录智能诊断的返回值,其他接口暂时未去掉 // 2020 0812 lin 只去掉了check,因为要记录智能诊断的返回值,其他接口暂时未去掉
if (["getAppTokenByHosts", "getAppTokenByAppKey", "test", "getIndustries", "getSecondIndustries", "getQualificationByIndustry", "counselling","queryTradeProduceList"].indexOf(req.body.actionType) >= 0) { if (["getAppTokenByHosts", "getAppTokenByAppKey", "test", "getIndustries", "getSecondIndustries", "getQualificationByIndustry", "counselling", "queryTradeProduceList"].indexOf(req.body.actionType) >= 0) {
req.body.actionBody.appHosts = req.host;
next();
return;
}
if (req.originalUrl.indexOf("/action/tmQuery") >= 0 || req.originalUrl.indexOf("/action/tmTools") >= 0) {
req.body.actionProcess="test-code";
req.body.actionBody.appHosts = req.host; req.body.actionBody.appHosts = req.host;
req.body.appInfo ={id:1}
next(); next();
return; return;
} }
......
<a name="menu" href="/doc">返回主目录</a> <a name="menu" href="/doc">返回主目录</a>
1. [获取pc端支付二维码--不跟订单关联](#getQrCode)
1. [pc端订单支付二维码生成](#getOrderQrCode) 1. [pc端订单支付二维码生成](#getOrderQrCode)
1. [pc端查询订单是否支付成功](#getOrderQrCode)
1. [获取H5支付链接](#getH5PayUrl) 1. [获取H5支付链接](#getH5PayUrl)
## **<a name="getQrCode"> 获取pc端支付二维码--不跟订单关联</a>** ## **<a name="getOrderQrCode"> pc端订单支付二维码生成</a>**
[返回到目录](#menu) [返回到目录](#menu)
##### URL ##### URL
[/web/payment/paymentApi/springBoard] [/web/payment/paymentApi/springBoard]
#### 参数格式 `JSON` #### 参数格式 `JSON`
#### HTTP请求方式 `POST` #### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:getQrCode #### 渠道执行的类型 actionType:getOrderQrCode
``` javascript ``` javascript
{ {
"uapp_id": "1", //平台渠道ID "orderNo": "TM22202008042050Pmex",//订单号
"order_num": "1", //支付单号 "opType": "wx"// 支付方式  alipay阿里  wx微信
"total_fee": "1",   //支付金额  分
"body_desc": "1",    //产品名称
"opType": "1", // 支付方式  alipay阿里  wx微信
} }
``` ```
#### 返回结果 #### 返回结果
```javascript ``` javascript
{ {
"status": 0,  //0 成功 小于0  失败 "status": 0,
"msg": "SUCCESS", "msg": "success",
"data": { "data": {
"payinfo": "https://syb.allinpay.com/apiweb/h5unionpay/native?key=l6lfPuHDErJrTW%2FN7WxSlg4n", //二维码url "payinfo": "https://syb.allinpay.com/apiweb/h5unionpay/native?key=BMFvrMDcrqzLnJ04YV%2B02uX0",
"reqsn": "dfghrtjjn_1",  ////商户订单号_appid "reqsn": "qftTM22202008042050Pmex_22",
"chnltrxid": "112094120001042656", // 支付渠道交易单号,如支付宝,微信平台的交易单号 "chnltrxid": "122005790000133940",
"trxid": "112094120001042656",  // 交易单号,平台的交易流水号 "trxid": "122005790000133940",
"trxstatus": "0000"   // 交易状态,0000:交易成功、1001:交易不存在、 "trxstatus": "0000",
"notify_url": "https://igirl.gongsibao.com/api/tl/zxNotify"
}, },
"requestId": "058244807fff4ab388bbda79afc04b28" "requestId": "07dedd4ffd4441dcac54c6d8a0f91653",
  } "wxPayOrderCode": "122005790000133596",
"aliPayOrderCode": "TM22202008042050Pmex"
}
``` ```
## **<a name="queryOrderStatus"> pc端查询订单是否支付成功</a>**
## **<a name="getOrderQrCode"> pc端订单支付二维码生成</a>**
[返回到目录](#menu) [返回到目录](#menu)
##### URL ##### URL
[/web/payment/paymentApi/springBoard] [/web/payment/paymentApi/springBoard]
#### 参数格式 `JSON` #### 参数格式 `JSON`
#### HTTP请求方式 `POST` #### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:getOrderQrCode #### 渠道执行的类型 actionType:queryOrderStatus
``` javascript ``` javascript
{ {
"orderNo": "TM22202008042050Pmex",//订单号 "orderNo": "TM22202008042050Pmex",//订单号
...@@ -55,23 +54,13 @@ ...@@ -55,23 +54,13 @@
#### 返回结果 #### 返回结果
``` javascript ``` javascript
{ {
"status": 0, "status": 0,// 0为成功,否则失败
"msg": "success", "msg": "success",
"data": { "data": null,
"payinfo": "https://syb.allinpay.com/apiweb/h5unionpay/native?key=BMFvrMDcrqzLnJ04YV%2B02uX0", "requestId": "07dedd4ffd4441dcac54c6d8a0f91653"
"reqsn": "qftTM22202008042050Pmex_22",
"chnltrxid": "122005790000133940",
"trxid": "122005790000133940",
"trxstatus": "0000",
"notify_url": "https://igirl.gongsibao.com/api/tl/zxNotify"
},
"requestId": "07dedd4ffd4441dcac54c6d8a0f91653",
"wxPayOrderCode": "122005790000133596",
"aliPayOrderCode": "TM22202008042050Pmex"
} }
``` ```
## **<a name="getH5PayUrl"> 获取H5支付链接</a>** ## **<a name="getH5PayUrl"> 获取H5支付链接</a>**
[返回到目录](#menu) [返回到目录](#menu)
##### URL ##### URL
......
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