无关风月
2024-08-19 c1f788b3cd5fc405906837da0fa102850fdc0c7f
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -35,6 +35,7 @@
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
@@ -86,6 +87,19 @@
    private WeixinProperties wxConfig;
    @Autowired
    private RestTemplate wxRestTemplate;
    @ApiOperation(value = "查询当前用户是否为会员 0否1是", tags = {"小程序--查询当前用户是否为会员"})
    @PostMapping(value = "/getUserInfo")
    public AjaxResult<Integer> getUserInfo() {
        TAppUser byId = appUserService.getById(tokenService.getLoginUserApplet().getUserId());
        if (byId.getVipEndTime() == null){
            return AjaxResult.ok(0);
        }else if (byId.getVipEndTime().isAfter(LocalDateTime.now())){
            return AjaxResult.ok(1);
        }else{
            return AjaxResult.ok(0);
        }
    }
    @ApiOperation(value = "通过code获得openid,  1 --->对应的appid:wx4c405fa42539fc21  2---->对应的appid:wx02d9f6c92e6d3c86")
    @GetMapping("openId-by-jscode2session/{code}")
    public AjaxResult<Map<String, Object>> jscode2session(@PathVariable String code) {