Bladeren bron

修改用户设备信息

zhouxianguang 6 jaren geleden
bovenliggende
commit
5ee11d4259

+ 22 - 0
rankin-api-web/src/main/java/cn/rankin/apiweb/controller/LoginController.java

@@ -123,6 +123,17 @@ public class LoginController
                 loginInfoDTO.setDeviceModel(model);
             }
         }
+        else if ("TABLET".equals(deviceType))
+        {
+            Pattern pattern = Pattern.compile(";\\s?(\\S*?\\s?\\S*?)\\s?(Build)?/");
+            Matcher matcher = pattern.matcher(userAgentStr);
+            String model = null;
+            if (matcher.find())
+            {
+                model = matcher.group(1).trim();
+                loginInfoDTO.setDeviceModel(model);
+            }
+        }
         else
         {
             loginInfoDTO.setDeviceModel(osName);
@@ -177,6 +188,17 @@ public class LoginController
                 loginInfoDTO.setDeviceModel(model);
             }
         }
+        else if ("TABLET".equals(deviceType))
+        {
+            Pattern pattern = Pattern.compile(";\\s?(\\S*?\\s?\\S*?)\\s?(Build)?/");
+            Matcher matcher = pattern.matcher(userAgentStr);
+            String model = null;
+            if (matcher.find())
+            {
+                model = matcher.group(1).trim();
+                loginInfoDTO.setDeviceModel(model);
+            }
+        }
         else
         {
             loginInfoDTO.setDeviceModel(osName);

+ 8 - 0
rankin-api-web/src/main/java/cn/rankin/apiweb/service/user/UserService.java

@@ -144,6 +144,10 @@ public class UserService
             dto.setDeviceType(deviceType);
             dto.setDeviceMfrs(deviceMfrs);
             dto.setDeviceName(deviceName);
+            if(deviceModel == "" || deviceModel == null)
+            {
+                dto.setDeviceModel("未知");
+            }
 
             int opRet = userClient.opUserDevice(userId,dto);
             if (opRet == 0)
@@ -318,6 +322,10 @@ public class UserService
             dto.setDeviceType(deviceType);
             dto.setDeviceMfrs(deviceMfrs);
             dto.setDeviceName(deviceName);
+            if(deviceModel == "" || deviceModel == null)
+            {
+                dto.setDeviceModel("未知");
+            }
 
             int opRet = userClient.opUserDevice(uid,dto);
             if (opRet == 0)