Browse Source

api 更新

lichangdong 2 days ago
parent
commit
82166463b1

+ 40 - 0
ent/addwechatfriendlog/where.go

@@ -633,6 +633,16 @@ func SourceLTE(v int) predicate.AddWechatFriendLog {
 	return predicate.AddWechatFriendLog(sql.FieldLTE(FieldSource, v))
 }
 
+// SourceIsNil applies the IsNil predicate on the "source" field.
+func SourceIsNil() predicate.AddWechatFriendLog {
+	return predicate.AddWechatFriendLog(sql.FieldIsNull(FieldSource))
+}
+
+// SourceNotNil applies the NotNil predicate on the "source" field.
+func SourceNotNil() predicate.AddWechatFriendLog {
+	return predicate.AddWechatFriendLog(sql.FieldNotNull(FieldSource))
+}
+
 // NickNameEQ applies the EQ predicate on the "nick_name" field.
 func NickNameEQ(v string) predicate.AddWechatFriendLog {
 	return predicate.AddWechatFriendLog(sql.FieldEQ(FieldNickName, v))
@@ -688,6 +698,16 @@ func NickNameHasSuffix(v string) predicate.AddWechatFriendLog {
 	return predicate.AddWechatFriendLog(sql.FieldHasSuffix(FieldNickName, v))
 }
 
+// NickNameIsNil applies the IsNil predicate on the "nick_name" field.
+func NickNameIsNil() predicate.AddWechatFriendLog {
+	return predicate.AddWechatFriendLog(sql.FieldIsNull(FieldNickName))
+}
+
+// NickNameNotNil applies the NotNil predicate on the "nick_name" field.
+func NickNameNotNil() predicate.AddWechatFriendLog {
+	return predicate.AddWechatFriendLog(sql.FieldNotNull(FieldNickName))
+}
+
 // NickNameEqualFold applies the EqualFold predicate on the "nick_name" field.
 func NickNameEqualFold(v string) predicate.AddWechatFriendLog {
 	return predicate.AddWechatFriendLog(sql.FieldEqualFold(FieldNickName, v))
@@ -753,6 +773,16 @@ func AvatarHasSuffix(v string) predicate.AddWechatFriendLog {
 	return predicate.AddWechatFriendLog(sql.FieldHasSuffix(FieldAvatar, v))
 }
 
+// AvatarIsNil applies the IsNil predicate on the "avatar" field.
+func AvatarIsNil() predicate.AddWechatFriendLog {
+	return predicate.AddWechatFriendLog(sql.FieldIsNull(FieldAvatar))
+}
+
+// AvatarNotNil applies the NotNil predicate on the "avatar" field.
+func AvatarNotNil() predicate.AddWechatFriendLog {
+	return predicate.AddWechatFriendLog(sql.FieldNotNull(FieldAvatar))
+}
+
 // AvatarEqualFold applies the EqualFold predicate on the "avatar" field.
 func AvatarEqualFold(v string) predicate.AddWechatFriendLog {
 	return predicate.AddWechatFriendLog(sql.FieldEqualFold(FieldAvatar, v))
@@ -803,6 +833,16 @@ func OrganizationIDLTE(v int64) predicate.AddWechatFriendLog {
 	return predicate.AddWechatFriendLog(sql.FieldLTE(FieldOrganizationID, v))
 }
 
+// OrganizationIDIsNil applies the IsNil predicate on the "organization_id" field.
+func OrganizationIDIsNil() predicate.AddWechatFriendLog {
+	return predicate.AddWechatFriendLog(sql.FieldIsNull(FieldOrganizationID))
+}
+
+// OrganizationIDNotNil applies the NotNil predicate on the "organization_id" field.
+func OrganizationIDNotNil() predicate.AddWechatFriendLog {
+	return predicate.AddWechatFriendLog(sql.FieldNotNull(FieldOrganizationID))
+}
+
 // And groups predicates with the AND operator between them.
 func And(predicates ...predicate.AddWechatFriendLog) predicate.AddWechatFriendLog {
 	return predicate.AddWechatFriendLog(sql.AndPredicates(predicates...))

+ 80 - 12
ent/addwechatfriendlog_create.go

@@ -366,28 +366,16 @@ func (awflc *AddWechatFriendLogCreate) check() error {
 	if _, ok := awflc.mutation.UpdatedAt(); !ok {
 		return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "AddWechatFriendLog.updated_at"`)}
 	}
-	if _, ok := awflc.mutation.Source(); !ok {
-		return &ValidationError{Name: "source", err: errors.New(`ent: missing required field "AddWechatFriendLog.source"`)}
-	}
-	if _, ok := awflc.mutation.NickName(); !ok {
-		return &ValidationError{Name: "nick_name", err: errors.New(`ent: missing required field "AddWechatFriendLog.nick_name"`)}
-	}
 	if v, ok := awflc.mutation.NickName(); ok {
 		if err := addwechatfriendlog.NickNameValidator(v); err != nil {
 			return &ValidationError{Name: "nick_name", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.nick_name": %w`, err)}
 		}
 	}
-	if _, ok := awflc.mutation.Avatar(); !ok {
-		return &ValidationError{Name: "avatar", err: errors.New(`ent: missing required field "AddWechatFriendLog.avatar"`)}
-	}
 	if v, ok := awflc.mutation.Avatar(); ok {
 		if err := addwechatfriendlog.AvatarValidator(v); err != nil {
 			return &ValidationError{Name: "avatar", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.avatar": %w`, err)}
 		}
 	}
-	if _, ok := awflc.mutation.OrganizationID(); !ok {
-		return &ValidationError{Name: "organization_id", err: errors.New(`ent: missing required field "AddWechatFriendLog.organization_id"`)}
-	}
 	return nil
 }
 
@@ -775,6 +763,12 @@ func (u *AddWechatFriendLogUpsert) AddSource(v int) *AddWechatFriendLogUpsert {
 	return u
 }
 
+// ClearSource clears the value of the "source" field.
+func (u *AddWechatFriendLogUpsert) ClearSource() *AddWechatFriendLogUpsert {
+	u.SetNull(addwechatfriendlog.FieldSource)
+	return u
+}
+
 // SetNickName sets the "nick_name" field.
 func (u *AddWechatFriendLogUpsert) SetNickName(v string) *AddWechatFriendLogUpsert {
 	u.Set(addwechatfriendlog.FieldNickName, v)
@@ -787,6 +781,12 @@ func (u *AddWechatFriendLogUpsert) UpdateNickName() *AddWechatFriendLogUpsert {
 	return u
 }
 
+// ClearNickName clears the value of the "nick_name" field.
+func (u *AddWechatFriendLogUpsert) ClearNickName() *AddWechatFriendLogUpsert {
+	u.SetNull(addwechatfriendlog.FieldNickName)
+	return u
+}
+
 // SetAvatar sets the "avatar" field.
 func (u *AddWechatFriendLogUpsert) SetAvatar(v string) *AddWechatFriendLogUpsert {
 	u.Set(addwechatfriendlog.FieldAvatar, v)
@@ -799,6 +799,12 @@ func (u *AddWechatFriendLogUpsert) UpdateAvatar() *AddWechatFriendLogUpsert {
 	return u
 }
 
+// ClearAvatar clears the value of the "avatar" field.
+func (u *AddWechatFriendLogUpsert) ClearAvatar() *AddWechatFriendLogUpsert {
+	u.SetNull(addwechatfriendlog.FieldAvatar)
+	return u
+}
+
 // SetOrganizationID sets the "organization_id" field.
 func (u *AddWechatFriendLogUpsert) SetOrganizationID(v int64) *AddWechatFriendLogUpsert {
 	u.Set(addwechatfriendlog.FieldOrganizationID, v)
@@ -817,6 +823,12 @@ func (u *AddWechatFriendLogUpsert) AddOrganizationID(v int64) *AddWechatFriendLo
 	return u
 }
 
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (u *AddWechatFriendLogUpsert) ClearOrganizationID() *AddWechatFriendLogUpsert {
+	u.SetNull(addwechatfriendlog.FieldOrganizationID)
+	return u
+}
+
 // UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
 // Using this option is equivalent to using:
 //
@@ -1138,6 +1150,13 @@ func (u *AddWechatFriendLogUpsertOne) UpdateSource() *AddWechatFriendLogUpsertOn
 	})
 }
 
+// ClearSource clears the value of the "source" field.
+func (u *AddWechatFriendLogUpsertOne) ClearSource() *AddWechatFriendLogUpsertOne {
+	return u.Update(func(s *AddWechatFriendLogUpsert) {
+		s.ClearSource()
+	})
+}
+
 // SetNickName sets the "nick_name" field.
 func (u *AddWechatFriendLogUpsertOne) SetNickName(v string) *AddWechatFriendLogUpsertOne {
 	return u.Update(func(s *AddWechatFriendLogUpsert) {
@@ -1152,6 +1171,13 @@ func (u *AddWechatFriendLogUpsertOne) UpdateNickName() *AddWechatFriendLogUpsert
 	})
 }
 
+// ClearNickName clears the value of the "nick_name" field.
+func (u *AddWechatFriendLogUpsertOne) ClearNickName() *AddWechatFriendLogUpsertOne {
+	return u.Update(func(s *AddWechatFriendLogUpsert) {
+		s.ClearNickName()
+	})
+}
+
 // SetAvatar sets the "avatar" field.
 func (u *AddWechatFriendLogUpsertOne) SetAvatar(v string) *AddWechatFriendLogUpsertOne {
 	return u.Update(func(s *AddWechatFriendLogUpsert) {
@@ -1166,6 +1192,13 @@ func (u *AddWechatFriendLogUpsertOne) UpdateAvatar() *AddWechatFriendLogUpsertOn
 	})
 }
 
+// ClearAvatar clears the value of the "avatar" field.
+func (u *AddWechatFriendLogUpsertOne) ClearAvatar() *AddWechatFriendLogUpsertOne {
+	return u.Update(func(s *AddWechatFriendLogUpsert) {
+		s.ClearAvatar()
+	})
+}
+
 // SetOrganizationID sets the "organization_id" field.
 func (u *AddWechatFriendLogUpsertOne) SetOrganizationID(v int64) *AddWechatFriendLogUpsertOne {
 	return u.Update(func(s *AddWechatFriendLogUpsert) {
@@ -1187,6 +1220,13 @@ func (u *AddWechatFriendLogUpsertOne) UpdateOrganizationID() *AddWechatFriendLog
 	})
 }
 
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (u *AddWechatFriendLogUpsertOne) ClearOrganizationID() *AddWechatFriendLogUpsertOne {
+	return u.Update(func(s *AddWechatFriendLogUpsert) {
+		s.ClearOrganizationID()
+	})
+}
+
 // Exec executes the query.
 func (u *AddWechatFriendLogUpsertOne) Exec(ctx context.Context) error {
 	if len(u.create.conflict) == 0 {
@@ -1674,6 +1714,13 @@ func (u *AddWechatFriendLogUpsertBulk) UpdateSource() *AddWechatFriendLogUpsertB
 	})
 }
 
