| | |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.dapp.chain.ChainService; |
| | | import cc.mrbird.febs.dapp.entity.DappMemberEntity; |
| | | import cc.mrbird.febs.dapp.entity.DappTransferRecordEntity; |
| | | import cc.mrbird.febs.dapp.service.DappMemberService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @author |
| | | * @date 2022-03-21 |
| | | **/ |
| | | @Slf4j |
| | |
| | | Map<String, Object> dataTable = getDataTable(dappMemberService.selectInPage(member, request)); |
| | | return new FebsResponse().success().data(dataTable); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getBalanceByAddress/{address}") |
| | | public FebsResponse getBalanceByAddress(@PathVariable("address") String address) { |
| | | BigDecimal balance = ChainService.INSTANCE.balanceOf(address); |
| | | DappMemberEntity member = dappMemberService.findByAddress(address); |
| | | member.setBalance(balance); |
| | | dappMemberService.updateById(member); |
| | | return new FebsResponse().success().data(balance); |
| | | } |
| | | |
| | | @PostMapping(value = "/accountStatus/{id}") |
| | | public FebsResponse accountStatus(@PathVariable("id") Long id) { |
| | | dappMemberService.accountStatus(id); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @PostMapping(value = "/changeAble/{id}") |
| | | public FebsResponse changeAble(@PathVariable("id") Long id) { |
| | | dappMemberService.changeAble(id); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | |
| | | @PostMapping(value = "/withdrawAble/{id}") |
| | | public FebsResponse withdrawAble(@PathVariable("id") Long id) { |
| | | dappMemberService.withdrawAble(id); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @PostMapping(value = "/changeMoney/{address}") |
| | | public FebsResponse changeMoney(@PathVariable(value = "address") String address) { |
| | | dappMemberService.transfer(address); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/transferList") |
| | | public FebsResponse transferList(DappTransferRecordEntity transfer, QueryRequest request) { |
| | | return new FebsResponse().success().data(getDataTable(dappMemberService.selectTransferInPage(transfer, request))); |
| | | } |
| | | } |