Commit e25ab601 by 宋毅

增加mobile字段

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