From 64a18a84cee2913dab964fba762c1300b03acdc4 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 18 五月 2023 16:36:59 +0800
Subject: [PATCH] 更新用户端接口

---
 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java |  134 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 125 insertions(+), 9 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 529c540..daf47ca 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
@@ -7,12 +7,11 @@
 import com.stylefeng.guns.core.support.HttpKit;
 import com.stylefeng.guns.core.util.ToolUtil;
 import com.stylefeng.guns.modular.system.model.UserInfo;
+import com.stylefeng.guns.modular.system.service.IReportLossService;
 import com.stylefeng.guns.modular.system.service.ISmsrecordService;
 import com.stylefeng.guns.modular.system.service.IUserInfoService;
 import com.stylefeng.guns.modular.system.service.IVerifiedService;
-import com.stylefeng.guns.modular.system.util.ALiApiUtil;
-import com.stylefeng.guns.modular.system.util.RedisUtil;
-import com.stylefeng.guns.modular.system.util.ResultUtil;
+import com.stylefeng.guns.modular.system.util.*;
 import com.stylefeng.guns.modular.system.warpper.LoginWarpper;
 import com.stylefeng.guns.modular.system.warpper.UserInfoWarpper;
 import com.stylefeng.guns.modular.system.warpper.UserInviteInfoWarpper;
@@ -26,10 +25,7 @@
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 用户控制器
@@ -53,7 +49,10 @@
     private RedisUtil redisUtil;
 
     @Autowired
-    private ALiApiUtil aLiApiUtil;
+    private IReportLossService reportLossService;
+
+
+
 
     @ResponseBody
     @PostMapping("/base/isEnterEmergencyContact")
@@ -130,6 +129,34 @@
             return ResultUtil.paranErr();
         }
     }
+
+    @ResponseBody
+    @PostMapping("/base/sedEmail")
+    @ApiOperation(value = "获取邮箱验证码【1.0】", tags = {"用户端-登录"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "邮箱地址", name = "email", required = true, dataType = "String")
+    })
+    public ResultUtil sedEmail(String email){
+        try {
+            if(ToolUtil.isEmpty(email)){
+                return ResultUtil.error("邮箱地址不能为空");
+            }
+            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);
+            EmailUtil.getMimeMessage(email, "验证码", "您的验证码:<span style=\"color:red;\">" + authCode + "</span>");
+            return ResultUtil.success();
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
+
+
 
 
     /**
@@ -298,6 +325,28 @@
     }
 
 
+    @ResponseBody
+    @PostMapping("/base/user/facebookLogin")
+    @ApiOperation(value = "FaceBook授权登录【1.0】", tags = {"用户端-登录"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "FaceBook用户id", name = "id", required = true, dataType = "String"),
+            @ApiImplicitParam(value = "FaceBook用户名称", name = "name", required = true, dataType = "String"),
+            @ApiImplicitParam(value = "FaceBook绑定的email", name = "email", required = false, dataType = "String"),
+            @ApiImplicitParam(value = "当前定位区县行政编号", name = "registAreaCode", required = true, dataType = "String"),
+            @ApiImplicitParam(value = "分享的用户id", name = "uid", required = false, dataType = "int"),
+    })
+    public ResultUtil facebookLogin(String id, String name, String email, String registAreaCode, Integer uid){
+        try {
+            return userInfoService.facebookLogin(id, name, email, registAreaCode, uid);
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
+
+
+
+
     /**
      * 设置电话号码
      * @param phone
@@ -327,6 +376,29 @@
     }
 
 
+    @ResponseBody
+    @PostMapping("/api/user/bindingEmail")
+    @ApiOperation(value = "设置邮箱地址【1.0】", tags = {"用户端-登录"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "绑定类型(1=注册账号绑定,2=个人中心绑定)", name = "type", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "邮箱地址", name = "email", required = true, dataType = "String"),
+            @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+    })
+    public ResultUtil<LoginWarpper> bindingEmail(Integer type, String email, String code, HttpServletRequest request){
+        try {
+            Integer uid = userInfoService.getUserIdFormRedis(request);
+            if(null == uid){
+                return ResultUtil.tokenErr();
+            }
+            return userInfoService.bindingEmail(uid, type, email, code);
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
+
+
     /**
      * 获取用户个人信息
      * @param request
@@ -334,7 +406,7 @@
      */
     @ResponseBody
     @PostMapping("/api/user/queryUserInfo")
-    @ApiOperation(value = "获取用户详情", tags = {"用户端-个人中心"}, notes = "")
+    @ApiOperation(value = "获取用户详情【1.0】", tags = {"用户端-个人中心"}, notes = "")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
     })
@@ -712,4 +784,48 @@
         }
     }
 
+
+
+    @ResponseBody
+    @PostMapping("/api/user/editLanguage")
+    @ApiOperation(value = "修改多语言配置", tags = {"用户端-个人中心"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "1=中文,2=英文,3=法语", name = "language", required = true, dataType = "int"),
+            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+    })
+    public ResultUtil editLanguage(Integer language, HttpServletRequest request){
+        try {
+            Integer uid = userInfoService.getUserIdFormRedis(request);
+            if(null == uid){
+                return ResultUtil.tokenErr();
+            }
+            UserInfo userInfo = userInfoService.selectById(uid);
+            userInfo.setLanguage(language);
+            userInfoService.updateById(userInfo);
+            return ResultUtil.success();
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
+
+
+    @ResponseBody
+    @PostMapping("/base/user/addReportLoss")
+    @ApiOperation(value = "提交报失", tags = {"用户端-个人中心"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城出行,4=同城小件物流,5=跨城小件物流)", name = "orderType", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "提交内容", name = "remark", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "提交图片", name = "image", required = true, dataType = "int"),
+    })
+    public ResultUtil addReportLoss(Integer orderType, Integer orderId, String remark, String image){
+        try {
+            reportLossService.addReportLoss(orderType, orderId, remark, image);
+            return ResultUtil.success();
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
 }

--
Gitblit v1.7.1