batch
This commit is contained in:
@@ -6015,15 +6015,24 @@ func GetVendorOrgCode(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID i
|
|||||||
return storeMap, dao.GetEntitiesByKV(db, &storeMap, cond, false)
|
return storeMap, dao.GetEntitiesByKV(db, &storeMap, cond, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
//辅助创建电子围栏
|
//批量辅助创建电子围栏
|
||||||
func AssistCreateFence(appOrgCode string, storeID int64) error {
|
func AssistCreateFence(relInfo map[string][]int64) (string, error) {
|
||||||
//创建前检查 暂时不支持
|
var (
|
||||||
if fenceID, err := tiktok_store.CreateFenceByStore(appOrgCode, storeID); err != nil {
|
errList = errlist.New()
|
||||||
return errors.New(fmt.Sprintf("创建电子围栏失败:%v", err))
|
)
|
||||||
} else {
|
for k, v := range relInfo {
|
||||||
if err := tiktok_store.BindFenceByStore(appOrgCode, storeID, []string{fenceID}); err != nil {
|
for _, i := range v {
|
||||||
return errors.New(fmt.Sprintf("绑定电子围栏失败:%v", err))
|
if fenceID, err := tiktok_store.CreateFenceByStore(k, i); err != nil {
|
||||||
|
errList.AddErr(fmt.Errorf("门店(%d)创建电子围栏失败:%v", i, err))
|
||||||
|
} else {
|
||||||
|
if err := tiktok_store.BindFenceByStore(k, i, []string{fenceID}); err != nil {
|
||||||
|
errList.AddErr(fmt.Errorf("门店(%d)绑定电子围栏失败:%v", i, err))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
if errList.GetErrListAsOne() != nil {
|
||||||
|
return fmt.Sprintf("批量创建电子围栏提示信息:%v", errList.GetErrListAsOne()), nil
|
||||||
|
}
|
||||||
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1511,14 +1511,16 @@ func (c *StoreController) GetDDScope() {
|
|||||||
// @Title 创建抖店电子围栏
|
// @Title 创建抖店电子围栏
|
||||||
// @Description 创建抖店电子围栏
|
// @Description 创建抖店电子围栏
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param storeID formData int true "门店ID"
|
// @Param payload formData string true "json数据,[]string对象"
|
||||||
// @Param vendorOrgCode formData string false "厂商内组织代码"
|
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /CreateDDStoreFence [post]
|
// @router /CreateDDStoreFence [post]
|
||||||
func (c *StoreController) CreateDDStoreFence() {
|
func (c *StoreController) CreateDDStoreFence() {
|
||||||
c.callCreateDDStoreFence(func(params *tStoreCreateDDStoreFenceParams) (interface{}, string, error) {
|
c.callCreateDDStoreFence(func(params *tStoreCreateDDStoreFenceParams) (retVal interface{}, errCode string, err error) {
|
||||||
err := cms.AssistCreateFence(params.VendorOrgCode, int64(params.StoreID))
|
payload := make(map[string][]int64)
|
||||||
return nil, "", err
|
if err = utils.UnmarshalUseNumber([]byte(params.Payload), &payload); err == nil {
|
||||||
|
retVal, err = cms.AssistCreateFence(payload)
|
||||||
|
}
|
||||||
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user