This commit is contained in:
苏尹岚
2020-08-11 09:27:00 +08:00
25 changed files with 348 additions and 117 deletions

View File

@@ -1057,6 +1057,47 @@ func RefreshPageActs(ctx *jxcontext.Context, vendorIDs []int, createdFrom time.T
return hint, err
}
func DeleteStoresFromAct(ctx *jxcontext.Context, vendorID int, actTypes, storeIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
db := dao.GetDB()
task := tasksch.NewParallelTask("将SKU从所有活动中删除", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
storeID := batchItemList[0].(int)
acts, _ := dao.QueryActs(db, 0, 0, 50, 0, "", vendorID, []int{1}, actTypes, nil, storeID, nil, 0, utils.ZeroTimeValue, utils.ZeroTimeValue, time.Now().AddDate(0, -3, 0), time.Now())
for _, v := range acts.Data {
var actStoreSkuParam []*ActStoreSkuParam
_, actStoreSkus, _ := dao.GetActStoreSkuVendorList(db, v.ID, []int{vendorID}, nil, nil, "", 0, 99999)
for _, actStoreSku := range actStoreSkus {
if actStoreSku.StoreID == storeID {
aa := &ActStoreSkuParam{
ActStoreSku: model.ActStoreSku{
StoreID: storeID,
SkuID: actStoreSku.SkuID,
ActID: v.ID,
},
}
actStoreSkuParam = append(actStoreSkuParam, aa)
}
}
_, err = DeleteActStoreSkuBind(ctx, db, v.ID, actStoreSkuParam)
if err == nil {
_, err = SyncAct(ctx, nil, v.ID, nil, true)
}
}
return retVal, err
}, storeIDs)
tasksch.HandleTask(task, nil, true).Run()
if isAsync {
hint = task.GetID()
} else {
resultList, err2 := task.GetResult(0)
if err = err2; err == nil {
hint = utils.Int2Str(len(resultList))
}
}
return hint, err
}
func DeleteSkusFromAct(ctx *jxcontext.Context, vendorID int, actTypes, skuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
db := dao.GetDB()
actMap := make(map[int]*model.Act)

View File

@@ -672,6 +672,7 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku, isQueryMidPric
'","eclpID":"', t2.eclp_id,
'","weight":', t2.weight, ',"categoryID":', t2.category_id, ',"nameID":', t2.name_id,
', "seq":', t2.seq,
', "minOrderCount":', t2.min_order_count,
"}")), "]") skus_str,
CONCAT("[", GROUP_CONCAT(DISTINCT t3.place_code), "]") places_str
` + sql + `

View File

