puzhibing
2023-07-17 f195cf48cf57635c8848b2bc32afd4541c4090ed
cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackageController.java
@@ -1,6 +1,7 @@
package com.dsh.course.controller;
import com.dsh.course.entity.TCoursePackage;
import com.dsh.course.model.vo.response.ExchangeCoursePackageResponse;
import com.dsh.course.model.vo.response.WeekLimitedResponse;
import com.dsh.course.service.TCoursePackageDiscountService;
import com.dsh.course.service.TCoursePackageService;
@@ -56,7 +57,9 @@
    @ApiOperation(value = "本周福利-限时折扣列表", tags = {"APP-使用福利"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "discountType",value = "默认显示 限时折扣 (1限时折扣 2赠送课时)")
            @ApiImplicitParam(name = "discountType",value = "默认显示 限时折扣 (1限时折扣 2赠送课时)",dataType = "int"),
            @ApiImplicitParam(name = "lon",value = "经度",dataType = "String"),
            @ApiImplicitParam(name = "lat",value = "纬度",dataType = "String"),
    })
    public ResultUtil<WeekLimitedResponse> thisWeeksBenefitList(Integer discountType,String lon,String lat){
        try {
@@ -70,4 +73,50 @@
        }
    }
    /**
     * 折扣课包详情
     */
    @ResponseBody
    @PostMapping("/api/useBenefit/discountCourseDatas")
    @ApiOperation(value = "本周福利-折扣课包详情", tags = {"APP-使用福利"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "coursePackageDiscountId",value = "限时折扣配置id/赠送课时配置id",dataType = "int"),
            @ApiImplicitParam(name = "lon",value = "经度",dataType = "String"),
            @ApiImplicitParam(name = "lat",value = "纬度",dataType = "String"),
    })
    public ResultUtil<ExchangeCoursePackageResponse> discountCourseDatas(Integer coursePackageDiscountId,String lon,String lat){
        try {
            return ResultUtil.success(tcpdService.getWeekFreeCourseDetails(coursePackageDiscountId,lat,lon));
        }catch (Exception e){
            return ResultUtil.runErr();
        }
    }
    /**
     * 折扣课包支付
     */
    @ResponseBody
    @PostMapping("/api/useBenefit/paymentOfDiscountCoursePack")
    @ApiOperation(value = "本周福利-折扣课包支付", tags = {"APP-使用福利"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "coursePackageDiscountId",value = "限时折扣配置id/赠送课时配置id",dataType = "int"),
            @ApiImplicitParam(name = "lon",value = "经度",dataType = "String"),
            @ApiImplicitParam(name = "lat",value = "纬度",dataType = "String"),
    })
    public ResultUtil paymentWeeksFreeCourse(Integer coursePackageDiscountId){
        try {
            Integer appuserId = tokenUtil.getUserIdFormRedis();
            if(null == appuserId){
                return ResultUtil.tokenErr();
            }
            return tcpdService.paymentDiscountCoursePack(coursePackageDiscountId,appuserId);
        }catch (Exception e){
            return ResultUtil.runErr();
        }
    }
}