1
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"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/baseapi/platformapi/tiktok_shop/tiktok_api"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxstore/common"
|
"git.rosy.net.cn/jx-callback/business/jxstore/common"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxstore/event"
|
"git.rosy.net.cn/jx-callback/business/jxstore/event"
|
||||||
@@ -5853,3 +5854,38 @@ func UpdateStorePoiStatus(ctx *jxcontext.Context) error {
|
|||||||
task.GetID()
|
task.GetID()
|
||||||
return nil
|
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)
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -14,8 +15,13 @@ import (
|
|||||||
//更新抖店电子围栏
|
//更新抖店电子围栏
|
||||||
func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error) {
|
func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error) {
|
||||||
var (
|
var (
|
||||||
|
db = dao.GetDB()
|
||||||
vertex []warehouse_setFence_request.VerticesItem
|
vertex []warehouse_setFence_request.VerticesItem
|
||||||
)
|
)
|
||||||
|
if _, err := dao.GetStoresMapList(db, []int{model.VendorIDDD}, []int{storeDetail.Store.ID}, nil, model.StoreStatusAll, model.StoreIsSyncYes, "", "", ""); err != nil {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if globals.EnableStoreWrite {
|
if globals.EnableStoreWrite {
|
||||||
param := &warehouse_setFence_request.WarehouseSetFenceParam{
|
param := &warehouse_setFence_request.WarehouseSetFenceParam{
|
||||||
FenceInfo: &warehouse_setFence_request.FenceInfo{
|
FenceInfo: &warehouse_setFence_request.FenceInfo{
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
package tiktok_store
|
|
||||||
|
|
||||||
import (
|
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
|
||||||
"github.com/golang/tools/go/ssa/interp/testdata/src/fmt"
|
|
||||||
"strings"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestStoreUpdateFence(t *testing.T) {
|
|
||||||
tempStr := strings.Split("104.111331,30.67964544419017;104.13348225189759,30.671752134736078;104.14265760085712,30.652696;104.13348225189759,30.63363986526392;104.111331,30.625746555809826;104.08917974810242,30.63363986526392;104.0800043991429,30.652696;104.08917974810242,30.671752134736078", ";")
|
|
||||||
fmt.Println("%d", len(tempStr))
|
|
||||||
for v := len(tempStr) - 1; v >= 0; v-- {
|
|
||||||
s2 := strings.Split(tempStr[v], ",")
|
|
||||||
Longitude := utils.Str2Float64(s2[0])
|
|
||||||
Latitude := utils.Str2Float64(s2[1])
|
|
||||||
fmt.Sprintf("%s,%s", Longitude, Latitude)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
warehouse_create_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_create/request"
|
warehouse_create_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_create/request"
|
||||||
warehouse_createBatch_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_createBatch/request"
|
warehouse_createBatch_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_createBatch/request"
|
||||||
warehouse_createFence_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_createFence/request"
|
warehouse_createFence_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_createFence/request"
|
||||||
|
warehouse_getFences_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_getFences/response"
|
||||||
warehouse_getWarehouseByStore_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_getWarehouseByStore/response"
|
warehouse_getWarehouseByStore_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_getWarehouseByStore/response"
|
||||||
warehouse_setFence_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_setFence/request"
|
warehouse_setFence_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_setFence/request"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
||||||
@@ -224,7 +225,12 @@ func BindFenceByStore(appOrgCode string, storeID int64, addOutFenceIDs []string)
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取仓库绑定电子围栏(即门店) 同步三个映射关系
|
//获取电子围栏信息
|
||||||
//func GetStoreFence() {
|
func GetFence(appOrgCode, outFenceID string) (warehouse_getFences_response.FencesItem, error) {
|
||||||
//
|
data := warehouse_getFences_response.FencesItem{}
|
||||||
//}
|
resp, err := getAPI(appOrgCode, 0, "").GetFence(outFenceID)
|
||||||
|
if err != nil {
|
||||||
|
return data, err
|
||||||
|
}
|
||||||
|
return resp.Fences[0], nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -1492,3 +1492,18 @@ func (c *StoreController) UpdateStoreTemplate() {
|
|||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 获取抖店门店建议范围
|
||||||
|
// @Description 获取抖店门店建议范围
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param storeID query int true "门店ID"
|
||||||
|
// @Param vendorStoreID query string true "平台门店ID"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /GetDDScope [get]
|
||||||
|
func (c *StoreController) GetDDScope() {
|
||||||
|
c.callGetDDScope(func(params *tStoreGetDDScopeParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
retVal, err = cms.GetDDScope(params.Ctx, params.StoreID, params.VendorStoreID)
|
||||||
|
return nil, "", nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user