This commit is contained in:
邹宗楠
2024-01-16 16:24:50 +08:00
parent e3eff8739b
commit 1fe0ca13b0
7 changed files with 85 additions and 41 deletions

View File

@@ -888,17 +888,17 @@ func (c *SkuController) BatchSetRestockingPrice() {
// @Title 批量设置美团商品打包费为零
// @Description 批量设置美团商品打包费为零
// @Param token header string true "认证token"
// @Param storeIds formData string true "门店id列表"
// @Param payload formData string true "json数据SpuData对象()"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /BatchSetBoxPrice [post]
func (c *SkuController) BatchSetBoxPrice() {
c.callBatchSetBoxPrice(func(params *tSkuBatchSetBoxPriceParams) (retVal interface{}, errCode string, err error) {
var stores []int
if err = jxutils.Strings2Objs(params.StoreIds, &stores); err != nil {
return retVal, "", err
payload := make([]*mtwm.SetBoxPrice, 0, 0)
if err = utils.UnmarshalUseNumber([]byte(params.Payload), &payload); err != nil {
return nil, "", err
}
err = cms.BatchSetMTBoxPrice(params.Ctx, stores)
err = cms.BatchSetMTBoxPrice(params.Ctx, payload)
return retVal, "", err
})
}

View File

@@ -4,7 +4,9 @@ import (
"encoding/json"
"errors"
"fmt"
"git.rosy.net.cn/jx-callback/business/auth2"
"git.rosy.net.cn/jx-callback/business/bidding"
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/jx-callback/business/partner/delivery"
"strings"
"time"
@@ -496,12 +498,38 @@ func (c *OrderController) StaleIndexInfo() {
if err != nil {
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)
}
var storeList []*dao.StoreWithCityName
dataList := make([]int, 0, len(storeList))
mapDataList := make(map[int]int, len(storeList))
if storeList, err = cms.GetStoreList4User(ctx, mobile, userID); err == nil && len(storeList) > 0 {
// todo应该用通用方法
for _, v := range storeList {
dataList = append(dataList, v.Store.ID)
mapDataList[v.Store.ID] = model.YES
}
} else {
return retVal, "", err
}
if params.StoreID != 0 && mapDataList[params.StoreID] != model.YES {
return retVal, "", fmt.Errorf("此门店%d,不归属于该用户%s", params.StoreID, ctx.GetUserName())
}
var vendors []int
var brandIds []int
if err := jxutils.Strings2Objs(params.VendorIds, &vendors, params.BrandIds, &brandIds); err != nil {
return nil, "", err
return retVal, "", err
}
retVal, err = orderman.FixedOrderManager.GetStoresOrderSaleInfo2(params.Ctx, timeList[0], timeList[1], params.StoreID, brandIds, vendors)
retVal, err = orderman.FixedOrderManager.GetStoresOrderSaleInfo2(params.Ctx, timeList[0], timeList[1], params.StoreID, brandIds, vendors, dataList, mapDataList)
return retVal, "", err
})
}