Initial commit

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 13:57:10 +08:00
co-authored by Claude Opus 5
commit 8679200f41
1897 changed files with 257900 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
package backpackmod
import (
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo/options"
)
type QueryAllWebCond struct {
Page int64 `form:"page" binding:"required"`
Limit int64 `form:"limit" binding:"required"`
Uid *int `form:"uid"` // 用户ID
Status *int `form:"status"` // 使用状态 1、已使用 2、未使用 3、过期
GoodsType *int `form:"goodsType"` // 类型
GoodsDesc *string `form:"goodsDesc"` // 描述
}
type QueryAllRes struct {
List []*Backpack `json:"list"`
Total int64 `json:"total"`
}
func (receiver *QueryAllWebCond) Filter() bson.M {
var query = bson.M{}
if receiver.Uid != nil {
query["uid"] = receiver.Uid
}
if receiver.GoodsType != nil {
query["goodsType"] = receiver.GoodsType
}
if receiver.GoodsDesc != nil {
query["goodsDesc"] = receiver.GoodsDesc
}
if receiver.Status != nil {
query["status"] = receiver.Status
}
return query
}
func (receiver QueryAllWebCond) Options() *options.FindOptions {
return options.Find().SetSkip((receiver.Page - 1) * receiver.Limit).SetLimit(receiver.Limit).SetSort(bson.D{{"createTime", -1}})
}