aa
This commit is contained in:
@@ -1933,12 +1933,11 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
task := tasksch.NewParallelTask("RefreshStoreManageState", tasksch.NewParallelConfig().SetParallelCount(3).SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
vendorID := batchItemList[0].(int)
|
||||
storeMaps, err := dao.GetStoresMapList(db, []int{vendorID}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "")
|
||||
paged, err := dao.GetStoreManageState(db, nil, nil, vendorID, 0, 0, model.UnlimitedPageSize)
|
||||
storeMaps, err := dao.GetStoresMapList(db, []int{vendorID}, nil, []int{model.StoreStatusOpened, model.StoreStatusClosed, model.StoreStatusHaveRest}, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "")
|
||||
storeManageStates, err := dao.GetStoreManageStateSimple(db, nil, nil, vendorID)
|
||||
var (
|
||||
storeManageStates = paged.Data.([]*dao.GetStoreManageStateResult)
|
||||
storeMapsMap = make(map[int]*model.StoreMap)
|
||||
storeManagesMap = make(map[int]*dao.GetStoreManageStateResult)
|
||||
storeManagesMap = make(map[int]*model.StoreManageState)
|
||||
deleteList []int
|
||||
createList, updateList []*model.StoreMap
|
||||
)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
@@ -1231,8 +1230,6 @@ func GetStoreManageState(db *DaoDB, storeIDs, brandIDs []int, vendorID, sortType
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
Begin(db)
|
||||
defer Commit(db)
|
||||
fmt.Println(sql)
|
||||
fmt.Println(sqlParams)
|
||||
if err = GetRows(db, &requestList, sql, sqlParams...); err == nil {
|
||||
return &model.PagedInfo{
|
||||
TotalCount: GetLastTotalRowCount(db),
|
||||
@@ -1241,3 +1238,30 @@ func GetStoreManageState(db *DaoDB, storeIDs, brandIDs []int, vendorID, sortType
|
||||
}
|
||||
return pagedInfo, err
|
||||
}
|
||||
|
||||
func GetStoreManageStateSimple(db *DaoDB, storeIDs, brandIDs []int, vendorID int) (pagedInfo []*model.StoreManageState, err error) {
|
||||
sql := `
|
||||
SELECT a.*
|
||||
FROM store_manage_state a
|
||||
LEFT JOIN store b ON b.id = a.store_id AND b.deleted_at = ?
|
||||
WHERE a.vendor_status <> ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
model.StoreStatusDisabled,
|
||||
}
|
||||
if len(storeIDs) > 0 {
|
||||
sql += " AND a.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
}
|
||||
if len(brandIDs) > 0 {
|
||||
sql += " AND b.brand_id IN (" + GenQuestionMarks(len(brandIDs)) + ")"
|
||||
sqlParams = append(sqlParams, brandIDs)
|
||||
}
|
||||
if vendorID != -1 {
|
||||
sql += " AND a.vendor_id = ?"
|
||||
sqlParams = append(sqlParams, vendorID)
|
||||
}
|
||||
err = GetRows(db, &pagedInfo, sql, sqlParams...)
|
||||
return pagedInfo, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user