This commit is contained in:
邹宗楠
2022-12-19 16:59:52 +08:00
parent 6c438e81dd
commit 676228f8be
2 changed files with 12 additions and 1 deletions

View File

@@ -42,6 +42,11 @@ func CreateThingMap(thingId int64, vendorThingID, appOrgCode, err string, thingT
return CreateEntity(GetDB(), thingMap) return CreateEntity(GetDB(), thingMap)
} }
func UpdateThingMap(thingMap *model.ThingMap) error {
_, err := UpdateEntity(GetDB(), thingMap, "ID")
return err
}
// GetThingToTiktokMapList 抖店获取同步类型 // GetThingToTiktokMapList 抖店获取同步类型
func GetThingToTiktokMapList(db *DaoDB, vendorId int, thingId int64, vendorOrgCode string) (cats []*model.ThingMap, err error) { func GetThingToTiktokMapList(db *DaoDB, vendorId int, thingId int64, vendorOrgCode string) (cats []*model.ThingMap, err error) {
sql := ` sql := `

View File

@@ -28,6 +28,7 @@ import (
"git.rosy.net.cn/jx-callback/globals" "git.rosy.net.cn/jx-callback/globals"
"math/rand" "math/rand"
"strings" "strings"
"time"
) )
type MainSku struct { type MainSku struct {
@@ -224,7 +225,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType) failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
continue continue
} }
if err := dao.CreateThingMap(int64(storeSku.SkuID), utils.Int64ToStr(tiktokResult.ProductId), storeDetail.VendorOrgCode, "本地不存在,线上也不存在", model.ThingTypeSku, model.SyncFlagNewMask); err != nil { if err := dao.CreateThingMap(int64(storeSku.SkuID), utils.Int64ToStr(tiktokResult.ProductId), storeDetail.VendorOrgCode, "本地不存在,线上也不存在", model.ThingTypeSku, 0); err != nil {
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType) failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
} }
@@ -307,6 +308,11 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
if err := api.EditStoreCommodity(updateParam); err != nil { if err := api.EditStoreCommodity(updateParam); err != nil {
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType) failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID) storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID)
} else {
localThing[0].UpdatedAt = time.Now()
localThing[0].SyncStatus = 0
localThing[0].ThingType = model.ThingTypeSku
dao.UpdateThingMap(localThing[0])
} }
continue continue
} }