优化停车费支付失败风险

This commit is contained in:
java110 2020-07-17 16:08:38 +08:00
parent 8e05cac0f4
commit 20d29d16bd
2 changed files with 37 additions and 16 deletions

View File

@ -202,6 +202,15 @@ class LoginFactory {
requsetHcServerToLogin(loginRes, callback = () => {}) {
let defaultRawData = '{"nickName":"","gender":1,"language":"","city":"","province":"","country":"","avatarUrl":""}'; // 请求服务端的登录接口
console.log('返回信息', loginRes);
let _appId = '';
// #ifdef MP-WEIXIN
let accountInfo = uni.getAccountInfoSync();
_appId = accountInfo.miniProgram.appId;
// #endif
// #ifdef H5
_appId = uni.getStorageSync(constant.mapping.W_APP_ID)
// #endif
wx.request({
url: constant.url.loginUrl,
method: 'post',
@ -215,11 +224,12 @@ class LoginFactory {
// 签名
encryptedData: '',
// 用户敏感信息
iv: '' // 解密算法的向量
iv: '' ,// 解密算法的向量
appId:_appId
},
success: function(res) {
if (res.statusCode == '401') {
let data = res.data;
uni.setStorageSync(constant.mapping.CURRENT_OPEN_ID, data.openId);
@ -228,30 +238,30 @@ class LoginFactory {
});
return;
}
res = res.data;
if (res.result == 0) {
//that.globalData.userInfo = res.userInfo;
console.log(res.userInfo);
wx.setStorageSync(constant.mapping.USER_INFO, JSON.stringify(res.userInfo));
let date = new Date();
let year = date.getFullYear(); //获取当前年份
let mon = date.getMonth(); //获取当前月份
let da = date.getDate(); //获取当前日
let h = date.getHours() + 1; //获取小时
let m = date.getMinutes(); //获取分钟
let s = date.getSeconds(); //获取秒
console.log("获取过去时间", year, mon, da, h, m, s); //将时间格式转化为时间戳
let afterOneHourDate = new Date(year, mon, da, h, m, s); //30s之后的时间
console.log("afterOneHourDate", afterOneHourDate);
wx.setStorageSync(constant.mapping.LOGIN_FLAG, {
sessionKey: res.sessionKey,

View File

@ -121,7 +121,8 @@
feePrice: 0.00,
communityId: '',
communityName: '',
feeId: ''
feeId: '',
appId:''
};
},
@ -130,6 +131,14 @@
*/
onLoad: function(options) {
context.onLoad(options);
// #ifdef MP-WEIXIN
let accountInfo = uni.getAccountInfoSync();
this.appId = accountInfo.miniProgram.appId;
// #endif
// #ifdef H5
this.appId = uni.getStorageSync(constant.mapping.W_APP_ID)
// #endif
let _fee = JSON.parse(options.fee);
let _receivableAmount = this.feeMonth * _fee.feePrice;
let _communityInfo = context.getCurrentCommunity();
@ -233,7 +242,8 @@
feeId: this.feeId,
feeName: '停车费',
receivedAmount: _receivedAmount,
tradeType:_tradeType
tradeType:_tradeType,
appId: this.appId
};
context.request({
url: constant.url.preOrder,
@ -303,7 +313,8 @@
feeId: this.feeId,
feeName: '停车费',
receivedAmount: _receivedAmount,
tradeType:_tradeType
tradeType:_tradeType,
appId: this.appId
}
context.request({