This commit is contained in:
richboo111
2023-03-06 14:11:57 +08:00
parent 370724e725
commit aaa5f5c1f1
3 changed files with 26 additions and 12 deletions

View File

@@ -254,7 +254,7 @@ func GetFence(appOrgCode string, outFenceID []string) ([]warehouse_getFences_res
}
//特殊处理
func SpecialTreat(vendorOrgCode string, vendorStoreID, storeID, deliveryFeeDeductionFee, minPrice int64) error {
func SpecialTreat(vendorOrgCode string, vendorStoreID, storeID, deliveryFeeDeductionFee, minPrice int64, autoCall string) error {
var (
db *dao.DaoDB
errList = errlist.New()
@@ -276,6 +276,7 @@ func SpecialTreat(vendorOrgCode string, vendorStoreID, storeID, deliveryFeeDeduc
if err = ShopBindStoreFreight(vendorOrgCode, vendorStoreID, freightTemplateID); err != nil {
errList.AddErr(fmt.Errorf("京西菜市门店:%d 平台门店:%d 绑定运费模板:%d 失败:%v", storeID, vendorStoreID, freightTemplateID, err))
} else {
1
FreightTemplate.TemplateID = freightTemplateID
}
}
@@ -308,8 +309,18 @@ func SpecialTreat(vendorOrgCode string, vendorStoreID, storeID, deliveryFeeDeduc
}
}
}
//4.设置自动运力
if autoCall == tiktok_api.AutoCallRiderOpen {
if err := SetStoreAutoCallRider(vendorOrgCode, tiktok_api.AutoCallRiderOpen, vendorStoreID); err != nil {
errList.AddErr(fmt.Errorf("开启门店自动运力失败:%v", err))
}
} else {
if err := SetStoreAutoCallRider(vendorOrgCode, tiktok_api.AutoCallRiderClose, vendorStoreID); err != nil {
errList.AddErr(fmt.Errorf("关闭门店自动运力失败:%v", err))
}
}
//多次同步数据库,兜底处理
if err := dao.CreateEntity(db, FreightTemplate); err != nil {
if err := dao.CreateEntity(db, FreightTemplate); dao.IsDuplicateError(err) || err != nil {
_, err1 := dao.UpdateEntity(db, FreightTemplate, "TemplateID", "TradeLimitID")
if err1 != nil {
globals.SugarLogger.Debugf("更新起送价限售模板,更新进数据库错误信息:%v", err1)