From f44df77f5b4dc2c49902e1c4d921bd8305ac1e50 Mon Sep 17 00:00:00 2001
From: liujie <liujie>
Date: 星期三, 06 九月 2023 16:59:59 +0800
Subject: [PATCH] 用户端 推特登录

---
 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java |  106 +++++++++++++++++++++++++++-------------------------
 1 files changed, 55 insertions(+), 51 deletions(-)

diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java
index e12337e..7138ccb 100644
--- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java
+++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java
@@ -9,6 +9,7 @@
 import com.stylefeng.guns.core.support.HttpKit;
 import com.stylefeng.guns.core.util.ToolUtil;
 import com.stylefeng.guns.modular.system.model.BankCard;
+import com.stylefeng.guns.modular.system.model.TEmail;
 import com.stylefeng.guns.modular.system.model.UserInfo;
 import com.stylefeng.guns.modular.system.service.*;
 import com.stylefeng.guns.modular.system.util.*;
@@ -68,6 +69,9 @@
     @Value("${spring.mail.template-path}")
     private String templatePath;
 
+    @Autowired
+    private TEmailService emailService;
+
 
 
 
@@ -112,8 +116,6 @@
         }
     }
 
-
-
     /**
      * 获取短信验证码
      * @param phone
@@ -154,8 +156,6 @@
         }
     }
 
-
-
     @ResponseBody
     @PostMapping("/base/queryCaptcha1")
     @ApiOperation(value = "获取短信验证码", tags = {"用户端-登录"}, notes = "")
@@ -183,10 +183,6 @@
         }
     }
 
-
-
-
-
     @ResponseBody
     @PostMapping("/base/sedEmail")
     @ApiOperation(value = "获取邮箱验证码【1.0】", tags = {"用户端-登录"}, notes = "")
@@ -195,22 +191,33 @@
     })
     public ResultUtil sedEmail(String email, Integer language, HttpServletRequest request){
         try {
+
             Integer uid = userInfoService.getUserIdFormRedis(request);
+
             if(ToolUtil.isEmpty(email)){
                 return ResultUtil.error(language == 1 ? "邮箱不能为空" : language == 2 ? "The mailbox cannot be empty" : "L’email ne peut pas être vide");
             }
+
             Random random = new Random();
+
             StringBuffer sb = new StringBuffer();
+
             for(int i = 0; i < 4; i++){
                 sb.append((int) (random.nextDouble() * 10));
             }
+
             String authCode = sb.toString();
+
             redisUtil.setStrValue(email, authCode, 5 * 60);
 
             UserInfo userInfo = userInfoService.selectById(uid);
+
             String nickName = "";
+
             if(null != userInfo){
+
                 nickName = userInfo.getNickName();
+
             }
 
             if(ToolUtil.isNotEmpty(email)){
@@ -240,7 +247,6 @@
                     Element content_french = document.getElementById("content_french");
                     content_french.text(authCode);
                 }
-
                 EmailUtil.send(email, language == 1 ? "验证码" : language == 2 ? "Verification code" : "Code de vérification",  document.html());
             }
             return ResultUtil.success();
@@ -249,9 +255,6 @@
             return ResultUtil.runErr();
         }
     }
-
-
-
 
     /**
      * 手机验证码登录
@@ -301,8 +304,6 @@
         }
     }
 
-
-
     /**
      * 手机验证码登录
      * @param phone
@@ -350,10 +351,6 @@
         }
     }
 
-
-
-
-
     /**
      * 账号密码登录
      * @param phone
@@ -386,7 +383,6 @@
             return ResultUtil.paranErr();
         }
     }
-
 
     /**
      * 忘记密码
@@ -422,7 +418,6 @@
             return ResultUtil.paranErr();
         }
     }
-
 
     /**
      * 微信授权登录
@@ -477,7 +472,6 @@
         }
     }
 
-
     @ResponseBody
     @PostMapping("/base/user/facebookLogin")
     @ApiOperation(value = "FaceBook授权登录【1.0】", tags = {"用户端-登录"}, notes = "")
@@ -493,15 +487,33 @@
     })
     public ResultUtil facebookLogin(String id, String name, String email, Double lat, Double lng, Integer uid, Integer language){
         try {
-            return userInfoService.facebookLogin(id, name, email, lat, lng, uid, language);
+            return userInfoService.facebookLogin(id, name, email, lat, lng, uid, language,1);
         }catch (Exception e){
             e.printStackTrace();
             return ResultUtil.runErr();
         }
     }
-
-
-
+    @ResponseBody
+    @PostMapping("/base/user/twitterLogin")
+    @ApiOperation(value = "twitter授权登录【1.0】", tags = {"用户端-登录"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "twitter用户id", name = "id", required = true, dataType = "String"),
+            @ApiImplicitParam(value = "twitter用户名称", name = "name", required = true, dataType = "String"),
+            @ApiImplicitParam(value = "twitter绑定的email", name = "email", required = false, dataType = "String"),
+            @ApiImplicitParam(value = "头像", name = "avatar", required = false, dataType = "String"),
+            @ApiImplicitParam(value = "性别(1=男,2=女)", name = "sex", required = false, dataType = "int"),
+            @ApiImplicitParam(value = "纬度", name = "lat", required = false, dataType = "double"),
+            @ApiImplicitParam(value = "经度", name = "lng", required = false, dataType = "double"),
+            @ApiImplicitParam(value = "分享的用户id", name = "uid", required = false, dataType = "int"),
+    })
+    public ResultUtil twitterLogin(String id, String name, String email, Double lat, Double lng, Integer uid, Integer language){
+        try {
+            return userInfoService.facebookLogin(id, name, email, lat, lng, uid, language,2);
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
 
     /**
      * 设置电话号码
@@ -553,7 +565,6 @@
         }
     }
 
-
     @ResponseBody
     @PostMapping("/api/user/bindingEmail")
     @ApiOperation(value = "设置邮箱地址【1.0】", tags = {"用户端-登录"}, notes = "")
@@ -576,6 +587,24 @@
         }
     }
 
+    @ResponseBody
+    @PostMapping("/api/user/getEmailList")
+    @ApiOperation(value = "获取邮箱信息", tags = {"用户端-获取邮箱信息"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+    })
+    public ResultUtil<?> getEmailList(HttpServletRequest request){
+        try {
+            Integer uid = userInfoService.getUserIdFormRedis(request);
+            if(null == uid){
+                return ResultUtil.tokenErr();
+            }
+            return ResultUtil.success(emailService.selectList(new EntityWrapper<TEmail>().eq("userId",uid).eq("type",1).orderBy("createTime",false)));
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
 
     /**
      * 获取用户个人信息
@@ -601,7 +630,6 @@
             return ResultUtil.runErr();
         }
     }
-
 
     /**
      * 手机号码获取用户
@@ -635,7 +663,6 @@
         }
     }
 
-
     /**
      * 实名认证操作
      * @param verifiedWarpper
@@ -660,7 +687,6 @@
             return ResultUtil.runErr();
         }
     }
-
 
     /**
      * 设置紧急联系人
@@ -698,7 +724,6 @@
         }
     }
 
-
     /**
      * 用户充值余额
      * @param payType
@@ -728,7 +753,6 @@
             return ResultUtil.runErr();
         }
     }
-
 
     /**
      * 修改手机号码
@@ -813,8 +837,6 @@
         }
     }
 
-
-
     /**
      * 修改登录密码
      * @param password
@@ -840,7 +862,6 @@
             return ResultUtil.runErr();
         }
     }
-
 
     /**
      * 修改个人信息
@@ -878,7 +899,6 @@
         }
     }
 
-
     @ResponseBody
     @PostMapping("/api/user/queryRealName")
     @ApiOperation(value = "获取实名认证的数据", tags = {"用户端-个人中心"}, notes = "")
@@ -899,7 +919,6 @@
         }
     }
 
-
     /**
      * 后台调用禁用用户
      * @param uid
@@ -919,7 +938,6 @@
             return ResultUtil.runErr();
         }
     }
-
 
     /**
      * 仿socket接口(单点登录)
@@ -1009,8 +1027,6 @@
         }
     }
 
-
-
     @ResponseBody
     @PostMapping("/api/user/editLanguage")
     @ApiOperation(value = "修改多语言配置", tags = {"用户端-个人中心"}, notes = "")
@@ -1034,7 +1050,6 @@
         }
     }
 
-
     @ResponseBody
     @PostMapping("/base/user/addReportLoss")
     @ApiOperation(value = "提交报失", tags = {"用户端-个人中心"}, notes = "")
@@ -1054,8 +1069,6 @@
         }
     }
 
-
-
     @ResponseBody
     @PostMapping("/base/user/queryOrderLicensePlate")
     @ApiOperation(value = "获取报失也车牌等信息", tags = {"用户端-个人中心"}, notes = "")
@@ -1073,8 +1086,6 @@
         }
     }
 
-
-
     @ResponseBody
     @RequestMapping("/base/user/image")
     public String image(@RequestPart("file") MultipartFile file) {
@@ -1085,8 +1096,6 @@
             return null;
         }
     }
-
-
 
     @ResponseBody
     @PostMapping("/api/user/queryBankCardList")
@@ -1115,8 +1124,6 @@
             return ResultUtil.runErr();
         }
     }
-
-
 
     @ResponseBody
     @PostMapping("/api/user/addBankCard")
@@ -1160,8 +1167,6 @@
         }
     }
 
-
-
     @ResponseBody
     @PostMapping("/api/user/delBankCard")
     @ApiOperation(value = "删除银行卡【1.1】", tags = {"用户端-个人中心"}, notes = "")
@@ -1178,7 +1183,6 @@
             return ResultUtil.runErr();
         }
     }
-
 
     /**
      * 下载pdf

--
Gitblit v1.7.1