1
This commit is contained in:
@@ -6095,3 +6095,7 @@ func BatchCreateFreeShipTemplate(relInfo map[string][]tiktok_store.RelInfo, ship
|
||||
func GetVendorStoreBind(vendorStoreId string, vendorId int) (int, error) {
|
||||
return dao.GetCodeAndIDByMeiTuan(vendorStoreId, vendorId)
|
||||
}
|
||||
|
||||
func BindJxPrintToStore(storeId int64, printSn, printKey string) error {
|
||||
return dao.BindJXPrintToStore(storeId, printSn, printKey)
|
||||
}
|
||||
|
||||
@@ -249,10 +249,10 @@ func Init() {
|
||||
cms.RefreshTiktokShopToken(jxcontext.AdminCtx)
|
||||
}, 60*time.Second, 30*time.Minute)
|
||||
|
||||
// 更新门店商品
|
||||
//ScheduleTimerFuncByInterval(func() {
|
||||
// syncStoreSkuTiktok()
|
||||
//}, 60*time.Second, 1*time.Minute)
|
||||
// 抖音更新门店商品
|
||||
ScheduleTimerFuncByInterval(func() {
|
||||
syncStoreSkuTiktok()
|
||||
}, 60*time.Second, 1*time.Minute)
|
||||
|
||||
// 定时任务刷新当前订单的物流信息
|
||||
ScheduleTimerFunc("RefreshMaterialLogistics", func() {
|
||||
@@ -574,6 +574,7 @@ func syncStoreSku() {
|
||||
}
|
||||
|
||||
func syncStoreSkuTiktok() {
|
||||
globals.SugarLogger.Debugf("==========syncStoreSkuTiktok=")
|
||||
syncFlag := 0 | model.SyncFlagSaleMask
|
||||
task := tasksch.NewParallelTask("同步京西商品到抖音平台,方案二使用", nil, jxcontext.AdminCtx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
@@ -593,6 +594,7 @@ func syncStoreSkuTiktok() {
|
||||
errList.AddErr(err)
|
||||
SaveImportantTaskID(TaskNameSyncStoreSku, SpecialTaskID)
|
||||
}
|
||||
globals.SugarLogger.Debugf("===============syncStoreSkuTiktok ,errList %s", utils.Format4Output(errList, false))
|
||||
err = errList.GetErrListAsOne()
|
||||
return retVal, err
|
||||
}, []int{0, 1})
|
||||
|
||||
@@ -1631,8 +1631,15 @@ func InsertIntoFreightTemplate(storeID int, vendorStoreID string, templateID, wa
|
||||
return err
|
||||
}
|
||||
|
||||
//只获取美团平台的京西storeID
|
||||
// GetCodeAndIDByMeiTuan 只获取美团平台的京西storeID
|
||||
func GetCodeAndIDByMeiTuan(vendorStoreID string, vendorId int) (storeID int, err error) {
|
||||
err = GetRow(GetDB(), &storeID, "SELECT s.store_id FROM store_map s WHERE s.vendor_store_id = ? AND s.vendor_id = ? ", vendorStoreID, vendorId)
|
||||
err = GetRow(GetDB(), &storeID, "SELECT s.store_id FROM store_map s WHERE s.vendor_store_id = ? AND s.vendor_id = ? AND deleted_at = ?", vendorStoreID, vendorId, utils.DefaultTimeValue)
|
||||
return storeID, err
|
||||
}
|
||||
|
||||
// BindJXPrintToStore 更新绑定门店的京西打印机 PrinterFontSize printer_sn printer_key printer_vendor_id printer_font_size
|
||||
func BindJXPrintToStore(storeId int64, printSn, printKey string) error {
|
||||
sql := ` UPDATE store SET printer_sn = ? , printer_key = ? , printer_vendor_id = ? , printer_font_size = ? WHERE id = ?`
|
||||
_, err := ExecuteSQL(GetDB(), sql, []interface{}{printSn, printKey, model.VendorIDJxprint, model.NO, storeId})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -43,15 +43,16 @@ func CreateThingMap(thingId int64, vendorThingID, appOrgCode, err string, thingT
|
||||
}
|
||||
|
||||
// GetThingToTiktokMapList 抖店获取同步类型
|
||||
func GetThingToTiktokMapList(db *DaoDB, vendorId int, thingId int64) (cats []*model.ThingMap, err error) {
|
||||
func GetThingToTiktokMapList(db *DaoDB, vendorId int, thingId int64, vendorOrgCode string) (cats []*model.ThingMap, err error) {
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM thing_map t1
|
||||
WHERE t1.thing_id = ? AND t1.vendor_id = ? AND t1.deleted_at = ?
|
||||
WHERE t1.thing_id = ? AND t1.vendor_id = ? AND vendor_org_code = ? AND t1.deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
thingId,
|
||||
vendorId,
|
||||
vendorOrgCode,
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
|
||||
|
||||
@@ -589,9 +589,6 @@ func (c *PurchaseHandler) Swtich2SelfDeliver(order *model.GoodsOrder, userName s
|
||||
AddressId: 0,
|
||||
StoreId: utils.Str2Int64(order.VendorStoreID),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
|
||||
// 根据本地商品id获取线上商品是否存在,存在则只创建子商品
|
||||
// 获取本地存储映射关系,获取本地主商品id是否存在
|
||||
localThing, err := dao.GetThingToTiktokMapList(db, model.VendorIDDD, int64(storeSku.SkuID))
|
||||
localThing, err := dao.GetThingToTiktokMapList(db, model.VendorIDDD, int64(storeSku.SkuID), storeDetail.VendorOrgCode)
|
||||
if len(localThing) == 0 {
|
||||
mainOrderDetail, err := api.GetSkuDetailLocalID("", utils.Int2Str(storeSku.SkuID))
|
||||
if err != nil || mainOrderDetail == nil || mainOrderDetail.ProductIdStr == "" {
|
||||
|
||||
Reference in New Issue
Block a user