db空指针

This commit is contained in:
sk 2024-10-16 13:20:43 +08:00
parent 5619d9c95d
commit b08113a339
1 changed files with 5 additions and 1 deletions

View File

@ -26,7 +26,11 @@ func AwardLogCollection(plt string) *mongo.Collection {
}
func FetchAwardLog(plt string) (recs model.AwardLog, err error) {
err = AwardLogCollection(plt).Find(bson.M{}).One(&recs)
c := AwardLogCollection(plt)
if c == nil {
return recs, AwardLogDBErr
}
err = c.Find(bson.M{}).One(&recs)
return
}