123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- package com.ruoyi.wx.web.controller;
- import com.ruoyi.common.core.domain.AjaxResult;
- import com.ruoyi.common.utils.ExceptionUtil;
- import com.ruoyi.framework.recovery.domain.RecContent;
- import com.ruoyi.framework.recovery.domain.RecContentUser;
- import com.ruoyi.wx.web.domain.vo.SaleInfoVo;
- import com.ruoyi.wx.web.service.IWxHomeService;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- import java.util.concurrent.ExecutionException;
- /**
- * 首页服务
- */
- @RestController
- @RequestMapping("/wx/home")
- @Slf4j
- public class WxHomeController {
- @Autowired
- private IWxHomeService wxHomeService;
- // @ApiOperation(value = "查询首页所有信息")
- @GetMapping("/index")
- public AjaxResult getIndex() {
- try {
- return wxHomeService.getIndex();
- } catch (InterruptedException | ExecutionException e) {
- return AjaxResult.error(e.getMessage(), e);
- }
- }
- // @ApiOperation(value = "发售信息详情", notes = "根据id查询详情内容")
- @GetMapping("/sale/info/{id}")
- public AjaxResult getSaleInfo(@PathVariable("id") Long id) {
- try {
- List<SaleInfoVo> infoList = wxHomeService.getSaleInfo(id);
- return AjaxResult.success(infoList);
- } catch (Exception e) {
- return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
- }
- }
- /**
- * 销售日历
- *
- */
- @GetMapping("/sale/calendar")
- public AjaxResult saleCalendar() {
- try {
- List<SaleInfoVo> infoList = wxHomeService.getSaleCalendar();
- return AjaxResult.success(infoList);
- } catch (Exception e) {
- return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
- }
- }
- /**
- * 点赞
- *
- * @param id 评论Id
- * @return 结果集
- */
- @GetMapping("/thumbs/{id}")
- public AjaxResult thumbs(@PathVariable("id") Long id) {
- try {
- Long thumbs = wxHomeService.thumbs(id);
- return AjaxResult.success(thumbs);
- } catch (Exception e) {
- return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
- }
- }
- /**
- * 当前用户点过的赞
- *
- */
- @GetMapping("/thumbs")
- public AjaxResult userThumbs() {
- try {
- List<RecContentUser> thumbs = wxHomeService.userThumbs();
- return AjaxResult.success(thumbs);
- } catch (Exception e) {
- return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
- }
- }
- @PostMapping("/add/content")
- public AjaxResult thumbs(@RequestBody RecContent recContent) {
- try {
- int thumbs = wxHomeService.addRecContent(recContent);
- return AjaxResult.success(thumbs);
- } catch (Exception e) {
- return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
- }
- }
- }
|