init: 初始化 web_hgdjb_server 项目

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 10:47:32 +08:00
co-authored by Claude Opus 4.7
commit f13d33af4d
707 changed files with 147705 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
package mwacc
import (
"strconv"
"videoweb/pub/pubdef"
"go.mongodb.org/mongo-driver/bson"
)
func MakeSearch(keyWords string, status int64, page pubdef.Page) (searchs bson.M) {
var search []bson.M
if len(keyWords) > 0 {
userId, _ := strconv.ParseInt(keyWords, 10, 64)
search = append(search, bson.M{FN.MwAcc.Id: userId})
search = append(search, bson.M{FN.MwAcc.UserName: bson.M{"$regex": keyWords}})
search = append(search, bson.M{FN.MwAcc.Acc: bson.M{"$regex": keyWords}})
search = append(search, bson.M{FN.MwAcc.Email: bson.M{"$regex": keyWords}})
}
match := bson.M{}
if len(search) > 0 {
match["$or"] = search
}
if status > 0 {
if status == 1 {
match[FN.MwAcc.IsEnb] = true
} else {
match[FN.MwAcc.IsEnb] = false
}
}
searchs = bson.M{}
searchs["$match"] = match
return
}
func MakeSort(pageNum int64, pageSize int64) (sort []bson.M) {
sort = append(sort, bson.M{
"$sort": bson.M{
FN.MwAcc.CreatedAt: -1,
},
})
if pageNum <= 0 {
pageNum = 1
}
if pageSize <= 0 {
pageSize = 10
}
skip := (pageNum - 1) * pageSize
sort = append(sort, bson.M{
"$skip": skip,
})
sort = append(sort, bson.M{
"$limit": pageSize,
})
return
}