CreateFreeShipTemplates

This commit is contained in:
richboo111
2022-11-23 16:49:21 +08:00
parent c444e9a47a
commit c3d5eb3d4d
5 changed files with 271 additions and 228 deletions

View File

@@ -6059,3 +6059,25 @@ func AssistCreateFence(relInfo map[string][]tiktok_store.RelInfo) (string, error
}
return "", nil
}
//批量创建包邮运费模板
func BatchCreateFreeShipTemplate(relInfo map[string][]tiktok_store.RelInfo, shipFee int64) (string, error) {
errList := errlist.New()
for k, v := range relInfo {
for _, i := range v {
if bindFreight, err := tiktok_store.GetStoreFreight(k, utils.Str2Int64(i.StoreID)); err != nil || utils.IsNil(bindFreight) {
if err := tiktok_store.CreateBindFreeShipTemplate(utils.Str2Int(i.StoreID), shipFee); err != nil {
errList.AddErr(err)
}
} else {
if err := tiktok_store.UpdateFreeShipTemplate(utils.Str2Int(i.StoreID), shipFee); err != nil {
errList.AddErr(err)
}
}
}
}
if errList.GetErrListAsOne() != nil {
return fmt.Sprintf("%v", errList.GetErrListAsOne()), nil
}
return "", nil
}