Browse Source

fix:处理冲突

jimmyyem 4 weeks ago
parent
commit
5939f9824c
12 changed files with 6 additions and 626 deletions
  1. 1 3
      desc/all.api
  2. 0 16
      ent/agent.go
  3. 0 30
      ent/agent/agent.go
  4. 0 23
      ent/agent/where.go
  5. 0 31
      ent/agent_create.go
  6. 0 73
      ent/agent_query.go
  7. 0 162
      ent/agent_update.go
  8. 0 16
      ent/client.go
  9. 0 83
      ent/mutation.go
  10. 0 1
      ent/schema/agent.go
  11. 5 73
      internal/handler/routes.go
  12. 0 115
      internal/types/types.go

+ 1 - 3
desc/all.api

@@ -48,6 +48,4 @@ import "./wechat/xunji_service.api"
 import "./wp_wecom/send_msg.api"
 import "./wechat/fastgpt.api"
 import "./wechat/department.api"
-import "./wechat/api_key.api"
-import "./wechat/xunji.api"
-import "./wechat/xunji_service.api"
+import "./wechat/api_key.api"

+ 0 - 16
ent/agent.go

@@ -57,8 +57,6 @@ type AgentEdges struct {
 	XjsAgent []*XunjiService `json:"xjs_agent,omitempty"`
 	// KeyAgent holds the value of the key_agent edge.
 	KeyAgent []*ApiKey `json:"key_agent,omitempty"`
-	// XjsAgent holds the value of the xjs_agent edge.
-	XjsAgent []*XunjiService `json:"xjs_agent,omitempty"`
 	// loadedTypes holds the information for reporting if a
 	// type was loaded (or requested) in eager-loading or not.
 	loadedTypes [5]bool
@@ -109,15 +107,6 @@ func (e AgentEdges) KeyAgentOrErr() ([]*ApiKey, error) {
 	return nil, &NotLoadedError{edge: "key_agent"}
 }
 
-// XjsAgentOrErr returns the XjsAgent value or an error if the edge
-// was not loaded in eager-loading.
-func (e AgentEdges) XjsAgentOrErr() ([]*XunjiService, error) {
-	if e.loadedTypes[4] {
-		return e.XjsAgent, nil
-	}
-	return nil, &NotLoadedError{edge: "xjs_agent"}
-}
-
 // scanValues returns the types for scanning values from sql.Rows.
 func (*Agent) scanValues(columns []string) ([]any, error) {
 	values := make([]any, len(columns))
@@ -254,11 +243,6 @@ func (a *Agent) QueryKeyAgent() *ApiKeyQuery {
 	return NewAgentClient(a.config).QueryKeyAgent(a)
 }
 
-// QueryXjsAgent queries the "xjs_agent" edge of the Agent entity.
-func (a *Agent) QueryXjsAgent() *XunjiServiceQuery {
-	return NewAgentClient(a.config).QueryXjsAgent(a)
-}
-
 // Update returns a builder for updating this Agent.
 // Note that you need to call Agent.Unwrap() before calling this method if this Agent
 // was returned from a transaction, and the transaction was committed or rolled back.

+ 0 - 30
ent/agent/agent.go

@@ -47,8 +47,6 @@ const (
 	EdgeXjsAgent = "xjs_agent"
 	// EdgeKeyAgent holds the string denoting the key_agent edge name in mutations.
 	EdgeKeyAgent = "key_agent"
-	// EdgeXjsAgent holds the string denoting the xjs_agent edge name in mutations.
-	EdgeXjsAgent = "xjs_agent"
 	// Table holds the table name of the agent in the database.
 	Table = "agent"
 	// WxAgentTable is the table that holds the wx_agent relation/edge.
@@ -86,13 +84,6 @@ const (
 	KeyAgentInverseTable = "api_key"
 	// KeyAgentColumn is the table column denoting the key_agent relation/edge.
 	KeyAgentColumn = "agent_id"
-	// XjsAgentTable is the table that holds the xjs_agent relation/edge.
-	XjsAgentTable = "xunji_service"
-	// XjsAgentInverseTable is the table name for the XunjiService entity.
-	// It exists in this package in order to avoid circular dependency with the "xunjiservice" package.
-	XjsAgentInverseTable = "xunji_service"
-	// XjsAgentColumn is the table column denoting the xjs_agent relation/edge.
-	XjsAgentColumn = "agent_id"
 )
 
 // Columns holds all SQL columns for agent fields.
@@ -289,20 +280,6 @@ func ByKeyAgent(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
 		sqlgraph.OrderByNeighborTerms(s, newKeyAgentStep(), append([]sql.OrderTerm{term}, terms...)...)
 	}
 }
-
-// ByXjsAgentCount orders the results by xjs_agent count.
-func ByXjsAgentCount(opts ...sql.OrderTermOption) OrderOption {
-	return func(s *sql.Selector) {
-		sqlgraph.OrderByNeighborsCount(s, newXjsAgentStep(), opts...)
-	}
-}
-
-// ByXjsAgent orders the results by xjs_agent terms.
-func ByXjsAgent(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
-	return func(s *sql.Selector) {
-		sqlgraph.OrderByNeighborTerms(s, newXjsAgentStep(), append([]sql.OrderTerm{term}, terms...)...)
-	}
-}
 func newWxAgentStep() *sqlgraph.Step {
 	return sqlgraph.NewStep(
 		sqlgraph.From(Table, FieldID),
@@ -338,10 +315,3 @@ func newKeyAgentStep() *sqlgraph.Step {
 		sqlgraph.Edge(sqlgraph.O2M, false, KeyAgentTable, KeyAgentColumn),
 	)
 }
-func newXjsAgentStep() *sqlgraph.Step {
-	return sqlgraph.NewStep(
-		sqlgraph.From(Table, FieldID),
-		sqlgraph.To(XjsAgentInverseTable, FieldID),
-		sqlgraph.Edge(sqlgraph.O2M, false, XjsAgentTable, XjsAgentColumn),
-	)
-}

+ 0 - 23
ent/agent/where.go

@@ -855,29 +855,6 @@ func HasKeyAgentWith(preds ...predicate.ApiKey) predicate.Agent {
 	})
 }
 
-// HasXjsAgent applies the HasEdge predicate on the "xjs_agent" edge.
-func HasXjsAgent() predicate.Agent {
-	return predicate.Agent(func(s *sql.Selector) {
-		step := sqlgraph.NewStep(
-			sqlgraph.From(Table, FieldID),
-			sqlgraph.Edge(sqlgraph.O2M, false, XjsAgentTable, XjsAgentColumn),
-		)
-		sqlgraph.HasNeighbors(s, step)
-	})
-}
-
-// HasXjsAgentWith applies the HasEdge predicate on the "xjs_agent" edge with a given conditions (other predicates).
-func HasXjsAgentWith(preds ...predicate.XunjiService) predicate.Agent {
-	return predicate.Agent(func(s *sql.Selector) {
-		step := newXjsAgentStep()
-		sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
-			for _, p := range preds {
-				p(s)
-			}
-		})
-	})
-}
-
 // And groups predicates with the AND operator between them.
 func And(predicates ...predicate.Agent) predicate.Agent {
 	return predicate.Agent(sql.AndPredicates(predicates...))

+ 0 - 31
ent/agent_create.go

@@ -238,21 +238,6 @@ func (ac *AgentCreate) AddKeyAgent(a ...*ApiKey) *AgentCreate {
 	return ac.AddKeyAgentIDs(ids...)
 }
 
-// AddXjsAgentIDs adds the "xjs_agent" edge to the XunjiService entity by IDs.
-func (ac *AgentCreate) AddXjsAgentIDs(ids ...uint64) *AgentCreate {
-	ac.mutation.AddXjsAgentIDs(ids...)
-	return ac
-}
-
-// AddXjsAgent adds the "xjs_agent" edges to the XunjiService entity.
-func (ac *AgentCreate) AddXjsAgent(x ...*XunjiService) *AgentCreate {
-	ids := make([]uint64, len(x))
-	for i := range x {
-		ids[i] = x[i].ID
-	}
-	return ac.AddXjsAgentIDs(ids...)
-}
-
 // Mutation returns the AgentMutation object of the builder.
 func (ac *AgentCreate) Mutation() *AgentMutation {
 	return ac.mutation
@@ -532,22 +517,6 @@ func (ac *AgentCreate) createSpec() (*Agent, *sqlgraph.CreateSpec) {
 		}
 		_spec.Edges = append(_spec.Edges, edge)
 	}
-	if nodes := ac.mutation.XjsAgentIDs(); len(nodes) > 0 {
-		edge := &sqlgraph.EdgeSpec{
-			Rel:     sqlgraph.O2M,
-			Inverse: false,
-			Table:   agent.XjsAgentTable,
-			Columns: []string{agent.XjsAgentColumn},
-			Bidi:    false,
-			Target: &sqlgraph.EdgeTarget{
-				IDSpec: sqlgraph.NewFieldSpec(xunjiservice.FieldID, field.TypeUint64),
-			},
-		}
-		for _, k := range nodes {
-			edge.Target.Nodes = append(edge.Target.Nodes, k)
-		}
-		_spec.Edges = append(_spec.Edges, edge)
-	}
 	return _node, _spec
 }
 

