add_wechat_friend_log.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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("任务执行次数"),
  48. field.Int("task_count").
  49. Default(0).
  50. Comment("是否可以添加好友(与属主账号非好友且其数据查询正常时 0 不可以,1 可以 2成功添加申请)"),
  51. field.Int64("task_id").Default(0).Comment("添加时候的请求体"),
  52. field.JSON("add_request", map[string]interface{}{}).
  53. Optional().Comment("添加时候的请求体"),
  54. field.JSON("add_result", map[string]interface{}{}).
  55. Optional().Comment("添加请求的结果"),
  56. field.Int64("created_at").
  57. DefaultFunc(func() int64 {
  58. return time.Now().Unix()
  59. }).Comment("创建时间戳"),
  60. field.Int64("updated_at").
  61. DefaultFunc(func() int64 {
  62. return time.Now().Unix()
  63. }).
  64. UpdateDefault(func() int64 {
  65. return time.Now().Unix()
  66. }).Comment("修改时间戳"),
  67. }
  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. entsql.Annotation{Table: "add_wechat_friend_log"},
  79. }
  80. }