瀏覽代碼

处理导入数据时手机号码加密两次的问题

zhou.xiaoning 2 年之前
父節點
當前提交
2c5be16709
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      models/account.go

+ 8 - 1
models/account.go

@@ -704,7 +704,14 @@ func GetUserInfo(userID int) (*Userinfo, error) {
 	if len(userInfo.Mobile) > 0 {
 		if s1, err := hex.DecodeString(userInfo.Mobile); err == nil { // hex -> []byte
 			if s2, err := utils.AESDecrypt(s1, key); err == nil {
-				userInfo.Mobile2 = string(s2)
+				// 临时操作 - 解决导入数据手机号码被加密两次的问题
+				if len(userInfo.Mobile) >= 40 {
+					if s3, err := utils.AESDecrypt(s2, key); err == nil {
+						userInfo.Mobile2 = string(s3)
+					}
+				} else {
+					userInfo.Mobile2 = string(s2)
+				}
 			}
 		}
 	}