Commit e25ab601 by 宋毅

增加mobile字段

parent b91f656f
...@@ -17,7 +17,7 @@ class UtilsUcommuneService extends AppServiceBase { ...@@ -17,7 +17,7 @@ class UtilsUcommuneService extends AppServiceBase {
this.paySecret = settings.paySecret() this.paySecret = settings.paySecret()
} }
//--------------------------------优客工厂相关接口-start----------------------------------------------------- //--------------------------------优客工厂相关接口-start-----------------------------------------------------
/** /**
...@@ -32,17 +32,18 @@ class UtilsUcommuneService extends AppServiceBase { ...@@ -32,17 +32,18 @@ class UtilsUcommuneService extends AppServiceBase {
var url = settings.ucommuneUrl() + "third/getUserInfo"; // 调用优客工场接口 获取用户信息 var url = settings.ucommuneUrl() + "third/getUserInfo"; // 调用优客工场接口 获取用户信息
// 拼接规则curl -k -H 'Content-type: application/json' -H 'authorization:{token}' -X POST {url} pobj作为发生错误时记录日志用 // 拼接规则curl -k -H 'Content-type: application/json' -H 'authorization:{token}' -X POST {url} pobj作为发生错误时记录日志用
let result = await this.restPostWithHAuthorizationUrl(pobj, actionBody.userToken, url); let result = await this.restPostWithHAuthorizationUrl(pobj, actionBody.userToken, url);
if(result.retCode == 0) { // 0成功 1失败 if (result.retCode == 0) { // 0成功 1失败
pobj.actionType = "getLoginByUserName"; pobj.actionType = "getLoginByUserName";
pobj.actionBody.channelUserId = result.data.nationalCode + "-" + result.data.mobile; // 即:86_18512345678 pobj.actionBody.channelUserId = result.data.nationalCode + "-" + result.data.mobile; // 即:86_18512345678
pobj.actionBody.userName = result.data.name; pobj.actionBody.userName = result.data.name;
pobj.actionBody.mobile: result.data.mobile;
pobj.actionBody.headUrl = result.data.headImg; pobj.actionBody.headUrl = result.data.headImg;
pobj.actionBody.userpin = pobj.actionBody.userpin || this.getUUID(); pobj.actionBody.userpin = pobj.actionBody.userpin || this.getUUID();
var tmpOpResult = await this.utilsAuthSve.getLoginByUserName(pobj, pobj.actionBody); var tmpOpResult = await this.utilsAuthSve.getLoginByUserName(pobj, pobj.actionBody);
if (tmpOpResult.status != 0 && tmpOpResult.status != 2060) { if (tmpOpResult.status != 0 && tmpOpResult.status != 2060) {
return tmpOpResult; return tmpOpResult;
} }
return system.getResultSuccess({ userpin: tmpOpResult.data.userpin ? tmpOpResult.data.userpin : pobj.actionBody.userpin}) return system.getResultSuccess({ userpin: tmpOpResult.data.userpin ? tmpOpResult.data.userpin : pobj.actionBody.userpin })
} else { } else {
// 获取用户信息失败 // 获取用户信息失败
return system.getResult(null, result); return system.getResult(null, result);
...@@ -85,23 +86,23 @@ class UtilsUcommuneService extends AppServiceBase { ...@@ -85,23 +86,23 @@ class UtilsUcommuneService extends AppServiceBase {
pobj.actionType = "getPayOrderInfo" // 获取订单详细信息 用来拼接字符串 totalsum为总金额,返回给前端 pobj.actionType = "getPayOrderInfo" // 获取订单详细信息 用来拼接字符串 totalsum为总金额,返回给前端
var reqUrl = settings.centerOrderUrl() + "action/order/springBoard"; var reqUrl = settings.centerOrderUrl() + "action/order/springBoard";
var orderResult = await this.restPostUrl(pobj, reqUrl); var orderResult = await this.restPostUrl(pobj, reqUrl);
if(orderResult.status != 0) { if (orderResult.status != 0) {
// return system.getResult(null, "Failed to get orderResult or order has been paid 100470"); // return system.getResult(null, "Failed to get orderResult or order has been paid 100470");
return system.getResult(null, orderResult); return system.getResult(null, orderResult);
} else { } else {
if(actionBody.payWay == 1) { // 支付宝 if (actionBody.payWay == 1) { // 支付宝
try { try {
let creatPayRequrl = "https://yf-api.gongsibao.com/pay/v1/aliPay/getPrePayIdAliPay"; let creatPayRequrl = "https://yf-api.gongsibao.com/pay/v1/aliPay/getPrePayIdAliPay";
let params = { let params = {
"app": "ukgc",//固定 "app": "ukgc",//固定
'body': orderResult.data.orderProduct.channelItemName, 'body': orderResult.data.orderProduct.channelItemName,
"key": "a1519e2eab53dfb909e4c32a86b2ea2b",//固定 "key": "a1519e2eab53dfb909e4c32a86b2ea2b",//固定
"notifyUrl" : this.centerChannelUrl + "orderNotify/aliPayNotify", "notifyUrl": this.centerChannelUrl + "orderNotify/aliPayNotify",
"outTradeNo": orderResult.data.receiptVoucher.sourceOrderNo + "-" + pobj.appInfo.uapp_id.toString() + "-" + orderResult.data.orderProduct.id.toString(), "outTradeNo": orderResult.data.receiptVoucher.sourceOrderNo + "-" + pobj.appInfo.uapp_id.toString() + "-" + orderResult.data.orderProduct.id.toString(),
"productCode" : orderResult.data.orderProduct.channelItemCode, "productCode": orderResult.data.orderProduct.channelItemCode,
"subject" : orderResult.data.orderProduct.channelItemName , "subject": orderResult.data.orderProduct.channelItemName,
"timeoutExpress" : '10m' , "timeoutExpress": '10m',
"totalAmount" : orderResult.data.receiptVoucher.totalSum, "totalAmount": orderResult.data.receiptVoucher.totalSum,
} }
var sign = JSON.stringify(params); var sign = JSON.stringify(params);
// sign += "ab53dfb909e4c32a" // sign += "ab53dfb909e4c32a"
...@@ -109,7 +110,7 @@ class UtilsUcommuneService extends AppServiceBase { ...@@ -109,7 +110,7 @@ class UtilsUcommuneService extends AppServiceBase {
sign = md5(sign).toUpperCase() sign = md5(sign).toUpperCase()
params.sign = sign params.sign = sign
let res = await axios.post(creatPayRequrl, params) let res = await axios.post(creatPayRequrl, params)
if(res.status == 200 && res.data.code == 200) { if (res.status == 200 && res.data.code == 200) {
await this.cacheManager["TlPayLocker"].init(orderResult.data.receiptVoucher.sourceOrderNo); await this.cacheManager["TlPayLocker"].init(orderResult.data.receiptVoucher.sourceOrderNo);
return system.getResultSuccess(res.data) return system.getResultSuccess(res.data)
} }
...@@ -120,10 +121,10 @@ class UtilsUcommuneService extends AppServiceBase { ...@@ -120,10 +121,10 @@ class UtilsUcommuneService extends AppServiceBase {
op: "center-app/app/base/service/impl/utilsSve/utilsUcommuneSve.js/orderConfirm", op: "center-app/app/base/service/impl/utilsSve/utilsUcommuneSve.js/orderConfirm",
content: "参数=" + JSON.stringify(orderResult) + ",error:" + e.stack, content: "参数=" + JSON.stringify(orderResult) + ",error:" + e.stack,
clientIp: pobj.client_ip || "" clientIp: pobj.client_ip || ""
}); });
return system.getResultFail(-200, e.stack); return system.getResultFail(-200, e.stack);
} }
// 之前写的 调用wx/alipay的方法,后续用不到会删掉 // 之前写的 调用wx/alipay的方法,后续用不到会删掉
// let sign = await PayUtil.getSign(null,"1") // let sign = await PayUtil.getSign(null,"1")
...@@ -171,13 +172,13 @@ class UtilsUcommuneService extends AppServiceBase { ...@@ -171,13 +172,13 @@ class UtilsUcommuneService extends AppServiceBase {
// } // }
// let agentInformation = JSON.parse(alipayAgentInformation) // let agentInformation = JSON.parse(alipayAgentInformation)
// let alipay = new AlipaySdk({ // let alipay = new AlipaySdk({
// appId: agentInformation.appid, // appId: agentInformation.appid,
// privateKey: agentInformation.publicKey, // privateKey: agentInformation.publicKey,
// // alipayPublicKey: agentInformation.publicKey, // // alipayPublicKey: agentInformation.publicKey,
// }); // });
// const params = { // const params = {
// bizContent: { // bizContent: {
...@@ -192,8 +193,8 @@ class UtilsUcommuneService extends AppServiceBase { ...@@ -192,8 +193,8 @@ class UtilsUcommuneService extends AppServiceBase {
// let alipayResponse = await alipay.exec('alipay.trade.app.pay', params); // let alipayResponse = await alipay.exec('alipay.trade.app.pay', params);
// console.log(alipayResponse) // console.log(alipayResponse)
// return system.getResultSuccess(alipayResponse) // return system.getResultSuccess(alipayResponse)
// var newobj = JSON.stringify(obj).replace(/\s*/g,""); // var newobj = JSON.stringify(obj).replace(/\s*/g,"");
// newobj += "ab53dfb909e4c32a" // newobj += "ab53dfb909e4c32a"
// newobj = md5(newobj).toUpperCase() // newobj = md5(newobj).toUpperCase()
...@@ -213,7 +214,7 @@ class UtilsUcommuneService extends AppServiceBase { ...@@ -213,7 +214,7 @@ class UtilsUcommuneService extends AppServiceBase {
// let alipayResponse = await this.alipay.exec('alipay.trade.app.pay', params); // let alipayResponse = await this.alipay.exec('alipay.trade.app.pay', params);
// console.log(alipayResponse); // console.log(alipayResponse);
} }
if(actionBody.payWay == 3) { // 微信 if (actionBody.payWay == 3) { // 微信
await this.cacheManager["TlPayLocker"].init(orderResult.data.receiptVoucher.sourceOrderNo); await this.cacheManager["TlPayLocker"].init(orderResult.data.receiptVoucher.sourceOrderNo);
let creatPayRequrl = "https://yf-api.gongsibao.com/pay/v1/createSign"; let creatPayRequrl = "https://yf-api.gongsibao.com/pay/v1/createSign";
let params = { let params = {
...@@ -221,51 +222,51 @@ class UtilsUcommuneService extends AppServiceBase { ...@@ -221,51 +222,51 @@ class UtilsUcommuneService extends AppServiceBase {
"key": "a1519e2eab53dfb909e4c32a86b2ea2b", "key": "a1519e2eab53dfb909e4c32a86b2ea2b",
"payParam": [ "payParam": [
{ {
"name":"appid", "name": "appid",
// 后期修改 // 后期修改
// "value":"1" // "value":"1"
"value":"wx6f3ebe44defe336a" "value": "wx6f3ebe44defe336a"
}, },
{ {
"name":"mch_id", "name": "mch_id",
// "value":"1" // "value":"1"
"value":"1232813602" "value": "1232813602"
}, },
{ {
"name":"device_info", "name": "device_info",
"value":"1000" "value": "1000"
}, },
{ {
"name":"body", "name": "body",
"value":"商标" "value": "商标"
// "value":orderResult.data.orderProduct.channelItemName // "value":orderResult.data.orderProduct.channelItemName
}, },
{ {
"name":"nonce_str", "name": "nonce_str",
// "value":"ibuaiVcKdpRxkhJA" // "value":"ibuaiVcKdpRxkhJA"
"value":WxPayUtil.generateNonceString() "value": WxPayUtil.generateNonceString()
}, },
{ {
"name":"openid", "name": "openid",
"value":"o7kgSs_2cuJxyBoIEWMwRUPfobLg" "value": "o7kgSs_2cuJxyBoIEWMwRUPfobLg"
}, },
{ {
"name":"notify_url", "name": "notify_url",
"value":"http://" "value": "http://"
// "value":this.centerChannelUrl + "orderNotify/wxPayNotify", // "value":this.centerChannelUrl + "orderNotify/wxPayNotify",
}, },
{ {
"name":"out_trade_no", "name": "out_trade_no",
// "value": "OT37202006221758koyn-37-69" // "value": "OT37202006221758koyn-37-69"
"value":orderResult.data.receiptVoucher.sourceOrderNo + "-" + pobj.appInfo.uapp_id.toString() + "-" + orderResult.data.orderProduct.id.toString() "value": orderResult.data.receiptVoucher.sourceOrderNo + "-" + pobj.appInfo.uapp_id.toString() + "-" + orderResult.data.orderProduct.id.toString()
}, },
{ {
"name":"sign_type", "name": "sign_type",
"value":"MD5" "value": "MD5"
}, },
{ {
"name":"total_fee", "name": "total_fee",
"value":"399" "value": "399"
// "value":orderResult.data.receiptVoucher.totalSum, // "value":orderResult.data.receiptVoucher.totalSum,
}, },
// { // {
...@@ -274,8 +275,8 @@ class UtilsUcommuneService extends AppServiceBase { ...@@ -274,8 +275,8 @@ class UtilsUcommuneService extends AppServiceBase {
// "Value": '192.168.2.210', // "Value": '192.168.2.210',
// }, // },
{ {
"name":"trade_type", "name": "trade_type",
"value":"JSAPI" "value": "JSAPI"
} }
], ],
"paymentType": "3" "paymentType": "3"
...@@ -297,7 +298,7 @@ class UtilsUcommuneService extends AppServiceBase { ...@@ -297,7 +298,7 @@ class UtilsUcommuneService extends AppServiceBase {
params.sign = sign params.sign = sign
console.log(params) console.log(params)
let res = await axios.post(creatPayRequrl, params) let res = await axios.post(creatPayRequrl, params)
if(res.status == 200 && res.data.code == 200) { if (res.status == 200 && res.data.code == 200) {
await this.cacheManager["TlPayLocker"].init(orderResult.data.receiptVoucher.sourceOrderNo); await this.cacheManager["TlPayLocker"].init(orderResult.data.receiptVoucher.sourceOrderNo);
return system.getResultSuccess(res.data) return system.getResultSuccess(res.data)
} }
...@@ -342,38 +343,38 @@ class UtilsUcommuneService extends AppServiceBase { ...@@ -342,38 +343,38 @@ class UtilsUcommuneService extends AppServiceBase {
// trade_type: 'NATIVE', // trade_type: 'NATIVE',
// attach: "" // attach: ""
// } // }
// opts.nonce_str = opts.nonce_str || WxPayUtil.generateNonceString(); // opts.nonce_str = opts.nonce_str || WxPayUtil.generateNonceString();
// opts.appid = agentInformation.appid; // opts.appid = agentInformation.appid;
// opts.mch_id = agentInformation.mchid; // opts.mch_id = agentInformation.mchid;
// opts.device_info = "WEB"; // opts.device_info = "WEB";
// opts.sign = WxPayUtil.sign(opts); // opts.sign = WxPayUtil.sign(opts);
// var postXml = WxPayUtil.buildXML({ xml: opts }); // var postXml = WxPayUtil.buildXML({ xml: opts });
// axios.post(unifiedorderUrl, postXml).then(function(result) { // axios.post(unifiedorderUrl, postXml).then(function(result) {
// // console.log("微信付款单请求result.data",result.data); // // console.log("微信付款单请求result.data",result.data);
// WxPayUtil.parseXML(result.data,function(json){ // WxPayUtil.parseXML(result.data,function(json){
// func(json) // func(json)
// }); // });
// }).catch(function(error){ // }).catch(function(error){
// console.log("微信生成付款单错误",error); // console.log("微信生成付款单错误",error);
// }) // })
// let wepay = new WXPay({ // let wepay = new WXPay({
// appId: agentInformation.appid, // appId: agentInformation.appid,
// mch_id: agentInformation.mchid, // mch_id: agentInformation.mchid,
// }); // });
// let res = await wepay.createUnifiedOrder({ // let res = await wepay.createUnifiedOrder({
// body: '扫码支付测试', // body: '扫码支付测试',
...@@ -420,20 +421,20 @@ class UtilsUcommuneService extends AppServiceBase { ...@@ -420,20 +421,20 @@ class UtilsUcommuneService extends AppServiceBase {
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
return result; return result;
} }
/** /**
* 点击确认支付后返回拼接字符串 orderConfirm 的验证数据方法 * 点击确认支付后返回拼接字符串 orderConfirm 的验证数据方法
* @param {*} pobj * @param {*} pobj
* @param {*} actionBody orderNo orderIndo订单号 * @param {*} actionBody orderNo orderIndo订单号
*/ */
async orderConfirmValidate(pobj, actionBody) { async orderConfirmValidate(pobj, actionBody) {
if(!actionBody.orderNo) { // 订单号 if (!actionBody.orderNo) { // 订单号
return system.getResult(null, "actionBody.orderNo can not be empty,100430"); return system.getResult(null, "actionBody.orderNo can not be empty,100430");
} }
if(!actionBody.payWay) { // 支付方式 1 支付宝 3微信 if (!actionBody.payWay) { // 支付方式 1 支付宝 3微信
return system.getResult(null, "actionBody.payWay can not be empty,100440"); return system.getResult(null, "actionBody.payWay can not be empty,100440");
} }
if(actionBody.payWay != 1 || actionBody.payWay != 3) { // payway 非1非3 if (actionBody.payWay != 1 || actionBody.payWay != 3) { // payway 非1非3
return system.getResult(null, "actionBody.payWay is eoor values,100450"); return system.getResult(null, "actionBody.payWay is eoor values,100450");
} }
} }
...@@ -446,21 +447,21 @@ class UtilsUcommuneService extends AppServiceBase { ...@@ -446,21 +447,21 @@ class UtilsUcommuneService extends AppServiceBase {
async ucommuneGetOrderDetail(pobj, actionBody) { async ucommuneGetOrderDetail(pobj, actionBody) {
return system.getResultSuccess() return system.getResultSuccess()
} }
//--------------------------------优客工厂相关接口--end----------------------------------------------------
//--------------------------------优客工厂相关接口--end----------------------------------------------------
} }
// 之前写的 调用wx/alipay的方法,后续用不到会删掉 // 之前写的 调用wx/alipay的方法,后续用不到会删掉
PayUtil = { PayUtil = {
getSign: async function(appid,paymentType) { getSign: async function (appid, paymentType) {
let requrl = "https://yf-api.gongsibao.com/pay/v1/createSign" let requrl = "https://yf-api.gongsibao.com/pay/v1/createSign"
let params = { let params = {
"app": "ukgc", "app": "ukgc",
"key": "a1519e2eab53dfb909e4c32a86b2ea2b", "key": "a1519e2eab53dfb909e4c32a86b2ea2b",
"payParam": [ "payParam": [
{ {
"name": "app_id", "name": "app_id",
"value": appid || "2019022163300183" "value": appid || "2019022163300183"
...@@ -489,11 +490,11 @@ PayUtil = { ...@@ -489,11 +490,11 @@ PayUtil = {
"paymentType": paymentType, "paymentType": paymentType,
} }
var signstr = JSON.stringify(params); var signstr = JSON.stringify(params);
signstr += "ab53dfb909e4c32a" signstr += "ab53dfb909e4c32a"
signstr = md5(signstr).toUpperCase() signstr = md5(signstr).toUpperCase()
params.sign = signstr params.sign = signstr
let res = await axios.post(requrl, params) let res = await axios.post(requrl, params)
if(res.data.code = 200) { if (res.data.code = 200) {
return res.data.value return res.data.value
} }
return system.getResult(null, "Failed to get sign, 100460"); return system.getResult(null, "Failed to get sign, 100460");
...@@ -503,7 +504,7 @@ PayUtil = { ...@@ -503,7 +504,7 @@ PayUtil = {
module.exports = UtilsUcommuneService; module.exports = UtilsUcommuneService;
WxPayUtil = { WxPayUtil = {
generateNonceString: function(length) { generateNonceString: function (length) {
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var maxPos = chars.length; var maxPos = chars.length;
var noceStr = ""; var noceStr = "";
......
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