From cc175f25cbd953fc2c3623495c1f4b8e0efec4ee Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期二, 25 二月 2025 17:12:16 +0800
Subject: [PATCH] 2.0新增

---
 UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java |   82 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 77 insertions(+), 5 deletions(-)

diff --git a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java
index 2bcee57..c8c1ed2 100644
--- a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java
+++ b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java
@@ -1,9 +1,13 @@
 package com.stylefeng.guns.modular.api;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.mapper.Wrapper;
 import com.stylefeng.guns.core.common.constant.JwtConstants;
 import com.stylefeng.guns.core.util.ToolUtil;
+import com.stylefeng.guns.modular.system.model.Invite;
 import com.stylefeng.guns.modular.system.model.UserInfo;
+import com.stylefeng.guns.modular.system.service.IInviteService;
 import com.stylefeng.guns.modular.system.service.ISmsrecordService;
 import com.stylefeng.guns.modular.system.service.IUserInfoService;
 import com.stylefeng.guns.modular.system.service.IVerifiedService;
@@ -18,11 +22,13 @@
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -47,9 +53,69 @@
 
     @Autowired
     private WeChatUtil weChatUtil;
+    @Autowired
+    private IInviteService inviteService;
 
 
-
+    /**
+     * 获取用户邀请二维码
+     * @param request
+     * @return
+     */
+    @ResponseBody
+    @PostMapping("/api/user/getCode")
+    @ApiOperation(value = "获取用户邀请二维码", tags = {"用户端-2.0新增"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+    })
+    public ResultUtil<String> getCode(HttpServletRequest request){
+        try {
+            Integer uid = userInfoService.getUserIdFormRedis(request);
+            if(null == uid){
+                return ResultUtil.tokenErr();
+            }
+            UserInfo userInfo = userInfoService.selectById(uid);
+            if (userInfo.getCode()==null){
+                userInfo = userInfoService.generateCode(userInfo);
+            }
+            return ResultUtil.success(userInfo.getCode());
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
+    /**
+     * 获取用户邀请二维码
+     * @param request
+     * @return
+     */
+    @ResponseBody
+    @PostMapping("/api/user/inviteList")
+    @ApiOperation(value = "获取用户邀请记录", tags = {"用户端-2.0新增"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "开始时间 yyyy-MM-dd", name = "startTime", required = false, dataType = "String"),
+            @ApiImplicitParam(value = "结束时间 yyyy-MM-dd", name = "endTime", required = false, dataType = "String"),
+            @ApiImplicitParam(value = "页码(首页1)", name = "pageNum", required = true, dataType = "int"),
+            @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"),
+            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+    })
+    public ResultUtil inviteList(String startTime,String endTime,Integer pageNum,Integer size,HttpServletRequest request){
+        try {
+            Integer uid = userInfoService.getUserIdFormRedis(request);
+            if(null == uid){
+                return ResultUtil.tokenErr();
+            }
+            if (StringUtils.hasLength(startTime)){
+                startTime = startTime + " 00:00:00";
+                endTime = endTime + " 23:59:59";
+            }
+            List<Invite> invites = inviteService.inviteList(uid,startTime,endTime,pageNum,size);
+            return ResultUtil.success(invites);
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
 
 
     /**
@@ -93,12 +159,15 @@
             @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"),
             @ApiImplicitParam(value = "短信验证码", name = "code", required = true, dataType = "String"),
             @ApiImplicitParam(value = "ip地址", name = "registIp", required = false, dataType = "String"),
+            @ApiImplicitParam(value = "分享人用户id-扫码分享传 ", name = "uid", required = false, dataType = "int"),
+            @ApiImplicitParam(value = "分享人类型1用户2司机-扫码分享传 ", name = "userType", required = false, dataType = "int"),
             @ApiImplicitParam(value = "登录端口-小程序传Applets", name = "loginType", required = false, dataType = "String"),
             @ApiImplicitParam(value = "当前定位区县行政编号", name = "registAreaCode", required = false, dataType = "String")
     })
-    public ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType){
+    public ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType
+            ,Integer uid,Integer userType){
         try {
-            return userInfoService.captchaLogin(phone, code, registIp, registAreaCode,loginType);
+            return userInfoService.captchaLogin(phone, code, registIp, registAreaCode,loginType,uid,userType);
         }catch (Exception e){
             e.printStackTrace();
             return ResultUtil.runErr();
@@ -227,6 +296,8 @@
     @ApiImplicitParams({
             @ApiImplicitParam(value = "登录端口(1:APP,2:小程序)", name = "type", required = true, dataType = "int"),
             @ApiImplicitParam(value = "微信openid(APP登录上传)", name = "openid", required = false, dataType = "String"),
+            @ApiImplicitParam(value = "分享人用户id-扫码分享传 ", name = "uid", required = false, dataType = "int"),
+            @ApiImplicitParam(value = "分享人类型1用户2司机-扫码分享传 ", name = "userType", required = false, dataType = "int"),
             @ApiImplicitParam(value = "微信unionid(APP登录上传)", name = "unionid", required = false, dataType = "String"),
             @ApiImplicitParam(value = "微信jscode(小程序登录上传)", name = "jscode", required = false, dataType = "String"),
             @ApiImplicitParam(value = "ip地址", name = "registIp", required = false, dataType = "String"),
@@ -236,9 +307,10 @@
             @ApiImplicitParam(value = "登录端口-小程序传Applets", name = "loginType", required = false, dataType = "String"),
             @ApiImplicitParam(value = "性别(1=男,2=女)", name = "sex", required = false, dataType = "int")
     })
-    public ResultUtil<LoginWarpper> wxLogin(Integer type, String openid, String unionid, String jscode, String registIp, String registAreaCode, Integer sex, String nickName, String avatar,String loginType){
+    public ResultUtil<LoginWarpper> wxLogin(Integer type, String openid, String unionid, String jscode, String registIp, String registAreaCode, Integer sex, String nickName, String avatar,String loginType
+            ,Integer uid,Integer userType){
         try {
-            return userInfoService.wxLogin(type, openid, unionid, jscode, registIp, registAreaCode, sex, nickName, avatar,loginType);
+            return userInfoService.wxLogin(type, openid, unionid, jscode, registIp, registAreaCode, sex, nickName, avatar,loginType,uid,userType);
         }catch (Exception e){
             e.printStackTrace();
             return ResultUtil.runErr();

--
Gitblit v1.7.1