1
This commit is contained in:
@@ -811,7 +811,6 @@ func GetVendorStore(ctx *jxcontext.Context, vendorID int, vendorOrgCode, vendorS
|
||||
return nil, err
|
||||
} else {
|
||||
handler := partner.GetDeliveryPlatformFromVendorID(vendorID).Handler
|
||||
globals.SugarLogger.Debugf("step2 handler==============%s", handler)
|
||||
if store, err := handler.GetStore(ctx, 0, vendorStoreID); err == nil {
|
||||
retVal = &StoreExt{
|
||||
Store: store.Store,
|
||||
@@ -1705,7 +1704,6 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
||||
if (valid["deliveryFeeDeductionSill"] != nil || valid["deliveryFeeDeductionFee"] != nil || valid["ybStorePrefix"] != nil) && vendorID == model.VendorIDDD {
|
||||
DDFlag = true
|
||||
} //特殊处理抖店运费模板、打包费
|
||||
globals.SugarLogger.Debugf("DeliveryFeeDeductionFee=====%d,YbStorePrefix====%s", storeMap.DeliveryFeeDeductionFee, storeMap.YbStorePrefix)
|
||||
if (storeMap.DeliveryFeeDeductionFee > 0 || utils.Str2Int(storeMap.YbStorePrefix) > 0) && vendorID == model.VendorIDDD {
|
||||
DDFlag = true
|
||||
}
|
||||
|
||||
@@ -840,7 +840,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
for vendorCatID := range reorderSkuMap {
|
||||
vendorCatIDs = append(vendorCatIDs, vendorCatID)
|
||||
}
|
||||
globals.SugarLogger.Debugf("门店商品排序=====")
|
||||
reorderTask := tasksch.NewParallelTask("门店商品排序", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError2), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
vendorCatID := batchItemList[0].(string)
|
||||
|
||||
@@ -79,7 +79,6 @@ func BatchUpdateEntityByKV(db *DaoDB, items []*KVUpdateItem) (num int64, err err
|
||||
if r := recover(); r != nil {
|
||||
if item != nil {
|
||||
var bindID int64
|
||||
globals.SugarLogger.Debugf("========item.item %s", utils.Format4Output(item.Item, false))
|
||||
value := refutil.CheckAndGetStructValue(item.Item).FieldByName(model.FieldID)
|
||||
if value.IsValid() {
|
||||
bindID = value.Int()
|
||||
|
||||
@@ -62,11 +62,9 @@ func (c *DeliveryHandler) GetStore(ctx *jxcontext.Context, storeID int, vendorSt
|
||||
VendorStoreID: utils.Int64ToStr(storeInfo.StoreDetail.Store.StoreId),
|
||||
CourierStatus: int(storeInfo.StoreDetail.Store.State),
|
||||
}
|
||||
globals.SugarLogger.Debugf("storeDetail.Store.Lng====%d,storeDetail.Store.Lat==========%d", storeDetail.Store.Lng, storeDetail.Store.Lat)
|
||||
} else {
|
||||
globals.SugarLogger.Debugf("GetStoreDetail err=========%s", err)
|
||||
globals.SugarLogger.Debugf("GetStoreDetail err %s", err)
|
||||
}
|
||||
globals.SugarLogger.Debugf("DYPS GetStore storeDetail====%s", utils.Format4Output(storeDetail, false))
|
||||
return storeDetail, err
|
||||
}
|
||||
|
||||
@@ -101,7 +99,6 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee
|
||||
return nil, err
|
||||
}
|
||||
delivery.OnWaybillCreated(bill)
|
||||
globals.SugarLogger.Debugf("DYPS CreateWaybill bill======%s", utils.Format4Output(bill, false))
|
||||
return bill, nil
|
||||
}
|
||||
|
||||
@@ -119,7 +116,6 @@ func (c *DeliveryHandler) CancelWaybill(bill *model.Waybill, cancelReasonID int,
|
||||
bill.Remark = cancelReason
|
||||
partner.CurOrderManager.OnWaybillStatusChanged(bill)
|
||||
}
|
||||
globals.SugarLogger.Debugf("DYPS CancelWaybill bill.Status=%d err=%v", bill.Status, err)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -133,7 +129,6 @@ func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInf
|
||||
deliveryFeeInfo = &partner.WaybillFeeInfo{}
|
||||
deliveryFeeInfo.DeliveryFee = dispatcherFee
|
||||
}
|
||||
globals.SugarLogger.Debugf("DYPS GetWaybillFee deliveryFeeInfo======%s", utils.Format4Output(deliveryFeeInfo, false))
|
||||
return deliveryFeeInfo, err
|
||||
}
|
||||
func getDispatcherFee(storeID int64, vendorOrderID string, dispatcherType int32) int64 {
|
||||
|
||||
@@ -218,7 +218,6 @@ func (p *PurchaseHandler) CreateSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSy
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) UpdateSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (err error) {
|
||||
globals.SugarLogger.Debugf("是不是正儿八经的京东商城%s", "UpdateSku2")
|
||||
param := skuInfo2Param(ctx, sku)
|
||||
if globals.EnableJdStoreWrite {
|
||||
_, err = getAPI(sku.VendorOrgCode).UpdateSku2(param)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@ package controllers
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/tiktok_store"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"github.com/astaxie/beego/server/web"
|
||||
"strings"
|
||||
@@ -31,7 +29,6 @@ func (t *TiktokController) CallbackTiktokOrderMsg() {
|
||||
|
||||
// 2.参数解析
|
||||
orderStatus, resp := api.TiktokStore.CreateOrderCallback(byteList)
|
||||
globals.SugarLogger.Debugf("CallbackTiktokOrderMsg orderStatus====%s resp====%s ", utils.Format4Output(orderStatus, false), utils.Format4Output(resp, false))
|
||||
if resp.Code != 0 {
|
||||
t.Data["json"] = resp
|
||||
t.ServeJSON()
|
||||
|
||||
Reference in New Issue
Block a user