package models import "zhiyuan/pkg/db" type Sms struct { ID int `json:"id"` Type int `json:"type"` UserID int `json:"user_id"` Phone int `json:"phone"` TemplateCode int `json:"template_code"` TemplateParam int `json:"template_param"` Status int `json:"status"` CreatedAt int `json:"created_at"` UpdatedAt int `json:"updated_at"` } func (Sms) TableName() string { return "zy_sms" } func (s Sms) GetOne(where map[string]interface{}, fields []string) (*Sms, error) { var sms *Sms rows, err := db.BuildSelectRows(s.TableName(), where, fields) if err != nil { return sms, err } db.ScanClose(rows, &sms) return sms, nil }