fusenapi/model/gmodel/fs_pay_event_logic.go

16 lines
363 B
Go
Raw Permalink Normal View History

2023-07-28 11:03:36 +00:00
package gmodel
import "context"
// TODO: 使用model的属性做你想做的
func (p *FsPayEventModel) CreateOrUpdate(ctx context.Context, req *FsPayEvent) (resp *FsPayEvent, err error) {
rowBuilder := p.db.Table(p.name).WithContext(ctx)
if req.Id > 0 {
err = rowBuilder.Save(req).Error
} else {
err = rowBuilder.Create(req).Error
}
return req, err
}