+ 0 - 73
ent/agent_query.go

@@ -32,7 +32,6 @@ type AgentQuery struct {
 	withWaAgent    *WhatsappQuery
 	withXjsAgent   *XunjiServiceQuery
 	withKeyAgent   *ApiKeyQuery
-	withXjsAgent   *XunjiServiceQuery
 	// intermediate query (i.e. traversal path).
 	sql  *sql.Selector
 	path func(context.Context) (*sql.Selector, error)
@@ -179,28 +178,6 @@ func (aq *AgentQuery) QueryKeyAgent() *ApiKeyQuery {
 	return query
 }
 
-// QueryXjsAgent chains the current query on the "xjs_agent" edge.
-func (aq *AgentQuery) QueryXjsAgent() *XunjiServiceQuery {
-	query := (&XunjiServiceClient{config: aq.config}).Query()
-	query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
-		if err := aq.prepareQuery(ctx); err != nil {
-			return nil, err
-		}
-		selector := aq.sqlQuery(ctx)
-		if err := selector.Err(); err != nil {
-			return nil, err
-		}
-		step := sqlgraph.NewStep(
-			sqlgraph.From(agent.Table, agent.FieldID, selector),
-			sqlgraph.To(xunjiservice.Table, xunjiservice.FieldID),
-			sqlgraph.Edge(sqlgraph.O2M, false, agent.XjsAgentTable, agent.XjsAgentColumn),
-		)
-		fromU = sqlgraph.SetNeighbors(aq.driver.Dialect(), step)
-		return fromU, nil
-	}
-	return query
-}
-
 // First returns the first Agent entity from the query.
 // Returns a *NotFoundError when no Agent was found.
 func (aq *AgentQuery) First(ctx context.Context) (*Agent, error) {
@@ -398,7 +375,6 @@ func (aq *AgentQuery) Clone() *AgentQuery {
 		withWaAgent:    aq.withWaAgent.Clone(),
 		withXjsAgent:   aq.withXjsAgent.Clone(),
 		withKeyAgent:   aq.withKeyAgent.Clone(),
-		withXjsAgent:   aq.withXjsAgent.Clone(),
 		// clone intermediate query.
 		sql:  aq.sql.Clone(),
 		path: aq.path,
@@ -460,17 +436,6 @@ func (aq *AgentQuery) WithKeyAgent(opts ...func(*ApiKeyQuery)) *AgentQuery {
 	return aq
 }
 
-// WithXjsAgent tells the query-builder to eager-load the nodes that are connected to
-// the "xjs_agent" edge. The optional arguments are used to configure the query builder of the edge.
-func (aq *AgentQuery) WithXjsAgent(opts ...func(*XunjiServiceQuery)) *AgentQuery {
-	query := (&XunjiServiceClient{config: aq.config}).Query()
-	for _, opt := range opts {
-		opt(query)
-	}
-	aq.withXjsAgent = query
-	return aq
-}
-
 // GroupBy is used to group vertices by one or more fields/columns.
 // It is often used with aggregate functions, like: count, max, mean, min, sum.
 //
@@ -555,7 +520,6 @@ func (aq *AgentQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Agent,
 			aq.withWaAgent != nil,
 			aq.withXjsAgent != nil,
 			aq.withKeyAgent != nil,
-			aq.withXjsAgent != nil,
 		}
 	)
 	_spec.ScanValues = func(columns []string) ([]any, error) {
@@ -611,13 +575,6 @@ func (aq *AgentQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Agent,
 			return nil, err
 		}
 	}
-	if query := aq.withXjsAgent; query != nil {
-		if err := aq.loadXjsAgent(ctx, query, nodes,
-			func(n *Agent) { n.Edges.XjsAgent = []*XunjiService{} },
-			func(n *Agent, e *XunjiService) { n.Edges.XjsAgent = append(n.Edges.XjsAgent, e) }); err != nil {
-			return nil, err
-		}
-	}
 	return nodes, nil
 }
 
