This commit is contained in:
邹宗楠
2023-01-05 09:32:25 +08:00
parent ba444ea667
commit 867690c646
10 changed files with 2 additions and 35 deletions

View File

@@ -40,7 +40,6 @@ func OnOrderMsg(msgId string, msg interface{}) (response *tiktokShop.CallbackRes
//}
jxutils.CallMsgHandler(func() {
response = CurPurchaseHandler.onOrderMsg(msgId, orderId, msg)
globals.SugarLogger.Debugf("OnOrderMsg response====%s", utils.Format4Output(response, false))
}, jxutils.ComposeUniversalOrderID(orderId, model.VendorIDDD))
}
return response

View File

@@ -170,11 +170,9 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOr
// UpdateStoreSkusPrice 更新商品价格
func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
api := getAPI(vendorOrgCode, storeID, vendorStoreID)
globals.SugarLogger.Debugf("看看走这儿了没,是不是更新 storeSkuList %s", utils.Format4Output(storeSkuList, false))
for _, v := range storeSkuList {
tiktokSkuId, failedList := getProductSkuId4UpdateStock(api, v, storeID)
if len(failedList) > 0 {
globals.SugarLogger.Debugf("看看走这儿了没,是不是更新 参数failedList1 %s", utils.Format4Output(failedList, false))
return failedList, err
}
globals.SugarLogger.Debugf("====SkuId:= %d,ProductId := %d ", tiktokSkuId, utils.Str2Int64(v.VendorMainId))
@@ -187,9 +185,6 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg
if err = api.EditPrice(price); err != nil {
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(v, err, storeID, model.VendorChineseNames[model.VendorIDDD], "更新价格异常")...)
}
globals.SugarLogger.Debugf("看看走这儿了没,是不是更新 参数 %s", utils.Format4Output(price, false))
globals.SugarLogger.Debugf("看看走这儿了没,是不是更新 返回值 %s", utils.Format4Output(failedList, false))
globals.SugarLogger.Debugf("看看走这儿了没,是不是更新 结构体 %s", utils.Format4Output(v, false))
}
return failedList, err
}

View File

