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)
|
||||
}
|
||||
|
||||
//辅助创建电子围栏
|
||||
func AssistCreateFence(appOrgCode string, storeID int64) error {
|
||||
//创建前检查 暂时不支持
|
||||
if fenceID, err := tiktok_store.CreateFenceByStore(appOrgCode, storeID); err != nil {
|
||||
return errors.New(fmt.Sprintf("创建电子围栏失败:%v", err))
|
||||
} else {
|
||||
if err := tiktok_store.BindFenceByStore(appOrgCode, storeID, []string{fenceID}); err != nil {
|
||||
return errors.New(fmt.Sprintf("绑定电子围栏失败:%v", err))
|
||||
//批量辅助创建电子围栏
|
||||
func AssistCreateFence(relInfo map[string][]int64) (string, error) {
|
||||
var (
|
||||
errList = errlist.New()
|
||||
)
|
||||
for k, v := range relInfo {
|
||||
for _, i := range v {
|
||||
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 创建抖店电子围栏
|
||||
// @Description 创建抖店电子围栏
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeID formData int true "门店ID"
|
||||
// @Param vendorOrgCode formData string false "厂商内组织代码"
|
||||
// @Param payload formData string true "json数据,[]string对象"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /CreateDDStoreFence [post]
|
||||
func (c *StoreController) CreateDDStoreFence() {
|
||||
c.callCreateDDStoreFence(func(params *tStoreCreateDDStoreFenceParams) (interface{}, string, error) {
|
||||
err := cms.AssistCreateFence(params.VendorOrgCode, int64(params.StoreID))
|
||||
return nil, "", err
|
||||
c.callCreateDDStoreFence(func(params *tStoreCreateDDStoreFenceParams) (retVal interface{}, errCode string, err error) {
|
||||
payload := make(map[string][]int64)
|
||||
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