From 792cbb986fb8c32f6bbc1638c4ae264372e7a28f Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 23 一月 2025 19:31:36 +0800
Subject: [PATCH] 新增引流接口及业务逻辑
---
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java | 94 ++++++++++++++++++++++++++++++++++-------------
1 files changed, 68 insertions(+), 26 deletions(-)
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
index d808e07..83f0fd9 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -798,35 +798,32 @@
public R giveVip(@RequestBody GiveVipDto giveVipDto) {
String[] split = giveVipDto.getUserIds().split(",");
for (String s : split) {
-
-
- TAppUser nowUser = appUserService.getById(s);
-
- int plusDay = 0;
- if (giveVipDto.getType() == 1) {
- plusDay = 1;
- } else if (giveVipDto.getType() == 2) {
- plusDay = 3;
- } else if (giveVipDto.getType() == 3) {
- plusDay = 12;
- }
+ TAppUser nowUser = appUserService.getById(s);
+ int plusDay = 0;
+ if (giveVipDto.getType() == 1) {
+ plusDay = 1;
+ } else if (giveVipDto.getType() == 2) {
+ plusDay = 3;
+ } else if (giveVipDto.getType() == 3) {
+ plusDay = 12;
+ }
BigDecimal bigDecimal = new BigDecimal("0");
TVip info = vipClient.getInfo1(giveVipDto.getVipId()).getData();
- switch (giveVipDto.getType()){
- case 1:
- bigDecimal = bigDecimal.add(info.getMonthlyCard()==null?new BigDecimal(0):info.getMonthlyCard());
- break;
- case 2:
- bigDecimal = bigDecimal.add(info.getSeasonCard()==null?new BigDecimal(0):info.getSeasonCard());
- break;
- case 3:
- bigDecimal = bigDecimal.add(info.getAnnualCard()==null?new BigDecimal(0):info.getAnnualCard());
- break;
- }
+ switch (giveVipDto.getType()){
+ case 1:
+ bigDecimal = bigDecimal.add(info.getMonthlyCard()==null?new BigDecimal(0):info.getMonthlyCard());
+ break;
+ case 2:
+ bigDecimal = bigDecimal.add(info.getSeasonCard()==null?new BigDecimal(0):info.getSeasonCard());
+ break;
+ case 3:
+ bigDecimal = bigDecimal.add(info.getAnnualCard()==null?new BigDecimal(0):info.getAnnualCard());
+ break;
+ }
//增加vipDetail
- giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay,giveVipDto.getType());
- appUserService.updateById(nowUser);
- // 新增后台赠送记录
+ giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay,giveVipDto.getType());
+ appUserService.updateById(nowUser);
+ // 新增后台赠送记录
TGrantVip tGrantVip = new TGrantVip();
tGrantVip.setCode(OrderCodeUtil.getOrderCode("ZS"));
tGrantVip.setAppUserId(nowUser.getId());
@@ -838,6 +835,51 @@
}
return R.ok();
}
+
+
+
+ @PostMapping(value = "/user/give/vip1")
+ public R giveVip1(@RequestBody GiveVipDto giveVipDto) {
+ String[] split = giveVipDto.getUserIds().split(",");
+ for (String s : split) {
+ TAppUser nowUser = appUserService.getById(s);
+ int plusDay = 0;
+ if (giveVipDto.getType() == 1) {
+ plusDay = 1;
+ } else if (giveVipDto.getType() == 2) {
+ plusDay = 3;
+ } else if (giveVipDto.getType() == 3) {
+ plusDay = 12;
+ }
+ BigDecimal bigDecimal = new BigDecimal("0");
+ TVip info = vipClient.getInfo1(giveVipDto.getVipId()).getData();
+ switch (giveVipDto.getType()){
+ case 1:
+ bigDecimal = bigDecimal.add(info.getMonthlyCard()==null?new BigDecimal(0):info.getMonthlyCard());
+ break;
+ case 2:
+ bigDecimal = bigDecimal.add(info.getSeasonCard()==null?new BigDecimal(0):info.getSeasonCard());
+ break;
+ case 3:
+ bigDecimal = bigDecimal.add(info.getAnnualCard()==null?new BigDecimal(0):info.getAnnualCard());
+ break;
+ }
+ //增加vipDetail
+ giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay,giveVipDto.getType());
+ appUserService.updateById(nowUser);
+ // 新增后台赠送记录
+ TGrantVip tGrantVip = new TGrantVip();
+ tGrantVip.setCode(OrderCodeUtil.getOrderCode("ZS"));
+ tGrantVip.setAppUserId(nowUser.getId());
+ tGrantVip.setVipId(giveVipDto.getVipId());
+ tGrantVip.setOrderAmount(bigDecimal);
+ tGrantVip.setCreateTime(LocalDateTime.now());
+ tGrantVip.setAppUserId(nowUser.getId());
+ orderClient.managementGiveVip(tGrantVip);
+ }
+ return R.ok();
+ }
+
@ApiOperation(value = "已赠送列表", tags = {"小程序-个人中心-邀请好友"})
@PostMapping(value = "/user/invite/page")
--
Gitblit v1.7.1