From 6bbb9ee5ab3178881fa1cc5bca350c0fa8c28d57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 23 Dec 2025 09:08:22 +0800 Subject: [PATCH] 1 --- business/model/dao/dao_order.go | 3 -- controllers/jx_order.go | 60 ++++++++++++++++----------------- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/business/model/dao/dao_order.go b/business/model/dao/dao_order.go index 0232f015e..9745adb63 100644 --- a/business/model/dao/dao_order.go +++ b/business/model/dao/dao_order.go @@ -2,7 +2,6 @@ package dao import ( "fmt" - "git.rosy.net.cn/jx-callback/globals" "regexp" "strconv" "time" @@ -2076,8 +2075,6 @@ func StaticStoreOrderChange(db *DaoDB, storeId []int, start, end time.Time, rank lastSql = fmt.Sprintf(lastSql, rank) - globals.SugarLogger.Debugf("-----sql := %s", lastSql) - globals.SugarLogger.Debugf("-----dailyParam := %s", utils.Format4Output(dailyParam, false)) data := make([]*StoreOrderRank, 0, 0) if err := GetRows(db, &data, lastSql, dailyParam...); err != nil { return nil, err diff --git a/controllers/jx_order.go b/controllers/jx_order.go index 88353d56b..cfef56196 100644 --- a/controllers/jx_order.go +++ b/controllers/jx_order.go @@ -579,9 +579,9 @@ func (c *OrderController) StaleIndexInfo() { func (c *OrderController) StoreOrderRank() { c.callStoreOrderRank(func(params *tOrderStoreOrderRankParams) (retVal interface{}, code string, err error) { var ( - //storeList []*dao.StoreWithCityName - //dataList = make([]int, 0, len(storeList)) - //mapDataList = make(map[int]int, len(storeList)) + storeList []*dao.StoreWithCityName + dataList = make([]int, 0, len(storeList)) + mapDataList = make(map[int]int, len(storeList)) ) timeList, err := jxutils.BatchStr2Time(params.Start, params.End) if err != nil { @@ -592,33 +592,33 @@ func (c *OrderController) StoreOrderRank() { return nil, "", err } - //ctx := params.Ctx - //if !auth2.IsV2Token(ctx.GetToken()) { - // return nil, model.ErrCodeTokenIsInvalid, model.ErrTokenIsInvalid - //} - //mobile, userID := ctx.GetMobileAndUserID() - //if mobile == "" || userID == "" || userID == "null" || userID == "NULL" { - // return nil, "", fmt.Errorf("不能得到用户手机号,%s,%s", userID, mobile) - //} - // - //if permission.IsRoled(ctx) { - // if storeList, err = cms.GetStoreList4User(ctx, mobile, userID); err == nil && len(storeList) > 0 { - // for _, v := range storeList { - // dataList = append(dataList, v.Store.ID) - // mapDataList[v.Store.ID] = model.YES - // } - // } - // if len(storeIdList) != model.NO { - // for _, sl := range storeIdList { - // if mapDataList[sl] != model.YES { - // return retVal, "", fmt.Errorf("此门店%d,不归属于该用户%s", sl, ctx.GetUserName()) - // } - // } - // } - //} - //if len(storeIdList) == model.NO { - // storeIdList = dataList - //} + ctx := params.Ctx + if !auth2.IsV2Token(ctx.GetToken()) { + return nil, model.ErrCodeTokenIsInvalid, model.ErrTokenIsInvalid + } + mobile, userID := ctx.GetMobileAndUserID() + if mobile == "" || userID == "" || userID == "null" || userID == "NULL" { + return nil, "", fmt.Errorf("不能得到用户手机号,%s,%s", userID, mobile) + } + + if permission.IsRoled(ctx) { + if storeList, err = cms.GetStoreList4User(ctx, mobile, userID); err == nil && len(storeList) > 0 { + for _, v := range storeList { + dataList = append(dataList, v.Store.ID) + mapDataList[v.Store.ID] = model.YES + } + } + if len(storeIdList) != model.NO { + for _, sl := range storeIdList { + if mapDataList[sl] != model.YES { + return retVal, "", fmt.Errorf("此门店%d,不归属于该用户%s", sl, ctx.GetUserName()) + } + } + } + } + if len(storeIdList) == model.NO { + storeIdList = dataList + } retVal, err = dao.StaticStoreOrderChange(dao.GetDB(), storeIdList, timeList[0], timeList[1], params.Rank) return retVal, "", err })