This commit is contained in:
richboo111
2022-10-31 14:59:58 +08:00
parent 2bd7f9aaf9
commit 8010561399
5 changed files with 67 additions and 23 deletions

View File

@@ -6,6 +6,7 @@ import (
"encoding/json"
"errors"
"fmt"
warehouse_getFences_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_getFences/response"
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
"git.rosy.net.cn/jx-callback/business/jxstore/common"
"git.rosy.net.cn/jx-callback/business/jxstore/event"
@@ -5853,3 +5854,38 @@ func UpdateStorePoiStatus(ctx *jxcontext.Context) error {
task.GetID()
return nil
}
//获取抖店门店建议范围 (即电子围栏)
func GetDDScope(ctx *jxcontext.Context, storeID int, vendorStoreID string) (warehouse_getFences_response.FencesItem, error) {
var (
data warehouse_getFences_response.FencesItem
)
if storeID == 0 || len(vendorStoreID) == 0 {
return data, errors.New("storeID,vendorStoreID 必填")
}
storeMap, err := GetVendorOrgCode(ctx, dao.GetDB(), storeID, model.VendorIDDD, vendorStoreID)
if err != nil {
return data, errors.New(fmt.Sprintf("获取vendorOrgCode失败请检查数据或重试:%v", err))
}
bindWarehouse, err := tiktok_store.GetWarehouseByStore(storeMap.VendorOrgCode, int64(storeID))
if err != nil {
return data, errors.New(fmt.Sprintf("获取门店(%d) 绑定fenceID失败:%v", storeID, err))
}
resp, err := tiktok_store.GetFence(storeMap.VendorOrgCode, bindWarehouse[0][utils.Str2Int(vendorStoreID)].OutFenceIds[0])
if err != nil {
return data, err
}
return resp, nil
}
//获取 VendorOrgCode
func GetVendorOrgCode(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, vendorStoreID string) (storeMap *model.StoreMap, err error) {
cond := map[string]interface{}{
model.FieldStoreID: storeID,
model.FieldVendorStoreID: vendorStoreID,
}
if vendorID != -1 {
cond[model.FieldVendorID] = vendorID
}
return storeMap, dao.GetEntitiesByKV(db, &storeMap, cond, false)
}