Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop

This commit is contained in:
richboo111
2022-12-22 14:16:46 +08:00
26 changed files with 553 additions and 401 deletions

View File

@@ -79,6 +79,7 @@ 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()

View File

@@ -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 s.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
}

View File

@@ -27,35 +27,37 @@ func GetThingMapList(db *DaoDB, thingType int, vendorIDs, thingIDs []int, vendor
return cats, err
}
func CreateThingMap(thingId int64, vendorThingID, appOrgCode, skuAttrId string) error {
func CreateThingMap(thingId int64, vendorThingID, appOrgCode, err string, thingType, syncStatus int8) error {
thingMap := &model.ThingMap{
ThingID: thingId,
ThingType: model.ThingTypeSku,
ThingType: thingType,
VendorID: model.VendorIDDD,
VendorOrgCode: appOrgCode,
VendorThingID: vendorThingID,
Remark: skuAttrId,
SyncStatus: 0,
}
// 正常来说这个skuAttrId 不应该为空
if skuAttrId == "" {
thingMap.Remark = "这个值不应该为空才对"
Remark: err,
SyncStatus: syncStatus,
}
WrapAddIDCULDEntity(thingMap, "jxadmin")
return CreateEntity(GetDB(), thingMap)
}
func UpdateThingMap(thingMap *model.ThingMap) error {
_, err := UpdateEntity(GetDB(), thingMap, "ID")
return err
}
// 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,
}