Order订单待测试
This commit is contained in:
@@ -2,6 +2,7 @@ package gmodel
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -51,7 +52,7 @@ func (a *FsAddressModel) CreateOne(ctx context.Context, address *FsAddress) (res
|
||||
func (a *FsAddressModel) UpdateAddAddress(ctx context.Context, address *FsAddress) (err error) {
|
||||
err = a.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
||||
if *address.IsDefault > 0 {
|
||||
err = tx.Where("user_id = ? and is_default = 1", *address.UserId).Update("is_default", 0).Error
|
||||
err = tx.Where("user_id = ? and is_default = 1", address.UserId).Update("is_default", 0).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -9,10 +9,8 @@ func (p *FsPayModel) GetListByOrderNumber(ctx context.Context, sn string) (resp
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (p *FsPayModel) GetOrderPayList(ctx context.Context, sn string, payStatus int64, isRefund int64) (resp []FsPay, err error) {
|
||||
err = p.db.WithContext(ctx).Model(&FsPay{}).Where("`order_number` = ? and `pay_status` = ? and `is_refund` = ?", sn, payStatus, isRefund).Find(&resp).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
return resp, err
|
||||
}
|
||||
|
||||
@@ -1,9 +1,24 @@
|
||||
package gmodel
|
||||
|
||||
import "context"
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// TODO: 使用model的属性做你想做的
|
||||
|
||||
func (fsRefundReason *FsRefundReasonModel) Update(cxt context.Context) {
|
||||
func (m *FsRefundReasonModel) Create(ctx context.Context, obj *FsRefundReason) error {
|
||||
return m.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (m *FsRefundReasonModel) Update(ctx context.Context, obj *FsRefundReason) error {
|
||||
return m.db.WithContext(ctx).Model(obj).Where("`id` = ?", obj.Id).Updates(obj).Error
|
||||
}
|
||||
|
||||
func (m *FsRefundReasonModel) UpdateByRefundReasonId(ctx context.Context, obj *FsRefundReason) error {
|
||||
return m.db.WithContext(ctx).Model(obj).Where("`refund_reason_id` = ?", obj.RefundReasonId).Updates(obj).Error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user