SJA APS后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.1 KiB

  1. package db
  2. import (
  3. "leit.com/leit_seat_aps/common"
  4. "time"
  5. )
  6. //邮件表
  7. type Sendmailtab struct {
  8. Id int `xorm:"pk"`
  9. Username string
  10. Password string
  11. Host string
  12. Tomail string
  13. Name string
  14. Subject string
  15. Body string
  16. Mailtype string
  17. Status string
  18. Resultinfo string
  19. Createtime string
  20. }
  21. type Sendmail struct {
  22. Username string
  23. Password string
  24. Host string
  25. Tomail string
  26. Name string
  27. Subject string
  28. Body string
  29. Mailtype string
  30. Status string
  31. Resultinfo string
  32. Createtime string
  33. }
  34. func (t *Sendmailtab) Clipped() {
  35. common.TrimStruct(t, *t)
  36. }
  37. func (t *Sendmailtab) TableName() string {
  38. return "sendmailtab"
  39. }
  40. //增
  41. func (t *Sendmailtab) Add() error {
  42. e := G_DbEngine
  43. mail := Sendmail{}
  44. mail.Status = t.Status
  45. mail.Mailtype = "html"
  46. mail.Body = t.Body
  47. mail.Subject = t.Subject
  48. mail.Name = t.Name
  49. mail.Tomail = t.Tomail
  50. mail.Host = t.Host
  51. mail.Password = t.Password
  52. mail.Username = t.Username
  53. mail.Createtime = common.TimeFormat(time.Now(), "yyyyMMddHHmmss")
  54. _, err := e.Table("sendmailtab").Insert(&mail)
  55. if err != nil {
  56. return err
  57. }
  58. return nil
  59. }