Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop

This commit is contained in:
momo 2023-09-25 16:01:03 +08:00
commit 5be1edfa71

View File

@ -24,19 +24,19 @@ func (a *FsAddressModel) CreateOne(ctx context.Context, address *FsAddress) (res
err = a.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error { err = a.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
// now := time.Now().UTC().Unix() // now := time.Now().UTC().Unix()
result = &FsAddress{ result = &FsAddress{
UserId: address.UserId, UserId: address.UserId,
Name: address.Name, AddressName: address.AddressName,
FirstName: address.FirstName, FirstName: address.FirstName,
LastName: address.LastName, LastName: address.LastName,
Mobile: address.Mobile, Mobile: address.Mobile,
Street: address.Street, Street: address.Street,
Suite: address.Suite, Suite: address.Suite,
City: address.City, City: address.City,
State: address.State, State: address.State,
Country: address.Country, Country: address.Country,
ZipCode: address.ZipCode, ZipCode: address.ZipCode,
Status: address.Status, Status: address.Status,
IsDefault: address.IsDefault, IsDefault: address.IsDefault,
} }
return tx.Create(result).Error return tx.Create(result).Error
@ -57,7 +57,7 @@ func (a *FsAddressModel) UpdateAddAddress(ctx context.Context, address *FsAddres
return err return err
} }
} }
return tx.Model(&FsAddress{}).Where("id = ? and user_id = ?", address.Id, address.UserId).Omit("id", "user_id").Updates(address).Error return tx.Model(&FsAddress{}).Where("id = ? and user_id = ?", address.AddressId, address.UserId).Omit("id", "user_id").Updates(address).Error
}) })
return err return err
} }