Forráskód Böngészése

fix:设置微信与whatsapp使用共同的label

jimmyyem 3 hete
szülő
commit
90dddc8d84

+ 0 - 1
crontask/compute_statistic.go

@@ -192,7 +192,6 @@ func (l *CronTask) computeStatistic() {
 		LabelsCount := []custom_types.LabelDist{}
 		err := l.svcCtx.DB.LabelRelationship.Query().Where(
 			labelrelationship.OrganizationIDEQ(orgID),
-			labelrelationship.Ctype(1),
 		).GroupBy(labelrelationship.FieldLabelID).Aggregate(ent.Count()).Scan(l.ctx, &LabelsCount)
 		l.Errorf("save hour data error:%v \n", err)
 		LabelsCountSet[orgID] = LabelsCount

+ 0 - 1
crontask/send_msg.go

@@ -296,7 +296,6 @@ func (l *CronTask) getContactList(labels []uint64, fromWxId string, stype int) (
 	// 获取 label_relationship 表中,label_id 等于 labids 的 contact_id
 	labelrelationships, err := l.svcCtx.DB.LabelRelationship.Query().Where(
 		labelrelationship.LabelIDIn(labels...),
-		labelrelationship.Ctype(1),
 	).All(l.ctx)
 	if err != nil {
 		return nil, dberrorhandler.DefaultEntError(l.Logger, err, nil)

+ 0 - 3
desc/wechat/label.api

@@ -59,9 +59,6 @@ type (
 
         // 标签模式:1动态 2静态
         Mode  *int `json:"mode,optional"`
-
-		// 内容类型:1-微信 2-whatsapp
-		Ctype *uint64 `json:"ctype,optional"`
     }
 
     // Label information response | Label信息返回体

+ 0 - 3
desc/wechat/label_relationship.api

@@ -112,9 +112,6 @@ type (
 
         // Label Relationships | 标签关系
         LabelRelationships []LabelRelationshipInfo `json:"labelRelationships,optional"`
-
-		// 内容类型:1-微信 2-whatsapp
-		Ctype *uint64 `json:"ctype,optional"`
     }
     // The response data of label relationship information | LabelRelationship信息
     LabelRelationshipInfo {

+ 1 - 12
ent/label.go

@@ -35,8 +35,6 @@ type Label struct {
 	Conditions string `json:"conditions,omitempty"`
 	// 机构 ID
 	OrganizationID uint64 `json:"organization_id,omitempty"`
-	// 内容类型:1-微信 2-whatsapp
-	Ctype uint64 `json:"ctype,omitempty"`
 	// Edges holds the relations/edges for other nodes in the graph.
 	// The values are being populated by the LabelQuery when eager-loading is set.
 	Edges        LabelEdges `json:"edges"`
@@ -66,7 +64,7 @@ func (*Label) scanValues(columns []string) ([]any, error) {
 	values := make([]any, len(columns))
 	for i := range columns {
 		switch columns[i] {
-		case label.FieldID, label.FieldStatus, label.FieldType, label.FieldFrom, label.FieldMode, label.FieldOrganizationID, label.FieldCtype:
+		case label.FieldID, label.FieldStatus, label.FieldType, label.FieldFrom, label.FieldMode, label.FieldOrganizationID:
 			values[i] = new(sql.NullInt64)
 		case label.FieldName, label.FieldConditions:
 			values[i] = new(sql.NullString)
@@ -147,12 +145,6 @@ func (l *Label) assignValues(columns []string, values []any) error {
 			} else if value.Valid {
 				l.OrganizationID = uint64(value.Int64)
 			}
-		case label.FieldCtype:
-			if value, ok := values[i].(*sql.NullInt64); !ok {
-				return fmt.Errorf("unexpected type %T for field ctype", values[i])
-			} else if value.Valid {
-				l.Ctype = uint64(value.Int64)
-			}
 		default:
 			l.selectValues.Set(columns[i], values[i])
 		}
@@ -220,9 +212,6 @@ func (l *Label) String() string {
 	builder.WriteString(", ")
 	builder.WriteString("organization_id=")
 	builder.WriteString(fmt.Sprintf("%v", l.OrganizationID))
-	builder.WriteString(", ")
-	builder.WriteString("ctype=")
-	builder.WriteString(fmt.Sprintf("%v", l.Ctype))
 	builder.WriteByte(')')
 	return builder.String()
 }

+ 0 - 10
ent/label/label.go

@@ -32,8 +32,6 @@ const (
 	FieldConditions = "conditions"
 	// FieldOrganizationID holds the string denoting the organization_id field in the database.
 	FieldOrganizationID = "organization_id"
-	// FieldCtype holds the string denoting the ctype field in the database.
-	FieldCtype = "ctype"
 	// EdgeLabelRelationships holds the string denoting the label_relationships edge name in mutations.
 	EdgeLabelRelationships = "label_relationships"
 	// Table holds the table name of the label in the database.
@@ -59,7 +57,6 @@ var Columns = []string{
 	FieldMode,
 	FieldConditions,
 	FieldOrganizationID,
-	FieldCtype,
 }
 
 // ValidColumn reports if the column name is valid (part of the table columns).
@@ -93,8 +90,6 @@ var (
 	DefaultConditions string
 	// DefaultOrganizationID holds the default value on creation for the "organization_id" field.
 	DefaultOrganizationID uint64
-	// DefaultCtype holds the default value on creation for the "ctype" field.
-	DefaultCtype uint64
 )
 
 // OrderOption defines the ordering options for the Label queries.
@@ -150,11 +145,6 @@ func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
 	return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
 }
 
-// ByCtype orders the results by the ctype field.
-func ByCtype(opts ...sql.OrderTermOption) OrderOption {
-	return sql.OrderByField(FieldCtype, opts...).ToFunc()
-}
-
 // ByLabelRelationshipsCount orders the results by label_relationships count.
 func ByLabelRelationshipsCount(opts ...sql.OrderTermOption) OrderOption {
 	return func(s *sql.Selector) {

+ 0 - 45
ent/label/where.go

@@ -100,11 +100,6 @@ func OrganizationID(v uint64) predicate.Label {
 	return predicate.Label(sql.FieldEQ(FieldOrganizationID, v))
 }
 
-// Ctype applies equality check predicate on the "ctype" field. It's identical to CtypeEQ.
-func Ctype(v uint64) predicate.Label {
-	return predicate.Label(sql.FieldEQ(FieldCtype, v))
-}
-
 // CreatedAtEQ applies the EQ predicate on the "created_at" field.
 func CreatedAtEQ(v time.Time) predicate.Label {
 	return predicate.Label(sql.FieldEQ(FieldCreatedAt, v))
@@ -545,46 +540,6 @@ func OrganizationIDNotNil() predicate.Label {
 	return predicate.Label(sql.FieldNotNull(FieldOrganizationID))
 }
 
-// CtypeEQ applies the EQ predicate on the "ctype" field.
-func CtypeEQ(v uint64) predicate.Label {
-	return predicate.Label(sql.FieldEQ(FieldCtype, v))
-}
-
-// CtypeNEQ applies the NEQ predicate on the "ctype" field.
-func CtypeNEQ(v uint64) predicate.Label {
-	return predicate.Label(sql.FieldNEQ(FieldCtype, v))
-}
-
-// CtypeIn applies the In predicate on the "ctype" field.
-func CtypeIn(vs ...uint64) predicate.Label {
-	return predicate.Label(sql.FieldIn(FieldCtype, vs...))
-}
-
-// CtypeNotIn applies the NotIn predicate on the "ctype" field.
-func CtypeNotIn(vs ...uint64) predicate.Label {
-	return predicate.Label(sql.FieldNotIn(FieldCtype, vs...))
-}
-
-// CtypeGT applies the GT predicate on the "ctype" field.
-func CtypeGT(v uint64) predicate.Label {
-	return predicate.Label(sql.FieldGT(FieldCtype, v))
-}
-
-// CtypeGTE applies the GTE predicate on the "ctype" field.
-func CtypeGTE(v uint64) predicate.Label {
-	return predicate.Label(sql.FieldGTE(FieldCtype, v))
-}
-
-// CtypeLT applies the LT predicate on the "ctype" field.
-func CtypeLT(v uint64) predicate.Label {
-	return predicate.Label(sql.FieldLT(FieldCtype, v))
-}
-
-// CtypeLTE applies the LTE predicate on the "ctype" field.
-func CtypeLTE(v uint64) predicate.Label {
-	return predicate.Label(sql.FieldLTE(FieldCtype, v))
-}
-
 // HasLabelRelationships applies the HasEdge predicate on the "label_relationships" edge.
 func HasLabelRelationships() predicate.Label {
 	return predicate.Label(func(s *sql.Selector) {

+ 0 - 85
ent/label_create.go

@@ -149,20 +149,6 @@ func (lc *LabelCreate) SetNillableOrganizationID(u *uint64) *LabelCreate {
 	return lc
 }
 
-// SetCtype sets the "ctype" field.
-func (lc *LabelCreate) SetCtype(u uint64) *LabelCreate {
-	lc.mutation.SetCtype(u)
-	return lc
-}
-
-// SetNillableCtype sets the "ctype" field if the given value is not nil.
-func (lc *LabelCreate) SetNillableCtype(u *uint64) *LabelCreate {
-	if u != nil {
-		lc.SetCtype(*u)
-	}
-	return lc
-}
-
 // SetID sets the "id" field.
 func (lc *LabelCreate) SetID(u uint64) *LabelCreate {
 	lc.mutation.SetID(u)
@@ -255,10 +241,6 @@ func (lc *LabelCreate) defaults() {
 		v := label.DefaultOrganizationID
 		lc.mutation.SetOrganizationID(v)
 	}
-	if _, ok := lc.mutation.Ctype(); !ok {
-		v := label.DefaultCtype
-		lc.mutation.SetCtype(v)
-	}
 }
 
 // check runs all checks and user-defined validators on the builder.
@@ -281,9 +263,6 @@ func (lc *LabelCreate) check() error {
 	if _, ok := lc.mutation.Mode(); !ok {
 		return &ValidationError{Name: "mode", err: errors.New(`ent: missing required field "Label.mode"`)}
 	}
-	if _, ok := lc.mutation.Ctype(); !ok {
-		return &ValidationError{Name: "ctype", err: errors.New(`ent: missing required field "Label.ctype"`)}
-	}
 	return nil
 }
 
@@ -353,10 +332,6 @@ func (lc *LabelCreate) createSpec() (*Label, *sqlgraph.CreateSpec) {
 		_spec.SetField(label.FieldOrganizationID, field.TypeUint64, value)
 		_node.OrganizationID = value
 	}
-	if value, ok := lc.mutation.Ctype(); ok {
-		_spec.SetField(label.FieldCtype, field.TypeUint64, value)
-		_node.Ctype = value
-	}
 	if nodes := lc.mutation.LabelRelationshipsIDs(); len(nodes) > 0 {
 		edge := &sqlgraph.EdgeSpec{
 			Rel:     sqlgraph.O2M,
@@ -569,24 +544,6 @@ func (u *LabelUpsert) ClearOrganizationID() *LabelUpsert {
 	return u
 }
 
-// SetCtype sets the "ctype" field.
-func (u *LabelUpsert) SetCtype(v uint64) *LabelUpsert {
-	u.Set(label.FieldCtype, v)
-	return u
-}
-
-// UpdateCtype sets the "ctype" field to the value that was provided on create.
-func (u *LabelUpsert) UpdateCtype() *LabelUpsert {
-	u.SetExcluded(label.FieldCtype)
-	return u
-}
-
-// AddCtype adds v to the "ctype" field.
-func (u *LabelUpsert) AddCtype(v uint64) *LabelUpsert {
-	u.Add(label.FieldCtype, v)
-	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:
 //
@@ -806,27 +763,6 @@ func (u *LabelUpsertOne) ClearOrganizationID() *LabelUpsertOne {
 	})
 }
 
-// SetCtype sets the "ctype" field.
-func (u *LabelUpsertOne) SetCtype(v uint64) *LabelUpsertOne {
-	return u.Update(func(s *LabelUpsert) {
-		s.SetCtype(v)
-	})
-}
-
-// AddCtype adds v to the "ctype" field.
-func (u *LabelUpsertOne) AddCtype(v uint64) *LabelUpsertOne {
-	return u.Update(func(s *LabelUpsert) {
-		s.AddCtype(v)
-	})
-}
-
-// UpdateCtype sets the "ctype" field to the value that was provided on create.
-func (u *LabelUpsertOne) UpdateCtype() *LabelUpsertOne {
-	return u.Update(func(s *LabelUpsert) {
-		s.UpdateCtype()
-	})
-}
-
 // Exec executes the query.
 func (u *LabelUpsertOne) Exec(ctx context.Context) error {
 	if len(u.create.conflict) == 0 {
@@ -1212,27 +1148,6 @@ func (u *LabelUpsertBulk) ClearOrganizationID() *LabelUpsertBulk {
 	})
 }
 
-// SetCtype sets the "ctype" field.
-func (u *LabelUpsertBulk) SetCtype(v uint64) *LabelUpsertBulk {
-	return u.Update(func(s *LabelUpsert) {
-		s.SetCtype(v)
-	})
-}
-
-// AddCtype adds v to the "ctype" field.
-func (u *LabelUpsertBulk) AddCtype(v uint64) *LabelUpsertBulk {
-	return u.Update(func(s *LabelUpsert) {
-		s.AddCtype(v)
-	})
-}
-
-// UpdateCtype sets the "ctype" field to the value that was provided on create.
-func (u *LabelUpsertBulk) UpdateCtype() *LabelUpsertBulk {
-	return u.Update(func(s *LabelUpsert) {
-		s.UpdateCtype()
-	})
-}
-
 // Exec executes the query.
 func (u *LabelUpsertBulk) Exec(ctx context.Context) error {
 	if u.create.err != nil {

+ 0 - 54
ent/label_update.go

@@ -186,27 +186,6 @@ func (lu *LabelUpdate) ClearOrganizationID() *LabelUpdate {
 	return lu
 }
 
-// SetCtype sets the "ctype" field.
-func (lu *LabelUpdate) SetCtype(u uint64) *LabelUpdate {
-	lu.mutation.ResetCtype()
-	lu.mutation.SetCtype(u)
-	return lu
-}
-
-// SetNillableCtype sets the "ctype" field if the given value is not nil.
-func (lu *LabelUpdate) SetNillableCtype(u *uint64) *LabelUpdate {
-	if u != nil {
-		lu.SetCtype(*u)
-	}
-	return lu
-}
-
-// AddCtype adds u to the "ctype" field.
-func (lu *LabelUpdate) AddCtype(u int64) *LabelUpdate {
-	lu.mutation.AddCtype(u)
-	return lu
-}
-
 // AddLabelRelationshipIDs adds the "label_relationships" edge to the LabelRelationship entity by IDs.
 func (lu *LabelUpdate) AddLabelRelationshipIDs(ids ...uint64) *LabelUpdate {
 	lu.mutation.AddLabelRelationshipIDs(ids...)
@@ -341,12 +320,6 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) {
 	if lu.mutation.OrganizationIDCleared() {
 		_spec.ClearField(label.FieldOrganizationID, field.TypeUint64)
 	}
-	if value, ok := lu.mutation.Ctype(); ok {
-		_spec.SetField(label.FieldCtype, field.TypeUint64, value)
-	}
-	if value, ok := lu.mutation.AddedCtype(); ok {
-		_spec.AddField(label.FieldCtype, field.TypeUint64, value)
-	}
 	if lu.mutation.LabelRelationshipsCleared() {
 		edge := &sqlgraph.EdgeSpec{
 			Rel:     sqlgraph.O2M,
@@ -569,27 +542,6 @@ func (luo *LabelUpdateOne) ClearOrganizationID() *LabelUpdateOne {
 	return luo
 }
 
-// SetCtype sets the "ctype" field.
-func (luo *LabelUpdateOne) SetCtype(u uint64) *LabelUpdateOne {
-	luo.mutation.ResetCtype()
-	luo.mutation.SetCtype(u)
-	return luo
-}
-
-// SetNillableCtype sets the "ctype" field if the given value is not nil.
-func (luo *LabelUpdateOne) SetNillableCtype(u *uint64) *LabelUpdateOne {
-	if u != nil {
-		luo.SetCtype(*u)
-	}
-	return luo
-}
-
-// AddCtype adds u to the "ctype" field.
-func (luo *LabelUpdateOne) AddCtype(u int64) *LabelUpdateOne {
-	luo.mutation.AddCtype(u)
-	return luo
-}
-
 // AddLabelRelationshipIDs adds the "label_relationships" edge to the LabelRelationship entity by IDs.
 func (luo *LabelUpdateOne) AddLabelRelationshipIDs(ids ...uint64) *LabelUpdateOne {
 	luo.mutation.AddLabelRelationshipIDs(ids...)
@@ -754,12 +706,6 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error
 	if luo.mutation.OrganizationIDCleared() {
 		_spec.ClearField(label.FieldOrganizationID, field.TypeUint64)
 	}
-	if value, ok := luo.mutation.Ctype(); ok {
-		_spec.SetField(label.FieldCtype, field.TypeUint64, value)
-	}
-	if value, ok := luo.mutation.AddedCtype(); ok {
-		_spec.AddField(label.FieldCtype, field.TypeUint64, value)
-	}
 	if luo.mutation.LabelRelationshipsCleared() {
 		edge := &sqlgraph.EdgeSpec{
 			Rel:     sqlgraph.O2M,

+ 1 - 12
ent/labelrelationship.go

@@ -31,8 +31,6 @@ type LabelRelationship struct {
 	ContactID uint64 `json:"contact_id,omitempty"`
 	// 机构 ID
 	OrganizationID uint64 `json:"organization_id,omitempty"`
-	// 内容类型:1-微信 2-whatsapp
-	Ctype uint64 `json:"ctype,omitempty"`
 	// Edges holds the relations/edges for other nodes in the graph.
 	// The values are being populated by the LabelRelationshipQuery when eager-loading is set.
 	Edges        LabelRelationshipEdges `json:"edges"`
@@ -77,7 +75,7 @@ func (*LabelRelationship) scanValues(columns []string) ([]any, error) {
 	values := make([]any, len(columns))
 	for i := range columns {
 		switch columns[i] {
-		case labelrelationship.FieldID, labelrelationship.FieldStatus, labelrelationship.FieldLabelID, labelrelationship.FieldContactID, labelrelationship.FieldOrganizationID, labelrelationship.FieldCtype:
+		case labelrelationship.FieldID, labelrelationship.FieldStatus, labelrelationship.FieldLabelID, labelrelationship.FieldContactID, labelrelationship.FieldOrganizationID:
 			values[i] = new(sql.NullInt64)
 		case labelrelationship.FieldCreatedAt, labelrelationship.FieldUpdatedAt:
 			values[i] = new(sql.NullTime)
@@ -138,12 +136,6 @@ func (lr *LabelRelationship) assignValues(columns []string, values []any) error
 			} else if value.Valid {
 				lr.OrganizationID = uint64(value.Int64)
 			}
-		case labelrelationship.FieldCtype:
-			if value, ok := values[i].(*sql.NullInt64); !ok {
-				return fmt.Errorf("unexpected type %T for field ctype", values[i])
-			} else if value.Valid {
-				lr.Ctype = uint64(value.Int64)
-			}
 		default:
 			lr.selectValues.Set(columns[i], values[i])
 		}
@@ -207,9 +199,6 @@ func (lr *LabelRelationship) String() string {
 	builder.WriteString(", ")
 	builder.WriteString("organization_id=")
 	builder.WriteString(fmt.Sprintf("%v", lr.OrganizationID))
-	builder.WriteString(", ")
-	builder.WriteString("ctype=")
-	builder.WriteString(fmt.Sprintf("%v", lr.Ctype))
 	builder.WriteByte(')')
 	return builder.String()
 }

+ 0 - 10
ent/labelrelationship/labelrelationship.go

@@ -26,8 +26,6 @@ const (
 	FieldContactID = "contact_id"
 	// FieldOrganizationID holds the string denoting the organization_id field in the database.
 	FieldOrganizationID = "organization_id"
-	// FieldCtype holds the string denoting the ctype field in the database.
-	FieldCtype = "ctype"
 	// EdgeContacts holds the string denoting the contacts edge name in mutations.
 	EdgeContacts = "contacts"
 	// EdgeLabels holds the string denoting the labels edge name in mutations.
@@ -59,7 +57,6 @@ var Columns = []string{
 	FieldLabelID,
 	FieldContactID,
 	FieldOrganizationID,
-	FieldCtype,
 }
 
 // ValidColumn reports if the column name is valid (part of the table columns).
@@ -87,8 +84,6 @@ var (
 	DefaultContactID uint64
 	// DefaultOrganizationID holds the default value on creation for the "organization_id" field.
 	DefaultOrganizationID uint64
-	// DefaultCtype holds the default value on creation for the "ctype" field.
-	DefaultCtype uint64
 )
 
 // OrderOption defines the ordering options for the LabelRelationship queries.
@@ -129,11 +124,6 @@ func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
 	return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
 }
 
-// ByCtype orders the results by the ctype field.
-func ByCtype(opts ...sql.OrderTermOption) OrderOption {
-	return sql.OrderByField(FieldCtype, opts...).ToFunc()
-}
-
 // ByContactsField orders the results by contacts field.
 func ByContactsField(field string, opts ...sql.OrderTermOption) OrderOption {
 	return func(s *sql.Selector) {

+ 0 - 45
ent/labelrelationship/where.go

@@ -85,11 +85,6 @@ func OrganizationID(v uint64) predicate.LabelRelationship {
 	return predicate.LabelRelationship(sql.FieldEQ(FieldOrganizationID, v))
 }
 
-// Ctype applies equality check predicate on the "ctype" field. It's identical to CtypeEQ.
-func Ctype(v uint64) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldEQ(FieldCtype, v))
-}
-
 // CreatedAtEQ applies the EQ predicate on the "created_at" field.
 func CreatedAtEQ(v time.Time) predicate.LabelRelationship {
 	return predicate.LabelRelationship(sql.FieldEQ(FieldCreatedAt, v))
@@ -310,46 +305,6 @@ func OrganizationIDNotNil() predicate.LabelRelationship {
 	return predicate.LabelRelationship(sql.FieldNotNull(FieldOrganizationID))
 }
 
-// CtypeEQ applies the EQ predicate on the "ctype" field.
-func CtypeEQ(v uint64) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldEQ(FieldCtype, v))
-}
-
-// CtypeNEQ applies the NEQ predicate on the "ctype" field.
-func CtypeNEQ(v uint64) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldNEQ(FieldCtype, v))
-}
-
-// CtypeIn applies the In predicate on the "ctype" field.
-func CtypeIn(vs ...uint64) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldIn(FieldCtype, vs...))
-}
-
-// CtypeNotIn applies the NotIn predicate on the "ctype" field.
-func CtypeNotIn(vs ...uint64) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldNotIn(FieldCtype, vs...))
-}
-
-// CtypeGT applies the GT predicate on the "ctype" field.
-func CtypeGT(v uint64) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldGT(FieldCtype, v))
-}
-
-// CtypeGTE applies the GTE predicate on the "ctype" field.
-func CtypeGTE(v uint64) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldGTE(FieldCtype, v))
-}
-
-// CtypeLT applies the LT predicate on the "ctype" field.
-func CtypeLT(v uint64) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldLT(FieldCtype, v))
-}
-
-// CtypeLTE applies the LTE predicate on the "ctype" field.
-func CtypeLTE(v uint64) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldLTE(FieldCtype, v))
-}
-
 // HasContacts applies the HasEdge predicate on the "contacts" edge.
 func HasContacts() predicate.LabelRelationship {
 	return predicate.LabelRelationship(func(s *sql.Selector) {

+ 0 - 85
ent/labelrelationship_create.go

@@ -108,20 +108,6 @@ func (lrc *LabelRelationshipCreate) SetNillableOrganizationID(u *uint64) *LabelR
 	return lrc
 }
 
-// SetCtype sets the "ctype" field.
-func (lrc *LabelRelationshipCreate) SetCtype(u uint64) *LabelRelationshipCreate {
-	lrc.mutation.SetCtype(u)
-	return lrc
-}
-
-// SetNillableCtype sets the "ctype" field if the given value is not nil.
-func (lrc *LabelRelationshipCreate) SetNillableCtype(u *uint64) *LabelRelationshipCreate {
-	if u != nil {
-		lrc.SetCtype(*u)
-	}
-	return lrc
-}
-
 // SetID sets the "id" field.
 func (lrc *LabelRelationshipCreate) SetID(u uint64) *LabelRelationshipCreate {
 	lrc.mutation.SetID(u)
@@ -209,10 +195,6 @@ func (lrc *LabelRelationshipCreate) defaults() {
 		v := labelrelationship.DefaultOrganizationID
 		lrc.mutation.SetOrganizationID(v)
 	}
-	if _, ok := lrc.mutation.Ctype(); !ok {
-		v := labelrelationship.DefaultCtype
-		lrc.mutation.SetCtype(v)
-	}
 }
 
 // check runs all checks and user-defined validators on the builder.
@@ -229,9 +211,6 @@ func (lrc *LabelRelationshipCreate) check() error {
 	if _, ok := lrc.mutation.ContactID(); !ok {
 		return &ValidationError{Name: "contact_id", err: errors.New(`ent: missing required field "LabelRelationship.contact_id"`)}
 	}
-	if _, ok := lrc.mutation.Ctype(); !ok {
-		return &ValidationError{Name: "ctype", err: errors.New(`ent: missing required field "LabelRelationship.ctype"`)}
-	}
 	if _, ok := lrc.mutation.ContactsID(); !ok {
 		return &ValidationError{Name: "contacts", err: errors.New(`ent: missing required edge "LabelRelationship.contacts"`)}
 	}
@@ -287,10 +266,6 @@ func (lrc *LabelRelationshipCreate) createSpec() (*LabelRelationship, *sqlgraph.
 		_spec.SetField(labelrelationship.FieldOrganizationID, field.TypeUint64, value)
 		_node.OrganizationID = value
 	}
-	if value, ok := lrc.mutation.Ctype(); ok {
-		_spec.SetField(labelrelationship.FieldCtype, field.TypeUint64, value)
-		_node.Ctype = value
-	}
 	if nodes := lrc.mutation.ContactsIDs(); len(nodes) > 0 {
 		edge := &sqlgraph.EdgeSpec{
 			Rel:     sqlgraph.M2O,
@@ -461,24 +436,6 @@ func (u *LabelRelationshipUpsert) ClearOrganizationID() *LabelRelationshipUpsert
 	return u
 }
 
-// SetCtype sets the "ctype" field.
-func (u *LabelRelationshipUpsert) SetCtype(v uint64) *LabelRelationshipUpsert {
-	u.Set(labelrelationship.FieldCtype, v)
-	return u
-}
-
-// UpdateCtype sets the "ctype" field to the value that was provided on create.
-func (u *LabelRelationshipUpsert) UpdateCtype() *LabelRelationshipUpsert {
-	u.SetExcluded(labelrelationship.FieldCtype)
-	return u
-}
-
-// AddCtype adds v to the "ctype" field.
-func (u *LabelRelationshipUpsert) AddCtype(v uint64) *LabelRelationshipUpsert {
-	u.Add(labelrelationship.FieldCtype, v)
-	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:
 //
@@ -628,27 +585,6 @@ func (u *LabelRelationshipUpsertOne) ClearOrganizationID() *LabelRelationshipUps
 	})
 }
 
-// SetCtype sets the "ctype" field.
-func (u *LabelRelationshipUpsertOne) SetCtype(v uint64) *LabelRelationshipUpsertOne {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.SetCtype(v)
-	})
-}
-
-// AddCtype adds v to the "ctype" field.
-func (u *LabelRelationshipUpsertOne) AddCtype(v uint64) *LabelRelationshipUpsertOne {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.AddCtype(v)
-	})
-}
-
-// UpdateCtype sets the "ctype" field to the value that was provided on create.
-func (u *LabelRelationshipUpsertOne) UpdateCtype() *LabelRelationshipUpsertOne {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.UpdateCtype()
-	})
-}
-
 // Exec executes the query.
 func (u *LabelRelationshipUpsertOne) Exec(ctx context.Context) error {
 	if len(u.create.conflict) == 0 {
@@ -964,27 +900,6 @@ func (u *LabelRelationshipUpsertBulk) ClearOrganizationID() *LabelRelationshipUp
 	})
 }
 
-// SetCtype sets the "ctype" field.
-func (u *LabelRelationshipUpsertBulk) SetCtype(v uint64) *LabelRelationshipUpsertBulk {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.SetCtype(v)
-	})
-}
-
-// AddCtype adds v to the "ctype" field.
-func (u *LabelRelationshipUpsertBulk) AddCtype(v uint64) *LabelRelationshipUpsertBulk {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.AddCtype(v)
-	})
-}
-
-// UpdateCtype sets the "ctype" field to the value that was provided on create.
-func (u *LabelRelationshipUpsertBulk) UpdateCtype() *LabelRelationshipUpsertBulk {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.UpdateCtype()
-	})
-}
-
 // Exec executes the query.
 func (u *LabelRelationshipUpsertBulk) Exec(ctx context.Context) error {
 	if u.create.err != nil {

+ 0 - 54
ent/labelrelationship_update.go

@@ -118,27 +118,6 @@ func (lru *LabelRelationshipUpdate) ClearOrganizationID() *LabelRelationshipUpda
 	return lru
 }
 
-// SetCtype sets the "ctype" field.
-func (lru *LabelRelationshipUpdate) SetCtype(u uint64) *LabelRelationshipUpdate {
-	lru.mutation.ResetCtype()
-	lru.mutation.SetCtype(u)
-	return lru
-}
-
-// SetNillableCtype sets the "ctype" field if the given value is not nil.
-func (lru *LabelRelationshipUpdate) SetNillableCtype(u *uint64) *LabelRelationshipUpdate {
-	if u != nil {
-		lru.SetCtype(*u)
-	}
-	return lru
-}
-
-// AddCtype adds u to the "ctype" field.
-func (lru *LabelRelationshipUpdate) AddCtype(u int64) *LabelRelationshipUpdate {
-	lru.mutation.AddCtype(u)
-	return lru
-}
-
 // SetContactsID sets the "contacts" edge to the Contact entity by ID.
 func (lru *LabelRelationshipUpdate) SetContactsID(id uint64) *LabelRelationshipUpdate {
 	lru.mutation.SetContactsID(id)
@@ -258,12 +237,6 @@ func (lru *LabelRelationshipUpdate) sqlSave(ctx context.Context) (n int, err err
 	if lru.mutation.OrganizationIDCleared() {
 		_spec.ClearField(labelrelationship.FieldOrganizationID, field.TypeUint64)
 	}
-	if value, ok := lru.mutation.Ctype(); ok {
-		_spec.SetField(labelrelationship.FieldCtype, field.TypeUint64, value)
-	}
-	if value, ok := lru.mutation.AddedCtype(); ok {
-		_spec.AddField(labelrelationship.FieldCtype, field.TypeUint64, value)
-	}
 	if lru.mutation.ContactsCleared() {
 		edge := &sqlgraph.EdgeSpec{
 			Rel:     sqlgraph.M2O,
@@ -430,27 +403,6 @@ func (lruo *LabelRelationshipUpdateOne) ClearOrganizationID() *LabelRelationship
 	return lruo
 }
 
-// SetCtype sets the "ctype" field.
-func (lruo *LabelRelationshipUpdateOne) SetCtype(u uint64) *LabelRelationshipUpdateOne {
-	lruo.mutation.ResetCtype()
-	lruo.mutation.SetCtype(u)
-	return lruo
-}
-
-// SetNillableCtype sets the "ctype" field if the given value is not nil.
-func (lruo *LabelRelationshipUpdateOne) SetNillableCtype(u *uint64) *LabelRelationshipUpdateOne {
-	if u != nil {
-		lruo.SetCtype(*u)
-	}
-	return lruo
-}
-
-// AddCtype adds u to the "ctype" field.
-func (lruo *LabelRelationshipUpdateOne) AddCtype(u int64) *LabelRelationshipUpdateOne {
-	lruo.mutation.AddCtype(u)
-	return lruo
-}
-
 // SetContactsID sets the "contacts" edge to the Contact entity by ID.
 func (lruo *LabelRelationshipUpdateOne) SetContactsID(id uint64) *LabelRelationshipUpdateOne {
 	lruo.mutation.SetContactsID(id)
@@ -600,12 +552,6 @@ func (lruo *LabelRelationshipUpdateOne) sqlSave(ctx context.Context) (_node *Lab
 	if lruo.mutation.OrganizationIDCleared() {
 		_spec.ClearField(labelrelationship.FieldOrganizationID, field.TypeUint64)
 	}
-	if value, ok := lruo.mutation.Ctype(); ok {
-		_spec.SetField(labelrelationship.FieldCtype, field.TypeUint64, value)
-	}
-	if value, ok := lruo.mutation.AddedCtype(); ok {
-		_spec.AddField(labelrelationship.FieldCtype, field.TypeUint64, value)
-	}
 	if lruo.mutation.ContactsCleared() {
 		edge := &sqlgraph.EdgeSpec{
 			Rel:     sqlgraph.M2O,

+ 4 - 6
ent/migrate/schema.go

@@ -430,7 +430,6 @@ var (
 		{Name: "mode", Type: field.TypeInt, Comment: "标签模式:1动态 2静态", Default: 1},
 		{Name: "conditions", Type: field.TypeString, Nullable: true, Comment: "标签的触达条件", Default: ""},
 		{Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
-		{Name: "ctype", Type: field.TypeUint64, Comment: "内容类型:1-微信 2-whatsapp", Default: 1},
 	}
 	// LabelTable holds the schema information for the "label" table.
 	LabelTable = &schema.Table{
@@ -452,7 +451,6 @@ var (
 		{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
 		{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
 		{Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
-		{Name: "ctype", Type: field.TypeUint64, Comment: "内容类型:1-微信 2-whatsapp", Default: 1},
 		{Name: "contact_id", Type: field.TypeUint64, Comment: "联系人 ID", Default: 1},
 		{Name: "label_id", Type: field.TypeUint64, Comment: "标签 ID", Default: 1},
 	}
@@ -464,13 +462,13 @@ var (
 		ForeignKeys: []*schema.ForeignKey{
 			{
 				Symbol:     "label_relationship_contact_contact_relationships",
-				Columns:    []*schema.Column{LabelRelationshipColumns[6]},
+				Columns:    []*schema.Column{LabelRelationshipColumns[5]},
 				RefColumns: []*schema.Column{ContactColumns[0]},
 				OnDelete:   schema.NoAction,
 			},
 			{
 				Symbol:     "label_relationship_label_label_relationships",
-				Columns:    []*schema.Column{LabelRelationshipColumns[7]},
+				Columns:    []*schema.Column{LabelRelationshipColumns[6]},
 				RefColumns: []*schema.Column{LabelColumns[0]},
 				OnDelete:   schema.NoAction,
 			},
@@ -479,12 +477,12 @@ var (
 			{
 				Name:    "labelrelationship_label_id",
 				Unique:  false,
-				Columns: []*schema.Column{LabelRelationshipColumns[7]},
+				Columns: []*schema.Column{LabelRelationshipColumns[6]},
 			},
 			{
 				Name:    "labelrelationship_contact_id",
 				Unique:  false,
-				Columns: []*schema.Column{LabelRelationshipColumns[6]},
+				Columns: []*schema.Column{LabelRelationshipColumns[5]},
 			},
 		},
 	}

+ 2 - 176
ent/mutation.go

@@ -15789,8 +15789,6 @@ type LabelMutation struct {
 	conditions                 *string
 	organization_id            *uint64
 	addorganization_id         *int64
-	ctype                      *uint64
-	addctype                   *int64
 	clearedFields              map[string]struct{}
 	label_relationships        map[uint64]struct{}
 	removedlabel_relationships map[uint64]struct{}
@@ -16369,62 +16367,6 @@ func (m *LabelMutation) ResetOrganizationID() {
 	delete(m.clearedFields, label.FieldOrganizationID)
 }
 
-// SetCtype sets the "ctype" field.
-func (m *LabelMutation) SetCtype(u uint64) {
-	m.ctype = &u
-	m.addctype = nil
-}
-
-// Ctype returns the value of the "ctype" field in the mutation.
-func (m *LabelMutation) Ctype() (r uint64, exists bool) {
-	v := m.ctype
-	if v == nil {
-		return
-	}
-	return *v, true
-}
-
-// OldCtype returns the old "ctype" field's value of the Label entity.
-// If the Label object wasn't provided to the builder, the object is fetched from the database.
-// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
-func (m *LabelMutation) OldCtype(ctx context.Context) (v uint64, err error) {
-	if !m.op.Is(OpUpdateOne) {
-		return v, errors.New("OldCtype is only allowed on UpdateOne operations")
-	}
-	if m.id == nil || m.oldValue == nil {
-		return v, errors.New("OldCtype requires an ID field in the mutation")
-	}
-	oldValue, err := m.oldValue(ctx)
-	if err != nil {
-		return v, fmt.Errorf("querying old value for OldCtype: %w", err)
-	}
-	return oldValue.Ctype, nil
-}
-
-// AddCtype adds u to the "ctype" field.
-func (m *LabelMutation) AddCtype(u int64) {
-	if m.addctype != nil {
-		*m.addctype += u
-	} else {
-		m.addctype = &u
-	}
-}
-
-// AddedCtype returns the value that was added to the "ctype" field in this mutation.
-func (m *LabelMutation) AddedCtype() (r int64, exists bool) {
-	v := m.addctype
-	if v == nil {
-		return
-	}
-	return *v, true
-}
-
-// ResetCtype resets all changes to the "ctype" field.
-func (m *LabelMutation) ResetCtype() {
-	m.ctype = nil
-	m.addctype = nil
-}
-
 // AddLabelRelationshipIDs adds the "label_relationships" edge to the LabelRelationship entity by ids.
 func (m *LabelMutation) AddLabelRelationshipIDs(ids ...uint64) {
 	if m.label_relationships == nil {
@@ -16513,7 +16455,7 @@ func (m *LabelMutation) Type() string {
 // order to get all numeric fields that were incremented/decremented, call
 // AddedFields().
 func (m *LabelMutation) Fields() []string {
-	fields := make([]string, 0, 10)
+	fields := make([]string, 0, 9)
 	if m.created_at != nil {
 		fields = append(fields, label.FieldCreatedAt)
 	}
@@ -16541,9 +16483,6 @@ func (m *LabelMutation) Fields() []string {
 	if m.organization_id != nil {
 		fields = append(fields, label.FieldOrganizationID)
 	}
-	if m.ctype != nil {
-		fields = append(fields, label.FieldCtype)
-	}
 	return fields
 }
 
@@ -16570,8 +16509,6 @@ func (m *LabelMutation) Field(name string) (ent.Value, bool) {
 		return m.Conditions()
 	case label.FieldOrganizationID:
 		return m.OrganizationID()
-	case label.FieldCtype:
-		return m.Ctype()
 	}
 	return nil, false
 }
@@ -16599,8 +16536,6 @@ func (m *LabelMutation) OldField(ctx context.Context, name string) (ent.Value, e
 		return m.OldConditions(ctx)
 	case label.FieldOrganizationID:
 		return m.OldOrganizationID(ctx)
-	case label.FieldCtype:
-		return m.OldCtype(ctx)
 	}
 	return nil, fmt.Errorf("unknown Label field %s", name)
 }
@@ -16673,13 +16608,6 @@ func (m *LabelMutation) SetField(name string, value ent.Value) error {
 		}
 		m.SetOrganizationID(v)
 		return nil
-	case label.FieldCtype:
-		v, ok := value.(uint64)
-		if !ok {
-			return fmt.Errorf("unexpected type %T for field %s", value, name)
-		}
-		m.SetCtype(v)
-		return nil
 	}
 	return fmt.Errorf("unknown Label field %s", name)
 }
@@ -16703,9 +16631,6 @@ func (m *LabelMutation) AddedFields() []string {
 	if m.addorganization_id != nil {
 		fields = append(fields, label.FieldOrganizationID)
 	}
-	if m.addctype != nil {
-		fields = append(fields, label.FieldCtype)
-	}
 	return fields
 }
 
@@ -16724,8 +16649,6 @@ func (m *LabelMutation) AddedField(name string) (ent.Value, bool) {
 		return m.AddedMode()
 	case label.FieldOrganizationID:
 		return m.AddedOrganizationID()
-	case label.FieldCtype:
-		return m.AddedCtype()
 	}
 	return nil, false
 }
@@ -16770,13 +16693,6 @@ func (m *LabelMutation) AddField(name string, value ent.Value) error {
 		}
 		m.AddOrganizationID(v)
 		return nil
-	case label.FieldCtype:
-		v, ok := value.(int64)
-		if !ok {
-			return fmt.Errorf("unexpected type %T for field %s", value, name)
-		}
-		m.AddCtype(v)
-		return nil
 	}
 	return fmt.Errorf("unknown Label numeric field %s", name)
 }
@@ -16852,9 +16768,6 @@ func (m *LabelMutation) ResetField(name string) error {
 	case label.FieldOrganizationID:
 		m.ResetOrganizationID()
 		return nil
-	case label.FieldCtype:
-		m.ResetCtype()
-		return nil
 	}
 	return fmt.Errorf("unknown Label field %s", name)
 }
@@ -16955,8 +16868,6 @@ type LabelRelationshipMutation struct {
 	addstatus          *int8
 	organization_id    *uint64
 	addorganization_id *int64
-	ctype              *uint64
-	addctype           *int64
 	clearedFields      map[string]struct{}
 	contacts           *uint64
 	clearedcontacts    bool
@@ -17355,62 +17266,6 @@ func (m *LabelRelationshipMutation) ResetOrganizationID() {
 	delete(m.clearedFields, labelrelationship.FieldOrganizationID)
 }
 
-// SetCtype sets the "ctype" field.
-func (m *LabelRelationshipMutation) SetCtype(u uint64) {
-	m.ctype = &u
-	m.addctype = nil
-}
-
-// Ctype returns the value of the "ctype" field in the mutation.
-func (m *LabelRelationshipMutation) Ctype() (r uint64, exists bool) {
-	v := m.ctype
-	if v == nil {
-		return
-	}
-	return *v, true
-}
-
-// OldCtype returns the old "ctype" field's value of the LabelRelationship entity.
-// If the LabelRelationship object wasn't provided to the builder, the object is fetched from the database.
-// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
-func (m *LabelRelationshipMutation) OldCtype(ctx context.Context) (v uint64, err error) {
-	if !m.op.Is(OpUpdateOne) {
-		return v, errors.New("OldCtype is only allowed on UpdateOne operations")
-	}
-	if m.id == nil || m.oldValue == nil {
-		return v, errors.New("OldCtype requires an ID field in the mutation")
-	}
-	oldValue, err := m.oldValue(ctx)
-	if err != nil {
-		return v, fmt.Errorf("querying old value for OldCtype: %w", err)
-	}
-	return oldValue.Ctype, nil
-}
-
-// AddCtype adds u to the "ctype" field.
-func (m *LabelRelationshipMutation) AddCtype(u int64) {
-	if m.addctype != nil {
-		*m.addctype += u
-	} else {
-		m.addctype = &u
-	}
-}
-
-// AddedCtype returns the value that was added to the "ctype" field in this mutation.
-func (m *LabelRelationshipMutation) AddedCtype() (r int64, exists bool) {
-	v := m.addctype
-	if v == nil {
-		return
-	}
-	return *v, true
-}
-
-// ResetCtype resets all changes to the "ctype" field.
-func (m *LabelRelationshipMutation) ResetCtype() {
-	m.ctype = nil
-	m.addctype = nil
-}
-
 // SetContactsID sets the "contacts" edge to the Contact entity by id.
 func (m *LabelRelationshipMutation) SetContactsID(id uint64) {
 	m.contacts = &id
@@ -17525,7 +17380,7 @@ func (m *LabelRelationshipMutation) Type() string {
 // order to get all numeric fields that were incremented/decremented, call
 // AddedFields().
 func (m *LabelRelationshipMutation) Fields() []string {
-	fields := make([]string, 0, 7)
+	fields := make([]string, 0, 6)
 	if m.created_at != nil {
 		fields = append(fields, labelrelationship.FieldCreatedAt)
 	}
@@ -17544,9 +17399,6 @@ func (m *LabelRelationshipMutation) Fields() []string {
 	if m.organization_id != nil {
 		fields = append(fields, labelrelationship.FieldOrganizationID)
 	}
-	if m.ctype != nil {
-		fields = append(fields, labelrelationship.FieldCtype)
-	}
 	return fields
 }
 
@@ -17567,8 +17419,6 @@ func (m *LabelRelationshipMutation) Field(name string) (ent.Value, bool) {
 		return m.ContactID()
 	case labelrelationship.FieldOrganizationID:
 		return m.OrganizationID()
-	case labelrelationship.FieldCtype:
-		return m.Ctype()
 	}
 	return nil, false
 }
@@ -17590,8 +17440,6 @@ func (m *LabelRelationshipMutation) OldField(ctx context.Context, name string) (
 		return m.OldContactID(ctx)
 	case labelrelationship.FieldOrganizationID:
 		return m.OldOrganizationID(ctx)
-	case labelrelationship.FieldCtype:
-		return m.OldCtype(ctx)
 	}
 	return nil, fmt.Errorf("unknown LabelRelationship field %s", name)
 }
@@ -17643,13 +17491,6 @@ func (m *LabelRelationshipMutation) SetField(name string, value ent.Value) error
 		}
 		m.SetOrganizationID(v)
 		return nil
-	case labelrelationship.FieldCtype:
-		v, ok := value.(uint64)
-		if !ok {
-			return fmt.Errorf("unexpected type %T for field %s", value, name)
-		}
-		m.SetCtype(v)
-		return nil
 	}
 	return fmt.Errorf("unknown LabelRelationship field %s", name)
 }
@@ -17664,9 +17505,6 @@ func (m *LabelRelationshipMutation) AddedFields() []string {
 	if m.addorganization_id != nil {
 		fields = append(fields, labelrelationship.FieldOrganizationID)
 	}
-	if m.addctype != nil {
-		fields = append(fields, labelrelationship.FieldCtype)
-	}
 	return fields
 }
 
@@ -17679,8 +17517,6 @@ func (m *LabelRelationshipMutation) AddedField(name string) (ent.Value, bool) {
 		return m.AddedStatus()
 	case labelrelationship.FieldOrganizationID:
 		return m.AddedOrganizationID()
-	case labelrelationship.FieldCtype:
-		return m.AddedCtype()
 	}
 	return nil, false
 }
@@ -17704,13 +17540,6 @@ func (m *LabelRelationshipMutation) AddField(name string, value ent.Value) error
 		}
 		m.AddOrganizationID(v)
 		return nil
-	case labelrelationship.FieldCtype:
-		v, ok := value.(int64)
-		if !ok {
-			return fmt.Errorf("unexpected type %T for field %s", value, name)
-		}
-		m.AddCtype(v)
-		return nil
 	}
 	return fmt.Errorf("unknown LabelRelationship numeric field %s", name)
 }
@@ -17771,9 +17600,6 @@ func (m *LabelRelationshipMutation) ResetField(name string) error {
 	case labelrelationship.FieldOrganizationID:
 		m.ResetOrganizationID()
 		return nil
-	case labelrelationship.FieldCtype:
-		m.ResetCtype()
-		return nil
 	}
 	return fmt.Errorf("unknown LabelRelationship field %s", name)
 }

+ 0 - 8
ent/runtime/runtime.go

@@ -702,10 +702,6 @@ func init() {
 	labelDescOrganizationID := labelFields[5].Descriptor()
 	// label.DefaultOrganizationID holds the default value on creation for the organization_id field.
 	label.DefaultOrganizationID = labelDescOrganizationID.Default.(uint64)
-	// labelDescCtype is the schema descriptor for ctype field.
-	labelDescCtype := labelFields[6].Descriptor()
-	// label.DefaultCtype holds the default value on creation for the ctype field.
-	label.DefaultCtype = labelDescCtype.Default.(uint64)
 	labelrelationshipMixin := schema.LabelRelationship{}.Mixin()
 	labelrelationshipMixinFields0 := labelrelationshipMixin[0].Fields()
 	_ = labelrelationshipMixinFields0
@@ -739,10 +735,6 @@ func init() {
 	labelrelationshipDescOrganizationID := labelrelationshipFields[2].Descriptor()
 	// labelrelationship.DefaultOrganizationID holds the default value on creation for the organization_id field.
 	labelrelationship.DefaultOrganizationID = labelrelationshipDescOrganizationID.Default.(uint64)
-	// labelrelationshipDescCtype is the schema descriptor for ctype field.
-	labelrelationshipDescCtype := labelrelationshipFields[3].Descriptor()
-	// labelrelationship.DefaultCtype holds the default value on creation for the ctype field.
-	labelrelationship.DefaultCtype = labelrelationshipDescCtype.Default.(uint64)
 	labeltaggingMixin := schema.LabelTagging{}.Mixin()
 	labeltaggingMixinHooks2 := labeltaggingMixin[2].Hooks()
 	labeltagging.Hooks[0] = labeltaggingMixinHooks2[0]

+ 0 - 1
ent/schema/label.go

@@ -34,7 +34,6 @@ func (Label) Fields() []ent.Field {
 		field.Uint64("organization_id").Optional().Default(1).
 			Comment("机构 ID").
 			Annotations(entsql.WithComments(true)),
-		field.Uint64("ctype").Default(1).Comment("内容类型:1-微信 2-whatsapp"),
 	}
 }
 

+ 0 - 1
ent/schema/label_relationship.go

@@ -25,7 +25,6 @@ func (LabelRelationship) Fields() []ent.Field {
 		field.Uint64("organization_id").Optional().Default(1).
 			Comment("机构 ID").
 			Annotations(entsql.WithComments(true)),
-		field.Uint64("ctype").Default(1).Comment("内容类型:1-微信 2-whatsapp"),
 	}
 }
 

+ 0 - 48
ent/set_not_nil.go

@@ -3752,30 +3752,6 @@ func (l *LabelCreate) SetNotNilOrganizationID(value *uint64) *LabelCreate {
 }
 
 // set field if value's pointer is not nil.
-func (l *LabelUpdate) SetNotNilCtype(value *uint64) *LabelUpdate {
-	if value != nil {
-		return l.SetCtype(*value)
-	}
-	return l
-}
-
-// set field if value's pointer is not nil.
-func (l *LabelUpdateOne) SetNotNilCtype(value *uint64) *LabelUpdateOne {
-	if value != nil {
-		return l.SetCtype(*value)
-	}
-	return l
-}
-
-// set field if value's pointer is not nil.
-func (l *LabelCreate) SetNotNilCtype(value *uint64) *LabelCreate {
-	if value != nil {
-		return l.SetCtype(*value)
-	}
-	return l
-}
-
-// set field if value's pointer is not nil.
 func (lr *LabelRelationshipUpdate) SetNotNilUpdatedAt(value *time.Time) *LabelRelationshipUpdate {
 	if value != nil {
 		return lr.SetUpdatedAt(*value)
@@ -3896,30 +3872,6 @@ func (lr *LabelRelationshipCreate) SetNotNilOrganizationID(value *uint64) *Label
 }
 
 // set field if value's pointer is not nil.
-func (lr *LabelRelationshipUpdate) SetNotNilCtype(value *uint64) *LabelRelationshipUpdate {
-	if value != nil {
-		return lr.SetCtype(*value)
-	}
-	return lr
-}
-
-// set field if value's pointer is not nil.
-func (lr *LabelRelationshipUpdateOne) SetNotNilCtype(value *uint64) *LabelRelationshipUpdateOne {
-	if value != nil {
-		return lr.SetCtype(*value)
-	}
-	return lr
-}
-
-// set field if value's pointer is not nil.
-func (lr *LabelRelationshipCreate) SetNotNilCtype(value *uint64) *LabelRelationshipCreate {
-	if value != nil {
-		return lr.SetCtype(*value)
-	}
-	return lr
-}
-
-// set field if value's pointer is not nil.
 func (lt *LabelTaggingUpdate) SetNotNilUpdatedAt(value *time.Time) *LabelTaggingUpdate {
 	if value != nil {
 		return lt.SetUpdatedAt(*value)

+ 1 - 1
internal/logic/contact/get_contact_list_logic.go

@@ -79,7 +79,7 @@ func (l *GetContactListLogic) GetContactList(req *types.ContactListReq) (*types.
 		predicates = append(predicates, contact.Or(contact.TypeEQ(1), contact.TypeEQ(2)))
 	}
 	data, err := l.svcCtx.DB.Contact.Query().Where(predicates...).WithContactRelationships(func(query *ent.LabelRelationshipQuery) {
-		query.WithLabels().Where(labelrelationship.Ctype(1))
+		query.WithLabels()
 	}).Page(l.ctx, req.Page, req.PageSize)
 
 	if err != nil {

+ 1 - 1
internal/logic/contact/get_whatsapp_contact_list_logic.go

@@ -50,7 +50,7 @@ func (l *GetWhatsappContactListLogic) GetWhatsappContactList(req *types.Whatsapp
 	}
 
 	data, err := l.svcCtx.DB.Contact.Query().Where(predicates...).WithContactRelationships(func(query *ent.LabelRelationshipQuery) {
-		query.WithLabels().Where(labelrelationship.Ctype(2))
+		query.WithLabels()
 	}).Page(l.ctx, req.Page, req.PageSize)
 
 	if err != nil {

+ 1 - 2
internal/logic/contact/import_whatsapp_contact_logic.go

@@ -104,7 +104,6 @@ func (l *ImportWhatsappContactLogic) ImportWhatsappContact(req *types.ImportWhat
 		if labels != "" {
 			for _, value := range strings.Split(labels, "+") {
 				_, err = l.svcCtx.DB.Label.Query().Where(
-					label.Ctype(2),
 					label.OrganizationID(organizationId),
 					label.Name(value),
 				).First(l.ctx)
@@ -112,7 +111,7 @@ func (l *ImportWhatsappContactLogic) ImportWhatsappContact(req *types.ImportWhat
 					continue
 				}
 
-				newLabel, err := l.svcCtx.DB.Label.Create().SetCtype(2).
+				newLabel, err := l.svcCtx.DB.Label.Create().
 					SetName(value).
 					SetType(5).
 					SetNotNilConditions(&conditions).

+ 0 - 1
internal/logic/label/create_label_logic.go

@@ -42,7 +42,6 @@ func (l *CreateLabelLogic) CreateLabel(req *types.LabelInfo) (*types.BaseMsgResp
 		SetNotNilMode(req.Mode).
 		SetNotNilConditions(&conditions).
 		SetOrganizationID(organizationId).
-		SetCtype(1).
 		Save(l.ctx)
 
 	if err != nil {

+ 0 - 1
internal/logic/label/get_label_batch_select_list_logic.go

@@ -30,7 +30,6 @@ func (l *GetLabelBatchSelectListLogic) GetLabelBatchSelectList(req *types.LabelL
 	organizationId := l.ctx.Value("organizationId").(uint64)
 	var predicates []predicate.Label
 	predicates = append(predicates, label.OrganizationIDEQ(organizationId))
-	predicates = append(predicates, label.Ctype(1))
 	if req.Name != nil {
 		predicates = append(predicates, label.NameContains(*req.Name))
 	}

+ 0 - 1
internal/logic/label/get_label_contacts_logic.go

@@ -36,7 +36,6 @@ func (l *GetLabelContactsLogic) GetLabelContacts(req *types.LabelListReq) (*type
 	}
 	var predicates []predicate.Label
 	predicates = append(predicates, label.OrganizationIDEQ(organizationId))
-	predicates = append(predicates, label.Ctype(1))
 	if len(req.LabelIDs) > 0 {
 		predicates = append(predicates, label.IDIn(req.LabelIDs...))
 	}

+ 0 - 1
internal/logic/label/get_label_list_logic.go

@@ -63,7 +63,6 @@ func (l *GetLabelListLogic) GetLabelList(req *types.LabelListReq) (*types.LabelL
 	fmt.Printf("---------------isAdmin----------------: %+v\n\n", isAdmin)
 	var predicates []predicate.Label
 	predicates = append(predicates, label.OrganizationIDEQ(organizationId))
-	predicates = append(predicates, label.Ctype(1))
 	if req.Type != nil {
 		predicates = append(predicates, label.TypeEQ(*req.Type))
 	}

+ 0 - 5
internal/logic/label/get_label_select_list_logic.go

@@ -30,11 +30,6 @@ func (l *GetLabelSelectListLogic) GetLabelSelectList(req *types.LabelListReq) (*
 	organizationId := l.ctx.Value("organizationId").(uint64)
 	var predicates []predicate.Label
 	predicates = append(predicates, label.OrganizationIDEQ(organizationId))
-	var ctype uint64 = 1
-	if req.Ctype != nil && *req.Ctype > 0 {
-		ctype = *req.Ctype
-	}
-	predicates = append(predicates, label.Ctype(ctype))
 	if req.Type != nil {
 		predicates = append(predicates, label.TypeEQ(*req.Type))
 	}

+ 0 - 2
internal/logic/label_relationship/set_whatsapp_contact_batch_label_logic.go

@@ -41,7 +41,6 @@ func (l *SetWhatsappContactBatchLabelLogic) SetWhatsappContactBatchLabel(req *ty
 		_, err = tx.Contact.Query().Where(
 			contact.ID(contactId),
 			contact.OrganizationIDEQ(organizationId),
-			contact.Ctype(2),
 		).Only(l.ctx)
 
 		// 获取联系人当前已关联的标签
@@ -85,7 +84,6 @@ func (l *SetWhatsappContactBatchLabelLogic) SetWhatsappContactBatchLabel(req *ty
 					SetLabelID(id).
 					SetContactID(contactId).
 					SetOrganizationID(organizationId).
-					SetCtype(2).
 					Save(l.ctx)
 				//if err != nil {
 				//	return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)

+ 0 - 2
internal/logic/label_relationship/set_whatsapp_contact_label_logic.go

@@ -40,7 +40,6 @@ func (l *SetWhatsappContactLabelLogic) SetWhatsappContactLabel(req *types.LabelR
 	_, err = tx.Contact.Query().Where(
 		contact.ID(*req.ContactId),
 		contact.OrganizationIDEQ(organizationId),
-		contact.Ctype(2),
 	).Only(l.ctx)
 
 	// 获取联系人当前已关联的标签
@@ -85,7 +84,6 @@ func (l *SetWhatsappContactLabelLogic) SetWhatsappContactLabel(req *types.LabelR
 			SetLabelID(id).
 			SetContactID(*req.ContactId).
 			SetOrganizationID(organizationId).
-			SetCtype(2).
 			Save(l.ctx)
 		//if err != nil {
 		//	return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)

+ 0 - 4
internal/types/types.go

@@ -828,8 +828,6 @@ type LabelInfo struct {
 	OrganizationId *uint64 `json:"organizationId,optional"`
 	// Label Relationships | 标签关系
 	LabelRelationships []LabelRelationshipInfo `json:"labelRelationships,optional"`
-	// 内容类型:1-微信 2-whatsapp
-	Ctype *uint64 `json:"ctype,optional"`
 }
 
 // The response data of label relationship information | LabelRelationship信息
@@ -1157,8 +1155,6 @@ type LabelListReq struct {
 	From *int `json:"from,optional"`
 	// 标签模式:1动态 2静态
 	Mode *int `json:"mode,optional"`
-	// 内容类型:1-微信 2-whatsapp
-	Ctype *uint64 `json:"ctype,optional"`
 }
 
 // Label information response | Label信息返回体