feat: mail config and mail send

This commit is contained in:
zchengo
2023-01-24 20:03:35 +08:00
parent a9e33f2bcc
commit 35886fde4f
17 changed files with 731 additions and 8 deletions
+16
View File
@@ -4,6 +4,7 @@ import (
"crm/models"
"crm/response"
"crm/service"
"log"
"strconv"
"github.com/gin-gonic/gin"
@@ -45,6 +46,21 @@ func (c *CustomerApi) Update(context *gin.Context) {
response.Result(errCode, nil, context)
}
// 发送邮件给客户
func (c *CustomerApi) SendMail(context *gin.Context) {
var param models.CustomerSendMailParam
uid, _ := strconv.Atoi(context.Request.Header.Get("uid"))
err := context.ShouldBind(&param)
if uid <= 0 || err != nil {
response.Result(response.ErrCodeParamInvalid, nil, context)
log.Println(err)
return
}
param.Uid = int64(uid)
errCode := c.customerService.SendMail(&param)
response.Result(errCode, nil, context)
}
// 删除客户
func (c *CustomerApi) Delete(context *gin.Context) {
var param models.CustomerDeleteParam