From 8cc3c660bdaaaa6a46eecadb78e4e9c17a07c227 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 06 五月 2022 18:57:06 +0800
Subject: [PATCH] bug修复

---
 app/src/main/java/com/yeshi/makemoney/app/controller/client/api/UserController.java |   58 +++++++++++++++++++++++-----------------------------------
 1 files changed, 23 insertions(+), 35 deletions(-)

diff --git a/app/src/main/java/com/yeshi/makemoney/app/controller/client/api/UserController.java b/app/src/main/java/com/yeshi/makemoney/app/controller/client/api/UserController.java
index 1f1307b..146760e 100644
--- a/app/src/main/java/com/yeshi/makemoney/app/controller/client/api/UserController.java
+++ b/app/src/main/java/com/yeshi/makemoney/app/controller/client/api/UserController.java
@@ -1,6 +1,7 @@
 package com.yeshi.makemoney.app.controller.client.api;
 
 import com.yeshi.makemoney.app.dto.user.LoginInfoDTO;
+import com.yeshi.makemoney.app.entity.APPPlatform;
 import com.yeshi.makemoney.app.entity.user.UserExtraInfo;
 import com.yeshi.makemoney.app.entity.user.UserInfo;
 import com.yeshi.makemoney.app.entity.user.UserLoginRecord;
@@ -16,6 +17,7 @@
 import com.yeshi.makemoney.app.service.inter.user.UserInfoService;
 import com.yeshi.makemoney.app.service.inter.user.WXUserInfoService;
 import com.yeshi.makemoney.app.service.inter.vip.VIPService;
+import com.yeshi.makemoney.app.service.manager.PushManager;
 import com.yeshi.makemoney.app.service.manager.VerifyCodeManager;
 import com.yeshi.makemoney.app.utils.ApiCodeConstant;
 import com.yeshi.makemoney.app.utils.ImageUtil;
@@ -71,8 +73,8 @@
     @Resource
     private VerifyCodeManager verifyCodeManager;
 
-    //    @Reference(version = "1.0", check = false)
-    private BDeviceTokenService bDeviceTokenService;
+    @Resource
+    private PushManager pushManager;
 
     @Resource
     private GoldCornGetRecordService goldCornGetRecordService;
@@ -129,7 +131,7 @@
                 public void run() {
                     try {
                         //鐧诲綍鎴愬姛
-                        bDeviceTokenService.bindUid(acceptData.getSystem().name(), acceptData.getUtdId(), userInfo.getId() + "");
+                        pushManager.bindUid(acceptData.getSystem(), userInfo.getId(), acceptData.getPlatform() == APPPlatform.ios ? acceptData.getIdfa() : acceptData.getUtdId());
                     } catch (Exception e) {
 
                     }
@@ -192,7 +194,7 @@
     public String logout(AcceptData acceptData, Long uid) {
         try {
             //瑙g粦UID
-            bDeviceTokenService.unBindUid(acceptData.getSystem().name(), acceptData.getUtdId());
+            pushManager.unBind(acceptData.getSystem(), acceptData.getPlatform() == APPPlatform.ios ? acceptData.getIdfa() : acceptData.getUtdId());
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -204,23 +206,23 @@
     @UserLogin(uid = "#uid")
     @ResponseBody
     @RequestMapping("unRegister")
-    public String unRegister(AcceptData acceptData, String vcode, String phone) {
+    public String unRegister(AcceptData acceptData, Long uid) {
 
-        if (StringUtil.isNullOrEmpty(vcode)) {
-            return JsonUtil.loadFalseResult("楠岃瘉鐮佷笉鑳戒负绌�");
-        }
+//        if (StringUtil.isNullOrEmpty(vcode)) {
+//            return JsonUtil.loadFalseResult("楠岃瘉鐮佷笉鑳戒负绌�");
+//        }
+//
+//        if (StringUtil.isNullOrEmpty(phone)) {
+//            return JsonUtil.loadFalseResult("鎵嬫満鍙蜂笉鑳戒负绌�");
+//        }
+//
+//        if (!verifyCodeManager.isPhoneCodeRight(acceptData.getSystem(), phone, vcode)) {
+//            return JsonUtil.loadFalseResult("楠岃瘉鐮侀敊璇�");
+//        }
 
-        if (StringUtil.isNullOrEmpty(phone)) {
-            return JsonUtil.loadFalseResult("鎵嬫満鍙蜂笉鑳戒负绌�");
-        }
-
-        if (!verifyCodeManager.isPhoneCodeRight(acceptData.getSystem(), phone, vcode)) {
-            return JsonUtil.loadFalseResult("楠岃瘉鐮侀敊璇�");
-        }
-
-        UserInfo user = userInfoService.selectValidByPhone(acceptData.getSystem(), phone);
+        UserInfo user = userInfoService.getAvaiableUser(uid);
         if (user == null) {
-            return JsonUtil.loadFalseResult("涓嶅瓨鍦ㄧ粦瀹氳鎵嬫満鍙风殑鐢ㄦ埛");
+            return JsonUtil.loadFalseResult("鐢ㄦ埛涓嶅瓨鍦ㄦ垨鐢ㄦ埛宸茶灏佺");
         }
         //娉ㄩ攢
         userAccountService.unRegister(user.getId());
@@ -312,28 +314,14 @@
     @ResponseBody
     @RequestMapping("uploadPushRegId")
     public String uploadPushRegId(AcceptData acceptData, Long uid, String regId) {
-
-        BPushDeviceToken deviceToken = new BPushDeviceToken();
-        deviceToken.setAppCode(acceptData.getSystem().name());
-        deviceToken.setDeviceId(acceptData.getUtdId());
-        deviceToken.setBuildModel(acceptData.getDeviceType());
-        deviceToken.setBuildVersion(acceptData.getOsVersion());
-        deviceToken.setToken(regId);
-        deviceToken.setType(PushPlatform.jpush);
-        if (uid != null) {
-            deviceToken.setUid(uid + "");
-        }
-        deviceToken.setVersionCode(acceptData.getVersion());
-
         try {
-            bDeviceTokenService.save(deviceToken);
+            pushManager.saveToken(acceptData, uid, regId);
             return JsonUtil.loadTrueResult("");
         } catch (BPushDeviceTokenException e) {
-            return JsonUtil.loadTrueResult(e.getMessage());
+            return JsonUtil.loadFalseResult(e.getCode(), "涓氬姟鍑洪敊");
         } catch (ParamsException e) {
-            return JsonUtil.loadTrueResult(e.getMessage());
+            return JsonUtil.loadFalseResult(e.getCode(), "鍙傛暟閿欒");
         }
-
     }
 
     /**

--
Gitblit v1.8.0