燕山石化溯源三维电子沙盘-【后端】-服务
13693261870
2024-03-21 0e8a68032d8539550b26655a96496e11df73baf6
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
package com.yssh.controller;
 
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yssh.service.EmailService;
import com.yssh.utils.Result;
import com.yssh.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.Resource;
 
@Api(tags="电子邮件")
@RestController
@RequestMapping("/email")
@SuppressWarnings("ALL")
public class EmailController {
    @Resource
    EmailService emailService;
 
    @ApiOperationSupport(order = 1)
    @GetMapping("/test")
    @ApiOperation(value = "测试", notes = "测试")
    public Result text(@RequestParam(value = "title", required = true) String title,
                       @RequestParam(value = "text", required = true) String text) {
        if (StringUtils.isEmpty(title) || StringUtils.isEmpty(text)) {
            return Result.error("title和text不能为空");
        }
 
        Boolean flag = emailService.send(title, text);
 
        return Result.OK(flag);
    }
}