红包抽奖次数提示

This commit is contained in:
GYJ
2024-12-07 11:36:09 +08:00
parent 94159c174e
commit 8c22e7ed95
3 changed files with 22 additions and 0 deletions

View File

@@ -46,6 +46,13 @@ public class AppCourseController extends AbstractController {
return courseDetailsService.selectCourseDetailsById(id, token, courseDetailsId);
}
@Login
@GetMapping("/getRedEnvelopeTips")
@ApiOperation("获取抽奖红包提示")
public Result getRedEnvelopeTips(@RequestAttribute("userId") Long userId) {
return courseService.getRedEnvelopeTips(userId);
}
@GetMapping("/selectCourseDetailsList")
@ApiOperation("查询推荐视频")
public Result selectCourseDetailsList(Integer page, Integer limit, String token, String randomNum, Integer wxShow, Integer dyShow) {

View File

@@ -61,4 +61,6 @@ public interface CourseService extends IService<Course> {
Result viewCourse(Long userId, Long courseId, Long courseDetailsId, String type);
Result getRedEnvelopeTips(Long userId);
}

View File

@@ -1,5 +1,6 @@
package com.sqx.modules.course.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -1258,4 +1259,16 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, Course> implements
return Result.success();
}
@Override
public Result getRedEnvelopeTips(Long userId) {
// 查询 用户 购买次数
Integer count = ordersService.countOrderNum(userId, DateUtil.formatTime(DateUtil.beginOfDay(new Date())));
String totalCount = commonInfoService.findOne(901).getValue();
String data = String.format("每日前%s次付款均可获取抽奖机会抽奖保底抽中付款金额等额红包红包可直接提现。当前为第%d次付款", totalCount, count + 1);
return Result.success().put("data", data);
}
}