+// ClearSource clears the value of the "source" field.
+func (u *AddWechatFriendLogUpsertBulk) ClearSource() *AddWechatFriendLogUpsertBulk {
+	return u.Update(func(s *AddWechatFriendLogUpsert) {
+		s.ClearSource()
+	})
+}
+
 // SetNickName sets the "nick_name" field.
 func (u *AddWechatFriendLogUpsertBulk) SetNickName(v string) *AddWechatFriendLogUpsertBulk {
 	return u.Update(func(s *AddWechatFriendLogUpsert) {
@@ -1688,6 +1735,13 @@ func (u *AddWechatFriendLogUpsertBulk) UpdateNickName() *AddWechatFriendLogUpser
 	})
 }
 
+// ClearNickName clears the value of the "nick_name" field.
+func (u *AddWechatFriendLogUpsertBulk) ClearNickName() *AddWechatFriendLogUpsertBulk {
+	return u.Update(func(s *AddWechatFriendLogUpsert) {
+		s.ClearNickName()
+	})
+}
+
 // SetAvatar sets the "avatar" field.
 func (u *AddWechatFriendLogUpsertBulk) SetAvatar(v string) *AddWechatFriendLogUpsertBulk {
 	return u.Update(func(s *AddWechatFriendLogUpsert) {
@@ -1702,6 +1756,13 @@ func (u *AddWechatFriendLogUpsertBulk) UpdateAvatar() *AddWechatFriendLogUpsertB
 	})
 }
 
