差评补款
This commit is contained in:
@@ -770,6 +770,9 @@ func GetOrdersSupplement(ctx *jxcontext.Context, storIDs, vendorIDs []int, vendo
|
||||
if toTime != "" {
|
||||
toTimeP = utils.Str2Time(toTime)
|
||||
}
|
||||
if fromTimeP.After(toTimeP) {
|
||||
return nil, fmt.Errorf("时间范围不合法!开始时间:[%v],结束时间:[%v]", fromTimeP, toTimeP)
|
||||
}
|
||||
result, totalCount, err := dao.GetOrdersSupplement(db, storIDs, vendorIDs, vendorOrderID, fromTimeP, toTimeP, status, stype, offset, pageSize)
|
||||
pageInfo = &model.PagedInfo{
|
||||
Data: result,
|
||||
@@ -778,18 +781,37 @@ func GetOrdersSupplement(ctx *jxcontext.Context, storIDs, vendorIDs []int, vendo
|
||||
return pageInfo, err
|
||||
}
|
||||
|
||||
func AddUpdateOrdersSupplement(ctx *jxcontext.Context, ordersSupplement *model.OrderSupplementFee) (num int, err error) {
|
||||
// var (
|
||||
// db = dao.GetDB()
|
||||
// id = ordersSupplement.ID
|
||||
// )
|
||||
// if id > 0 {
|
||||
// if ordersSupplement.Status == 1 {
|
||||
// return 0,fmt.Errorf("已结账的扣款信息不允许修改", a)
|
||||
// }
|
||||
// dao.UpdateEntity(db, ordersSupplement)
|
||||
// } else {
|
||||
|
||||
// }
|
||||
func AddUpdateOrdersSupplement(ctx *jxcontext.Context, ordersSupplement *model.OrderSupplementFee) (num int64, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
id = ordersSupplement.ID
|
||||
)
|
||||
now := time.Now()
|
||||
ordersSupplement.SupplementTime = &now
|
||||
defer func() {
|
||||
if r := recover(); r != nil || err != nil {
|
||||
dao.Rollback(db)
|
||||
if r != nil {
|
||||
panic(r)
|
||||
}
|
||||
}
|
||||
}()
|
||||
if id > 0 {
|
||||
if ordersSupplement.Status == 1 {
|
||||
return 0, fmt.Errorf("已结账的扣款信息不允许修改!门店ID:[%v],订单号:[%v]", ordersSupplement.StoreID, ordersSupplement.VendorOrderID)
|
||||
}
|
||||
ordersSupplement.UpdatedAt = time.Now()
|
||||
ordersSupplement.LastOperator = ctx.GetUserName()
|
||||
if ordersSupplement.Status == -1 {
|
||||
ordersSupplement.DeletedAt = time.Now()
|
||||
} else {
|
||||
ordersSupplement.DeletedAt = utils.DefaultTimeValue
|
||||
}
|
||||
num, err = dao.UpdateEntity(db, ordersSupplement)
|
||||
} else {
|
||||
dao.WrapAddIDCULDEntity(ordersSupplement, ctx.GetUserName())
|
||||
err = dao.CreateEntity(db, ordersSupplement)
|
||||
}
|
||||
dao.Commit(db)
|
||||
return num, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user