123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- package schema
- import (
- "wechat-api/ent/schema/localmixin"
- "entgo.io/ent"
- "entgo.io/ent/dialect/entsql"
- "entgo.io/ent/schema"
- "entgo.io/ent/schema/edge"
- "entgo.io/ent/schema/field"
- "entgo.io/ent/schema/index"
- "github.com/suyuan32/simple-admin-common/orm/ent/mixins"
- )
- type Contact struct {
- ent.Schema
- }
- func (Contact) Fields() []ent.Field {
- return []ent.Field{
- field.String("wx_wxid").Default("").
- Annotations(entsql.WithComments(true)).
- Comment("属主微信id"),
- field.Int("type").Optional().Default(1).
- Annotations(entsql.WithComments(true)).
- Comment("联系人类型:1好友,2群组,3公众号,4企业微信联系人"),
- field.String("wxid").Default("").
- Annotations(entsql.WithComments(true)).
- Comment("微信id 公众号微信ID"),
- field.String("account").Default("").
- Annotations(entsql.WithComments(true)).
- Comment("微信账号"),
- field.String("nickname").Default("").
- Annotations(entsql.WithComments(true)).
- Comment("微信昵称 群备注名称"),
- field.String("markname").Default("").
- Annotations(entsql.WithComments(true)).
- Comment("备注名"),
- field.String("headimg").Default("").
- Annotations(entsql.WithComments(true)).
- Comment("头像"),
- field.Int("sex").Default(0).
- Annotations(entsql.WithComments(true)).
- Comment("性别 0未知 1男 2女"),
- field.String("starrole").Default("").
- Annotations(entsql.WithComments(true)).
- Comment("星标 65/67=星标 1/3=未星标"),
- field.Int("dontseeit").Default(0).
- Annotations(entsql.WithComments(true)).
- Comment("不让他看我的朋友圈 0可以看 1不让看"),
- field.Int("dontseeme").Default(0).
- Annotations(entsql.WithComments(true)).
- Comment("不看他的朋友圈 0可以看 1不看 1=开启了不看他 128/129=仅聊天"),
- field.String("lag").Default("").
- Annotations(entsql.WithComments(true)).
- Comment("所属标签id清单,多开会用逗号隔开"),
- field.String("gid").Default("").
- Annotations(entsql.WithComments(true)).
- Comment("群组id"),
- field.String("gname").Default("").
- Annotations(entsql.WithComments(true)).
- Comment("群组名称"),
- field.String("v3").Default("").
- Annotations(entsql.WithComments(true)).
- Comment("v3数据"),
- field.Uint64("organization_id").Optional().Default(1).
- Comment("机构 ID").
- Annotations(entsql.WithComments(true)),
- field.Uint64("ctype").Default(1).Comment("内容类型:1-微信 2-whatsapp"),
- field.Int("cage").Default(0).Comment("年龄"),
- field.String("cname").Default("").Comment("姓名"),
- field.String("carea").Default("").Comment("地区"),
- field.String("cbirthday").Default("").Comment("出生日期"),
- field.String("cbirtharea").Default("").Comment("出生地"),
- field.String("cidcard_no").Default("").Comment("身份证号"),
- field.String("ctitle").Default("").Comment("称呼"),
- field.String("cc").Default("").Comment("国家区号"),
- field.String("phone").Default("").Comment("手机号"),
- }
- }
- func (Contact) Mixin() []ent.Mixin {
- return []ent.Mixin{
- mixins.IDMixin{},
- mixins.StatusMixin{},
- localmixin.SoftDeleteMixin{},
- }
- }
- func (Contact) Indexes() []ent.Index {
- return []ent.Index{
- index.Fields("wx_wxid", "wxid").Unique(),
- index.Fields("wxid"),
- index.Fields("type"),
- index.Fields("gid"),
- }
- }
- func (Contact) Edges() []ent.Edge {
- return []ent.Edge{
- edge.To("contact_relationships", LabelRelationship.Type),
- edge.To("contact_messages", MessageRecords.Type),
- }
- }
- func (Contact) Annotations() []schema.Annotation {
- return []schema.Annotation{
- entsql.WithComments(true),
- entsql.Annotation{Table: "contact"},
- }
- }
|