修复空卡密导致自动化规则账号不显示
This commit is contained in:
1 parent
b831f2d7c8
commit
1185551018
5 files changed
+14
-3
No files matched your search
@@ -27,9 +27,14 @@ func (s *Server) listCards(w http.ResponseWriter, r *http.Request) {
|
||||
sess := auth.SessionFromContext(r.Context())
|
||||
cards, err := s.Store.Cards.AllForUser(r.Context(), sess.UserID)
|
||||
if err != nil {
|
||||
s.Logger.Error("查询卡密失败", "user_id", sess.UserID, "err", err)
|
||||
writeErr(w, http.StatusInternalServerError, "查询失败")
|
||||
return
|
||||
}
|
||||
if cards == nil {
|
||||
s.Logger.Debug("用户没有卡密,返回空列表", "user_id", sess.UserID)
|
||||
cards = []db.CardFull{}
|
||||
}
|
||||
writeJSON(w, http.StatusOK, cards)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user