package com.ruoyi.system.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.ruoyi.system.service.ZsEmailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
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;
@Slf4j
@RestController
@RequestMapping("/system/zsEmail")
public class ZsEmailController {
    @Autowired
    private ZsEmailService emailService;
    /**
     * 站点模块 调用发送邮箱接口
     * @param receiveEmail 接收邮箱
     * @param title 标题
     * @param context 内容
     */
    @SaIgnore
    @GetMapping("/sendEmailWeb")
    public boolean sendEmailWeb(@RequestParam("receiveEmail") String receiveEmail,
                           @RequestParam("title")String title,
                           @RequestParam("context")String context) {
        //发送邮件
        try {
            return  emailService.sendEmail(receiveEmail,title,context);
        } catch (Exception e) {
            log.error("邮件发送接口失败！",e);
            return false;
        }

    }
}
