新版仿ok交易所-后端
1
zj
2026-02-03 c7c4c4eec809cfd5e399edab50fae9bf68681585
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
package com.yami.trading.api.controller;
 
import com.yami.trading.common.domain.Result;
import com.yami.trading.common.manager.email.EmailMessage;
import com.yami.trading.common.util.IPHelper;
import com.yami.trading.service.IdentifyingCodeService;
import com.yami.trading.service.IdentifyingCodeTimeWindowService;
import com.yami.trading.service.InternalEmailSenderService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.Random;
 
@RequestMapping("api/idcode")
@RestController
@Api(tags = "idcode")
public class ApiIdentifyingCodeController {
 
    @Autowired
    private IdentifyingCodeService identifyingCodeService;
    @Autowired
    private InternalEmailSenderService internalEmailSenderService;
    @Autowired
    private IdentifyingCodeTimeWindowService identifyingCodeTimeWindowService;
 
    @RequestMapping("execute")
    public Result execute(@RequestParam String target) {
//            identifyingCodeService.send(target, IPHelper.getIpAddr());
        Random random = new Random();
        String code = String.valueOf(random.nextInt(999999) % 900000 + 100000);
        this.identifyingCodeTimeWindowService.putAuthCode(target, code);
        EmailMessage emailMessage = new EmailMessage();
        emailMessage.setContent(code);
        emailMessage.setTomail(target);
        internalEmailSenderService.aokSend(emailMessage);
        return Result.succeed(null);
    }
 
}