@@ -272,11 +272,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
} else {
// 主商品存在,直接同步子商品
childrenProductId, err := api.CreateSubProduct(utils.Str2Int64(localThing[0].VendorThingID), utils.Str2Int64(vendorStoreID))
globals.SugarLogger.Debugf("===============childrenProductId %d", childrenProductId)
if err != nil && strings.Contains(err.Error(), "2010004") { // 2010004:主商品非在线审核通过状态,不允许绑定子商品
// 线上本地都存在,但是线上审核不成功,就去更新主商品
mainOrderDetail = loadMainProductId(api, storeSku, localThing[0].VendorThingID)
globals.SugarLogger.Debugf("====bool %s", utils.Format4Output(mainOrderDetail.CheckStatus == tiktokShop.SkuCheckStatusProhibit || mainOrderDetail.CheckStatus == tiktokShop.SkuCheckStatusNotPass, false))
if mainOrderDetail.CheckStatus == tiktokShop.SkuCheckStatusProhibit || mainOrderDetail.CheckStatus == tiktokShop.SkuCheckStatusNotPass {
// 更新主商品,在同步到子门店,考虑审核时间
updateParam := &product_editV2_request.ProductEditV2Param{
@@ -306,7 +304,6 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
updateParam.SpecPrices = param.SpecPrices
//updateParam.StoreId = utils.Str2Int64(vendorStoreID)
err := api.EditStoreCommodity(updateParam)
globals.SugarLogger.Debugf("=====EditStoreCommodity====== %s", err.Error())
if err != nil {
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID)
@@ -316,10 +313,10 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
// localThing[0].ThingType = model.ThingTypeSku
// dao.UpdateThingMap(localThing[0])
//}
globals.SugarLogger.Debugf("=====EditStoreCommodity====== %s", utils.Format4Output(updateParam, false))
continue
}
}
if err != nil || childrenProductId == 0 {
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
storeSku.SkuSyncStatus = model.SyncFlagStoreSkuModifiedMask
@@ -485,7 +482,6 @@ func checkNameLenght(name string) string {
return name
}
func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuSyncInfo, childrenProductId int64, vendorStoreID, syncType string) (failedList []*partner.StoreSkuInfoWithErr) {
globals.SugarLogger.Debugf("===========1")
skuId, failed := getProductSkuID(api, storeSku, syncType, childrenProductId)
if skuId == 0 || len(failed) > 0 {
return failed
@@ -497,9 +493,7 @@ func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuS
ProductId: childrenProductId,
}); err != nil {
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeSku.StoreID, model.VendorChineseNames[model.VendorIDDD], syncType)
globals.SugarLogger.Debugf("===========2 failedList %s", utils.Format4Output(failedList, false))
}
globals.SugarLogger.Debugf("===========2")
// 同步库存
paramStock := &sku_syncStock_request.SkuSyncStockParam{
@@ -513,21 +507,17 @@ func upDateChildrenPriceStockLaunch(api *tiktokShop.API, storeSku *dao.StoreSkuS
}
if err := api.UpdateSkuStock(paramStock); err != nil {
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(storeSku, err, storeSku.StoreID, model.VendorChineseNames[model.VendorIDDD], fmt.Sprintf("子商品添加固定库存.%s", err.Error()))...)
globals.SugarLogger.Debugf("===========3 failedList %s", utils.Format4Output(failedList, false))
}
globals.SugarLogger.Debugf("===========3")
// 上架
if err := api.LaunchProduct(childrenProductId); err != nil {
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(storeSku, err, storeSku.StoreID, model.VendorChineseNames[model.VendorIDDD], fmt.Sprintf("上架子商品异常.%s", err.Error()))...)
globals.SugarLogger.Debugf("===========4 failedList %s", utils.Format4Output(failedList, false))
}
if len(failedList) > 0 {
storeSku.SkuSyncStatus = model.SyncFlagStoreSkuModifiedMask
} else {
storeSku.SkuSyncStatus = 0
}
globals.SugarLogger.Debugf("====upDateChildrenPriceStockLaunch=== 444444,%s", utils.Format4Output(failedList, false))
return failedList
}
@@ -739,7 +729,6 @@ func GetDeliveryTemp(api *tiktokShop.API, vendorStoreID string, storeDetail *dao
StoreId: utils.Str2Int64(vendorStoreID),
FreightId: temp.TemplateId,
}); err != nil {
globals.SugarLogger.Debugf("BindFreightTemplate =err %s", err)
return 0, err
}
freightId = temp.TemplateId

View File

@@ -270,11 +270,9 @@ func SpecialTreat(vendorOrgCode string, vendorStoreID, storeID, deliveryFeeDeduc
}
if bindFreightIDs == 0 { //1未查询到绑定信息不算错误
if freightTemplateID, err := CreateFreightTemplate(int(storeID)); err != nil || freightTemplateID == 0 || utils.IsNil(freightTemplateID) {
globals.SugarLogger.Debug("创建运费模板失败:", err)
errList.AddErr(fmt.Errorf("创建运费模板失败:%v", err))
} else { //绑定
if err = ShopBindStoreFreight(vendorOrgCode, vendorStoreID, freightTemplateID); err != nil {
globals.SugarLogger.Debugf("京西菜市门店:%d 平台门店:%d 绑定运费模板:%d 失败:%v", storeID, vendorStoreID, freightTemplateID, err)
errList.AddErr(fmt.Errorf("京西菜市门店:%d 平台门店:%d 绑定运费模板:%d 失败:%v", storeID, vendorStoreID, freightTemplateID, err))
} else {
FreightTemplate.TemplateID = freightTemplateID
@@ -319,7 +317,6 @@ func SpecialTreat(vendorOrgCode string, vendorStoreID, storeID, deliveryFeeDeduc
}
}
endErr := errList.GetErrListAsOne()
globals.SugarLogger.Debugf("SpecialTreat wrong information endErr: %s", endErr)
return endErr
}