调整依赖结构,jxutils不依赖于dao,dao依赖于jxutils
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
)
|
||||
|
||||
@@ -71,8 +72,8 @@ func GetActVendorInfo(db *DaoDB, actID int, vendorIDs []int) (actMap map[int]*mo
|
||||
|
||||
func GetActStoreSkuVendorList(db *DaoDB, actID int, vendorIDs, storeIDs, skuIDs []int, keyword string, offset, pageSize int) (totalCount int, actStoreSkuList []*model.ActStoreSku2, err error) {
|
||||
globals.SugarLogger.Debugf("GetActStoreSkuVendorList actID:%d", actID)
|
||||
offset = FormalizePageOffset(offset)
|
||||
pageSize = FormalizePageSize(pageSize)
|
||||
offset = jxutils.FormalizePageOffset(offset)
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
|
||||
leftOrEmpty := ""
|
||||
if len(vendorIDs) == 1 && (vendorIDs[0] == -1 || vendorIDs[0] == model.VendorIDJX) {
|
||||
@@ -178,8 +179,8 @@ func QueryActs(db *DaoDB, actID int, offset, pageSize int, syncStatus int, keywo
|
||||
if actID == 0 && utils.IsTimeZero(createdAtFrom) && utils.IsTimeZero(beginAt) {
|
||||
return nil, fmt.Errorf("actID,createdAtFrom和beginAt中,至少要指定一个条件")
|
||||
}
|
||||
offset = FormalizePageOffset(offset)
|
||||
pageSize = FormalizePageSize(pageSize)
|
||||
offset = jxutils.FormalizePageOffset(offset)
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
isGetAll := offset == 0 && pageSize == model.UnlimitedPageSize
|
||||
|
||||
sql := `
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
)
|
||||
|
||||
@@ -38,8 +39,8 @@ func GetUserByID(db *DaoDB, fieldName, fieldValue string) (user *model.User, err
|
||||
}
|
||||
|
||||
func GetUsers(db *DaoDB, userType int, keyword string, userIDs []string, userID2, mobile string, offset, pageSize int) (userList []*model.User, totalCount int, err error) {
|
||||
offset = FormalizePageOffset(offset)
|
||||
pageSize = FormalizePageSize(pageSize)
|
||||
offset = jxutils.FormalizePageOffset(offset)
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
if userType == 0 {
|
||||
userType = 255
|
||||
}
|
||||
@@ -182,8 +183,8 @@ func QueryUserDeliveryAddress(db *DaoDB, addressID int64, userIDs []string, offs
|
||||
sql += " AND t1.user_id IN (" + GenQuestionMarks(len(userIDs)) + ")"
|
||||
sqlParams = append(sqlParams, userIDs)
|
||||
}
|
||||
offset = FormalizePageOffset(offset)
|
||||
pageSize = FormalizePageSize(pageSize)
|
||||
offset = jxutils.FormalizePageOffset(offset)
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
sql += `
|
||||
ORDER BY t1.is_default DESC, t1.consignee_name
|
||||
LIMIT ? OFFSET ?`
|
||||
|
||||
@@ -201,18 +201,10 @@ func IsVendorThingIDEmpty(vendorThingID string) bool {
|
||||
return vendorThingID == "" || vendorThingID == "0"
|
||||
}
|
||||
|
||||
func FormalizePageSize(pageSize int) int {
|
||||
if pageSize == 0 {
|
||||
return model.DefPageSize
|
||||
} else if pageSize < 0 {
|
||||
return model.UnlimitedPageSize
|
||||
func GetAuthType4Vendor(vendorID int) (authType string) {
|
||||
authType = ConvertJsonFieldPrefix(model.VendorNames[vendorID])
|
||||
if authType != "" {
|
||||
authType = "vendor." + authType
|
||||
}
|
||||
return pageSize
|
||||
}
|
||||
|
||||
func FormalizePageOffset(offset int) int {
|
||||
if offset < 0 {
|
||||
offset = 0
|
||||
}
|
||||
return offset
|
||||
return authType
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package dao
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
)
|
||||
|
||||
@@ -72,8 +73,8 @@ func QueryFoodRecipes(db *DaoDB, keyword string, recipeID int, authorID, userID
|
||||
) > 0`
|
||||
sqlParams = append(sqlParams, skuIDs)
|
||||
}
|
||||
offset = FormalizePageOffset(offset)
|
||||
pageSize = FormalizePageSize(pageSize)
|
||||
offset = jxutils.FormalizePageOffset(offset)
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
sql += `
|
||||
ORDER BY t1.created_at DESC
|
||||
LIMIT ? OFFSET ?`
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
)
|
||||
|
||||
@@ -76,8 +77,8 @@ func QueryPageStores(db *DaoDB, pageSize, offset int, keyword string, vendorStor
|
||||
ORDER BY t1.recent_order_num DESC
|
||||
LIMIT ? OFFSET ?
|
||||
`
|
||||
pageSize = FormalizePageSize(pageSize)
|
||||
offset = FormalizePageOffset(offset)
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
offset = jxutils.FormalizePageOffset(offset)
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
var shopList []*PageShopWithPlaceName
|
||||
Begin(db)
|
||||
|
||||
Reference in New Issue
Block a user