| | |
| | | package cc.mrbird.febs.dapp.controller; |
| | | |
| | | import cc.mrbird.febs.common.annotation.EncryptEnable; |
| | | import cc.mrbird.febs.common.configure.i18n.MessageSourceUtils; |
| | | import cc.mrbird.febs.common.contants.AppContants; |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.dapp.dto.RecordInPageDto; |
| | | import cc.mrbird.febs.dapp.dto.WalletOperateDto; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.dapp.dto.*; |
| | | import cc.mrbird.febs.dapp.entity.DappMemberEntity; |
| | | import cc.mrbird.febs.dapp.service.DappMemberService; |
| | | import cc.mrbird.febs.dapp.service.DappSystemService; |
| | | import cc.mrbird.febs.dapp.service.DappWalletService; |
| | | import cc.mrbird.febs.dapp.vo.WalletInfoVo; |
| | | import cc.mrbird.febs.dapp.vo.*; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author |
| | | * @author |
| | | * @date 2022-03-17 |
| | | **/ |
| | | @Slf4j |
| | | @EncryptEnable |
| | | @RequiredArgsConstructor |
| | | @CrossOrigin("*") |
| | | @RestController |
| | | @Api(value = "dapp接口", tags = "dapp接口") |
| | | @RequestMapping(value = "/dapi/member") |
| | | public class ApiDappMemberController { |
| | | public class ApiDappMemberController extends BaseController { |
| | | |
| | | private final DappWalletService dappWalletService; |
| | | private final DappSystemService dappSystemService; |
| | | private final DappMemberService dappMemberService; |
| | | private final RedisUtils redisUtils; |
| | | |
| | | @ApiOperation(value = "获取账户信息接口", notes = "获取账号信息接口") |
| | | @ApiResponses({ |
| | |
| | | return new FebsResponse().success().data(walletInfoVo); |
| | | } |
| | | |
| | | // @ApiOperation(value = "兑换接口", notes = "兑换") |
| | | // @PostMapping(value = "/change") |
| | | // public FebsResponse change(@RequestBody WalletOperateDto walletOperateDto) { |
| | | // dappWalletService.change(walletOperateDto); |
| | | // return new FebsResponse().success().message("兑换成功"); |
| | | // } |
| | | // |
| | | // @ApiOperation(value = "提现接口", notes = "提现接口") |
| | | // @PostMapping(value = "/withdraw") |
| | | // public FebsResponse withdraw(@RequestBody WalletOperateDto walletOperateDto) { |
| | | // dappWalletService.withdraw(walletOperateDto); |
| | | // return new FebsResponse().success().message("申请成功, 等待审核"); |
| | | // } |
| | | @ApiOperation(value = "转账", notes = "转账") |
| | | @PostMapping(value = "/transfer") |
| | | public FebsResponse transfer(@RequestBody TransferDto transferDto) { |
| | | return new FebsResponse().success().data(dappWalletService.transfer(transferDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "记录列表", notes = "记录列表") |
| | | @PostMapping(value = "/recordInPage") |
| | | public FebsResponse recordInPage(@RequestBody RecordInPageDto recordInPageDto) { |
| | | return new FebsResponse().success().data(dappWalletService.recordInPage(recordInPageDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "计算最新价", notes = "计算最新价") |
| | | @PostMapping(value = "/calPrice") |
| | | public FebsResponse calPrice(@RequestBody PriceDto priceDto) { |
| | | return new FebsResponse().success().data(dappWalletService.calPrice(priceDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "系统参数", notes = "系统参数") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = SystemDto.class) |
| | | }) |
| | | @GetMapping(value = "/system") |
| | | public FebsResponse system() { |
| | | return new FebsResponse().success().data(dappSystemService.system()); |
| | | } |
| | | |
| | | @ApiOperation(value = "我的团队", notes = "我的团队") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = TeamListVo.class) |
| | | }) |
| | | @PostMapping(value = "/team") |
| | | public FebsResponse team(@RequestBody TeamListDto teamListDto) { |
| | | return new FebsResponse().success().data(dappMemberService.findTeamList(teamListDto)); |
| | | } |
| | | |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = ActiveNftListVo.class) |
| | | }) |
| | | @ApiOperation(value = "开盲盒", notes = "开盲盒") |
| | | @PostMapping(value = "/boxSurprise") |
| | | public FebsResponse boxSurprise() { |
| | | ActiveNftListVo data = dappWalletService.boxSurprise(); |
| | | return new FebsResponse().success().data(data); |
| | | // return new FebsResponse().fail().message(MessageSourceUtils.getString("box_surprise_002")); |
| | | } |
| | | |
| | | @ApiOperation(value = "激活卡牌", notes = "激活卡牌") |
| | | @PostMapping(value = "/activeNft") |
| | | public FebsResponse activeNft(@RequestBody @Valid ActiveDto activeDto) { |
| | | dappWalletService.activeNft(activeDto); |
| | | return new FebsResponse().success().message(MessageSourceUtils.getString("nft_active_002")); |
| | | } |
| | | |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = ActiveNftListVo.class) |
| | | }) |
| | | @ApiOperation(value = "卡牌列表", notes = "卡牌列表") |
| | | @PostMapping(value = "/findNftList") |
| | | public FebsResponse findNftList() { |
| | | return new FebsResponse().success().data(dappWalletService.findUnActiveNftList()); |
| | | } |
| | | |
| | | @ApiOperation(value = "价格", notes = "价格") |
| | | @GetMapping(value = "/price") |
| | | public FebsResponse price() { |
| | | return new FebsResponse().success().data(dappSystemService.findPriceListIn24H()); |
| | | } |
| | | |
| | | @ApiOperation(value = "IGT退出登录", notes = "退出登录") |
| | | @PostMapping(value = "/logOut") |
| | | public FebsResponse logout() { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | |
| | | String redisKey = AppContants.REDIS_KEY_SIGN + member.getId(); |
| | | String existToken = redisUtils.getString(redisKey); |
| | | if (StrUtil.isNotBlank(existToken)) { |
| | | Object o = redisUtils.get(existToken); |
| | | if (ObjectUtil.isNotEmpty(o)) { |
| | | redisUtils.del(existToken); |
| | | } |
| | | } |
| | | redisUtils.del(redisKey); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "IGT获取用户信息", notes = "获取用户信息") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = MemberInfoVo.class) |
| | | }) |
| | | @GetMapping(value = "/memberInfo") |
| | | public FebsResponse getMemberInfo() { |
| | | MemberInfoVo memberInfoVo = dappMemberService.getMemberInfo(); |
| | | return new FebsResponse().success().data(memberInfoVo); |
| | | } |
| | | |
| | | @ApiOperation(value = "IGT资金记录-类型", notes = "资金记录-类型") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = ApiAmountTypeVo.class) |
| | | }) |
| | | @GetMapping(value = "/amountType") |
| | | public FebsResponse amountType() { |
| | | return dappMemberService.amountType(); |
| | | } |
| | | |
| | | @ApiOperation(value ="IGT资金记录-分页", notes = "资金记录-分页") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = ApiAmountChangeListVo.class) |
| | | }) |
| | | @PostMapping(value = "/findAmountInPage") |
| | | public FebsResponse findAmountInPage(@RequestBody ApiAmountChangeDto apiAmountChangeDto) { |
| | | Map<String, Object> data = getDataTable(dappMemberService.findAmountInPage(apiAmountChangeDto)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | @ApiOperation(value ="IGT我的团队-新增团队成员", notes = "我的团队-新增团队成员") |
| | | @PostMapping(value = "/addTeammate") |
| | | public FebsResponse addTeammate(@RequestBody ApiAddTeammateDto apiAddTeammateDto) { |
| | | return dappMemberService.addTeammate(apiAddTeammateDto); |
| | | } |
| | | |
| | | @ApiOperation(value ="IGT我的团队-团队列表", notes = "我的团队-团队列表") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "success", response = ApiMyTeammateInfoListVo.class) |
| | | }) |
| | | @PostMapping(value = "/myTeammateInfo") |
| | | public FebsResponse myTeammateInfo(@RequestBody ApiMyTeammateInfoDto apiMyTeammateInfoDto) { |
| | | |
| | | Map<String, Object> data = getDataTable(dappMemberService.myTeammateInfo(apiMyTeammateInfoDto)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | @ApiOperation(value ="IGT我的团队-资金记录-分页", notes = "我的团队-资金记录-分页") |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "success", response = ApiMyTeammateAmountChangeListVo.class) |
| | | }) |
| | | @PostMapping(value = "/teammateChangeListInPage") |
| | | public FebsResponse teammateChangeListInPage(@RequestBody ApiAmountChangeDto apiAmountChangeDto) { |
| | | Map<String, Object> data = getDataTable(dappMemberService.findTeammateChangeListInPage(apiAmountChangeDto)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | @ApiOperation(value = "IGT更新登录密码", notes = "更新登录密码") |
| | | @PostMapping(value = "/updatePassword") |
| | | public FebsResponse updatePassword(@RequestBody ApiUpdatePasswordDto apiUpdatePasswordDto) { |
| | | return dappWalletService.updatePassword(apiUpdatePasswordDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "IGT重置登录密码", notes = "重置登录密码") |
| | | @PostMapping(value = "/resetPassword") |
| | | public FebsResponse resetPassword(@RequestBody ApiResetPasswordDto apiResetPasswordDto) { |
| | | return dappWalletService.resetPassword(apiResetPasswordDto); |
| | | } |
| | | |
| | | @ApiOperation(value ="IGT银行卡-列表分页", notes = "银行卡-列表分页") |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "success", response = ApiBankListVo.class) |
| | | }) |
| | | @PostMapping(value = "/bankList") |
| | | public FebsResponse bankList(@RequestBody ApiBankListDto apiBankListDto) { |
| | | // Map<String, Object> data = getDataTable(dappMemberService.getBankListInPage(apiBankListDto)); |
| | | return dappMemberService.getBankListInPage(apiBankListDto); |
| | | } |
| | | |
| | | @ApiOperation(value ="IGT银行卡-新增", notes = "银行卡-新增") |
| | | @PostMapping(value = "/addBank") |
| | | public FebsResponse addBank(@RequestBody ApiAddBankDto addBankDto) { |
| | | return dappMemberService.addBank(addBankDto); |
| | | } |
| | | |
| | | @ApiOperation(value ="IGT我的钱包", notes = "我的钱包") |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "success", response = ApiAddressInfoVo.class) |
| | | }) |
| | | @PostMapping(value = "/myAddress") |
| | | public FebsResponse myAddress() { |
| | | return dappMemberService.getBankListInPage(); |
| | | } |
| | | |
| | | @ApiOperation(value ="IGT我的钱包-新增", notes = "我的钱包-新增") |
| | | @PostMapping(value = "/addAddress") |
| | | public FebsResponse addAddress(@RequestBody ApiAddAddressDto apiAddAddressDto) { |
| | | return dappMemberService.addAddress(apiAddAddressDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "IGT发送客服消息", notes = "发送客服消息") |
| | | @PostMapping(value = "/addMessage") |
| | | public FebsResponse addMessage(@RequestBody AddMessageDto addMessageDto) { |
| | | return dappMemberService.addMessage(addMessageDto); |
| | | } |
| | | |
| | | @ApiOperation(value ="IGT客服消息-列表分页", notes = "客服消息-列表分页") |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "success", response = ApiMessageListVo.class) |
| | | }) |
| | | @PostMapping(value = "/messageList") |
| | | public FebsResponse messageList(@RequestBody ApiMessageListDto apiMessageListDto) { |
| | | Map<String, Object> data = getDataTable(dappMemberService.getMessageListInPage(apiMessageListDto)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | } |