KKSU
2023-11-30 93a790d54eaf6041039f96bd5d585c6333262fe2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
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.entity.FebsResponse;
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.DappAccountMoneyChangeEntity;
import cc.mrbird.febs.dapp.entity.DappMemberEntity;
import cc.mrbird.febs.dapp.entity.DappNodeOrderEntity;
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.*;
import cn.hutool.core.util.ObjectUtil;
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.*;
 
import javax.validation.Valid;
import java.util.HashMap;
 
/**
 * @author
 * @date 2022-03-17
 **/
@Slf4j
@EncryptEnable
@RequiredArgsConstructor
@CrossOrigin("*")
@RestController
@Api(value = "dapp接口", tags = "dapp接口")
@RequestMapping(value = "/dapi/member")
public class ApiDappMemberController {
 
    private final DappWalletService dappWalletService;
    private final DappSystemService dappSystemService;
    private final DappMemberService dappMemberService;
    private final RedisUtils redisUtils;
 
    @ApiOperation(value = "获取用户信息", notes = "获取用户信息")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = DappMemberInfoVo.class)
    })
    @PostMapping(value = "/memberInfo")
    public FebsResponse memberInfo() {
        return dappMemberService.getMemberInfo();
    }
 
    @ApiOperation(value = "我的团队", notes = "我的团队")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = TeamListVo.class)
    })
    @PostMapping(value = "/teamList")
    public FebsResponse team() {
        return new FebsResponse().success().data(dappMemberService.findTeamList());
    }
 
    @ApiOperation(value = "记录列表", notes = "记录列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = DappFundFlowVo.class)
    })
    @PostMapping(value = "/recordInPage")
    public FebsResponse recordInPage(@RequestBody RecordInPageDto recordInPageDto) {
        return new FebsResponse().success().data(dappWalletService.getRecordVoInPage(recordInPageDto));
    }
 
    @ApiOperation(value = "共享收入与业绩", notes = "共享收入与业绩")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = DappAccountMoneyChangeEntity.class)
    })
    @PostMapping(value = "/changeInPage")
    public FebsResponse changeInPage(@RequestBody ChangeInPageDto changeInPageDto) {
        return dappWalletService.getChangeInPageInPage(changeInPageDto);
    }
 
    @ApiOperation(value = "最新共享收入与业绩", notes = "最新共享收入与业绩")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = DappAccountMoneyChangeEntity.class)
    })
    @GetMapping(value = "/changeInToday")
    public FebsResponse changeInToday() {
        return dappWalletService.changeInToday();
    }
 
    @ApiOperation(value = "兑换AUSDT", notes = "兑换AUSDT")
    @PostMapping(value = "/transferAusd")
    public FebsResponse transferAusd(@RequestBody TransferAusdDto transferAusdDto) {
        return new FebsResponse().success().data(dappWalletService.transferAusd(transferAusdDto));
    }
 
    @ApiOperation(value = "闪兑-资产钱包转帐到闪兑钱包3% 手续费(扣币)", notes = "资产钱包转帐到闪兑钱包3% 手续费(扣币)")
    @PostMapping(value = "/mineToCoin")
    public FebsResponse mineToCoin(@RequestBody MineToCoinDto mineToCoinDto) {
        dappWalletService.mineToCoin(mineToCoinDto);
        return new FebsResponse().success().data("success");
    }
 
    @ApiOperation(value = "互转ANDAO", notes = "互转ANDAO")
    @PostMapping(value = "/roundCoin")
    public FebsResponse roundCoin(@RequestBody RoundCoinDto roundCoinDto) {
        dappWalletService.roundCoin(roundCoinDto);
        return new FebsResponse().success().data("success");
    }
 
    @ApiOperation(value = "互转AUSDT", notes = "互转AUSDT")
    @PostMapping(value = "/roundCoinAusdt")
    public FebsResponse roundCoinAusdt(@RequestBody RoundCoinDto roundCoinDto) {
        dappWalletService.roundCoinAusdt(roundCoinDto);
        return new FebsResponse().success().data("success");
    }
 
    @ApiOperation(value = "提现规则", notes = "提现规则")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = CashOutSettingVo.class)
    })
    @GetMapping(value = "/cashOutSetting")
    public FebsResponse cashOutSetting() {
        return new FebsResponse().success().data(dappWalletService.cashOutSetting());
    }
 
    @ApiOperation(value = "提现", notes = "提现")
    @PostMapping(value = "/withdraw")
    public FebsResponse withdraw(@RequestBody @Valid WithdrawDto withdrawDto) {
//        return new FebsResponse().success().message("合约更新中");
        dappWalletService.withdraw(withdrawDto);
        return new FebsResponse().success().message("success");
    }
 
    @ApiOperation(value = "动能信息", notes = "动能信息")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = ApiRunListInfoVo.class)
    })
    @PostMapping(value = "/runListInfo")
    public FebsResponse runListInfo() {
        return new FebsResponse().success().data(dappMemberService.findRunListInfo());
    }
 
    @PostMapping(value = "/logout")
    public FebsResponse logout() {
        DappMemberEntity member = LoginUserUtil.getAppUser();
        redisUtils.hdel(AppContants.REDIS_KEY_SIGN, member.getAddress());
        redisUtils.hdel(AppContants.REDIS_KEY_MEMBER_INFO, member.getAddress());
        return new FebsResponse().success();
    }
}