package com.ylx.api;

import com.ylx.common.core.domain.R;
import com.ylx.point.domain.dto.ApiAddPointsDTO;
import com.ylx.point.service.IPointAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
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 javax.annotation.Resource;

@RestController
@RequestMapping("/api/user/point")
@Api(tags = {"用户积分"})
public class ApiUserPointController {

    @Resource
    private IPointAccountService pointAccountService;

    @ApiOperation("本地生活抽奖，用户获得积分")
    @PostMapping(value = "/add")
    public R addPoints(@RequestBody @Validated ApiAddPointsDTO dto) {
        this.pointAccountService.apiAddPoints(dto);
        return R.ok();
    }

}
