You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
1.6 KiB

package user
import (
"yunyan/comm"
"yunyan/modules"
"yunyan/lego/base"
"yunyan/lego/core"
)
// apiV3Comp 客户端配置下发的 v3 接口组件(路由 user_<方法名小写>_v3)。
//
// v3 只新增接口,不动 v1/v2 的任何既有响应结构——老客户端继续走老接口,行为完全不变。
// 与 v2 的差别集中在 GetAppConfig:不再单独下发 mcps(MCP 已并入第三方服务配置),
// 改为一次性给出「第三方服务(含 MCP) + 会议记录能力」,客户端启动少跑两趟接口。
type apiV3Comp struct {
modules.MCompHttpGate
service base.IRPCXService
module *User
options *Options
}
func (this *apiV3Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompHttpGate.Init(service, module, comp, options)
this.service = service.(base.IRPCXService)
this.module = module.(*User)
this.options = options.(*Options)
this.Version = "v3"
// 响应含第三方服务明文凭据,声明加密:网关对响应体做 AES-CBC(key=gateway 配置 EncryptKey),
// 响应头 X-Encrypted:1。字段本身因此不再逐个加密。
this.EncryptMsgs = []string{"GetAppConfig", "GetAgents"}
return
}
func (this *apiV3Comp) Start() (err error) {
if err = this.MCompHttpGate.Start(); err != nil {
return
}
// 会议记录能力由 echomeet 模块提供(同进程)。取不到说明本服务没装 echomeet,
// 此时 v3 的 meet 字段留空,其余配置照常下发。
if m, e := this.service.GetModule(comm.ModuleEchomeet); e == nil {
this.module.echomeet, _ = m.(comm.IEchomeet)
}
return
}