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 UsageStatisticMonth struct { ent.Schema } func (UsageStatisticMonth) 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 (UsageStatisticMonth) Mixin() []ent.Mixin { return []ent.Mixin{ mixins.IDMixin{}, mixins.StatusMixin{}, localmixin.SoftDeleteMixin{}, } } func (UsageStatisticMonth) Indexes() []ent.Index { return []ent.Index{ index.Fields("addtime"), index.Fields("bot_id"), } } func (UsageStatisticMonth) Edges() []ent.Edge { return nil } func (UsageStatisticMonth) Annotations() []schema.Annotation { return []schema.Annotation{ entsql.WithComments(true), entsql.Annotation{Table: "usage_statistic_month"}, } }