| | |
| | | import com.ruoyi.account.service.UserCancellationLogService; |
| | | import com.ruoyi.account.service.UserCouponService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.feignClient.StoreClient; |
| | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/recommend") |
| | | @ApiOperation(value = "推广中心", tags = {"小程序-推广中心"}) |
| | | public R<AppUser> recommend(){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserid(); |
| | | //获取绑定门店 |
| | | AppUser user = appUserService.getById(userId); |
| | | if (user.getShopId()!=null){ |
| | | R<Shop> storeById = storeClient.getStoreById(user.getShopId()); |
| | | if (storeById.getData()!=null){ |
| | | user.setShopName(storeById.getData().getName()); |
| | | user.setShopCover(storeById.getData().getHomePicture()); |
| | | user.setShopAddress(storeById.getData().getAddress()); |
| | | } |
| | | } |
| | | |
| | | //获取绑定上级 |
| | | if (user.getInviteUserId()!=null) { |
| | | AppUser byId = appUserService.getById(user.getInviteUserId()); |
| | | user.setTopUser(byId); |
| | | } |
| | | //获取绑定下级列表 |
| | | List<AppUser> list = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, user.getInviteUserId()).list(); |
| | | for (AppUser appUser : list) { |
| | | Long count1 = appUserService.lambdaQuery().eq(AppUser::getVipId, 1).eq(AppUser::getTopInviteId, 1).count(); |
| | | Long count2 = appUserService.lambdaQuery().eq(AppUser::getVipId, 2).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count3 = appUserService.lambdaQuery().eq(AppUser::getVipId, 3).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count4 = appUserService.lambdaQuery().eq(AppUser::getVipId, 4).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count5 = appUserService.lambdaQuery().eq(AppUser::getVipId, 5).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count6 = appUserService.lambdaQuery().eq(AppUser::getVipId, 6).eq(AppUser::getTopInviteId, userId).count(); |
| | | Long count7 = appUserService.lambdaQuery().eq(AppUser::getVipId, 7).eq(AppUser::getTopInviteId, userId).count(); |
| | | appUser.setCount1(count1); |
| | | appUser.setCount2(count2); |
| | | appUser.setCount3(count3); |
| | | appUser.setCount4(count4); |
| | | appUser.setCount5(count5); |
| | | appUser.setCount6(count6); |
| | | appUser.setCount7(count7); |
| | | } |
| | | user.setBottomUsers(list); |
| | | |
| | | return R.ok(user); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/index") |
| | | @ApiOperation(value = "个人中心首页", tags = {"小程序-个人中心首页"}) |