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); } }