@@ -772,36 +729,6 @@ func (aq *AgentQuery) loadKeyAgent(ctx context.Context, query *ApiKeyQuery, node
 	}
 	return nil
 }
-func (aq *AgentQuery) loadXjsAgent(ctx context.Context, query *XunjiServiceQuery, nodes []*Agent, init func(*Agent), assign func(*Agent, *XunjiService)) error {
-	fks := make([]driver.Value, 0, len(nodes))
-	nodeids := make(map[uint64]*Agent)
-	for i := range nodes {
-		fks = append(fks, nodes[i].ID)
-		nodeids[nodes[i].ID] = nodes[i]
-		if init != nil {
-			init(nodes[i])
-		}
-	}
-	if len(query.ctx.Fields) > 0 {
-		query.ctx.AppendFieldOnce(xunjiservice.FieldAgentID)
-	}
-	query.Where(predicate.XunjiService(func(s *sql.Selector) {
-		s.Where(sql.InValues(s.C(agent.XjsAgentColumn), fks...))
-	}))
-	neighbors, err := query.All(ctx)
-	if err != nil {
-		return err
-	}
-	for _, n := range neighbors {
-		fk := n.AgentID
-		node, ok := nodeids[fk]
-		if !ok {
-			return fmt.Errorf(`unexpected referenced foreign-key "agent_id" returned %v for node %v`, fk, n.ID)
-		}
-		assign(node, n)
-	}
-	return nil
-}
 
 func (aq *AgentQuery) sqlCount(ctx context.Context) (int, error) {
 	_spec := aq.querySpec()

+ 0 - 162
ent/agent_update.go

@@ -278,21 +278,6 @@ func (au *AgentUpdate) AddKeyAgent(a ...*ApiKey) *AgentUpdate {
 	return au.AddKeyAgentIDs(ids...)
 }
 
-// AddXjsAgentIDs adds the "xjs_agent" edge to the XunjiService entity by IDs.
-func (au *AgentUpdate) AddXjsAgentIDs(ids ...uint64) *AgentUpdate {
-	au.mutation.AddXjsAgentIDs(ids...)
-	return au
-}
-
-// AddXjsAgent adds the "xjs_agent" edges to the XunjiService entity.
-func (au *AgentUpdate) AddXjsAgent(x ...*XunjiService) *AgentUpdate {
-	ids := make([]uint64, len(x))
-	for i := range x {
-		ids[i] = x[i].ID
-	}
-	return au.AddXjsAgentIDs(ids...)
-}
-
 // Mutation returns the AgentMutation object of the builder.
 func (au *AgentUpdate) Mutation() *AgentMutation {
 	return au.mutation
@@ -403,27 +388,6 @@ func (au *AgentUpdate) RemoveKeyAgent(a ...*ApiKey) *AgentUpdate {
 	return au.RemoveKeyAgentIDs(ids...)
 }
 
-// ClearXjsAgent clears all "xjs_agent" edges to the XunjiService entity.
-func (au *AgentUpdate) ClearXjsAgent() *AgentUpdate {
-	au.mutation.ClearXjsAgent()
-	return au
-}
-
-// RemoveXjsAgentIDs removes the "xjs_agent" edge to XunjiService entities by IDs.
-func (au *AgentUpdate) RemoveXjsAgentIDs(ids ...uint64) *AgentUpdate {
-	au.mutation.RemoveXjsAgentIDs(ids...)
-	return au
-}
-
-// RemoveXjsAgent removes "xjs_agent" edges to XunjiService entities.
-func (au *AgentUpdate) RemoveXjsAgent(x ...*XunjiService) *AgentUpdate {
-	ids := make([]uint64, len(x))
-	for i := range x {
-		ids[i] = x[i].ID
-	}
-	return au.RemoveXjsAgentIDs(ids...)
-}
-
 // Save executes the query and returns the number of nodes affected by the update operation.
 func (au *AgentUpdate) Save(ctx context.Context) (int, error) {
 	if err := au.defaults(); err != nil {
@@ -781,51 +745,6 @@ func (au *AgentUpdate) sqlSave(ctx context.Context) (n int, err error) {
 		}
 		_spec.Edges.Add = append(_spec.Edges.Add, edge)
 	}
-	if au.mutation.XjsAgentCleared() {
-		edge := &sqlgraph.EdgeSpec{
-			Rel:     sqlgraph.O2M,
-			Inverse: false,
-			Table:   agent.XjsAgentTable,
-			Columns: []string{agent.XjsAgentColumn},
-			Bidi:    false,
-			Target: &sqlgraph.EdgeTarget{
-				IDSpec: sqlgraph.NewFieldSpec(xunjiservice.FieldID, field.TypeUint64),
-			},
-		}
-		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
-	}
-	if nodes := au.mutation.RemovedXjsAgentIDs(); len(nodes) > 0 && !au.mutation.XjsAgentCleared() {
-		edge := &sqlgraph.EdgeSpec{
-			Rel:     sqlgraph.O2M,
-			Inverse: false,
-			Table:   agent.XjsAgentTable,
-			Columns: []string{agent.XjsAgentColumn},
-			Bidi:    false,
-			Target: &sqlgraph.EdgeTarget{
-				IDSpec: sqlgraph.NewFieldSpec(xunjiservice.FieldID, field.TypeUint64),
-			},
-		}
-		for _, k := range nodes {
-			edge.Target.Nodes = append(edge.Target.Nodes, k)
-		}
-		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
-	}
-	if nodes := au.mutation.XjsAgentIDs(); len(nodes) > 0 {
-		edge := &sqlgraph.EdgeSpec{
-			Rel:     sqlgraph.O2M,
-			Inverse: false,
-			Table:   agent.XjsAgentTable,
-			Columns: []string{agent.XjsAgentColumn},
-			Bidi:    false,
-			Target: &sqlgraph.EdgeTarget{
-				IDSpec: sqlgraph.NewFieldSpec(xunjiservice.FieldID, field.TypeUint64),
-			},
-		}
-		for _, k := range nodes {
-			edge.Target.Nodes = append(edge.Target.Nodes, k)
-		}
-		_spec.Edges.Add = append(_spec.Edges.Add, edge)
-	}
 	if n, err = sqlgraph.UpdateNodes(ctx, au.driver, _spec); err != nil {
 		if _, ok := err.(*sqlgraph.NotFoundError); ok {
 			err = &NotFoundError{agent.Label}
@@ -1091,21 +1010,6 @@ func (auo *AgentUpdateOne) AddKeyAgent(a ...*ApiKey) *AgentUpdateOne {
 	return auo.AddKeyAgentIDs(ids...)
 }
 
-// AddXjsAgentIDs adds the "xjs_agent" edge to the XunjiService entity by IDs.
-func (auo *AgentUpdateOne) AddXjsAgentIDs(ids ...uint64) *AgentUpdateOne {
-	auo.mutation.AddXjsAgentIDs(ids...)
-	return auo
-}
-
-// AddXjsAgent adds the "xjs_agent" edges to the XunjiService entity.
-func (auo *AgentUpdateOne) AddXjsAgent(x ...*XunjiService) *AgentUpdateOne {
-	ids := make([]uint64, len(x))
-	for i := range x {
-		ids[i] = x[i].ID
-	}
-	return auo.AddXjsAgentIDs(ids...)
-}
-
 // Mutation returns the AgentMutation object of the builder.
 func (auo *AgentUpdateOne) Mutation() *AgentMutation {
 	return auo.mutation
@@ -1216,27 +1120,6 @@ func (auo *AgentUpdateOne) RemoveKeyAgent(a ...*ApiKey) *AgentUpdateOne {
 	return auo.RemoveKeyAgentIDs(ids...)
 }
 
-// ClearXjsAgent clears all "xjs_agent" edges to the XunjiService entity.
-func (auo *AgentUpdateOne) ClearXjsAgent() *AgentUpdateOne {
-	auo.mutation.ClearXjsAgent()
-	return auo
-}
-
-// RemoveXjsAgentIDs removes the "xjs_agent" edge to XunjiService entities by IDs.
-func (auo *AgentUpdateOne) RemoveXjsAgentIDs(ids ...uint64) *AgentUpdateOne {
-	auo.mutation.RemoveXjsAgentIDs(ids...)
-	return auo
-}
-
-// RemoveXjsAgent removes "xjs_agent" edges to XunjiService entities.
-func (auo *AgentUpdateOne) RemoveXjsAgent(x ...*XunjiService) *AgentUpdateOne {
-	ids := make([]uint64, len(x))
-	for i := range x {
-		ids[i] = x[i].ID
-	}
-	return auo.RemoveXjsAgentIDs(ids...)
-}
-
 // Where appends a list predicates to the AgentUpdate builder.
 func (auo *AgentUpdateOne) Where(ps ...predicate.Agent) *AgentUpdateOne {
 	auo.mutation.Where(ps...)
@@ -1624,51 +1507,6 @@ func (auo *AgentUpdateOne) sqlSave(ctx context.Context) (_node *Agent, err error
 		}
 		_spec.Edges.Add = append(_spec.Edges.Add, edge)
 	}
-	if auo.mutation.XjsAgentCleared() {
-		edge := &sqlgraph.EdgeSpec{
-			Rel:     sqlgraph.O2M,
-			Inverse: false,
-			Table:   agent.XjsAgentTable,
-			Columns: []string{agent.XjsAgentColumn},
-			Bidi:    false,
-			Target: &sqlgraph.EdgeTarget{
-				IDSpec: sqlgraph.NewFieldSpec(xunjiservice.FieldID, field.TypeUint64),
-			},
-		}
-		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
-	}
-	if nodes := auo.mutation.RemovedXjsAgentIDs(); len(nodes) > 0 && !auo.mutation.XjsAgentCleared() {
-		edge := &sqlgraph.EdgeSpec{
-			Rel:     sqlgraph.O2M,
-			Inverse: false,
-			Table:   agent.XjsAgentTable,
-			Columns: []string{agent.XjsAgentColumn},
-			Bidi:    false,
-			Target: &sqlgraph.EdgeTarget{
-				IDSpec: sqlgraph.NewFieldSpec(xunjiservice.FieldID, field.TypeUint64),
-			},
-		}
-		for _, k := range nodes {
-			edge.Target.Nodes = append(edge.Target.Nodes, k)
-		}
-		_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
-	}
-	if nodes := auo.mutation.XjsAgentIDs(); len(nodes) > 0 {
-		edge := &sqlgraph.EdgeSpec{
-			Rel:     sqlgraph.O2M,
-			Inverse: false,
-			Table:   agent.XjsAgentTable,
-			Columns: []string{agent.XjsAgentColumn},
-			Bidi:    false,
-			Target: &sqlgraph.EdgeTarget{
-				IDSpec: sqlgraph.NewFieldSpec(xunjiservice.FieldID, field.TypeUint64),
-			},
-		}
-		for _, k := range nodes {
-			edge.Target.Nodes = append(edge.Target.Nodes, k)
-		}
-		_spec.Edges.Add = append(_spec.Edges.Add, edge)
-	}
 	_node = &Agent{config: auo.config}
 	_spec.Assign = _node.assignValues
 	_spec.ScanValues = _node.scanValues

+ 0 - 16
ent/client.go

@@ -748,22 +748,6 @@ func (c *AgentClient) QueryKeyAgent(a *Agent) *ApiKeyQuery {
 	return query
 }
 
-// QueryXjsAgent queries the xjs_agent edge of a Agent.
-func (c *AgentClient) QueryXjsAgent(a *Agent) *XunjiServiceQuery {
-	query := (&XunjiServiceClient{config: c.config}).Query()
-	query.path = func(context.Context) (fromV *sql.Selector, _ error) {
-		id := a.ID
-		step := sqlgraph.NewStep(
-			sqlgraph.From(agent.Table, agent.FieldID, id),
-			sqlgraph.To(xunjiservice.Table, xunjiservice.FieldID),
-			sqlgraph.Edge(sqlgraph.O2M, false, agent.XjsAgentTable, agent.XjsAgentColumn),
-		)
-		fromV = sqlgraph.Neighbors(a.driver.Dialect(), step)
-		return fromV, nil
-	}
-	return query
-}
-
 // Hooks returns the client hooks.
 func (c *AgentClient) Hooks() []Hook {
 	hooks := c.hooks.Agent

+ 0 - 83
ent/mutation.go

@@ -147,9 +147,6 @@ type AgentMutation struct {
 	key_agent          map[uint64]struct{}
 	removedkey_agent   map[uint64]struct{}
 	clearedkey_agent   bool
-	xjs_agent          map[uint64]struct{}
-	removedxjs_agent   map[uint64]struct{}
-	clearedxjs_agent   bool
 	done               bool
 	oldValue           func(context.Context) (*Agent, error)
 	predicates         []predicate.Agent
@@ -1018,60 +1015,6 @@ func (m *AgentMutation) ResetKeyAgent() {
 	m.removedkey_agent = nil
 }
 
-// AddXjsAgentIDs adds the "xjs_agent" edge to the XunjiService entity by ids.
-func (m *AgentMutation) AddXjsAgentIDs(ids ...uint64) {
-	if m.xjs_agent == nil {
-		m.xjs_agent = make(map[uint64]struct{})
-	}
-	for i := range ids {
-		m.xjs_agent[ids[i]] = struct{}{}
-	}
-}
-
-// ClearXjsAgent clears the "xjs_agent" edge to the XunjiService entity.
-func (m *AgentMutation) ClearXjsAgent() {
-	m.clearedxjs_agent = true
-}
-
-// XjsAgentCleared reports if the "xjs_agent" edge to the XunjiService entity was cleared.
-func (m *AgentMutation) XjsAgentCleared() bool {
-	return m.clearedxjs_agent
-}
-
-// RemoveXjsAgentIDs removes the "xjs_agent" edge to the XunjiService entity by IDs.
-func (m *AgentMutation) RemoveXjsAgentIDs(ids ...uint64) {
-	if m.removedxjs_agent == nil {
-		m.removedxjs_agent = make(map[uint64]struct{})
-	}
-	for i := range ids {
-		delete(m.xjs_agent, ids[i])
-		m.removedxjs_agent[ids[i]] = struct{}{}
-	}
-}
-
-// RemovedXjsAgent returns the removed IDs of the "xjs_agent" edge to the XunjiService entity.
-func (m *AgentMutation) RemovedXjsAgentIDs() (ids []uint64) {
-	for id := range m.removedxjs_agent {
-		ids = append(ids, id)
-	}
-	return
-}
-
-// XjsAgentIDs returns the "xjs_agent" edge IDs in the mutation.
-func (m *AgentMutation) XjsAgentIDs() (ids []uint64) {
-	for id := range m.xjs_agent {
-		ids = append(ids, id)
-	}
-	return
-}
-
-// ResetXjsAgent resets all changes to the "xjs_agent" edge.
-func (m *AgentMutation) ResetXjsAgent() {
-	m.xjs_agent = nil
-	m.clearedxjs_agent = false
-	m.removedxjs_agent = nil
-}
-
 // Where appends a list predicates to the AgentMutation builder.
 func (m *AgentMutation) Where(ps ...predicate.Agent) {
 	m.predicates = append(m.predicates, ps...)
@@ -1445,9 +1388,6 @@ func (m *AgentMutation) AddedEdges() []string {
 	if m.key_agent != nil {
 		edges = append(edges, agent.EdgeKeyAgent)
 	}
-	if m.xjs_agent != nil {
-		edges = append(edges, agent.EdgeXjsAgent)
-	}
 	return edges
 }
 
@@ -1485,12 +1425,6 @@ func (m *AgentMutation) AddedIDs(name string) []ent.Value {
 			ids = append(ids, id)
 		}
 		return ids
-	case agent.EdgeXjsAgent:
-		ids := make([]ent.Value, 0, len(m.xjs_agent))
-		for id := range m.xjs_agent {
-			ids = append(ids, id)
-		}
-		return ids
 	}
 	return nil
 }
@@ -1513,9 +1447,6 @@ func (m *AgentMutation) RemovedEdges() []string {
 	if m.removedkey_agent != nil {
 		edges = append(edges, agent.EdgeKeyAgent)
 	}
-	if m.removedxjs_agent != nil {
-		edges = append(edges, agent.EdgeXjsAgent)
-	}
 	return edges
 }
 
@@ -1553,12 +1484,6 @@ func (m *AgentMutation) RemovedIDs(name string) []ent.Value {
 			ids = append(ids, id)
 		}
 		return ids
-	case agent.EdgeXjsAgent:
-		ids := make([]ent.Value, 0, len(m.removedxjs_agent))
-		for id := range m.removedxjs_agent {
-			ids = append(ids, id)
-		}
-		return ids
 	}
 	return nil
 }
@@ -1581,9 +1506,6 @@ func (m *AgentMutation) ClearedEdges() []string {
 	if m.clearedkey_agent {
 		edges = append(edges, agent.EdgeKeyAgent)
 	}
-	if m.clearedxjs_agent {
-		edges = append(edges, agent.EdgeXjsAgent)
-	}
 	return edges
 }
 
@@ -1601,8 +1523,6 @@ func (m *AgentMutation) EdgeCleared(name string) bool {
 		return m.clearedxjs_agent
 	case agent.EdgeKeyAgent:
 		return m.clearedkey_agent
-	case agent.EdgeXjsAgent:
-		return m.clearedxjs_agent
 	}
 	return false
 }
@@ -1634,9 +1554,6 @@ func (m *AgentMutation) ResetEdge(name string) error {
 	case agent.EdgeKeyAgent:
 		m.ResetKeyAgent()
 		return nil
-	case agent.EdgeXjsAgent:
-		m.ResetXjsAgent()
-		return nil
 	}
 	return fmt.Errorf("unknown Agent edge %s", name)
 }

+ 0 - 1
ent/schema/agent.go

@@ -43,7 +43,6 @@ func (Agent) Edges() []ent.Edge {
 		edge.To("wa_agent", Whatsapp.Type),
 		edge.To("xjs_agent", XunjiService.Type),
 		edge.To("key_agent", ApiKey.Type),
-		edge.To("xjs_agent", XunjiService.Type),
 	}
 }
 

+ 5 - 73
internal/handler/routes.go

@@ -2106,6 +2106,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 					Path:    "/xunji",
 					Handler: xunji.GetXunjiByIdHandler(serverCtx),
 				},
+				{
+					Method:  http.MethodPost,
+					Path:    "/xunji/detail",
+					Handler: xunji.GetXunjiHandler(serverCtx),
+				},
 			}...,
 		),
 		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
