package app import ( "github.com/sirupsen/logrus" "gorm.io/gorm" "lcfns/global" "lcfns/model/app" ) type PictureService struct { } func (ps *PictureService) SaveEventPicture(pic *app.Picture, picData *app.PictureData) { err := global.Db.Transaction(func(tx *gorm.DB) error { err := global.Db.Create(picData).Error if err != nil { return err } pic.DataId = picData.ID err = global.Db.Create(pic).Error if err != nil { return err } return nil }) if err != nil { logrus.WithField("eventId", pic.EventId).Error("图片保存失败") } } // Picture 获取图片 func (ps *PictureService) Picture() { }