sms.go 689 B

1234567891011121314151617181920212223242526272829
  1. package models
  2. import "zhiyuan/pkg/db"
  3. type Sms struct {
  4. ID int `json:"id"`
  5. Type int `json:"type"`
  6. UserID int `json:"user_id"`
  7. Phone int `json:"phone"`
  8. TemplateCode int `json:"template_code"`
  9. TemplateParam int `json:"template_param"`
  10. Status int `json:"status"`
  11. CreatedAt int `json:"created_at"`
  12. UpdatedAt int `json:"updated_at"`
  13. }
  14. func (Sms) TableName() string {
  15. return "zy_sms"
  16. }
  17. func (s Sms) GetOne(where map[string]interface{}, fields []string) (*Sms, error) {
  18. var sms *Sms
  19. rows, err := db.BuildSelectRows(s.TableName(), where, fields)
  20. if err != nil {
  21. return sms, err
  22. }
  23. db.ScanClose(rows, &sms)
  24. return sms, nil
  25. }