admin
2024-04-26 5e7b0ed4a154ad067cbcf4aa1a1c7cce32f9864c
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java
@@ -2,6 +2,7 @@
import com.alipay.api.AlipayApiException;
import com.google.gson.Gson;
import com.ks.push.service.BDeviceTokenService;
import com.yeshi.fanli.dto.wx.WXAccountInfoDTO;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.*;
@@ -31,10 +32,14 @@
import com.yeshi.fanli.util.wx.MyWXLoginUtil;
import com.yeshi.fanli.vo.user.QQUserInfoVO;
import net.sf.json.JSONObject;
import org.apache.dubbo.config.annotation.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.TimeUtil;
import org.yeshi.utils.encrypt.DESUtil;
import org.yeshi.utils.entity.ProxyIP;
import org.yeshi.utils.entity.wx.WeiXinUser;
@@ -53,6 +58,8 @@
@Controller
@RequestMapping("api/v1/user")
public class UserAccountController {
    private Logger logger = LoggerFactory.getLogger(UserAccountController.class);
    @Resource
    private UserInfoService userInfoService;
@@ -119,6 +126,10 @@
    @Resource
    private DeviceActiveService deviceActiveService;
    @Reference(version = "1.0", check = false)
    private BDeviceTokenService bDeviceTokenService;
    private BusinessSystem getSystem(AcceptData acceptData) {
        BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
@@ -1055,16 +1066,27 @@
            return;
        if ("android".equalsIgnoreCase(acceptData.getPlatform())) {
            DeviceActive deviceActive = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
            // 需要解绑HW推送的用户绑定
            deviceTokenHWService.unBindDeviceToken(acceptData.getDevice());
            if (deviceActive != null) {
                // 解绑OPPO推送的用户绑定
                deviceTokenOPPOService.unBindUid(uid, deviceActive.getId());
                // 解绑VIVO推送的用户绑定
                deviceTokenVIVOService.unBindUid(uid, deviceActive.getId());
                // 解绑XM推送的用户绑定
                deviceTokenXMService.unBindUid(deviceActive.getId());
            //新版推送解绑
            if (acceptData.getSystem().isNewPush()) {
                try {
                    bDeviceTokenService.unBindUid(acceptData.getSystem().name(), StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid());
                } catch (Exception e) {
                    logger.error("新版推送解绑出错:{}", uid, e);
                }
            } else {
                // 需要解绑HW推送的用户绑定
                deviceTokenHWService.unBindDeviceToken(acceptData.getDevice());
                if (deviceActive != null) {
                    // 解绑OPPO推送的用户绑定
                    deviceTokenOPPOService.unBindUid(uid, deviceActive.getId());
                    // 解绑VIVO推送的用户绑定
                    deviceTokenVIVOService.unBindUid(uid, deviceActive.getId());
                    // 解绑XM推送的用户绑定
                    deviceTokenXMService.unBindUid(deviceActive.getId());
                }
            }
        }
        out.print(JsonUtil.loadTrueResult(""));
    }
@@ -1088,6 +1110,14 @@
        if (!VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion())) {
            out.print("请升级到最新版本");
            return;
        }
        if (!StringUtil.isNullOrEmpty(aliAccessToken)) {
            long now = System.currentTimeMillis();
            String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.oneKeyLoginCount, StringUtil.Md5(StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid()));
            redisManager.increase(key);
            int expire = (int) ((TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(now + 1000 * 60 * 60 * 24L, "yyyyMMdd"), "yyyyMMdd") - now) / 1000);
            redisManager.expire(key, expire);
        }
        try {
@@ -1170,6 +1200,15 @@
            out.print(JsonUtil.loadFalseResult("系统不存在"));
            return;
        }
        if (!StringUtil.isNullOrEmpty(aliAccessToken)) {
            long now = System.currentTimeMillis();
            String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.oneKeyLoginCount, StringUtil.Md5(StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid()));
            redisManager.increase(key);
            int expire = (int) ((TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(now + 1000 * 60 * 60 * 24L, "yyyyMMdd"), "yyyyMMdd") - now) / 1000);
            redisManager.expire(key, expire);
        }
        String mobile = null;
        try {
            mobile = userAccountService.getMobile(vcode, phone, aliAccessToken, acceptData.getSystem(), SMSHistory.TYPE_BIND);