rk
3 小时以前 c74a6f59490cfb9a0ee37f70427739b74e7fbd58
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
package com.doumee.api.web;
 
import com.doumee.core.annotation.LoginRequired;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.MemberCoupon;
import com.doumee.service.business.MemberCouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
@Slf4j
@Api(tags = "会员优惠券")
@RestController
@RequestMapping("/web/memberCoupon")
public class MemberCouponApi extends ApiController {
 
    @Autowired
    private MemberCouponService memberCouponService;
 
    @LoginRequired
    @ApiOperation(value = "会员优惠券列表", notes = "小程序端")
    @PostMapping("/findPage")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true),
    })
    public ApiResponse<PageData<MemberCoupon>> findPage(@RequestBody PageWrap<MemberCoupon> pageWrap) {
        Integer status = pageWrap.getModel() != null ? pageWrap.getModel().getStatus() : null;
        return ApiResponse.success("操作成功", memberCouponService.findMemberPage(getMemberId(), status, pageWrap));
    }
 
    @LoginRequired
    @ApiOperation(value = "领取优惠券", notes = "小程序端")
    @GetMapping("/claim")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true),
    })
    public ApiResponse claim(@RequestParam Integer couponId) {
        memberCouponService.claimCoupon(getMemberId(), couponId);
        return ApiResponse.success("操作成功");
    }
}