luodangjia
2024-12-09 5728732f45cc45f3c5cbde0abe7a7c5efee605b9
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java
@@ -1,9 +1,8 @@
package com.ruoyi.account.controller;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.service.AppUserService;
import com.ruoyi.account.service.VipCenterService;
import com.ruoyi.account.service.VipSettingService;
import com.ruoyi.account.vo.vip.Level;
import com.ruoyi.account.vo.vip.VipLevel;
@@ -18,9 +17,11 @@
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@@ -49,6 +50,8 @@
    private VipGoodClient vipGoodClient;
    @Resource
    private AppUserService appUserService;
    @Resource
    private VipCenterService vipCenterService;
    @GetMapping("getVipLevelList")
@@ -56,7 +59,7 @@
    public R<VipLevel> vipLevelList() {
        try {
            R<List<VipSetting>> r = remoteVipSettingClient.list();
            if (!checkSuccess(r)) {
            if (checkSuccess(r)) {
                return R.fail("会员等级获取失败");
            }
            List<VipSetting> vipSettingList = r.getData();
@@ -65,7 +68,7 @@
            }
            R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(3);
            if (!checkSuccess(baseSettingR)) {
            if (checkSuccess(baseSettingR)) {
                log.error("【会员设置说明】获取失败:{}", baseSettingR.getMsg());
                return R.fail("会员等级获取失败");
            }
@@ -124,21 +127,22 @@
    }
    public R<Void> test() {
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        AppUser appUser = appUserService.getById(loginUserApplet.getUserid());
        if (appUser.getShopPoint() < 500){
            return R.fail("消费积分不足500");
    @GetMapping("/check")
    @ApiOperation(value = "会员申请检查", tags = {"会员中心-小程序"})
    public R<Boolean> check(@ApiParam("4:准代理,5:代理,6:总代理,7:合伙人") @RequestParam Integer type) {
        LoginUser loginUser = tokenService.getLoginUser();
        Long userid = loginUser.getUserid();
        if (type == 4){
            return R.ok(vipCenterService.checkReadyToBeProxy(userid, type));
        }else if (type == 5){
            return R.ok(vipCenterService.checkReadyToBeAgent(userid));
        }else if (type == 6){
            return R.ok(vipCenterService.checkReadyToBeTotalAgent(userid));
        }else if (type == 7){
            return R.ok(vipCenterService.checkReadyToBePartner(userid));
        }else {
            return R.fail("参数错误");
        }
        if (appUser.getSharePoint() < 500){
            return R.fail("返佣积分不足500");
        }
        // 当前用户的直推用户
//        List<AppUser> bottomUsers = appUserService.list(new LambdaQueryWrapper<AppUser>()
//                .eq(AppUser::getInviteUserId, loginUserApplet.getUserid())
//                .eq(AppUser::getVipId));
        return null;
    }