1
This commit is contained in:
@@ -3,9 +3,6 @@ package ebai
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/im"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
@@ -17,7 +14,6 @@ const (
|
||||
|
||||
// OnImMessage 用户/骑手 发送/已读消息 回调
|
||||
func (p *PurchaseHandler) OnImMessage(msg *ebaiapi.CallbackMsg) (response *ebaiapi.CallbackResponse) {
|
||||
globals.SugarLogger.Debugf("ebaiOnImMessage msg=%s", utils.Format4Output(msg, false))
|
||||
str, err := json.Marshal(msg.Data)
|
||||
|
||||
err = im.ReadMsgFromVendor(IMVendorIDELM, msg.Source, str)
|
||||
|
||||
@@ -141,15 +141,16 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
if storeSku.StoreSkuStatus != model.YES { // 未可售的商品不参与修改
|
||||
continue
|
||||
}
|
||||
|
||||
globals.SugarLogger.Debugf("------------1")
|
||||
// 根据本地商品id获取线上商品是否存在,存在则只创建子商品
|
||||
// 获取本地存储映射关系,获取本地主商品id是否存在
|
||||
var mainProductId int64 = 0
|
||||
var mainOrderDetail *product_detail_response.ProductDetailData
|
||||
localThing, _ := dao.GetThingToTiktokMapList(db, model.VendorIDDD, int64(storeSku.SkuID), storeDetail.VendorOrgCode)
|
||||
if len(localThing) != 0 {
|
||||
if len(localThing) != 0 && localThing[0].VendorThingID != "" {
|
||||
mainProductId = utils.Str2Int64(localThing[0].VendorThingID)
|
||||
}
|
||||
globals.SugarLogger.Debugf("------------2")
|
||||
|
||||
if len(localThing) == 0 {
|
||||
param, failedList2 := makeMainProductSku(db, api, storeSku, storeDetail, storeID, vendorStoreID, syncType)
|
||||
@@ -218,6 +219,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSku, errors.New("只创建了主商品,没创建子商品"), storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||
} else if localThing[0].SyncStatus == model.ThingTypeSyncFail { // 同步失败在重新创建
|
||||
param, failedList2 := makeMainProductSku(db, api, storeSku, storeDetail, storeID, vendorStoreID, syncType)
|
||||
globals.SugarLogger.Debugf("----------param := %s", utils.Format4Output(param, false))
|
||||
if len(failedList2) != 0 {
|
||||
failedList = append(failedList, failedList2...)
|
||||
continue
|
||||
@@ -441,7 +443,6 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
//param.MainProductId = mainIdInt
|
||||
//param.FreightId, _ = api.GetStoreBindTemp(utils.Str2Int64(vendorStoreID))
|
||||
param.SpecPrices = GetSpecPrices(param.Specs, vendorStoreID, mainIdInt, storeSku)
|
||||
globals.SugarLogger.Debugf("--------param2 := %s", utils.Format4Output(param, false))
|
||||
err = api.EditStoreCommodity(param)
|
||||
if err != nil && !strings.Contains(err.Error(), "您上传的商品主图存在重复") {
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||
@@ -477,9 +478,12 @@ func makeMainProductSku(db *dao.DaoDB, api *tiktokShop.API, storeSku *dao.StoreS
|
||||
OuterProductId: utils.Int2Str(storeSku.SkuID), // 本地skuId为外部商品id
|
||||
}
|
||||
param.Name = checkNameLenght(param.Name)
|
||||
globals.SugarLogger.Debugf("----------param := %s", utils.Format4Output(1, false))
|
||||
|
||||
// 获取上传图,商品轮播图
|
||||
img, detailImg, whiteImg, err := GetTiktokImgList(api, utils.Int2Str(storeSku.StoreID), storeSku.SkuID, storeSku.DescImg, storeSku.Img, []string{storeSku.Img2, storeSku.Img3, storeSku.Img4, storeSku.Img5})
|
||||
globals.SugarLogger.Debugf("----------GetTiktokImgList := %s", utils.Format4Output(img, false))
|
||||
globals.SugarLogger.Debugf("----------err := %v", err)
|
||||
if err != nil {
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
|
||||
return
|
||||
@@ -503,6 +507,7 @@ func makeMainProductSku(db *dao.DaoDB, api *tiktokShop.API, storeSku *dao.StoreS
|
||||
}
|
||||
param.CategoryLeafId = vendorCategoryId
|
||||
}
|
||||
globals.SugarLogger.Debugf("----------333 := %s", utils.Format4Output(3333, false))
|
||||
// 这个情况是原有商品不存在和推荐查询不到类目id是,使用京西类目和抖音类目的绑定关系
|
||||
// 但是不太实用,导致商品类目错误被暂停营业等
|
||||
//if storeSku.VendorVendorCatID != 0 && param.CategoryLeafId == 0 {
|
||||
|
||||
Reference in New Issue
Block a user