socket为空时 报错问题
登录时 获取手机号乱码
This commit is contained in:
@@ -110,7 +110,6 @@ public class LoginContoller {
|
||||
String encryptedData = map.get("encryptedData");
|
||||
String ivStr = map.get("iv");
|
||||
// String phone = map.get("phone");
|
||||
log.info("登录传参:入参:{}",JSONUtil.toJSONString(map));
|
||||
// 用户非敏感信息:rawData
|
||||
// 签名:signature
|
||||
JSONObject rawDataJson = JSON.parseObject(rawData);
|
||||
@@ -128,10 +127,11 @@ public class LoginContoller {
|
||||
}
|
||||
String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
|
||||
String phone = "";
|
||||
log.info("登录传参:解码获取手机号{}",data);
|
||||
try{
|
||||
if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
|
||||
phone =JSONObject.parseObject(data).get("phoneNumber").toString();
|
||||
}else {
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.info("登录传参:获取手机号失败{}",data);
|
||||
}
|
||||
String nickName = rawDataJson.getString("nickName");
|
||||
|
||||
@@ -57,7 +57,9 @@ public class LoginService {
|
||||
public Result wxCustomLogin(String openId, String headImage, String nickName, String telephone, String ip) throws Exception {
|
||||
TbUserInfo userInfo = tbUserInfoMapper.selectByOpenId(openId);
|
||||
if (ObjectUtil.isNull(userInfo)) {
|
||||
if(StringUtils.isNotBlank(telephone)){
|
||||
userInfo = tbUserInfoMapper.selectByPhone(telephone);
|
||||
}
|
||||
if (ObjectUtil.isNull(userInfo)) {
|
||||
userInfo = new TbUserInfo();
|
||||
userInfo.setAmount(BigDecimal.ZERO);
|
||||
@@ -84,6 +86,7 @@ public class LoginService {
|
||||
userInfo.setLastLogInAt(System.currentTimeMillis());
|
||||
userInfo.setCreatedAt(System.currentTimeMillis());
|
||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||
if(StringUtils.isNotBlank(telephone)){
|
||||
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByPhone(telephone);
|
||||
if(CollectionUtils.isEmpty(tbShopUsers)){
|
||||
for (TbShopUser tbShopUser : tbShopUsers) {
|
||||
@@ -97,6 +100,7 @@ public class LoginService {
|
||||
tbShopUserMapper.updateByPrimaryKey(tbShopUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
tbUserInfoMapper.insert(userInfo);
|
||||
}
|
||||
else {
|
||||
@@ -108,6 +112,7 @@ public class LoginService {
|
||||
}
|
||||
else {
|
||||
String phone = userInfo.getTelephone();
|
||||
if(StringUtils.isNotBlank(telephone)){
|
||||
if (StringUtils.isBlank(phone) || !phone.equals(telephone)) {
|
||||
userInfo.setTelephone(telephone);
|
||||
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
|
||||
@@ -118,6 +123,7 @@ public class LoginService {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//生成token 信息
|
||||
String token = TokenUtil.generateToken(userInfo.getId(), userInfo.getMiniAppOpenId(), userInfo.getTelephone(), userInfo.getNickName());
|
||||
|
||||
|
||||
@@ -275,13 +275,17 @@ public class AppWebSocketServer {
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void AppSendInfo(Object message, String tableId,String userId, boolean userFlag) throws IOException {
|
||||
log.info("发送消息 tableId:{} \n userFlag:{}\n message:{}",tableId,userFlag,JSONUtil.toJSONString(message));
|
||||
log.info("发送消息 tableId:{} \n userId:{}\n userFlag:{}\n message:{}",tableId,userId,userFlag,JSONUtil.toJSONString(message));
|
||||
if (userFlag) {
|
||||
if (webSocketMap.containsKey(tableId)) {
|
||||
ConcurrentHashMap<String, AppWebSocketServer> userSocketMap = webSocketMap.get(tableId);
|
||||
if(!userSocketMap.isEmpty()){
|
||||
if(StringUtils.isNotBlank(userId)){
|
||||
userSocketMap.get(userId).sendMessage(message);
|
||||
}
|
||||
}else {
|
||||
log.error("请求的tableId:"+tableId+"用户连接为空");
|
||||
}
|
||||
}else {
|
||||
log.error("请求的tableId:"+tableId+" userId:" + userId + "不在该服务器上");
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ mybatis:
|
||||
ysk:
|
||||
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
||||
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
|
||||
callBackGroupurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBackGroup
|
||||
callBackGroupurl: https://wxcashiertest.sxczgkj.cn/cashierService/notify/notifyCallBackGroup
|
||||
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
|
||||
default: 18710449883
|
||||
server:
|
||||
|
||||
@@ -402,6 +402,7 @@
|
||||
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
|
||||
WHERE
|
||||
pro.type_enum = 'group'
|
||||
AND pro.is_combo = '1'
|
||||
GROUP BY
|
||||
sku.product_id
|
||||
ORDER BY
|
||||
@@ -421,6 +422,7 @@
|
||||
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
|
||||
WHERE
|
||||
pro.type_enum = 'group'
|
||||
AND pro.is_combo = '1'
|
||||
GROUP BY
|
||||
sku.product_id
|
||||
ORDER BY
|
||||
|
||||
Reference in New Issue
Block a user