business_bonus.go
1.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
package models
import (
"context"
"time"
"github.com/go-pg/pg/v10"
)
// 业务分红信息
type BusinessBonus struct {
tableName struct{} `pg:"business_bonus"`
// 唯一标识
Id int64 `pg:",pk"`
// 公司编号
CompanyId int64
// 合伙人信息Id
PartnerInfoId int64
// 应收分红
Bonus float64 `pg:",use_zero"`
// 未收分红
BonusNot float64 `pg:",use_zero"`
// 分红支出
BonusExpense float64 `pg:",use_zero"`
//已收分红
BonusHas float64 `pg:",use_zero"`
//是否有效【0;无效】【1:有效】
IsDisable int8 `pg:",use_zero"`
// 分红状态 1:待支付分红 2:已支付分红
BonusStatus int8 `pg:",use_zero"`
// 创建时间
CreateAt time.Time
// 更新时间
UpdateAt time.Time
// 删除时间
DeleteAt time.Time
}
var _ pg.BeforeUpdateHook = (*BusinessBonus)(nil)
func (bonus *BusinessBonus) BeforeUpdate(ctx context.Context) (context.Context, error) {
bonus.UpdateAt = time.Now()
return ctx, nil
}
var _ pg.BeforeInsertHook = (*BusinessBonus)(nil)
func (bonus *BusinessBonus) BeforeInsert(ctx context.Context) (context.Context, error) {
bonus.CreateAt = time.Now()
return ctx, nil
}