优化代码

This commit is contained in:
GoEdgeLab
2022-03-22 19:30:30 +08:00
parent 31599bee13
commit 2b0e2b6888
90 changed files with 294 additions and 294 deletions

View File

@@ -7,7 +7,7 @@ import (
var SharedCacheLocker = sync.RWMutex{}
// 处理JSON字节Slice
// JSONBytes 处理JSON字节Slice
func JSONBytes(data []byte) []byte {
if len(data) == 0 {
return []byte("null")
@@ -15,12 +15,12 @@ func JSONBytes(data []byte) []byte {
return data
}
// 判断JSON是否不为空
// IsNotNull 判断JSON是否不为空
func IsNotNull(data string) bool {
return len(data) > 0 && data != "null"
}
// 构造Query
// NewQuery 构造Query
func NewQuery(tx *dbs.Tx, dao dbs.DAOWrapper, adminId int64, userId int64) *dbs.Query {
query := dao.Object().Query(tx)
if adminId > 0 {