无关风月
2024-10-14 039a33d1bfa6ef041161666bbd120c34086fe7c1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package com.xinquan.system.controller;
 
 
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.xinquan.common.core.domain.R;
import com.xinquan.system.domain.ContentSetting;
import com.xinquan.system.domain.HotWords;
import com.xinquan.system.domain.VipSetting;
import com.xinquan.system.service.VipSettingService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.omg.CORBA.PRIVATE_MEMBER;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
/**
 * <p>
 * 会员设置表 前端控制器
 * </p>
 *
 * @author mitao
 * @since 2024-08-21
 */
@RestController
@RequestMapping("/system/vip-setting")
public class VipSettingController {
    @Resource
    private VipSettingService vipSettingService;
 
    @PostMapping("/queryVip")
    @ApiOperation(value = "获取会员价格设置", tags = {"管理后台-会员设置"})
    public R<VipSetting> queryVip() {
        VipSetting one = vipSettingService.lambdaQuery()
                .eq(VipSetting::getSettingType, 1).one();
        return R.ok(one);
    }
    @PostMapping("/saveVip")
    @ApiOperation(value = "保存会员价格设置", tags = {"管理后台-会员设置"})
    public R<VipSetting> saveVip(@RequestBody VipSetting vipSetting) {
        vipSettingService.updateById(vipSetting);
        return R.ok();
    }
    @PostMapping("/updateVipContent")
    @ApiOperation(value = "修改会员权益介绍/获取会员用户协议/获取续费管理说明",tags = "管理后台-会员设置")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "内容类型 1=会员权益介绍 2=会员用户协议 3=续费管理说明", name = "type", required = true, dataType = "int"),
            @ApiImplicitParam(value = "富文本内容", name = "content", required = true, dataType = "String"),
    })
    public R updateVipContent(Integer type,String content) {
        VipSetting one = vipSettingService.lambdaQuery()
                .eq(VipSetting::getSettingType, type+1).one();
        one.setContent(content);
        vipSettingService.updateById(one);
        return R.ok();
    }
    @PostMapping("/getVipPrice")
    @ApiOperation(value = "安卓-获取月度 季度 年度会员价格",tags = "APP-会员")
    public R<VipSetting> getVipPrice() {
        VipSetting one = vipSettingService.lambdaQuery().eq(VipSetting::getClientType, 1)
                .eq(VipSetting::getSettingType, 1).one();
        return R.ok(one);
    }
    @PostMapping("/getVipPriceApple")
    @ApiOperation(value = "苹果-获取月度 季度 年度会员价格",tags = "APP-会员")
    public R<VipSetting> getVipPriceApple() {
        VipSetting one = vipSettingService.lambdaQuery().eq(VipSetting::getClientType, 2)
                .eq(VipSetting::getSettingType, 1).one();
        return R.ok(one);
    }
    @PostMapping("/getVipContent")
    @ApiOperation(value = "获取会员权益介绍/获取会员用户协议/获取续费管理说明",tags = "APP/管理后台通用-会员")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "内容类型 1=会员权益介绍 2=会员用户协议 3=续费管理说明", name = "type", required = true, dataType = "int"),
    })
    public R<String> getVipPriceApple(Integer type) {
        VipSetting one = vipSettingService.lambdaQuery()
                .eq(VipSetting::getSettingType, type+1).one();
        return R.ok(one.getContent());
    }
 
}