@@ -2266,77 +2271,4 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 		),
 		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
 	)
-
-	server.AddRoutes(
-		rest.WithMiddlewares(
-			[]rest.Middleware{serverCtx.Authority},
-			[]rest.Route{
-				{
-					Method:  http.MethodPost,
-					Path:    "/xunji/create",
-					Handler: xunji.CreateXunjiHandler(serverCtx),
-				},
-				{
-					Method:  http.MethodPost,
-					Path:    "/xunji/update",
-					Handler: xunji.UpdateXunjiHandler(serverCtx),
-				},
-				{
-					Method:  http.MethodPost,
-					Path:    "/xunji/delete",
-					Handler: xunji.DeleteXunjiHandler(serverCtx),
-				},
-				{
-					Method:  http.MethodPost,
-					Path:    "/xunji/list",
-					Handler: xunji.GetXunjiListHandler(serverCtx),
-				},
-				{
-					Method:  http.MethodPost,
-					Path:    "/xunji",
-					Handler: xunji.GetXunjiByIdHandler(serverCtx),
-				},
-				{
-					Method:  http.MethodPost,
-					Path:    "/xunji/detail",
-					Handler: xunji.GetXunjiHandler(serverCtx),
-				},
-			}...,
-		),
-		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
-	)
-
-	server.AddRoutes(
-		rest.WithMiddlewares(
-			[]rest.Middleware{serverCtx.Authority},
-			[]rest.Route{
-				{
-					Method:  http.MethodPost,
-					Path:    "/xunji_service/create",
-					Handler: xunji_service.CreateXunjiServiceHandler(serverCtx),
-				},
-				{
-					Method:  http.MethodPost,
-					Path:    "/xunji_service/update",
-					Handler: xunji_service.UpdateXunjiServiceHandler(serverCtx),
-				},
-				{
-					Method:  http.MethodPost,
-					Path:    "/xunji_service/delete",
-					Handler: xunji_service.DeleteXunjiServiceHandler(serverCtx),
-				},
-				{
-					Method:  http.MethodPost,
-					Path:    "/xunji_service/list",
-					Handler: xunji_service.GetXunjiServiceListHandler(serverCtx),
-				},
-				{
-					Method:  http.MethodPost,
-					Path:    "/xunji_service",
-					Handler: xunji_service.GetXunjiServiceByIdHandler(serverCtx),
-				},
-			}...,
-		),
-		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
-	)
 }

