From c79a494a58c633deb607f2e880f2ea1f6d9eea64 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期一, 15 十二月 2025 09:39:07 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/jiashida
---
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java | 86 ++++++++++++++++++++++++++++++++++++++++--
1 files changed, 81 insertions(+), 5 deletions(-)
diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java
index 1c0ddd3..a00f7d9 100644
--- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java
@@ -1,29 +1,84 @@
package com.ruoyi.web.controller.api;
+import cn.hutool.core.util.PhoneUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.model.LoginUserApplet;
+import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.system.model.TAppUser;
import com.ruoyi.system.model.TBanner;
-import com.ruoyi.system.service.TBannerService;
+import com.ruoyi.system.model.TBigGiftPackage;
+import com.ruoyi.system.model.TPhysicalGoods;
+import com.ruoyi.system.query.AppletPhysicalGoodsQuery;
+import com.ruoyi.system.service.*;
+import com.ruoyi.system.vo.SupervisorUserVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Lazy;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import javax.validation.constraints.NotNull;
import java.util.List;
+import java.util.Objects;
@Slf4j
@RestController
@RequestMapping("/index")
@Api(tags = "首页模块")
+@Validated
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
public class IndexController {
private final TBannerService tBannerService;
+ private final TAppUserService tAppUserService;
+ private final TokenService tokenService;
+ private final ISysUserService sysUserService;
+ private final TBigGiftPackageService bigGiftPackageService;
+ private final TPhysicalGoodsService physicalGoodsService;
+ @ApiOperation("根据推广码获取上级用户信息")
+ @GetMapping("/getSuperiorInfo")
+ public R<SupervisorUserVO> getSuperiorInfo(@ApiParam(name = "superiorType", value = "上级类型 1:股东;2:营销员")
+ @NotNull(message = "上级类型不能为空") @RequestParam Integer superiorType,
+ @ApiParam(name = "spreadCode", value = "推广码")
+ @NotNull(message = "推广码不能为空") @RequestParam String spreadCode) {
+ SupervisorUserVO supervisorUserVO = new SupervisorUserVO();
+ //根据上级类型获取上级用户信息
+ if (superiorType.equals(1)) {
+ SysUser sysUser = sysUserService.selectByCode(spreadCode);
+ if (Objects.nonNull(sysUser)) {
+ supervisorUserVO.setId(sysUser.getUserId().intValue());
+ supervisorUserVO.setPhone((String) PhoneUtil.hideBetween(sysUser.getPhonenumber()));
+ supervisorUserVO.setNickName(sysUser.getNickName());
+ supervisorUserVO.setAvatar(""); //todo 设置默认头像
+ }
+ } else {
+ tAppUserService.lambdaQuery().eq(TAppUser::getCode, spreadCode).ne(TAppUser::getStatus, 3).last("LIMIT 1").oneOpt()
+ .ifPresent(appUser -> {
+ supervisorUserVO.setId(appUser.getId());
+ supervisorUserVO.setPhone((String) PhoneUtil.hideBetween(appUser.getPhone()));
+ supervisorUserVO.setAvatar(appUser.getProfilePhoto());
+ supervisorUserVO.setNickName(appUser.getName());
+ });
+ }
+ return R.ok(supervisorUserVO);
+ }
+
+ @ApiOperation("确认上级用户-接受邀请")
+ @GetMapping("/confirmSuperior")
+ public R<?> confirmSuperior(@ApiParam(name = "superiorType", value = "上级类型 1:股东;2:营销员")
+ @NotNull(message = "上级类型不能为空") @RequestParam Integer superiorType,
+ @ApiParam(name = "superiorId", value = "上级用户ID")
+ @NotNull(message = "上级ID不能为空") @RequestParam Integer superiorId) {
+ LoginUserApplet loginUserApplet = tokenService.getLoginUserApplet();
+ tAppUserService.confirmSuperior(superiorType, superiorId, loginUserApplet);
+ return R.ok();
+ }
@ApiOperation(value = "首页模块--轮播图",response = TBanner.class)
@GetMapping(value = "/getBannerList")
@@ -38,5 +93,26 @@
TBanner tBanner = tBannerService.getById(id);
return R.ok(tBanner);
}
+ @ApiOperation("获取大礼包列表")
+ @GetMapping("/big-gift/list")
+ public R<List<TBigGiftPackage>> getBigGiftList() {
+ return R.ok(bigGiftPackageService.list());
+ }
+ @ApiOperation("大礼包商品详情")
+ @GetMapping("/big-gift/detail/{id}")
+ public R<TBigGiftPackage> getBigGiftDetail(@ApiParam(name = "id", value = "大礼包ID") @PathVariable Integer id) {
+ return R.ok(bigGiftPackageService.getById(id));
+ }
+
+ @ApiOperation("实物商品分页列表")
+ @PostMapping("/physical-goods/page")
+ public R<IPage<TPhysicalGoods>> getPhysicalGoodsPageList(@RequestBody AppletPhysicalGoodsQuery query) {
+ return R.ok(physicalGoodsService.getPageList(query));
+ }
+ @ApiOperation("实物商品详情")
+ @GetMapping("/physical-goods/detail/{id}")
+ public R<TPhysicalGoods> getPhysicalGoodsDetail(@ApiParam(name = "id", value = "实物商品ID")@PathVariable Integer id) {
+ return R.ok(physicalGoodsService.getById(id));
+ }
}
--
Gitblit v1.7.1