+// ClearAvatar clears the value of the "avatar" field.
+func (u *AddWechatFriendLogUpsertBulk) ClearAvatar() *AddWechatFriendLogUpsertBulk {
+	return u.Update(func(s *AddWechatFriendLogUpsert) {
+		s.ClearAvatar()
+	})
+}
+
 // SetOrganizationID sets the "organization_id" field.
 func (u *AddWechatFriendLogUpsertBulk) SetOrganizationID(v int64) *AddWechatFriendLogUpsertBulk {
 	return u.Update(func(s *AddWechatFriendLogUpsert) {
@@ -1723,6 +1784,13 @@ func (u *AddWechatFriendLogUpsertBulk) UpdateOrganizationID() *AddWechatFriendLo
 	})
 }
 
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (u *AddWechatFriendLogUpsertBulk) ClearOrganizationID() *AddWechatFriendLogUpsertBulk {
+	return u.Update(func(s *AddWechatFriendLogUpsert) {
+		s.ClearOrganizationID()
+	})
+}
+
 // Exec executes the query.
 func (u *AddWechatFriendLogUpsertBulk) Exec(ctx context.Context) error {
 	if u.create.err != nil {

+ 72 - 0
ent/addwechatfriendlog_update.go

@@ -256,6 +256,12 @@ func (awflu *AddWechatFriendLogUpdate) AddSource(i int) *AddWechatFriendLogUpdat
 	return awflu
 }
 
+// ClearSource clears the value of the "source" field.
+func (awflu *AddWechatFriendLogUpdate) ClearSource() *AddWechatFriendLogUpdate {
+	awflu.mutation.ClearSource()
+	return awflu
+}
+
 // SetNickName sets the "nick_name" field.
 func (awflu *AddWechatFriendLogUpdate) SetNickName(s string) *AddWechatFriendLogUpdate {
 	awflu.mutation.SetNickName(s)
@@ -270,6 +276,12 @@ func (awflu *AddWechatFriendLogUpdate) SetNillableNickName(s *string) *AddWechat
 	return awflu
 }
 
+// ClearNickName clears the value of the "nick_name" field.
+func (awflu *AddWechatFriendLogUpdate) ClearNickName() *AddWechatFriendLogUpdate {
+	awflu.mutation.ClearNickName()
+	return awflu
+}
+
 // SetAvatar sets the "avatar" field.
 func (awflu *AddWechatFriendLogUpdate) SetAvatar(s string) *AddWechatFriendLogUpdate {
 	awflu.mutation.SetAvatar(s)
@@ -284,6 +296,12 @@ func (awflu *AddWechatFriendLogUpdate) SetNillableAvatar(s *string) *AddWechatFr
 	return awflu
 }
 
+// ClearAvatar clears the value of the "avatar" field.
+func (awflu *AddWechatFriendLogUpdate) ClearAvatar() *AddWechatFriendLogUpdate {
+	awflu.mutation.ClearAvatar()
+	return awflu
+}
+
 // SetOrganizationID sets the "organization_id" field.
 func (awflu *AddWechatFriendLogUpdate) SetOrganizationID(i int64) *AddWechatFriendLogUpdate {
 	awflu.mutation.ResetOrganizationID()
@@ -305,6 +323,12 @@ func (awflu *AddWechatFriendLogUpdate) AddOrganizationID(i int64) *AddWechatFrie
 	return awflu
 }
 
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (awflu *AddWechatFriendLogUpdate) ClearOrganizationID() *AddWechatFriendLogUpdate {
+	awflu.mutation.ClearOrganizationID()
+	return awflu
+}
+
 // Mutation returns the AddWechatFriendLogMutation object of the builder.
 func (awflu *AddWechatFriendLogUpdate) Mutation() *AddWechatFriendLogMutation {
 	return awflu.mutation
@@ -463,18 +487,30 @@ func (awflu *AddWechatFriendLogUpdate) sqlSave(ctx context.Context) (n int, err
 	if value, ok := awflu.mutation.AddedSource(); ok {
 		_spec.AddField(addwechatfriendlog.FieldSource, field.TypeInt, value)
 	}
+	if awflu.mutation.SourceCleared() {
+		_spec.ClearField(addwechatfriendlog.FieldSource, field.TypeInt)
+	}
 	if value, ok := awflu.mutation.NickName(); ok {
 		_spec.SetField(addwechatfriendlog.FieldNickName, field.TypeString, value)
 	}
+	if awflu.mutation.NickNameCleared() {
+		_spec.ClearField(addwechatfriendlog.FieldNickName, field.TypeString)
+	}
 	if value, ok := awflu.mutation.Avatar(); ok {
 		_spec.SetField(addwechatfriendlog.FieldAvatar, field.TypeString, value)
 	}
+	if awflu.mutation.AvatarCleared() {
+		_spec.ClearField(addwechatfriendlog.FieldAvatar, field.TypeString)
+	}
 	if value, ok := awflu.mutation.OrganizationID(); ok {
 		_spec.SetField(addwechatfriendlog.FieldOrganizationID, field.TypeInt64, value)
 	}
 	if value, ok := awflu.mutation.AddedOrganizationID(); ok {
 		_spec.AddField(addwechatfriendlog.FieldOrganizationID, field.TypeInt64, value)
 	}
+	if awflu.mutation.OrganizationIDCleared() {
+		_spec.ClearField(addwechatfriendlog.FieldOrganizationID, field.TypeInt64)
+	}
 	if n, err = sqlgraph.UpdateNodes(ctx, awflu.driver, _spec); err != nil {
 		if _, ok := err.(*sqlgraph.NotFoundError); ok {
 			err = &NotFoundError{addwechatfriendlog.Label}
@@ -724,6 +760,12 @@ func (awfluo *AddWechatFriendLogUpdateOne) AddSource(i int) *AddWechatFriendLogU
 	return awfluo
 }
 
+// ClearSource clears the value of the "source" field.
+func (awfluo *AddWechatFriendLogUpdateOne) ClearSource() *AddWechatFriendLogUpdateOne {
+	awfluo.mutation.ClearSource()
+	return awfluo
+}
+
 // SetNickName sets the "nick_name" field.
 func (awfluo *AddWechatFriendLogUpdateOne) SetNickName(s string) *AddWechatFriendLogUpdateOne {
 	awfluo.mutation.SetNickName(s)
@@ -738,6 +780,12 @@ func (awfluo *AddWechatFriendLogUpdateOne) SetNillableNickName(s *string) *AddWe
 	return awfluo
 }
 
+// ClearNickName clears the value of the "nick_name" field.
+func (awfluo *AddWechatFriendLogUpdateOne) ClearNickName() *AddWechatFriendLogUpdateOne {
+	awfluo.mutation.ClearNickName()
+	return awfluo
+}
+
 // SetAvatar sets the "avatar" field.
 func (awfluo *AddWechatFriendLogUpdateOne) SetAvatar(s string) *AddWechatFriendLogUpdateOne {
 	awfluo.mutation.SetAvatar(s)
@@ -752,6 +800,12 @@ func (awfluo *AddWechatFriendLogUpdateOne) SetNillableAvatar(s *string) *AddWech
 	return awfluo
 }
 
+// ClearAvatar clears the value of the "avatar" field.
+func (awfluo *AddWechatFriendLogUpdateOne) ClearAvatar() *AddWechatFriendLogUpdateOne {
+	awfluo.mutation.ClearAvatar()
+	return awfluo
+}
+
 // SetOrganizationID sets the "organization_id" field.
 func (awfluo *AddWechatFriendLogUpdateOne) SetOrganizationID(i int64) *AddWechatFriendLogUpdateOne {
 	awfluo.mutation.ResetOrganizationID()
@@ -773,6 +827,12 @@ func (awfluo *AddWechatFriendLogUpdateOne) AddOrganizationID(i int64) *AddWechat
 	return awfluo
 }
 
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (awfluo *AddWechatFriendLogUpdateOne) ClearOrganizationID() *AddWechatFriendLogUpdateOne {
+	awfluo.mutation.ClearOrganizationID()
+	return awfluo
+}
+
 // Mutation returns the AddWechatFriendLogMutation object of the builder.
 func (awfluo *AddWechatFriendLogUpdateOne) Mutation() *AddWechatFriendLogMutation {
 	return awfluo.mutation
@@ -961,18 +1021,30 @@ func (awfluo *AddWechatFriendLogUpdateOne) sqlSave(ctx context.Context) (_node *
 	if value, ok := awfluo.mutation.AddedSource(); ok {
 		_spec.AddField(addwechatfriendlog.FieldSource, field.TypeInt, value)
 	}
+	if awfluo.mutation.SourceCleared() {
+		_spec.ClearField(addwechatfriendlog.FieldSource, field.TypeInt)
+	}
 	if value, ok := awfluo.mutation.NickName(); ok {
 		_spec.SetField(addwechatfriendlog.FieldNickName, field.TypeString, value)
 	}
+	if awfluo.mutation.NickNameCleared() {
+		_spec.ClearField(addwechatfriendlog.FieldNickName, field.TypeString)
+	}
 	if value, ok := awfluo.mutation.Avatar(); ok {
 		_spec.SetField(addwechatfriendlog.FieldAvatar, field.TypeString, value)
 	}
+	if awfluo.mutation.AvatarCleared() {
+		_spec.ClearField(addwechatfriendlog.FieldAvatar, field.TypeString)
+	}
 	if value, ok := awfluo.mutation.OrganizationID(); ok {
 		_spec.SetField(addwechatfriendlog.FieldOrganizationID, field.TypeInt64, value)
 	}
 	if value, ok := awfluo.mutation.AddedOrganizationID(); ok {
 		_spec.AddField(addwechatfriendlog.FieldOrganizationID, field.TypeInt64, value)
 	}
+	if awfluo.mutation.OrganizationIDCleared() {
+		_spec.ClearField(addwechatfriendlog.FieldOrganizationID, field.TypeInt64)
+	}
 	_node = &AddWechatFriendLog{config: awfluo.config}
 	_spec.Assign = _node.assignValues
 	_spec.ScanValues = _node.scanValues

+ 4 - 4
ent/migrate/schema.go

@@ -25,10 +25,10 @@ var (
 		{Name: "add_result", Type: field.TypeJSON, Nullable: true},
 		{Name: "created_at", Type: field.TypeInt64},
 		{Name: "updated_at", Type: field.TypeInt64},
-		{Name: "source", Type: field.TypeInt, Default: 1},
-		{Name: "nick_name", Type: field.TypeString, Size: 255, Default: ""},
-		{Name: "avatar", Type: field.TypeString, Size: 255, Default: ""},
-		{Name: "organization_id", Type: field.TypeInt64, Default: 0},
+		{Name: "source", Type: field.TypeInt, Nullable: true, Default: 1},
+		{Name: "nick_name", Type: field.TypeString, Nullable: true, Size: 255, Default: ""},
+		{Name: "avatar", Type: field.TypeString, Nullable: true, Size: 255, Default: ""},
+		{Name: "organization_id", Type: field.TypeInt64, Nullable: true, Default: 0},
 	}
 	// AddWechatFriendLogTable holds the schema information for the "add_wechat_friend_log" table.
 	AddWechatFriendLogTable = &schema.Table{

+ 78 - 0
ent/mutation.go

@@ -953,10 +953,24 @@ func (m *AddWechatFriendLogMutation) AddedSource() (r int, exists bool) {
 	return *v, true
 }
 
+// ClearSource clears the value of the "source" field.
+func (m *AddWechatFriendLogMutation) ClearSource() {
+	m.source = nil
+	m.addsource = nil
+	m.clearedFields[addwechatfriendlog.FieldSource] = struct{}{}
+}
+
+// SourceCleared returns if the "source" field was cleared in this mutation.
+func (m *AddWechatFriendLogMutation) SourceCleared() bool {
+	_, ok := m.clearedFields[addwechatfriendlog.FieldSource]
+	return ok
+}
+
 // ResetSource resets all changes to the "source" field.
 func (m *AddWechatFriendLogMutation) ResetSource() {
 	m.source = nil
 	m.addsource = nil
+	delete(m.clearedFields, addwechatfriendlog.FieldSource)
 }
 
 // SetNickName sets the "nick_name" field.
@@ -990,9 +1004,22 @@ func (m *AddWechatFriendLogMutation) OldNickName(ctx context.Context) (v string,
 	return oldValue.NickName, nil
 }
 
+// ClearNickName clears the value of the "nick_name" field.
+func (m *AddWechatFriendLogMutation) ClearNickName() {
+	m.nick_name = nil
+	m.clearedFields[addwechatfriendlog.FieldNickName] = struct{}{}
+}
+
+// NickNameCleared returns if the "nick_name" field was cleared in this mutation.
+func (m *AddWechatFriendLogMutation) NickNameCleared() bool {
+	_, ok := m.clearedFields[addwechatfriendlog.FieldNickName]
+	return ok
+}
+
 // ResetNickName resets all changes to the "nick_name" field.
 func (m *AddWechatFriendLogMutation) ResetNickName() {
 	m.nick_name = nil
+	delete(m.clearedFields, addwechatfriendlog.FieldNickName)
 }
 
 // SetAvatar sets the "avatar" field.
@@ -1026,9 +1053,22 @@ func (m *AddWechatFriendLogMutation) OldAvatar(ctx context.Context) (v string, e
 	return oldValue.Avatar, nil
 }
 
+// ClearAvatar clears the value of the "avatar" field.
+func (m *AddWechatFriendLogMutation) ClearAvatar() {
+	m.avatar = nil
+	m.clearedFields[addwechatfriendlog.FieldAvatar] = struct{}{}
+}
+
+// AvatarCleared returns if the "avatar" field was cleared in this mutation.
+func (m *AddWechatFriendLogMutation) AvatarCleared() bool {
+	_, ok := m.clearedFields[addwechatfriendlog.FieldAvatar]
+	return ok
+}
+
 // ResetAvatar resets all changes to the "avatar" field.
 func (m *AddWechatFriendLogMutation) ResetAvatar() {
 	m.avatar = nil
+	delete(m.clearedFields, addwechatfriendlog.FieldAvatar)
 }
 
 // SetOrganizationID sets the "organization_id" field.
@@ -1081,10 +1121,24 @@ func (m *AddWechatFriendLogMutation) AddedOrganizationID() (r int64, exists bool
 	return *v, true
 }
 
+// ClearOrganizationID clears the value of the "organization_id" field.
+func (m *AddWechatFriendLogMutation) ClearOrganizationID() {
+	m.organization_id = nil
+	m.addorganization_id = nil
+	m.clearedFields[addwechatfriendlog.FieldOrganizationID] = struct{}{}
+}
+
+// OrganizationIDCleared returns if the "organization_id" field was cleared in this mutation.
+func (m *AddWechatFriendLogMutation) OrganizationIDCleared() bool {
+	_, ok := m.clearedFields[addwechatfriendlog.FieldOrganizationID]
+	return ok
+}
+
 // ResetOrganizationID resets all changes to the "organization_id" field.
 func (m *AddWechatFriendLogMutation) ResetOrganizationID() {
 	m.organization_id = nil
 	m.addorganization_id = nil
+	delete(m.clearedFields, addwechatfriendlog.FieldOrganizationID)
 }
 
 // Where appends a list predicates to the AddWechatFriendLogMutation builder.
@@ -1527,6 +1581,18 @@ func (m *AddWechatFriendLogMutation) ClearedFields() []string {
 	if m.FieldCleared(addwechatfriendlog.FieldAddResult) {
 		fields = append(fields, addwechatfriendlog.FieldAddResult)
 	}
+	if m.FieldCleared(addwechatfriendlog.FieldSource) {
+		fields = append(fields, addwechatfriendlog.FieldSource)
+	}
+	if m.FieldCleared(addwechatfriendlog.FieldNickName) {
+		fields = append(fields, addwechatfriendlog.FieldNickName)
+	}
+	if m.FieldCleared(addwechatfriendlog.FieldAvatar) {
+		fields = append(fields, addwechatfriendlog.FieldAvatar)
+	}
+	if m.FieldCleared(addwechatfriendlog.FieldOrganizationID) {
+		fields = append(fields, addwechatfriendlog.FieldOrganizationID)
+	}
 	return fields
 }
 
@@ -1553,6 +1619,18 @@ func (m *AddWechatFriendLogMutation) ClearField(name string) error {
 	case addwechatfriendlog.FieldAddResult:
 		m.ClearAddResult()
 		return nil
+	case addwechatfriendlog.FieldSource:
+		m.ClearSource()
+		return nil
+	case addwechatfriendlog.FieldNickName:
+		m.ClearNickName()
+		return nil
+	case addwechatfriendlog.FieldAvatar:
+		m.ClearAvatar()
+		return nil
+	case addwechatfriendlog.FieldOrganizationID:
+		m.ClearOrganizationID()
+		return nil
 	}
 	return fmt.Errorf("unknown AddWechatFriendLog nullable field %s", name)
 }

+ 4 - 4
ent/schema/add_wechat_friend_log.go

@@ -68,10 +68,10 @@ func (AddWechatFriendLog) Fields() []ent.Field {
 			}).UpdateDefault(func() int64 {
 			return time.Now().Unix()
 		}).Comment("修改时间戳"),
-		field.Int("source").Default(1).Comment("1.api录入 2.人工导入"),
-		field.String("nick_name").NotEmpty().Default("").MaxLen(255).Comment("用户名称"),
-		field.String("avatar").NotEmpty().Default("").MaxLen(255).Comment("用户头像"),
-		field.Int64("organization_id").Default(0).Comment("组织架构id"),
+		field.Int("source").Default(1).Optional().Comment("1.api录入 2.人工导入"),
+		field.String("nick_name").NotEmpty().Default("").Optional().MaxLen(255).Comment("用户名称"),
+		field.String("avatar").NotEmpty().Default("").MaxLen(255).Optional().Comment("用户头像"),
+		field.Int64("organization_id").Default(0).Optional().Comment("组织架构id"),
 	}
 }
 

+ 4 - 2
internal/logic/add_friend/add_friend_list_logic.go

@@ -99,11 +99,12 @@ func (l *AddFriendListLogic) AddFriendList(req *types.AddFriendListReq) (resp *t
 					statusMap := map[int]string{
 						0: "数据准备中",
 						1: "待执行",
-						2: "成功请",
-						3: "timeout及其他错误",
+						2: "成功请",
+						3: "执行错误",
 						4: "用户不存在",
 						5: "后台取消",
 						6: "已是好友",
+						7: "成功邀请",
 					}
 					statusStr := statusMap[v.IsCanAdd]
 					return &statusStr
@@ -117,6 +118,7 @@ func (l *AddFriendListLogic) AddFriendList(req *types.AddFriendListReq) (resp *t
 						4: 0,
 						5: 0,
 						6: 0,
+						7: 0,
 					}
 					isShow := statusMap[v.IsCanAdd]
 					return &isShow