master
howell 3 years ago
parent 9a843903b3
commit 3569a34133

@ -1474,32 +1474,32 @@ func (g *goodsLogic) Update(args *strict.Goods) error {
}
if args.Cover != "" {
size, err := common.ImageSize(filepath.Join(static_path.Dir.Root, args.Cover))
if err != nil {
return errors.New("cover图片错误")
}
name := filepath.Base(args.Cover)
if err = tx.Table(photos.TableName()).Create(&goods3.RecookGoodsMainPhotoModel{
// size, err := common.ImageSize(filepath.Join(static_path.Dir.Root, args.Cover))
// if err != nil {
// return errors.New("cover图片错误")
// }
// name := filepath.Base(args.Cover)
if err := tx.Table(photos.TableName()).Create(&goods3.RecookGoodsMainPhotoModel{
GoodsId: rg.Id,
Url: args.Cover,
Name: name,
Name: "",
IsMaster: goods3.RecookGoodsMainPhotoIsMasterTrue,
OrderNo: 0,
Width: size.X,
Height: size.Y,
Width: 0,
Height: 0,
}).Error; err != nil {
return err
}
if gs.Id != 0 {
if err = tx.Table(photos2.TableName()).Create(&goods2.GysGoodsMainPhotoModel{
if err := tx.Table(photos2.TableName()).Create(&goods2.GysGoodsMainPhotoModel{
GoodsId: gs.Id,
Url: args.Cover,
Name: name,
Name: "",
IsMaster: goods3.RecookGoodsMainPhotoIsMasterTrue,
OrderNo: 0,
Width: size.X,
Height: size.Y,
Width: 0,
Height: 0,
}).Error; err != nil {
return err
}

Loading…
Cancel
Save