puzhibing
2022-08-22 1421f8e9c308c4741cb396309035009393b5b036
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
48
package com.stylefeng.guns.modular.api;
 
import com.stylefeng.guns.modular.system.service.IAdvertisementService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.AdvertisementWarpper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
/**
 * 广告控制器
 */
@Api
@RestController
@RequestMapping("/base/advertisement")
public class AdvertisementController {
 
    @Autowired
    private IAdvertisementService advertisementService;
 
 
 
    @ResponseBody
    @PostMapping("/queryByType")
    @ApiOperation(value = "获取广告列表", tags = {"用户端-首页"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "数据类型(1:弹窗广告,2:底部广告)", name = "type", required = true, dataType = "int"),
            @ApiImplicitParam(value = "当前定位城市code(510100)", name = "code", required = true, dataType = "string")
    })
    public ResultUtil<List<AdvertisementWarpper>> queryAdvertisement(String code, Integer type){
        try {
            List<AdvertisementWarpper> advertisementWarpper = advertisementService.queryAdvertisement(code, type);
            return ResultUtil.success(advertisementWarpper);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
}