0.11.1: 旗舰版完善(资源权限等级/个人环境变量/收藏/企业报表/租户概览/ARM64发布/多渠道接入)

- 迁移 000035-000037(权限等级/环境变量/渠道)
- 新增 internal/channel 渠道抽象层(webhook/企微/钉钉/飞书)
- 全部功能端到端验证通过(25 包单测)
This commit is contained in:
2026-08-13 11:54:34 +08:00
parent c22669c31d
commit 4563979a15
25 changed files with 1664 additions and 7 deletions
+12 -2
View File
@@ -16,6 +16,7 @@ import (
// MarketItem is the lightweight unified catalog row for a published resource,
// regardless of which of the three resource tables it lives in.
type MarketItem struct {
PermissionLevel string `json:"permission_level,omitempty"`
Type string `json:"type"`
Code string `json:"code"`
Name string `json:"name"`
@@ -300,11 +301,20 @@ func (s *MarketplaceService) Detail(ctx context.Context, resourceType, code stri
// Install records a portal user's workspace binding to a published resource.
// It is the permission grant that lets a cross-department user invoke a
// resource that would otherwise be invisible to them.
func (s *MarketplaceService) Install(ctx context.Context, resourceType, code, portalUserID string) (bool, error) {
// Install 记录安装;permissionLevel 为 view/use/manage(默认 use)。
func (s *MarketplaceService) Install(ctx context.Context, resourceType, code, portalUserID, permissionLevel string) (bool, error) {
resourceID, err := s.publishedResourceID(ctx, resourceType, code)
if err != nil {
return false, err
}
switch permissionLevel {
case "", "view", "use", "manage":
default:
return false, errors.New("权限等级必须是 view/use/manage")
}
if permissionLevel == "" {
permissionLevel = "use"
}
id, err := newUUID()
if err != nil {
return false, err
@@ -314,7 +324,7 @@ func (s *MarketplaceService) Install(ctx context.Context, resourceType, code, po
return false, err
}
defer rollback(ctx, tx)
tag, err := tx.Exec(ctx, `INSERT INTO gateway.marketplace_installations(id,resource_type,resource_id,portal_user_id) VALUES($1,$2,$3,$4) ON CONFLICT(resource_type,resource_id,portal_user_id) DO NOTHING`, id, resourceType, resourceID, portalUserID)
tag, err := tx.Exec(ctx, `INSERT INTO gateway.marketplace_installations(id,resource_type,resource_id,portal_user_id,permission_level) VALUES($1,$2,$3,$4,$5) ON CONFLICT(resource_type,resource_id,portal_user_id) DO UPDATE SET permission_level=$5`, id, resourceType, resourceID, portalUserID, permissionLevel)
if err != nil {
return false, err
}