add_wechat_friend_log.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.JSON("find_request", map[string]interface{}{}).
  34. Optional().
  35. Comment("发起查询数据的时候json"),
  36. field.JSON("find_result", map[string]interface{}{}).
  37. Optional().
  38. Comment("查询返回结果"),
  39. field.Int("is_can_add").
  40. Default(0).
  41. Comment("是否可以添加好友(与属主账号非好友且其数据查询正常时 0 不可以,1 可以)"),
  42. field.Int64("task_id").Default(0).Comment("添加时候的请求体"),
  43. field.JSON("add_request", map[string]interface{}{}).
  44. Optional().Comment("添加时候的请求体"),
  45. field.JSON("add_result", map[string]interface{}{}).
  46. Optional().Comment("添加请求的结果"),
  47. field.Int64("created_at").
  48. DefaultFunc(func() int64 {
  49. return time.Now().Unix()
  50. }).Comment("创建时间戳"),
  51. field.Int64("updated_at").
  52. DefaultFunc(func() int64 {
  53. return time.Now().Unix()
  54. }).
  55. UpdateDefault(func() int64 {
  56. return time.Now().Unix()
  57. }).Comment("修改时间戳"),
  58. }
  59. }
  60. // TableName sets the custom table name.
  61. func (AddWechatFriendLog) TableName() string {
  62. return "add_wechat_friend_log"
  63. }
  64. // Indexes of the AddWechatFriendLog.
  65. func (AddWechatFriendLog) Indexes() []ent.Index {
  66. return []ent.Index{
  67. index.Fields("owner_wx_id", "is_can_add"),
  68. }
  69. }
  70. func (AddWechatFriendLog) Annotations() []schema.Annotation {
  71. return []schema.Annotation{
  72. schema.Comment("微信添加好友记录"),
  73. }
  74. }