From 41cdd685bc86c89c5b767e6b289a23dc07f02a00 Mon Sep 17 00:00:00 2001 From: howell <2827207845@qq.com> Date: Tue, 1 Mar 2022 18:04:02 +0800 Subject: [PATCH] fix: update fright --- internal/v2/logic/supplier/freight/freight.go | 12 ++++++++---- .../v2/model/recook/freight/recookFreightInfo.go | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/v2/logic/supplier/freight/freight.go b/internal/v2/logic/supplier/freight/freight.go index 97200d4..a7e5c69 100644 --- a/internal/v2/logic/supplier/freight/freight.go +++ b/internal/v2/logic/supplier/freight/freight.go @@ -204,11 +204,15 @@ func (f *freightLogic) Edit(userId uint, freightId uint, name string, allFree in } return recookFreightInfoModel.Transaction(func(tx *gorm.DB) error { recookFreightInfoModel.SetDb(tx) - info := freight.RecookFreightInfoModel{ - Name: name, - AllFree: allFree, + info := map[string]interface{}{ + "name": name, + "all_free": allFree, } - err := recookFreightInfoModel.UpdateById(freightId, &info) + //info := freight.RecookFreightInfoModel{ + // Name: name, + // AllFree: allFree, + //} + err := recookFreightInfoModel.UpdateById(freightId, info) if err != nil { return errors.New("网络异常") } diff --git a/internal/v2/model/recook/freight/recookFreightInfo.go b/internal/v2/model/recook/freight/recookFreightInfo.go index af93569..6f543b5 100644 --- a/internal/v2/model/recook/freight/recookFreightInfo.go +++ b/internal/v2/model/recook/freight/recookFreightInfo.go @@ -47,7 +47,7 @@ func (r *RecookFreightInfoModel) ListCount(query interface{}, args ...interface{ } // @Style 修改数据 -func (r *RecookFreightInfoModel) UpdateById(id uint, data *RecookFreightInfoModel) error { +func (r *RecookFreightInfoModel) UpdateById(id uint, data map[string]interface{}) error { return r.GetDb().Model(&RecookFreightInfoModel{}).Where("id = ?", id).Update(data).Error }