order_base.go
2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package models
import (
"context"
"time"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
)
//OrderBase 订单基础
type OrderBase struct {
tableName struct{} `pg:"order_base"`
//表id
Id int64 `pg:",pk"`
//订单类型
OrderType int
//订单编号
OrderCode string
//交货编号
DeliveryCode string
//买家
Buyer domain.Buyer
//订单区域信息
RegionInfo domain.RegionInfo
//订单对应的合伙人
PartnerId int64
//业务员抽成比例
SalesmanBonusPercent float64 `pg:",use_zero"`
//业务员抽成
SalesmanBonus float64 `pg:",use_zero"`
//预计的订单内货品总数
PlanOrderCount int `pg:",use_zero"`
//预计的订单的总金额
PlanOrderAmount float64 `pg:",use_zero"`
//按需使用的订单内货品总数 (初始值=-1)
//业务判定时0是有效值,负值无效
UseOrderCount int `pg:",use_zero"`
//按需使用的订单内货总金额 (初始值=-1)
//业务判定时0是有效值,负值无效
UseOrderAmount float64 `pg:",use_zero"`
//订单的创建时间
CreateTime time.Time
//发货时间
DeliveryTime time.Time
//更新时间
UpdateTime time.Time
//合伙人应收分红
PlanPartnerBonus float64 `pg:",use_zero"`
//调整后的合伙人应收分红 (初始值=-1);
//业务判定时0是有效值,负值无效
UsePartnerBonus float64 `pg:",use_zero"`
//合伙人已收分红
PartnerBonusHas float64 `pg:",use_zero"`
//合伙人未收分红
PartnerBonusNot float64
//合伙人分红支出
PartnerBonusExpense float64 `pg:",use_zero"`
//上一次查看时间 已读情况
LastViewTime time.Time
//是否关闭订单
IsDisable int `pg:",use_zero"`
//分红支付状态
BonusStatus int
CompanyId int64
}
var _ pg.BeforeUpdateHook = (*OrderBase)(nil)
func (order *OrderBase) BeforeUpdate(ctx context.Context) (context.Context, error) {
order.UpdateTime = time.Now()
return ctx, nil
}
var _ pg.BeforeInsertHook = (*OrderBase)(nil)
func (order *OrderBase) BeforeInsert(ctx context.Context) (context.Context, error) {
order.CreateTime = time.Now()
order.UpdateTime = time.Now()
return ctx, nil
}