add_wechat_friend_log.go 2.3 KB

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