package models import ( "pro2d/components/db" "pro2d/protos/pb" ) type AccountModel struct { *db.MgoColl *pb.AccountInfo } func AccountExistByPhone(phone string) (bool, *AccountModel){ m := NewAccount(phone) if err := m.Load(); err != nil { return false, m } return true, m } func NewAccount(phone string) *AccountModel { ac := &pb.AccountInfo{ Phone: phone, } account := &AccountModel{ MgoColl: db.NewMongoColl(phone, ac), AccountInfo: ac, } return account }