parent
6ce581047b
commit
b1fd675442
@ -0,0 +1,30 @@
|
||||
package com.luoo.user.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.luoo.user.pojo.Carousel;
|
||||
import com.luoo.user.service.CarouselService;
|
||||
|
||||
import api.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
@Api(tags = "IndexController")
|
||||
@RestController
|
||||
@RequestMapping("/index")
|
||||
public class IndexController {
|
||||
|
||||
@Resource
|
||||
private CarouselService carouselService;
|
||||
|
||||
@ApiOperation(value = "1.获取轮播图", notes = "返回5个")
|
||||
@GetMapping("/loadCarousel")
|
||||
public Result<List<Carousel>> loadCarousel() {
|
||||
List<Carousel> carouselList = carouselService.loadCarousel();
|
||||
return Result.success(carouselList);
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.luoo.user.pojo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
/**
|
||||
* app轮播
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class Carousel{
|
||||
|
||||
/**
|
||||
* 自增ID
|
||||
*/
|
||||
@ApiModelProperty(value = "自增ID")
|
||||
private Integer carouselId;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String imgPath;
|
||||
|
||||
/**
|
||||
* 0:期刊 1:外部连接
|
||||
*/
|
||||
@ApiModelProperty(value = "0:歌曲 1:期刊 2:外部连接")
|
||||
private Integer objectType;
|
||||
|
||||
/**
|
||||
* 对象ID
|
||||
*/
|
||||
@ApiModelProperty(value = "对象ID")
|
||||
private String objectId;
|
||||
|
||||
/**
|
||||
* 外部连接
|
||||
*/
|
||||
@ApiModelProperty(value = "外部连接")
|
||||
private String outerLink;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.luoo.user.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.luoo.user.pojo.Carousel;
|
||||
|
||||
@Service
|
||||
public class CarouselService {
|
||||
private static final List<Carousel> DEFAULT_CAROUSEL_LIST=new ArrayList<>();
|
||||
static {
|
||||
DEFAULT_CAROUSEL_LIST.add(Carousel.builder().carouselId(1).imgPath("http://cdn.indie.cn/music/10016/07.jpg").objectType(0).objectId("1643965109602750464").outerLink(null).build());
|
||||
DEFAULT_CAROUSEL_LIST.add(Carousel.builder().carouselId(2).imgPath("http://cdn.indie.cn/music/00985/00.jpg").objectType(1).objectId("1635099768424370176").outerLink(null).build());
|
||||
DEFAULT_CAROUSEL_LIST.add(Carousel.builder().carouselId(3).imgPath("http://cdn.indie.cn/music/00984/00.jpg").objectType(1).objectId("1635099812296790016").outerLink(null).build());
|
||||
DEFAULT_CAROUSEL_LIST.add(Carousel.builder().carouselId(4).imgPath("http://cdn.indie.cn/music/00942/00.jpg").objectType(2).objectId(null).outerLink("http://116.62.145.60:3000/music").build());
|
||||
DEFAULT_CAROUSEL_LIST.add(Carousel.builder().carouselId(5).imgPath("http://cdn.indie.cn/music/00982/00.jpg").objectType(1).objectId("1635099717706846208").outerLink(null).build());
|
||||
}
|
||||
public List<Carousel> loadCarousel() {
|
||||
return DEFAULT_CAROUSEL_LIST;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue