| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.netflix.eureka.ServerRequestAuthFilter; |
| | | import com.supersavedriving.driver.modular.system.service.ICommercialService; |
| | | import com.supersavedriving.driver.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.service.ICommercialService; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.CommercialWarpper; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.context.request.RequestAttributes; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/commercial/queryCommercialList") |
| | | @ServiceLog(name = "获取广告列表", url = "/api/driver/queryCommercialList") |
| | | // @ServiceLog(name = "获取广告列表", url = "/api/driver/queryCommercialList") |
| | | @ApiOperation(value = "获取广告列表", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "广告类型(1=弹窗广告,2=底部广告)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "设备类型(1=小程序,2=司机端)", name = "device", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<CommercialWarpper>> queryCommercialList(Integer type, Integer device, HttpServletRequest request){ |
| | | public ResponseWarpper<List<CommercialWarpper>> queryCommercialList(Integer type, Integer device){ |
| | | if(ToolUtil.isEmpty(type)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("type")); |
| | | } |
| | |
| | | return ResponseWarpper.success(ResultUtil.paranErr("device")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | List<CommercialWarpper> commercialWarppers = commercialService.queryCommercialList(uid, type, device); |
| | | return ResponseWarpper.success(commercialWarppers); |