feat: add Z12/Z13 bind APIs, stock import, and sync docs

Enable auto default sync channels on agent activate, bind-code/phone confirm flows, publish ALTER, and align admin/yuheng docs with the production bind path.
This commit is contained in:
whm
2026-08-05 11:47:20 +08:00
parent b04b180d30
commit cb56e6847e
31 changed files with 1882 additions and 91 deletions

View File

@@ -11,6 +11,7 @@ import (
"aijianzhan/platform/internal/agentstore"
"aijianzhan/platform/internal/audit"
"aijianzhan/platform/internal/authx"
"aijianzhan/platform/internal/bindcodestore"
"aijianzhan/platform/internal/config"
"aijianzhan/platform/internal/crud"
"aijianzhan/platform/internal/dbsync"
@@ -47,6 +48,7 @@ type ServiceContext struct {
DB *sql.DB
JWT authx.JWTConfig
DBSync *dbsync.Manager
BindCodes bindcodestore.Store
TenantPerm tenantperm.Store
SMS *smsstore.Store
License *license.Manager
@@ -160,6 +162,12 @@ func NewServiceContext(c config.Config) *ServiceContext {
return ok
}
}
// Z9e存量已发布模块补齐 import/export不依赖用户再发布
if ctx.Meta != nil && !ctx.MemoryMode {
bfCtx, bfCancel := context.WithTimeout(context.Background(), 30*time.Second)
meta.RunBackfillDefaultImportExportOnBoot(bfCtx, ctx.Meta)
bfCancel()
}
if c.DryRun {
ctx.Schema = schema.NoopRunner{}
}
@@ -176,6 +184,11 @@ func NewServiceContext(c config.Config) *ServiceContext {
} else {
ctx.DBSync = dbsync.NewManager(store)
log.Printf("dbsync middleware enabled (dir=%s)", dir)
if bc, err := bindcodestore.NewFileStore(dir); err != nil {
log.Printf("bind code store: %v", err)
} else {
ctx.BindCodes = bc
}
}
}