1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- package com.ruoyi.wx.web.controller;
- import com.ruoyi.common.core.domain.AjaxResult;
- import com.ruoyi.wx.web.domain.dto.LotteryDto;
- import com.ruoyi.wx.web.domain.vo.AwardVo;
- import com.ruoyi.wx.web.domain.vo.LotteryVo;
- import com.ruoyi.wx.web.service.IWxLotteryUserService;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- /**
- *
- * 微信抽奖中心
- */
- @Slf4j
- @RestController
- @RequestMapping("/wx/lottery")
- public class WxLotteryUserController {
- @Autowired
- private IWxLotteryUserService wxLotteryUserService;
- /**
- * 获取全量抽奖详情
- *
- * @param type 查询历史或者当前内容,now:查询当前抽奖,history:查询历史抽奖
- * @return 结果集
- */
- @GetMapping("/info/list")
- public AjaxResult getLotteryUserList(String type) {
- try {
- List<AwardVo> lotteryVo = wxLotteryUserService.getList(type);
- return AjaxResult.success(lotteryVo);
- } catch (SecurityException e) {
- return AjaxResult.error(e.getMessage());
- }
- }
- /**
- *
- * 获取当前人的抽奖内容
- * @return
- */
- @GetMapping("/info/list/{lotteryId}")
- public AjaxResult getIndex(@PathVariable("lotteryId") Long lotteryId) {
- try {
- List<LotteryVo> lotteryVo = wxLotteryUserService.getListById(lotteryId);
- return AjaxResult.success(lotteryVo);
- } catch (SecurityException e) {
- return AjaxResult.error(e.getMessage());
- }
- }
- /**
- * 当前人员进行抽奖
- *
- * @return
- */
- @PostMapping("/info/add")
- public AjaxResult addLottery(@RequestBody LotteryDto lotteryDto) {
- try {
- LotteryVo lotteryVo = wxLotteryUserService.addLottery(lotteryDto);
- return AjaxResult.success(lotteryVo);
- } catch (SecurityException e) {
- return AjaxResult.error(e.getMessage());
- }
- }
- }
|