This commit is contained in:
cun-nan 2024-02-20 11:00:47 +08:00
parent 6830a50945
commit 26555b9dbc
6 changed files with 77 additions and 16 deletions

View File

@ -149,14 +149,14 @@ public interface LJUserService extends IService<LJUser> {
public void clearRule();
/**
* 根据openid查询用户信息
* 根据微信openid查询用户信息
* @param openId
* @return
*/
LJUser selectUserByOpenId(String openId);
/**
* 根据userId查询用户信息
* 根据支付宝userId查询用户信息
* @param userId
* @return
*/

View File

@ -413,13 +413,17 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
user.setUserNo(number);
}
if (StringUtils.isEmpty(user.getName())){
String before = user.getMobile().substring(0, 3);
String after = user.getMobile().substring(7);
user.setName(before+"****"+after);
if (StringUtils.isNotEmpty(user.getMobile())) {
String before = user.getMobile().substring(0, 3);
String after = user.getMobile().substring(7);
user.setName(before + "****" + after);
}
}else {
user.setName(user.getName());
}
user.setDescription("支付宝登录自动注册");
if (StringUtils.isNotEmpty(user.getMobile())) {
user.setDescription("支付宝登录自动注册");
}
int row = baseMapper.insert(user);
return row;
}

View File

@ -1,5 +1,6 @@
package com.fuint.common.util;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.dto.UserInfo;
@ -158,4 +159,24 @@ public class TokenUtil {
}
throw new LoginEffectiveException("登录失效,请重新登录");
}
/**
* 获取当前登录用户信息小程序未登录状态下支付调用
* @return
* */
public static AccountInfo getNowAccountInfo1() throws LoginEffectiveException {
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String token = request.getHeader("Access-Token");
Object loginInfo = RedisUtil.get(Constants.SESSION_ADMIN_USER + token);
ObjectMapper objectMapper = new ObjectMapper();
AccountInfo accountInfo = objectMapper.convertValue(loginInfo, AccountInfo.class);
if (accountInfo != null && ObjectUtil.isEmpty(accountInfo.getToken()) || accountInfo != null && accountInfo.getToken().equals(token)) {
return accountInfo;
}
}catch (Exception e){
log.error(e.getMessage());
}
throw new LoginEffectiveException("登录失效,请重新登录");
}
}

View File

@ -48,29 +48,29 @@
<view class="hui-size">实付金额</view>
<view class="">{{oilOrder.payAmount}}</view>
</view>
<view class="dis-fx" v-if="oilOrder.orderStatus=='paid'">
<view class="dis-fx" v-if="AppToken && oilOrder.orderStatus=='paid'">
<view class="hui-size">储值卡付款金额</view>
<view class="">{{ oilOrder.balanceAmount }}</view>
</view>
<view class="dis-fx" v-if="oilOrder.orderStatus=='paid'">
<view class="dis-fx" v-if="AppToken && oilOrder.orderStatus=='paid'">
<view class="hui-size">囤油卡付款升数</view>
<view class="">{{ oilOrder.oilCardAmount }}</view>
</view>
<view class="box-title">优惠信息</view>
<view class="dis-fx" v-if="oilOrder.activeId && oilOrder.activeType=='1'">
<view class="box-title" v-if="AppToken">优惠信息</view>
<view class="dis-fx" v-if="AppToken && oilOrder.activeId && oilOrder.activeType=='1'">
<view class="hui-size">满减活动优惠</view>
<view class="">{{fullOrDiscount.deductionAmount || oilOrder.discountAmount}}</view>
</view>
<view class="dis-fx" v-if="oilOrder.activeId && oilOrder.activeType=='2'">
<view class="dis-fx" v-if="AppToken && oilOrder.activeId && oilOrder.activeType=='2'">
<view class="hui-size">折扣活动优惠</view>
<view class="">{{fullOrDiscount.deductionAmount || oilOrder.discountAmount}}</view>
</view>
<view class="dis-fx" v-if="oilOrder.cardFavorableId">
<view class="dis-fx" v-if="AppToken && oilOrder.cardFavorableId">
<view class="hui-size">优惠券优惠</view>
<view class="">{{cardFavorable.discountAmount || oilOrder.discountAmount}}</view>
</view>
<view class="dis-fx" v-if="oilOrder.discountAmount>0">
<view class="dis-fx" v-if="AppToken && oilOrder.discountAmount>0">
<view class="hui-size">优惠合计金额</view>
<view class="">{{oilOrder.discountAmount}}</view>
</view>
@ -86,7 +86,8 @@
</view>
</view>
<view class="anniu" v-if="oilOrder.orderStatus=='paid' && oilOrder.remark==null || oilOrder.orderStatus=='paid' && oilOrder.remark==''" @click="gocomment()">
<view class="anniu" v-if="oilOrder.orderStatus=='paid' && oilOrder.remark==null || oilOrder.orderStatus=='paid' && oilOrder.remark==''"
@click="gocomment()">
<text>去评价</text>
</view>
@ -108,6 +109,8 @@
cardFavorable:{},
//
fullOrDiscount:{},
// token
AppToken: uni.getStorageSync("App-Token"),
}
},
onLoad(e) {

View File

@ -38,7 +38,7 @@
</view>
</view>
<view style="background-color: white;width: 94%;margin: 15px auto;">
<view style="background-color: white;width: 94%;margin: 15px auto;" v-if="AppToken">
<view class="desc">
<view style="display: flex;">
@ -158,6 +158,10 @@
return {
// WECHAT ALIPAY
appltType: uni.getStorageSync("appltType"),
// token
AppToken: uni.getStorageSync("App-Token"),
//
ifLogin:false,
gradeDis:"",
title: '',
value: true,
@ -314,6 +318,7 @@
type:this.preferentialData.type,
balanceAmountSale:this.balanceRedece,
oilCardAmountSale:this.oilCardRedece,
ifLogin:this.ifLogin
};
let _this = this;
request({
@ -822,7 +827,14 @@
// _this.getStore(res.data.storeId)
_this.getOilNumber(res.data.storeId)
// _this.chooseCoupons()
_this.getUser(res.data.userId)
//
if (_this.AppToken) {
_this.getUser(res.data.userId)
_this.ifLogin = true
}else{
_this.ifLogin = false
_this.payAmount = _this.oilOrder.orderAmount
}
}
})
},

View File

@ -39,6 +39,7 @@ const request = config => {
// debugger
let res = response
console.log(res);
const code = res.data.code || 200
const msg = errorCode[code] || res.data.msg || errorCode['default']
if (code === 401) {
@ -61,6 +62,26 @@ const request = config => {
// }
})
reject('无效的会话,或者会话已过期,请重新登录。')
} else if (code === 1001) {
showConfirm('您暂未登录,您可以继续留在该页面,或者重新登录?').then(res => {
console.log("res", res)
if (res.confirm) {
uni.reLaunch({
url: '/pagesLogin/login/login'
})
} else {
uni.reLaunch({
url: '/pages/index/index'
})
}
// if (res.confirm) {
// store.dispatch('LogOut').then(res => {
// })
// }
})
reject('无效的会话,或者会话已过期,请重新登录。')
} else if (code === 500) {
toast(msg)
reject('500')