|
|
@@ -1,5 +1,6 @@
|
|
|
package com.ytpm.lemonios.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
@@ -209,7 +210,13 @@ public class AppUserServiceImpl implements AppUserService {
|
|
|
newUser.setLastLoginIp(param.getLoginIp());
|
|
|
newUser.setPhone(param.getPhone());
|
|
|
newUser.setDeviceId(param.getDeviceId());
|
|
|
- newUser.setLoginDays(old.getLoginDays()+1);
|
|
|
+ YtDyzLoginRecord wxLoginRecord = loginRecordMapper.getLastLoginRecord(old.getUserId(), 0);
|
|
|
+ YtDyzLoginRecord visitorLoginRecord = loginRecordMapper.getLastLoginRecord(old.getUserId(), 1);
|
|
|
+ if (wxLoginRecord == null && visitorLoginRecord == null
|
|
|
+ || wxLoginRecord != null && wxLoginRecord.getLoginTime() != null
|
|
|
+ && DateUtil.compare(wxLoginRecord.getLoginTime(), newUser.getLastLoginTime(), "yyyy-MM-dd") < 0) {
|
|
|
+ newUser.setLoginDays(old.getLoginDays() + 1);
|
|
|
+ }
|
|
|
appUserMapper.updateUser(newUser);
|
|
|
}
|
|
|
|
|
|
@@ -240,10 +247,14 @@ public class AppUserServiceImpl implements AppUserService {
|
|
|
newUser.setLastLoginIp(param.getLoginIp());
|
|
|
newUser.setPhone(param.getPhone());
|
|
|
newUser.setDeviceId(param.getDeviceId());
|
|
|
- newUser.setLoginDays(old.getLoginDays()+1);
|
|
|
+ YtDyzLoginRecord wxLoginRecord = loginRecordMapper.getLastLoginRecord(old.getUserId(), 0);
|
|
|
+ YtDyzLoginRecord visitorLoginRecord = loginRecordMapper.getLastLoginRecord(old.getUserId(), 1);
|
|
|
+ if (wxLoginRecord == null && visitorLoginRecord == null
|
|
|
+ || wxLoginRecord != null && wxLoginRecord.getLoginTime() != null
|
|
|
+ && DateUtil.compare(wxLoginRecord.getLoginTime(), newUser.getLastLoginTime(), "yyyy-MM-dd") < 0) {
|
|
|
+ newUser.setLoginDays(old.getLoginDays() + 1);
|
|
|
+ }
|
|
|
appUserMapper.updateUser(newUser);
|
|
|
- YtDyzUser oldUser = appUserMapper.selectById(newUser.getUserId());
|
|
|
- System.out.println(oldUser);
|
|
|
}
|
|
|
|
|
|
/**
|