package db
|
|
|
|
import (
|
|
"leit.com/leit_seat_aps/common"
|
|
"time"
|
|
)
|
|
|
|
//邮件表
|
|
type Sendmailtab struct {
|
|
Id int `xorm:"pk"`
|
|
Username string
|
|
Password string
|
|
Host string
|
|
Tomail string
|
|
Name string
|
|
Subject string
|
|
Body string
|
|
Mailtype string
|
|
Status string
|
|
Resultinfo string
|
|
Createtime string
|
|
}
|
|
|
|
type Sendmail struct {
|
|
Username string
|
|
Password string
|
|
Host string
|
|
Tomail string
|
|
Name string
|
|
Subject string
|
|
Body string
|
|
Mailtype string
|
|
Status string
|
|
Resultinfo string
|
|
Createtime string
|
|
}
|
|
|
|
func (t *Sendmailtab) Clipped() {
|
|
common.TrimStruct(t, *t)
|
|
}
|
|
func (t *Sendmailtab) TableName() string {
|
|
return "sendmailtab"
|
|
}
|
|
|
|
//增
|
|
func (t *Sendmailtab) Add() error {
|
|
e := G_DbEngine
|
|
mail := Sendmail{}
|
|
mail.Status = t.Status
|
|
mail.Mailtype = "html"
|
|
mail.Body = t.Body
|
|
mail.Subject = t.Subject
|
|
mail.Name = t.Name
|
|
mail.Tomail = t.Tomail
|
|
mail.Host = t.Host
|
|
mail.Password = t.Password
|
|
mail.Username = t.Username
|
|
mail.Createtime = common.TimeFormat(time.Now(), "yyyyMMddHHmmss")
|
|
_, err := e.Table("sendmailtab").Insert(&mail)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|