| | |
| | | import com.ruoyi.account.api.vo.GetAppUserVipDetail; |
| | | import com.ruoyi.account.service.TAppUserVipDetailService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | |
| | | @Resource |
| | | private TAppUserVipDetailService appUserVipDetailService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * 获取用户当前有效的vip明细 |
| | |
| | | .last(" and now() between start_time and end_time")); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | @Resource |
| | | private VipClient vipClient; |
| | | |
| | | @GetMapping("/getVipUseDetail") |
| | | @ApiOperation(value = "生效会员列表", tags = {"小程序-个人中心"}) |
| | | public R<List<TAppUserVipDetail>> getVipUseDetail(){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | List<TAppUserVipDetail> list = appUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, userId).last(" and now() between start_time and end_time order by start_time desc").list(); |
| | | |
| | | for (TAppUserVipDetail tAppUserVipDetail : list) { |
| | | if(null != tAppUserVipDetail.getVipId()){ |
| | | TVip data = vipClient.getInfo1(tAppUserVipDetail.getVipId()).getData(); |
| | | tAppUserVipDetail.setVipName(data.getName()); |
| | | } |
| | | } |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改会员明细 |
| | | * @param appUserVipDetail |
| | | */ |
| | | @PostMapping("/updateAppUserVipDetail") |
| | | public void updateAppUserVipDetail(@RequestBody TAppUserVipDetail appUserVipDetail){ |
| | | appUserVipDetailService.updateById(appUserVipDetail); |
| | | } |
| | | |
| | | } |