| | |
| | | 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.chain.TrxUsdtUpdateService; |
| | | import cc.mrbird.febs.dapp.dto.*; |
| | | import cc.mrbird.febs.dapp.service.DappMemberService; |
| | | import cc.mrbird.febs.dapp.service.DappSimulateDataService; |
| | | import cc.mrbird.febs.dapp.service.DappSystemService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @author |
| | | * @date 2022-03-17 |
| | | **/ |
| | | @Slf4j |
| | | @EncryptEnable |
| | | @RequiredArgsConstructor |
| | | @CrossOrigin("*") |
| | | @RestController |
| | |
| | | |
| | | private final DappMemberService dappMemberService; |
| | | private final DappSystemService dappSystemService; |
| | | private final DappSimulateDataService dappSimulateDataService; |
| | | |
| | | @ApiOperation(value = "授权接口", notes = "授权接口") |
| | | @PostMapping(value = "/approve") |
| | | public FebsResponse approve(@RequestBody ApproveDto approveDto) { |
| | | dappMemberService.approve(approveDto); |
| | | return new FebsResponse().success().message("授权成功"); |
| | | // @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 = "链接接口") |
| | | @PostMapping(value = "/connect") |
| | | public FebsResponse connect(@RequestBody ConnectDto connectDto) { |
| | | dappMemberService.connect(connectDto); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "是否授权接口", notes = "是否授权接口") |
| | | @GetMapping(value = "/isApprove/{address}") |
| | | public FebsResponse isApprove(@PathVariable("address") String address) { |
| | | boolean isApprove = dappMemberService.isApprove(address); |
| | | if (isApprove) { |
| | | return new FebsResponse().success().message("已授权"); |
| | | } |
| | | return new FebsResponse().fail().message("未授权"); |
| | | } |
| | | |
| | | @ApiOperation(value = "首页总收入和列表", notes = "总收入和列表") |
| | | @ApiOperation(value = "头部数据", notes = "头部数据") |
| | | @GetMapping(value = "/totalIncome") |
| | | public FebsResponse totalIncome() { |
| | | return new FebsResponse().success().data(dappSystemService.findTotalInComeAndList()); |
| | | } |
| | | |
| | | @ApiOperation(value = "全局设置", notes = "全局设置") |
| | | @GetMapping(value = "/globalSetting") |
| | | public FebsResponse globalSetting() { |
| | | return new FebsResponse().success().data(dappSystemService.globalSetting()); |
| | | @PostMapping(value = "/encrypt") |
| | | public FebsResponse encryptTest(@RequestBody EncryptDto encryptDto) { |
| | | System.out.println(encryptDto.getTest()); |
| | | return new FebsResponse().success().data("123"); |
| | | } |
| | | |
| | | @ApiOperation(value = "IGT获取验证码", notes = "获取验证码") |
| | | @GetMapping("/captcha") |
| | | public FebsResponse captcha() throws IOException { |
| | | return dappMemberService.captchaCreator(); |
| | | } |
| | | |
| | | @ApiOperation(value = "IGT注册接口", notes = "注册接口") |
| | | @PostMapping(value = "/register") |
| | | public FebsResponse register(@RequestBody @Validated RegisterDto registerDto) { |
| | | return dappMemberService.register(registerDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "IGT账号密码登录接口", notes = "账号密码登录接口") |
| | | @PostMapping(value = "/toLogin") |
| | | public FebsResponse login(@RequestBody LoginDto loginDto) { |
| | | return dappMemberService.toLogin(loginDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "IGT游客身份登录", notes = "游客身份登录") |
| | | @PostMapping(value = "/touristLogin") |
| | | public FebsResponse touristLogin(@RequestBody TouristLoginDto touristLoginDto) { |
| | | return dappMemberService.touristLogin(touristLoginDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "IGT获取版本信息") |
| | | @GetMapping(value = "/appVersion") |
| | | public FebsResponse appVersion() { |
| | | return new FebsResponse().success().data(dappMemberService.findAppVersion()); |
| | | } |
| | | |
| | | private final TrxUsdtUpdateService trxUsdtUpdateService; |
| | | |
| | | @ApiOperation(value = "IGT充值未到账,比对本地地址 同步充值USDT-TRC20") |
| | | @GetMapping(value = "/updateAddress") |
| | | public FebsResponse updateAddress(@RequestBody UpdateAddressDto updateAddressDto) { |
| | | if("xy".equals(updateAddressDto.getSymbol())){ |
| | | long blockHeight = Long.parseLong(updateAddressDto.getBlockHeight()); |
| | | trxUsdtUpdateService.monitorCoinListener(blockHeight); |
| | | } |
| | | return new FebsResponse().success(); |
| | | } |
| | | } |