db空指针
This commit is contained in:
parent
b08113a339
commit
13e44216be
|
@ -52,7 +52,11 @@ func InsertAnnouncerLog(logs ...*model.AnnouncerLog) (err error) {
|
||||||
// 取最新100条数据
|
// 取最新100条数据
|
||||||
func FetchAnnouncerLog(plt string) (recs []model.AnnouncerLog, err error) {
|
func FetchAnnouncerLog(plt string) (recs []model.AnnouncerLog, err error) {
|
||||||
query := bson.M{}
|
query := bson.M{}
|
||||||
err = AnnouncerLogCollection(plt).Find(query).Sort("-_id").Limit(100).All(&recs)
|
c := AnnouncerLogCollection(plt)
|
||||||
|
if c == nil {
|
||||||
|
return recs, AnnouncerLogDBErr
|
||||||
|
}
|
||||||
|
err = c.Find(query).Sort("-_id").Limit(100).All(&recs)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue