This commit is contained in:
邹宗楠
2023-10-09 17:37:55 +08:00
parent 9aedf80217
commit 77685f8676
2 changed files with 30 additions and 15 deletions

View File

@@ -4742,24 +4742,34 @@ func RefreshStoreBind(ctx *jxcontext.Context) (err error) {
return err
}
func UpdateVendorStoreBussinessStatus(ctx *jxcontext.Context, storeID, vendorID, status int) (err error) {
func UpdateVendorStoreBussinessStatus(ctx *jxcontext.Context, storeID int, vendorID []int, status int) (err error) {
var (
db = dao.GetDB()
)
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID, "")
if err != nil {
return err
}
handler := partner.GetPurchasePlatformFromVendorID(vendorID)
if err = handler.UpdateStoreLineStatus(ctx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, status); err == nil {
if storeMaps, _ := dao.GetStoresMapList(db, []int{vendorID}, []int{storeID}, nil, model.StoreStatusAll,
model.StoreIsSyncAll, "", "", ""); len(storeMaps) > 0 {
storeMaps[0].IsOnline = status
storeMaps[0].Status = status
dao.UpdateEntity(db, storeMaps[0], "IsOnline", "Status")
errList := make([]string, 0, 0)
for _, v := range vendorID {
storeDetail, err := dao.GetStoreDetail(db, storeID, v, "")
if err != nil {
return err
}
handler := partner.GetPurchasePlatformFromVendorID(v)
if err = handler.UpdateStoreLineStatus(ctx, storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID, status); err == nil {
if storeMaps, _ := dao.GetStoresMapList(db, []int{v}, []int{storeID}, nil, model.StoreStatusAll,
model.StoreIsSyncAll, "", "", ""); len(storeMaps) > 0 {
storeMaps[0].IsOnline = status
storeMaps[0].Status = status
dao.UpdateEntity(db, storeMaps[0], "IsOnline", "Status")
}
} else {
errList = append(errList, fmt.Sprintf("平台[%d],门店id[%d],错误:%s", v, storeID, err.Error()))
}
}
return err
if len(errList) == model.NO {
return nil
}
return fmt.Errorf(strings.Join(errList, ","))
}
type JdPage struct {