@@ -2,6 +2,7 @@ package cms
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
@@ -3399,13 +3400,16 @@ func UpdateStorePricePack(ctx *jxcontext.Context, storeID, vendorID int, pricePa
}()
//证明是门店自己的调价包
if strings.Contains(pricePack, utils.Int2Str(storeID)) {
obj := dao.PricePercentagePack2Obj(value)
realValue, _ := json.Marshal(obj)
// _, err = UpdateConfig(ctx, pricePack, model.ConfigTypePricePack, string(realValue))
configList, err := dao.QueryConfigs(db, pricePack, model.ConfigTypePricePack, "")
if err != nil {
dao.Rollback(db)
return err
}
if _, err = dao.UpdateEntityLogically(db, configList[0], map[string]interface{}{
"Value": value,
"Value": string(realValue),
}, ctx.GetUserName(), nil); err != nil {
dao.Rollback(db)
return err

View File

@@ -4079,7 +4079,7 @@ func BackUpStoreSkuBind(ctx *jxcontext.Context, isAsync, isContinueWhenError boo
snapshotAt = utils.Time2Date(time.Now())
)
storeSkuBindHis := &model.StoreSkuBindHistory{
SnapshotAt: snapshotAt.AddDate(0, 0, -2),
SnapshotAt: snapshotAt.AddDate(0, 0, -5),
}
dao.DeleteEntity(db, storeSkuBindHis, "SnapshotAt")
storeList, err := dao.GetStoreList(db, nil, nil, nil, nil, "")
@@ -4397,7 +4397,6 @@ func SyncMatterC4ToGy(ctx *jxcontext.Context, isContinueWhenError, isAsync bool)
updateMatters = append(updateMatters, skusMap[c4.EclpID])
}
}
fmt.Println("updateMatters", utils.Format4Output(updateMatters, false))
case 1:
if len(deleteMatters) > 0 {
for _, v := range deleteMatters {

View File

@@ -1297,6 +1297,9 @@ func SetMTPSStatus(ctx *jxcontext.Context, storeId, courierStatus int) {
ShopInfo, _ := api.MtpsAPI.ShopQuery(strconv.Itoa(storeId))
if ShopInfo != nil {
ShopName = ShopInfo.ShopName
if ShopName == "" {
ShopName = StoreLists[0].Name[:len(StoreLists[0].Name)-3]
}
StoreInfoList, _ = api.MtpsAPI.GetStoreStatus(ShopName)
if StoreInfoList != nil && StoreInfoList.DataList != nil {
goto ifExist
@@ -1354,15 +1357,15 @@ func SetMTPSStatus(ctx *jxcontext.Context, storeId, courierStatus int) {
{
if StoreInfoList.DataList[0].OuterPoiID != "" {
//若存在且名字不为空,就是找到了
if StoreInfoList.DataList[0].OpenType != courierStatus {
sl := make(map[string]interface{})
sl["vendorStoreID"] = StoreInfoList.DataList[0].OuterPoiID
sl["status"] = StoreInfoList.DataList[0].OpenType
sl["vendorStatus"] = StoreInfoList.DataList[0].OpenType
globals.SugarLogger.Debugf("被修改配送状态的VendorStoreID是:%s,名称是:%s,美团状态是:%s,本地状态是:%s",
StoreInfoList.DataList[0].OuterPoiID, StoreInfoList.DataList[0].PoiName, strconv.Itoa(StoreInfoList.DataList[0].OpenType), strconv.Itoa(StoreLists[0].Status))
UpdateStoreCourierMap(ctx, nil, storeId, model.VendorIDMTPS, sl, ctx.GetUserName())
}
// if StoreInfoList.DataList[0].OpenType != courierStatus ||{
sl := make(map[string]interface{})
sl["vendorStoreID"] = StoreInfoList.DataList[0].OuterPoiID
sl["status"] = StoreInfoList.DataList[0].OpenType
sl["vendorStatus"] = StoreInfoList.DataList[0].OpenType
globals.SugarLogger.Debugf("被修改配送状态的VendorStoreID是:%s,名称是:%s,美团状态是:%s,本地状态是:%s",
StoreInfoList.DataList[0].OuterPoiID, StoreInfoList.DataList[0].PoiName, strconv.Itoa(StoreInfoList.DataList[0].OpenType), strconv.Itoa(StoreLists[0].Status))
UpdateStoreCourierMap(ctx, nil, storeId, model.VendorIDMTPS, sl, ctx.GetUserName())
// }
}
}
} else {

View File

@@ -165,9 +165,9 @@ func Init() {
ScheduleTimerFunc("doDailyWork2", doDailyWork2, dailyWorkTimeList2)
ScheduleTimerFuncByInterval(func() {
orderman.SaveJdsOrders(jxcontext.AdminCtx, time.Now().Add(-20*time.Minute), time.Now())
}, 10*time.Second, 10*time.Minute)
// ScheduleTimerFuncByInterval(func() {
// orderman.SaveJdsOrders(jxcontext.AdminCtx, time.Now().Add(-20*time.Minute), time.Now())
// }, 10*time.Second, 10*time.Minute)
//京东的订单信息解密密钥获取
ScheduleTimerFuncByInterval(func() {

View File

@@ -804,6 +804,7 @@ func GetWeeklyStoreScore(storeID, weekIndexParam int) (outWeeklyStoreScoreDataLi
if weekIndexParam == -1 {
outWeeklyStoreScoreDataList = weeklyStoreScoreDataList
} else {
fmt.Println("testss", utils.Format4Output(weeklyStoreScoreDataList, false))
outWeeklyStoreScoreDataList = []*model.WeeklyStoreScore{weeklyStoreScoreDataList[weekIndexParam]}
}
}

View File

@@ -1587,36 +1587,58 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
// fmt.Println("deleteList2", deleteList)
db := dao.GetDB()
storeIDs := []int{
667443,
667433,
667389,
666862,
666835,
666830,
666826,
666822,
666800,
666785,
666775,
666772,
103459,
102860,
102859,
102858,
102852,
102847,
102811,
102793,
102780,
101732,
100714,
100712,
667335,
667321,
667319,
667260,
667227,
667167,
667109,
667094,
667050,
666898,
666852,
666815,
666763,
666761,
666760,
666759,
666714,
666708,
666705,
666669,
103437,
103425,
103349,
103123,
103116,
103107,
103069,
103019,
102940,
102890,
102831,
102772,
102751,
101870,
101755,
101176,
100767,
100754,
100726,
100699,
100476,
100369,
100366,
100361,
100351,
100350,
}
for _, storeID := range storeIDs {
acts, _ := dao.QueryActs(db, 0, 0, 50, -1, "", -1, []int{1}, []int{0, 3, 4}, nil, storeID, nil, 0, utils.ZeroTimeValue, utils.ZeroTimeValue, utils.Str2Time("2020-05-30 00:00:00"), utils.Str2Time("2020-07-30 00:00:00"))
acts, _ := dao.QueryActs(db, 0, 0, 50, 0, "", -1, []int{1}, []int{0, 3, 4}, nil, storeID, nil, 0, utils.ZeroTimeValue, utils.ZeroTimeValue, utils.Str2Time("2020-05-30 00:00:00"), utils.Str2Time("2020-07-30 00:00:00"))
for _, v := range acts.Data {
var actStoreSkuParam []*act.ActStoreSkuParam
_, actStoreSkus, _ := dao.GetActStoreSkuVendorList(db, v.ID, nil, nil, nil, "", 0, 99999)
_, actStoreSkus, _ := dao.GetActStoreSkuVendorList(db, v.ID, []int{0}, nil, nil, "", 0, 99999)
for _, actStoreSku := range actStoreSkus {
if actStoreSku.StoreID == storeID {
aa := &act.ActStoreSkuParam{