This commit is contained in:
邹宗楠
2022-12-30 15:00:25 +08:00
parent 10d74eed08
commit 659e87e73a
6 changed files with 15 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
package dao
import (
"fmt"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
)
@@ -50,8 +51,15 @@ func UpdateThingMap(thingMap *model.ThingMap) error {
return err
}
var thingMapList = make(map[string][]*model.ThingMap, 1024)
// GetThingToTiktokMapList 抖店获取同步类型
func GetThingToTiktokMapList(db *DaoDB, vendorId int, thingId int64, vendorOrgCode string) (cats []*model.ThingMap, err error) {
if _, ok := thingMapList[fmt.Sprintf("%d_%s_%d", vendorId, vendorOrgCode, thingId)]; ok {
if len(thingMapList[fmt.Sprintf("%d_%s_%d", vendorId, vendorOrgCode, thingId)]) != 0 {
return thingMapList[fmt.Sprintf("%d_%s_%d", vendorId, vendorOrgCode, thingId)], nil
}
}
sql := `
SELECT t1.*
FROM thing_map t1
@@ -65,6 +73,9 @@ func GetThingToTiktokMapList(db *DaoDB, vendorId int, thingId int64, vendorOrgCo
}
err = GetRows(db, &cats, sql, sqlParams...)
if len(cats) != 0 {
thingMapList[fmt.Sprintf("%d_%s_%d", cats[0].VendorID, cats[0].VendorOrgCode, cats[0].ThingID)] = cats
}
return cats, err
}