123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package schema
- import (
- "wechat-api/ent/custom_types"
- "wechat-api/ent/schema/localmixin"
- "entgo.io/ent"
- "entgo.io/ent/dialect/entsql"
- "entgo.io/ent/schema"
- "entgo.io/ent/schema/field"
- "entgo.io/ent/schema/index"
- "github.com/suyuan32/simple-admin-common/orm/ent/mixins"
- )
- type UsageStatisticHour struct {
- ent.Schema
- }
- func (UsageStatisticHour) Fields() []ent.Field {
- return []ent.Field{
- field.Uint64("addtime").Comment("写入小时"),
- field.Int("type").Comment("1-微信 2-名片"),
- field.String("bot_id").Optional().Comment("微信或名片id"),
- field.Uint64("organization_id").Optional().Comment("机构ID"),
- field.Uint64("ai_response").Comment("AI回复次数"),
- field.Uint64("sop_run").Comment("SOP运行次数"),
- field.Uint64("total_friend").Comment("好友总数"),
- field.Uint64("total_group").Comment("群总数"),
- field.Uint64("account_balance").Comment("账户余额(单位:分)"),
- field.Uint64("consume_token").Comment("消耗token数"),
- field.Uint64("active_user").Comment("活跃用户数"),
- field.Int64("new_user").Comment("新增用户数"),
- field.JSON("label_dist", []custom_types.LabelDist{}).
- Annotations(entsql.WithComments(true)).
- Comment("标签分布"),
- }
- }
- func (UsageStatisticHour) Mixin() []ent.Mixin {
- return []ent.Mixin{
- mixins.IDMixin{},
- mixins.StatusMixin{},
- localmixin.SoftDeleteMixin{},
- }
- }
- func (UsageStatisticHour) Indexes() []ent.Index {
- return []ent.Index{
- index.Fields("addtime"),
- index.Fields("bot_id"),
- }
- }
- func (UsageStatisticHour) Edges() []ent.Edge {
- return nil
- }
- func (UsageStatisticHour) Annotations() []schema.Annotation {
- return []schema.Annotation{
- entsql.WithComments(true),
- entsql.Annotation{Table: "usage_statistic_hour"},
- }
- }
|