add_wechat_friend_log.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. "entgo.io/ent/schema/index"
  8. "time"
  9. )
  10. // AddWechatFriendLog holds the schema definition for the AddWechatFriendLog entity.
  11. type AddWechatFriendLog struct {
  12. ent.Schema
  13. }
  14. // Fields of the AddWechatFriendLog.
  15. func (AddWechatFriendLog) Fields() []ent.Field {
  16. return []ent.Field{
  17. field.Int64("id").
  18. Comment("主键id").
  19. Unique().
  20. Immutable(),
  21. field.String("owner_wx_id").
  22. Default("").
  23. NotEmpty().
  24. MaxLen(64).
  25. Comment("属主的wxid"),
  26. field.Int("owner_wx_type").
  27. Default(1).
  28. Comment("属主的微信类型(1个微,2企微)"),
  29. field.String("find_content").
  30. Default("").
  31. NotEmpty().
  32. MaxLen(64).
  33. Comment("手机号"),
  34. field.String("message").
  35. Default("").
  36. NotEmpty().
  37. MaxLen(255).
  38. Comment("添加好友时候填写的申请消息"),
  39. field.JSON("find_request", map[string]interface{}{}).
  40. Optional().
  41. Comment("发起查询数据的时候json"),
  42. field.JSON("find_result", map[string]interface{}{}).
  43. Optional().
  44. Comment("查询返回结果"),
  45. field.Int("is_can_add").
  46. Default(0).
  47. Comment("是否可以添加好友(与属主账号非好友且其数据查询正常时 0 不可以,1 可以)"),
  48. field.Int64("task_id").Default(0).Comment("添加时候的请求体"),
  49. field.JSON("add_request", map[string]interface{}{}).
  50. Optional().Comment("添加时候的请求体"),
  51. field.JSON("add_result", map[string]interface{}{}).
  52. Optional().Comment("添加请求的结果"),
  53. field.Int64("created_at").
  54. DefaultFunc(func() int64 {
  55. return time.Now().Unix()
  56. }).Comment("创建时间戳"),
  57. field.Int64("updated_at").
  58. DefaultFunc(func() int64 {
  59. return time.Now().Unix()
  60. }).
  61. UpdateDefault(func() int64 {
  62. return time.Now().Unix()
  63. }).Comment("修改时间戳"),
  64. }
  65. }
  66. // Indexes of the AddWechatFriendLog.
  67. func (AddWechatFriendLog) Indexes() []ent.Index {
  68. return []ent.Index{
  69. index.Fields("owner_wx_id", "is_can_add"),
  70. }
  71. }
  72. func (AddWechatFriendLog) Annotations() []schema.Annotation {
  73. return []schema.Annotation{
  74. schema.Comment("微信添加好友记录"),
  75. entsql.Annotation{Table: "add_wechat_friend_log"},
  76. }
  77. }