Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -6016,20 +6016,34 @@ func GetVendorOrgCode(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID i
|
||||
}
|
||||
|
||||
//批量辅助创建电子围栏
|
||||
func AssistCreateFence(relInfo map[string]map[string]string) (string, error) {
|
||||
func AssistCreateFence(relInfo map[string][]tiktok_store.RelInfo) (string, error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
FreightTemplate = &model.FreightTemplate{}
|
||||
)
|
||||
errList := errlist.New()
|
||||
globals.SugarLogger.Debugf("进入AssistCreateFence")
|
||||
for k, v := range relInfo {
|
||||
for i, j := range v {
|
||||
if fenceID, err := tiktok_store.CreateFenceByStore(k, utils.Str2Int64(i)); err != nil {
|
||||
errList.AddErr(fmt.Errorf("平台门店(%s),门店(%s) 创建电子围栏失败:%v", j, i, err))
|
||||
for _, i := range v {
|
||||
if fenceID, err := tiktok_store.CreateFenceByStore(k, utils.Str2Int64(i.StoreID)); err != nil {
|
||||
errList.AddErr(fmt.Errorf("平台门店(%s),门店(%s) 创建电子围栏失败:%v", i.VendorStoreID, i.StoreID, err))
|
||||
} else {
|
||||
if err := tiktok_store.BindFenceByStore(k, utils.Str2Int64(j), []string{fenceID}); err != nil {
|
||||
errList.AddErr(fmt.Errorf("平台门店(%s),门店(%s)绑定电子围栏失败:%v", j, i, err))
|
||||
if err := tiktok_store.BindFenceByStore(k, utils.Str2Int64(i.VendorStoreID), []string{fenceID}); err != nil {
|
||||
errList.AddErr(fmt.Errorf("平台门店(%s),门店(%s)绑定电子围栏失败:%v", i.VendorStoreID, i.StoreID, err))
|
||||
}
|
||||
}
|
||||
}
|
||||
if err := dao.CreateEntity(db, FreightTemplate); err != nil {
|
||||
if _, err1 := dao.UpdateEntity(db, FreightTemplate, "FenceID"); err1 != nil {
|
||||
globals.SugarLogger.Debugf("db update storeID,vendorStoreID defeat on :%v", err1)
|
||||
errList.AddErr(fmt.Errorf("更新操作,同步进数据库错误信息:%v", err1))
|
||||
} else {
|
||||
errList.AddErr(fmt.Errorf("创建操作,同步进数据库错误信息:%v", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
if errList.GetErrListAsOne() != nil {
|
||||
globals.SugarLogger.Debugf("errList.GetErrListAsOne()===========%v", errList.GetErrListAsOne())
|
||||
return fmt.Sprintf("批量创建电子围栏错误,请根据提示处理:%v", errList.GetErrListAsOne()), nil
|
||||
}
|
||||
return "", nil
|
||||
|
||||
Reference in New Issue
Block a user