message_records.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package schema
  2. import (
  3. "entgo.io/ent"
  4. "entgo.io/ent/dialect/entsql"
  5. "entgo.io/ent/schema"
  6. "entgo.io/ent/schema/field"
  7. "github.com/suyuan32/simple-admin-common/orm/ent/mixins"
  8. )
  9. type MessageRecords struct {
  10. ent.Schema
  11. }
  12. func (MessageRecords) Fields() []ent.Field {
  13. return []ent.Field{
  14. field.String("bot_wxid").
  15. Annotations(entsql.WithComments(true)).
  16. Comment("机器人微信 id"),
  17. field.Uint64("contact_id").Optional().
  18. Annotations(entsql.WithComments(true)).
  19. Comment("联系人 id"),
  20. field.Int("contact_type").Default(1).
  21. Annotations(entsql.WithComments(true)).
  22. Comment("类型:1好友,2群组,3企业微信联系人"),
  23. field.String("contact_wxid").Default("").
  24. Annotations(entsql.WithComments(true)).
  25. Comment("接收方微信 id"),
  26. field.Int("content_type").Default(1).
  27. Annotations(entsql.WithComments(true)).
  28. Comment("内容类型 1 文本 2 文件"),
  29. field.String("content").Default("").
  30. Annotations(entsql.WithComments(true)).
  31. Comment("发送内容"),
  32. field.String("error_detail").Default("").
  33. Annotations(entsql.WithComments(true)).
  34. Comment("异常原因"),
  35. field.Time("send_time").Optional().
  36. Annotations(entsql.WithComments(true)).
  37. Comment("发送时间"),
  38. field.Int("source_type").Default(1).
  39. Annotations(entsql.WithComments(true)).
  40. Comment("源类型 1 点发 2 群发 3 SOP"),
  41. field.Uint64("source_id").Default(1).Optional().
  42. Annotations(entsql.WithComments(true)).
  43. Comment("源 ID"),
  44. field.Uint64("sub_source_id").Default(1).Optional().
  45. Annotations(entsql.WithComments(true)).
  46. Comment("次源 ID"),
  47. }
  48. }
  49. func (MessageRecords) Mixin() []ent.Mixin {
  50. return []ent.Mixin{
  51. mixins.IDMixin{},
  52. mixins.StatusMixin{},
  53. }
  54. }
  55. func (MessageRecords) Indexes() []ent.Index {
  56. return nil
  57. }
  58. func (MessageRecords) Edges() []ent.Edge {
  59. return nil
  60. }
  61. func (MessageRecords) Annotations() []schema.Annotation {
  62. return []schema.Annotation{entsql.Annotation{Table: "message_records"}}
  63. }