1
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user