新增功能:把所有营业的门店,京西商城门店都打开,默认范围3km,默认100-100京西价格套餐
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
|
||||
"github.com/astaxie/beego"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -563,6 +564,62 @@ func CompareJxAndMultiVenderDepot(ctx *jxcontext.Context, vendorMap map[int]bool
|
||||
}
|
||||
}
|
||||
|
||||
func StoreOpenAll(ctx *jxcontext.Context) {
|
||||
db := dao.GetDB()
|
||||
StoreLists, err := dao.GetStoreList(db, nil, nil, []int{1}, nil, "")
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("商店列表获取失败")
|
||||
}
|
||||
var StoreMapLists []*model.StoreMap
|
||||
for _, StoreList := range StoreLists {
|
||||
if StoreMapLists, err = dao.GetStoresMapList(db, []int{0, 1, 3}, []int{StoreList.ID}, nil, 1, -1, "", ""); err != nil {
|
||||
globals.SugarLogger.Debugf("商店列表获取失败")
|
||||
}
|
||||
if len(StoreMapLists) > 0 {
|
||||
/*将map查询的结果全部放进数组*/
|
||||
for _, StoreMapList := range StoreMapLists {
|
||||
/*二元运算符*/
|
||||
StoreMapList.SyncStatus = StoreMapList.SyncStatus | model.SyncFlagModifiedMask
|
||||
StoreMapList.UpdatedAt = time.Now()
|
||||
StoreMapList.LastOperator = ctx.GetUserName()
|
||||
dao.UpdateEntity(db, StoreMapList, "SyncStatus", "UpdatedAt", "LastOperator")
|
||||
//}
|
||||
/*同步*/
|
||||
if _, err = CurVendorSync.SyncStore(ctx, db, StoreMapList.VendorID, StoreList.ID, false, ctx.GetUserName()); err != nil {
|
||||
globals.SugarLogger.Debugf("同步失败")
|
||||
}
|
||||
}
|
||||
}
|
||||
if StoreMapLists, err = dao.GetStoresMapList(db, []int{9}, []int{StoreList.ID}, nil, 1, -1, "", ""); err != nil {
|
||||
globals.SugarLogger.Debugf("商店列表获取失败")
|
||||
}
|
||||
if len(StoreMapLists) == 0 {
|
||||
/*遍历,绑定*/
|
||||
Map := &model.StoreMap{}
|
||||
Map.VendorStoreID = strconv.Itoa(StoreList.ID)
|
||||
Map.AutoPickup = 1
|
||||
Map.DeliveryCompetition = 1
|
||||
Map.PricePercentage = 100
|
||||
Map.IsSync = 1
|
||||
Map.PricePercentagePack = "京西100-100"
|
||||
Map.DeliveryFeeDeductionSill = 0
|
||||
Map.DeliveryFeeDeductionFee = 0
|
||||
Map.IsOrder = 0
|
||||
if _, err := AddStoreVendorMap(ctx, db, 9, "", StoreList.ID, Map); err != nil {
|
||||
globals.SugarLogger.Debugf("AddStoreVendorMap调用出错,StoreID是" + strconv.Itoa(StoreList.ID))
|
||||
}
|
||||
}
|
||||
/*改配送范围*/
|
||||
//deliverrangetype 3
|
||||
//deliverrange 3000
|
||||
StoreList.DeliveryRange = "3000"
|
||||
StoreList.DeliveryRangeType = 3
|
||||
StoreList.UpdatedAt = time.Now()
|
||||
StoreList.LastOperator = ctx.GetUserName()
|
||||
dao.UpdateEntity(db, StoreList, "DeliveryRange", "DeliveryRangeType", "LastOperator", "UpdatedAt")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDiff(ctx *jxcontext.Context, vendorIDList []int, storeIDList []int) {
|
||||
baseapi.SugarLogger.Debugf("CheckSkuDiffBetweenJxAndVendor start time: %v", time.Now())
|
||||
startProcessTime := time.Now().Unix()
|
||||
|
||||
Reference in New Issue
Block a user