init: AIGC-Hub/AVCC 方案文档 + TCS-IPTV 内容可信锁定系统 MVP
- 方案文档: AVCC 体系建设、IPTV TCS 需求(0-req)/PRD(1-prd)/任务(2-task)/二三四期任务 - tcs-iptv: Go 后端(哈希SDK/MA码生成/可信数据空间mock/业务编排/HTTP API+HMAC鉴权) - web-console: React+AntD 监管大屏(角色工作台/全流程演示/监管片库) - 一剧一码+集级哈希, 集级下架/恢复, 全栈测试通过
This commit is contained in:
Executable
+73
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
# 端到端冒烟:送审→发码签发→CSPS→入库→发布→注入→下架
|
||||
# 依赖:api-svc 运行在 :8080
|
||||
set -e
|
||||
BASE="http://localhost:8080/api/v1"
|
||||
|
||||
# HMAC 签名工具(与 httpx.Sign 一致:base64(HMAC-SHA256(secret, METHOD\nPATH)))
|
||||
sign() { # secret method path
|
||||
printf '%s\n%s' "$2" "$3" | openssl dgst -sha256 -hmac "$1" -binary | base64
|
||||
}
|
||||
|
||||
call() { # apiKey secret method path jsonBody
|
||||
local key="$1" secret="$2" method="$3" path="$4" body="$5"
|
||||
# 签名只用 path(不含 query),与 Go 端 c.Request.URL.Path 一致
|
||||
local sigpath="/api/v1${path%%\?*}"
|
||||
local sig; sig=$(sign "$secret" "$method" "$sigpath")
|
||||
if [ "$method" = "GET" ]; then
|
||||
curl -s -X GET "$BASE$path" -H "Authorization: TCS $key:$sig"
|
||||
else
|
||||
curl -s -X "$method" "$BASE$path" \
|
||||
-H "Authorization: TCS $key:$sig" \
|
||||
-H "Content-Type: application/json" -d "$body"
|
||||
fi
|
||||
}
|
||||
|
||||
echo "== 1) CP 送审 =="
|
||||
REG=$(call ak-cp sk-cp POST /content/register \
|
||||
'{"title":"示例微短剧","episode_count":24,"category":"WD","file_sha256":"fh-001","merkle_root":"mr-001","perceptual_hash":"ph-001","cp_media_id":"FS-77821","cp_name":"飞翮信息"}')
|
||||
echo "$REG"
|
||||
REVIEW_ID=$(echo "$REG" | sed -n 's/.*"review_id":"\([^"]*\)".*/\1/p')
|
||||
CTID=$(echo "$REG" | sed -n 's/.*"content_twin_id":"\([^"]*\)".*/\1/p')
|
||||
echo "review_id=$REVIEW_ID ctid=$CTID"
|
||||
|
||||
echo "== 2) 监管发码签发 =="
|
||||
ISS=$(call ak-regulator sk-regulator POST /content/issue \
|
||||
"{\"review_id\":\"$REVIEW_ID\",\"issuer\":\"北京市广播电视局\"}")
|
||||
echo "$ISS"
|
||||
MA=$(echo "$ISS" | sed -n 's/.*"ma_code":"\([^"]*\)".*/\1/p')
|
||||
CERT=$(echo "$ISS" | sed -n 's/.*"certificate":"\([^"]*\)".*/\1/p')
|
||||
echo "ma_code=$MA"
|
||||
|
||||
echo "== 3) CSPS 审核通过 =="
|
||||
call ak-reviewer sk-reviewer POST /content/csps-result \
|
||||
"{\"ma_code\":\"$MA\",\"approved\":true,\"reviewer_id\":\"rv-1\"}"; echo
|
||||
|
||||
echo "== 4) 入媒资库 =="
|
||||
call ak-reviewer sk-reviewer POST /content/ingest \
|
||||
"{\"ma_code\":\"$MA\",\"content_twin_id\":\"$CTID\",\"media_asset_id\":\"MEDIA-001\",\"lib_name\":\"广东IPTV媒资库\"}"; echo
|
||||
|
||||
echo "== 5) 发布给运营商 =="
|
||||
call ak-reviewer sk-reviewer POST /content/publish \
|
||||
"{\"ma_code\":\"$MA\",\"certificate\":\"$CERT\"}"; echo
|
||||
|
||||
echo "== 6) CDN 注入校验(匹配) =="
|
||||
call ak-operator sk-operator POST /content/inject \
|
||||
"{\"content_twin_id\":\"$CTID\",\"ma_code\":\"$MA\",\"file_sha256\":\"fh-001\",\"operator_id\":\"CT-IPTV-GD\",\"cdn_endpoint\":\"cdn://ct-gd/vod/1\"}"; echo
|
||||
|
||||
echo "== 7) CDN 注入校验(篡改,应拒绝) =="
|
||||
call ak-operator sk-operator POST /content/inject \
|
||||
"{\"content_twin_id\":\"$CTID\",\"ma_code\":\"$MA\",\"file_sha256\":\"tampered\",\"operator_id\":\"CT-IPTV-GD\",\"cdn_endpoint\":\"cdn://x\"}"; echo
|
||||
|
||||
echo "== 8) 映射查询 =="
|
||||
call ak-regulator sk-regulator GET "/content/mappings?ma_code=$MA" ""; echo
|
||||
|
||||
echo "== 9) 运营商越权下架(应拒绝) =="
|
||||
call ak-operator sk-operator POST /content/takedown \
|
||||
"{\"ma_code\":\"$MA\",\"reason\":\"越权\"}"; echo
|
||||
|
||||
echo "== 10) 监管应急下架 =="
|
||||
call ak-regulator sk-regulator POST /content/takedown \
|
||||
"{\"ma_code\":\"$MA\",\"reason\":\"违规\"}"; echo
|
||||
|
||||
echo "== 完成 =="
|
||||
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
# 陕西 IPTV 场景演示数据:造若干条内容,跑通"送审→发码→审核→入库→发布→注入"。
|
||||
#
|
||||
# 参与方设定:
|
||||
# 管理方(审核+监管):陕西IPTV运营公司(机构节点 6101)
|
||||
# 内容提供商(CP):西安曲江丝路文化传播 / 陕文投艺达影视 / 西部电影集团(西影)
|
||||
# 运营商:中国电信陕西(天翼高清) / 中国移动陕西(魔百和) / 中国联通陕西
|
||||
set -e
|
||||
BASE="http://localhost:8080/api/v1"
|
||||
|
||||
sign() { printf '%s\n%s' "$2" "$3" | openssl dgst -sha256 -hmac "$1" -binary | base64; }
|
||||
call() { # key secret method path body
|
||||
local key="$1" secret="$2" method="$3" path="$4" body="$5"
|
||||
local sig; sig=$(sign "$secret" "$method" "/api/v1${path%%\?*}")
|
||||
if [ "$method" = "GET" ]; then
|
||||
curl -s -X GET "$BASE$path" -H "Authorization: TCS $key:$sig"
|
||||
else
|
||||
curl -s -X "$method" "$BASE$path" -H "Authorization: TCS $key:$sig" \
|
||||
-H "Content-Type: application/json" -d "$body"
|
||||
fi
|
||||
}
|
||||
field() { echo "$1" | sed -n "s/.*\"$2\":\"\([^\"]*\)\".*/\1/p"; }
|
||||
|
||||
# 一条内容完整流转:title category fhash cp_id cp_name op_id op_name cdn
|
||||
flow() {
|
||||
local title="$1" cat="$2" fh="$3" cpid="$4" cpname="$5" opid="$6" opname="$7" cdn="$8"
|
||||
echo ">>> [$title] CP=$cpname"
|
||||
local reg; reg=$(call ak-cp sk-cp POST /content/register \
|
||||
"{\"title\":\"$title\",\"episode_count\":24,\"category\":\"$cat\",\"file_sha256\":\"$fh\",\"merkle_root\":\"mr-$fh\",\"perceptual_hash\":\"ph-$fh\",\"cp_media_id\":\"$cpid\",\"cp_name\":\"$cpname\"}")
|
||||
local rid ctid; rid=$(field "$reg" review_id); ctid=$(field "$reg" content_twin_id)
|
||||
|
||||
# CSPS 合规审核(发码前)
|
||||
call ak-reviewer sk-reviewer POST /content/csps-result \
|
||||
"{\"review_id\":\"$rid\",\"approved\":true,\"reviewer_id\":\"sxiptv-审核员01\"}" >/dev/null
|
||||
|
||||
# 审核通过后发码签发
|
||||
local iss; iss=$(call ak-regulator sk-regulator POST /content/issue \
|
||||
"{\"review_id\":\"$rid\",\"issuer\":\"陕西IPTV运营公司\"}")
|
||||
local ma cert; ma=$(field "$iss" ma_code); cert=$(field "$iss" certificate)
|
||||
echo " MA码: $ma"
|
||||
|
||||
call ak-reviewer sk-reviewer POST /content/ingest \
|
||||
"{\"ma_code\":\"$ma\",\"content_twin_id\":\"$ctid\",\"media_asset_id\":\"SXMEDIA-$fh\",\"lib_name\":\"陕西IPTV媒体资源库\"}" >/dev/null
|
||||
call ak-reviewer sk-reviewer POST /content/publish \
|
||||
"{\"ma_code\":\"$ma\",\"certificate\":\"$cert\"}" >/dev/null
|
||||
local inj; inj=$(call ak-operator sk-operator POST /content/inject \
|
||||
"{\"content_twin_id\":\"$ctid\",\"ma_code\":\"$ma\",\"file_sha256\":\"$fh\",\"operator_id\":\"$opid\",\"cdn_endpoint\":\"$cdn\"}")
|
||||
echo " 运营商: $opname 注入: $(field "$inj" distribution_id)"
|
||||
echo "$ma" >> /tmp/tcs_demo_macodes.txt
|
||||
}
|
||||
|
||||
: > /tmp/tcs_demo_macodes.txt
|
||||
|
||||
flow "长安少年行" WD "fh-changan-001" \
|
||||
"XAQJSL-2026-001" "西安曲江丝路文化传播有限公司" \
|
||||
"CT-SX-IPTV" "中国电信陕西公司(天翼高清)" "cdn://ct-sx/iptv/vod/changan001"
|
||||
|
||||
flow "白鹿原·麦客" WJ "fh-bailuyuan-002" \
|
||||
"SWTYD-2026-007" "陕文投艺达影视有限公司" \
|
||||
"CM-SX-IPTV" "中国移动陕西公司(魔百和)" "cdn://cm-sx/iptv/vod/bailuyuan002"
|
||||
|
||||
flow "丝路驼铃" DY "fh-silu-003" \
|
||||
"XIYING-2026-015" "西部电影集团(西影视频)" \
|
||||
"CU-SX-IPTV" "中国联通陕西公司" "cdn://cu-sx/iptv/vod/silu003"
|
||||
|
||||
echo ""
|
||||
echo "=== 已生成 MA 码(可复制到监管大屏查询)==="
|
||||
cat /tmp/tcs_demo_macodes.txt
|
||||
echo ""
|
||||
echo "提示:在 http://localhost:5174 输入上述任一 MA 码查询全链路三方映射。"
|
||||
Reference in New Issue
Block a user