+ 0 - 115
internal/types/types.go

@@ -4223,16 +4223,8 @@ type XunjiInfo struct {
 	Token *string `json:"token,optional"`
 	// 加密key
 	EncodingKey *string `json:"encodingKey,optional"`
-	// 角色ID
-	AgentId *uint64 `json:"agentId,optional"`
 	// organization_id | 租户ID
 	OrganizationId *uint64 `json:"organizationId,optional"`
-	// 微信ID
-	Wxid *string `json:"wxid,optional"`
-	// 大模型服务地址
-	ApiBase *string `json:"apiBase,optional"`
-	// 大模型服务密钥
-	ApiKey *string `json:"apiKey,optional"`
 }
 
 // The response data of xunji list | Xunji列表数据
@@ -4498,110 +4490,3 @@ type ApiKeyListReq struct {
 	Key            *string `json:"key,optional"`
 	OrganizationId *uint64 `json:"organization_id,optional"`
 }
-
-// The data of xunji information | Xunji信息
-// swagger:model XunjiInfo
-type XunjiInfo struct {
-	BaseIDInfo
-	// Status 1: normal 2: ban | 状态 1 正常 2 禁用
-	Status *uint8 `json:"status,optional"`
-	// AppKey
-	AppKey *string `json:"appKey,optional"`
-	// AppSecret
-	AppSecret *string `json:"appSecret,optional"`
-	// Token
-	Token *string `json:"token,optional"`
-	// 加密key
-	EncodingKey *string `json:"encodingKey,optional"`
-	// organization_id | 租户ID
-	OrganizationId *uint64 `json:"organizationId,optional"`
-}
-
-// The response data of xunji list | Xunji列表数据
-// swagger:model XunjiListResp
-type XunjiListResp struct {
-	BaseDataInfo
-	// Xunji list data | Xunji列表数据
-	Data XunjiListInfo `json:"data"`
-}
-
-// Xunji list data | Xunji列表数据
-// swagger:model XunjiListInfo
-type XunjiListInfo struct {
-	BaseListInfo
-	// The API list data | Xunji列表数据
-	Data []XunjiInfo `json:"data"`
-}
-
-// Get xunji list request params | Xunji列表请求参数
-// swagger:model XunjiListReq
-type XunjiListReq struct {
-	PageInfo
-	// AppKey
-	AppKey *string `json:"appKey,optional"`
-	// AppSecret
-	AppSecret *string `json:"appSecret,optional"`
-	// Token
-	Token *string `json:"token,optional"`
-}
-
-// Xunji information response | Xunji信息返回体
-// swagger:model XunjiInfoResp
-type XunjiInfoResp struct {
-	BaseDataInfo
-	// Xunji information | Xunji数据
-	Data XunjiInfo `json:"data"`
-}
-
-// The data of xunji service information | XunjiService信息
-// swagger:model XunjiServiceInfo
-type XunjiServiceInfo struct {
-	BaseIDInfo
-	// Status 1: normal 2: ban | 状态 1 正常 2 禁用
-	Status *uint8 `json:"status,optional"`
-	// Xunji表ID
-	XunjiId *uint64 `json:"xunjiId,optional"`
-	// 智能体ID
-	AgentId *uint64 `json:"agentId,optional"`
-	// 模式信息
-	AgentInfo *AgentInfo `json:"agentInfo,optional"`
-	// organization_id | 租户ID
-	OrganizationId *uint64 `json:"organizationId,optional"`
-	// 微信ID
-	Wxid *string `json:"wxid,optional"`
-	// 大模型服务地址
-	ApiBase *string `json:"apiBase,optional"`
-	// 大模型服务密钥
-	ApiKey *string `json:"apiKey,optional"`
-}
-
-// The response data of xunji service list | XunjiService列表数据
-// swagger:model XunjiServiceListResp
-type XunjiServiceListResp struct {
-	BaseDataInfo
-	// XunjiService list data | XunjiService列表数据
-	Data XunjiServiceListInfo `json:"data"`
-}
-
-// XunjiService list data | XunjiService列表数据
-// swagger:model XunjiServiceListInfo
-type XunjiServiceListInfo struct {
-	BaseListInfo
-	// The API list data | XunjiService列表数据
-	Data []XunjiServiceInfo `json:"data"`
-}
-
-// Get xunji service list request params | XunjiService列表请求参数
-// swagger:model XunjiServiceListReq
-type XunjiServiceListReq struct {
-	PageInfo
-	XunjiID *uint64 `json:"configId,optional"`
-}
-
-// XunjiService information response | XunjiService信息返回体
-// swagger:model XunjiServiceInfoResp
-type XunjiServiceInfoResp struct {
-	BaseDataInfo
-	// XunjiService information | XunjiService数据
-	Data XunjiServiceInfo `json:"data"`
-}