| | |
| | | package cc.mrbird.febs.dapp.controller; |
| | | |
| | | import cc.mrbird.febs.common.annotation.EncryptEnable; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.dapp.dto.ApproveDto; |
| | | import cc.mrbird.febs.dapp.dto.ConnectDto; |
| | | import cc.mrbird.febs.dapp.dto.NewsListDto; |
| | | import cc.mrbird.febs.dapp.entity.DappMemberEntity; |
| | | import cc.mrbird.febs.dapp.entity.MallNewsInfo; |
| | | import cc.mrbird.febs.dapp.service.DappMemberService; |
| | | import cc.mrbird.febs.dapp.service.DappSimulateDataService; |
| | | import cc.mrbird.febs.dapp.service.DappSystemService; |
| | | import cc.mrbird.febs.dapp.vo.SimulateDataVo; |
| | | import cc.mrbird.febs.dapp.service.IApiMallNewsService; |
| | | import cc.mrbird.febs.dapp.vo.NewsListVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * @author |
| | | * @author |
| | | * @date 2022-03-17 |
| | | **/ |
| | | @Slf4j |
| | | @EncryptEnable |
| | | @RequiredArgsConstructor |
| | | @CrossOrigin("*") |
| | | @RestController |
| | |
| | | |
| | | private final DappMemberService dappMemberService; |
| | | private final DappSystemService dappSystemService; |
| | | private final DappSimulateDataService dappSimulateDataService; |
| | | private final IApiMallNewsService newsService; |
| | | |
| | | // @ApiOperation(value = "授权接口", notes = "授权接口") |
| | | // @PostMapping(value = "/approve") |
| | | // public FebsResponse approve(@RequestBody ApproveDto approveDto) { |
| | | // dappMemberService.approve(approveDto); |
| | | // return new FebsResponse().success().message("授权成功"); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "是否授权接口", notes = "是否授权接口") |
| | | // @GetMapping(value = "/isApprove/{chain}/{address}") |
| | | // public FebsResponse isApprove(@PathVariable("address") String address,@PathVariable("chain") String chain) { |
| | | // return new FebsResponse().success().message("获取成功").data(dappMemberService.isApprove(address, chain)); |
| | | // } |
| | | @ApiOperation(value = "地址是否存在", notes = "地址是否存在") |
| | | @GetMapping(value = "/exist/{address}") |
| | | public FebsResponse exist(@PathVariable("address") String address) { |
| | | DappMemberEntity member = dappMemberService.findByAddress(address, "BSC"); |
| | | |
| | | @ApiOperation(value = "头部数据", notes = "头部数据") |
| | | @GetMapping(value = "/totalIncome") |
| | | public FebsResponse totalIncome() { |
| | | return new FebsResponse().success().data(dappSystemService.findTotalInComeAndList()); |
| | | int result = member == null ? 2 : 1; |
| | | return new FebsResponse().success().data(result); |
| | | } |
| | | |
| | | // @ApiOperation(value = "全局设置", notes = "全局设置") |
| | | // @GetMapping(value = "/globalSetting") |
| | | // public FebsResponse globalSetting() { |
| | | // return new FebsResponse().success().data(dappSystemService.globalSetting()); |
| | | // } |
| | | @ApiOperation(value = "链接接口", notes = "链接接口") |
| | | @PostMapping(value = "/connect") |
| | | public FebsResponse connect(@RequestBody ConnectDto connectDto) { |
| | | dappMemberService.connect(connectDto); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | // @ApiOperation(value = "获取模拟数据", notes = "获取模拟数据") |
| | | // @GetMapping(value = "/findSimulateData/{batchNo}") |
| | | // public FebsResponse findSimulateData(@PathVariable("batchNo") String batchNo) { |
| | | // SimulateDataVo simulateData = dappSimulateDataService.findSimulateData(batchNo); |
| | | // return new FebsResponse().success().data(simulateData); |
| | | // } |
| | | @ApiOperation(value = "新闻分类", notes = "新闻分类") |
| | | @GetMapping(value = "/findNewsInfoCategory") |
| | | public FebsResponse findNewsInfoCategory() { |
| | | return new FebsResponse().success().data(newsService.findNewsCategoryList()); |
| | | } |
| | | |
| | | @ApiOperation(value ="获取新闻列表-分页", notes = "获取新闻列表") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = NewsListVo.class) |
| | | }) |
| | | @PostMapping(value = "/findNewsInPage") |
| | | public FebsResponse findNewsInPage(@RequestBody NewsListDto newsListDto) { |
| | | return new FebsResponse().success().data(newsService.findNewsInPage(newsListDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "新闻列表", notes = "新闻列表") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = NewsListVo.class) |
| | | }) |
| | | @GetMapping(value = "/findNews") |
| | | public FebsResponse findNews() { |
| | | return new FebsResponse().success().data(newsService.findTopNews()); |
| | | } |
| | | |
| | | @ApiOperation(value = "新闻详情", notes = "新闻详情") |
| | | @GetMapping(value = "/newsDetails/{id}") |
| | | public FebsResponse newsDetails(@PathVariable("id") Long id) { |
| | | MallNewsInfo news = newsService.getById(id); |
| | | if (news == null) { |
| | | return new FebsResponse().fail().message("新闻不存在"); |
| | | } |
| | | return new FebsResponse().success().data(news); |
| | | } |
| | | |
| | | } |