sync: 同步 v1.0.4 开源代码并脱敏
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# 电信 v1 现状、v3 并行接入与切换
|
||||
|
||||
调查日期:2026-10-10。代码依据为当前本地三个服务仓库;数据库通过 DBX 只读查询 `开发环境(192.0.2.29).db_iotlcm`。未修改数据库、未部署、未调用电信真实查询或操作接口。
|
||||
调查日期:2026-10-10。代码依据为当前本地三个服务仓库;数据库通过 DBX 只读查询 `开发环境(127.0.0.1).db_iotlcm`。未修改数据库、未部署、未调用电信真实查询或操作接口。
|
||||
|
||||
接口依据:用户提供的《中国电信天翼物联5GCMP能力调用参考文档-V3.pdf》,464 页,封面版本 `V3.2026.1.7`;《iotlcm上游API静态审计明细(41条审计记录).xlsx》,其中 21 条为电信记录,其余为移动记录。推荐路径以 PDF 接口定义为准;示例与参数表冲突的地方单独记录。
|
||||
|
||||
|
||||
Regular → Executable
+5
-5
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# 物联网卡卡状态查询 — 请求体与 internal/model/sim_chan_api.go 中 SimCardStatusInput 一致(simKeys)
|
||||
# 参数说明见 docs/测试资源.md
|
||||
# 请仅使用获得授权的测试卡
|
||||
# 用法:在工程根目录执行
|
||||
# chmod +x docs/scripts/query_sim_card_status.sh
|
||||
# ./docs/scripts/query_sim_card_status.sh
|
||||
@@ -12,11 +12,11 @@ BASE_URL="${BASE_URL:-http://127.0.0.1:8110}"
|
||||
PATH_QUERY="/query/sim-status"
|
||||
CHAN_KEY="${CHAN_KEY:-YiDong_EC}"
|
||||
|
||||
if [[ -n "${ICCID:-}" ]]; then
|
||||
IFS=',' read -r -a ICCIDS <<< "${ICCID}"
|
||||
else
|
||||
ICCIDS=("898604F4152391115473" "898604F4152391115474")
|
||||
if [[ -z "${ICCID:-}" ]]; then
|
||||
echo "请设置 ICCID(仅获授权的测试卡)" >&2
|
||||
exit 2
|
||||
fi
|
||||
IFS=',' read -r -a ICCIDS <<< "${ICCID}"
|
||||
|
||||
json_simkeys="["
|
||||
sep=""
|
||||
|
||||
Regular → Executable
+6
-6
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# 查询 SIM 卡会话 — 请求体与 internal/model/sim_chan_api.go 中 SimSessionInput 一致(simKeys)
|
||||
# 参数说明见 docs/测试资源.md
|
||||
# 请仅使用获得授权的测试卡
|
||||
# 用法:在工程根目录执行
|
||||
# chmod +x docs/scripts/query_sim_session.sh
|
||||
# ./docs/scripts/query_sim_session.sh
|
||||
@@ -12,12 +12,12 @@ BASE_URL="${BASE_URL:-http://127.0.0.1:8110}"
|
||||
PATH_QUERY="/query/sim-session"
|
||||
CHAN_KEY="${CHAN_KEY:-YiDong_EC}"
|
||||
|
||||
# 默认 ICCID 来自测试资源(两张移动卡)
|
||||
if [[ -n "${ICCID:-}" ]]; then
|
||||
IFS=',' read -r -a ICCIDS <<< "${ICCID}"
|
||||
else
|
||||
ICCIDS=("898604F4152391115473" "898604F4152391115474")
|
||||
# 不内置真实卡号;调用者必须提供 ICCID
|
||||
if [[ -z "${ICCID:-}" ]]; then
|
||||
echo "请设置 ICCID(仅获授权的测试卡)" >&2
|
||||
exit 2
|
||||
fi
|
||||
IFS=',' read -r -a ICCIDS <<< "${ICCID}"
|
||||
|
||||
json_simkeys="["
|
||||
sep=""
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
-- Migration guide for the shared-token template split.
|
||||
-- Review rows before running against a production database. This script does
|
||||
-- not move or retain Henan Lelian credentials.
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
-- 1. Inspect the archived template and its channels.
|
||||
SELECT temp_key, temp_model, temp_config
|
||||
FROM t_sim_channel_template
|
||||
WHERE temp_key = 'sim_onelink_shared_v5';
|
||||
|
||||
SELECT chan_key, chan_config, chan_status
|
||||
FROM t_sim_channels
|
||||
WHERE temp_key = 'sim_onelink_shared_v5';
|
||||
|
||||
-- 2. Seed the new templates first (see seed_onelink_shared_channel.sql),
|
||||
-- then migrate only Tengyu rows after reviewing their provider value.
|
||||
-- The JSON functions require MySQL 5.7+ and intentionally preserve only the
|
||||
-- channel credentials. Public API/provider settings live in the new template.
|
||||
UPDATE t_sim_channels
|
||||
SET temp_key = 'sim_onelink_tengyu_v1',
|
||||
chan_config = JSON_OBJECT(
|
||||
'credentials', JSON_OBJECT(
|
||||
'pwdKey', JSON_UNQUOTE(JSON_EXTRACT(chan_config, '$.auth.pwdKey')),
|
||||
'channelNo', JSON_UNQUOTE(JSON_EXTRACT(chan_config, '$.auth.channelNo'))
|
||||
)
|
||||
)
|
||||
WHERE temp_key = 'sim_onelink_shared_v5'
|
||||
AND LOWER(JSON_UNQUOTE(JSON_EXTRACT(chan_config, '$.auth.provider'))) = 'tengyu';
|
||||
|
||||
-- 3. Henan Lelian rows must be disabled and manually migrated or removed.
|
||||
UPDATE t_sim_channels
|
||||
SET chan_status = 0
|
||||
WHERE temp_key = 'sim_onelink_shared_v5'
|
||||
AND LOWER(JSON_UNQUOTE(JSON_EXTRACT(chan_config, '$.auth.provider'))) = 'henan_lelian';
|
||||
|
||||
-- 4. After all rows are reviewed and migrated, remove the archived template.
|
||||
-- DELETE FROM t_sim_channel_template WHERE temp_key = 'sim_onelink_shared_v5';
|
||||
@@ -0,0 +1,65 @@
|
||||
-- Shared OneLink template/channel examples. Token endpoint and credentials
|
||||
-- belong to the shared-token template configuration.
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
INSERT INTO `t_sim_channel_template` (
|
||||
`temp_key`, `temp_name`, `temp_model`, `temp_config`, `temp_status`,
|
||||
`tenant_id`, `created_dept`, `created_by`, `updated_by`
|
||||
) VALUES (
|
||||
'sim_onelink_tengyu_v1',
|
||||
'Tengyu shared OneLink token v1',
|
||||
'shared_token',
|
||||
'{"token":{"provider":"tengyu","baseUrl":"http://www.sdtywl.cn/","path":"/prod-api/open/api/oneLinkToken"}}',
|
||||
1, '000000', 103, 1, 1
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`temp_name` = VALUES(`temp_name`), `temp_model` = VALUES(`temp_model`),
|
||||
`temp_config` = VALUES(`temp_config`), `temp_status` = VALUES(`temp_status`),
|
||||
`updated_by` = VALUES(`updated_by`);
|
||||
|
||||
INSERT INTO `t_sim_channels` (
|
||||
`temp_key`, `chan_key`, `chan_name`, `chan_config`, `chan_status`,
|
||||
`chan_alias`, `region_code`, `app_key`, `app_secret`, `access_token`,
|
||||
`refresh_token`, `tenant_id`, `created_dept`, `created_by`, `updated_by`
|
||||
) VALUES (
|
||||
'sim_onelink_tengyu_v1',
|
||||
'OneLink_TENGYU_EXAMPLE',
|
||||
'OneLink Tengyu shared-token example',
|
||||
'{"credentials":{"pwdKey":"REPLACE_WITH_PWDKEY","channelNo":"REPLACE_WITH_CHANNEL_NO"}}',
|
||||
1, '', '', '', '', '', '', '000000', 103, 1, 1
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`temp_key` = VALUES(`temp_key`), `chan_key` = VALUES(`chan_key`),
|
||||
`chan_config` = VALUES(`chan_config`), `chan_status` = VALUES(`chan_status`),
|
||||
`updated_by` = VALUES(`updated_by`);
|
||||
|
||||
INSERT INTO `t_sim_channel_template` (
|
||||
`temp_key`, `temp_name`, `temp_model`, `temp_config`, `temp_status`,
|
||||
`tenant_id`, `created_dept`, `created_by`, `updated_by`
|
||||
) VALUES (
|
||||
'sim_onelink_xuzhou_mobile_v1',
|
||||
'Xuzhou Mobile shared OneLink token v1',
|
||||
'shared_token',
|
||||
'{"token":{"provider":"xuzhou_mobile","baseUrl":"http://iot.yuanjianiot.com","path":"/admin/api/get/token","carrierType":1}}',
|
||||
1, '000000', 103, 1, 1
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`temp_name` = VALUES(`temp_name`), `temp_model` = VALUES(`temp_model`),
|
||||
`temp_config` = VALUES(`temp_config`), `temp_status` = VALUES(`temp_status`),
|
||||
`updated_by` = VALUES(`updated_by`);
|
||||
|
||||
INSERT INTO `t_sim_channels` (
|
||||
`temp_key`, `chan_key`, `chan_name`, `chan_config`, `chan_status`,
|
||||
`chan_alias`, `region_code`, `app_key`, `app_secret`, `access_token`,
|
||||
`refresh_token`, `tenant_id`, `created_dept`, `created_by`, `updated_by`
|
||||
) VALUES (
|
||||
'sim_onelink_xuzhou_mobile_v1',
|
||||
'OneLink_XUZHOU_MOBILE_EXAMPLE',
|
||||
'OneLink Xuzhou Mobile shared-token example',
|
||||
'{"credentials":{"appId":"REPLACE_WITH_APP_ID"}}',
|
||||
1, '', '', '', '', '', '', '000000', 103, 1, 1
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`temp_key` = VALUES(`temp_key`), `chan_name` = VALUES(`chan_name`),
|
||||
`chan_config` = VALUES(`chan_config`), `chan_status` = VALUES(`chan_status`),
|
||||
`updated_by` = VALUES(`updated_by`);
|
||||
@@ -0,0 +1,100 @@
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
-- 腾宇(综合充值平台)通道初始化。
|
||||
-- 字段复用约定(internal/logic/upstreamimpl/sim_recharge.go):
|
||||
-- t_sim_channels.app_key = pwdkey(个人中心 > 密钥 Key)
|
||||
-- t_sim_channels.app_secret = pwdiv(签名 IV,sign=md5(pwdkey+pwdiv+timestamp))
|
||||
-- 执行前必须替换以下三个占位符。
|
||||
SET @recharge_pwdkey = 'REPLACE_WITH_PWDKEY';
|
||||
SET @recharge_pwdiv = 'REPLACE_WITH_PWDIV_OR_IV';
|
||||
SET @recharge_chan_key = 'REPLACE_WITH_LOCAL_CHAN_KEY';
|
||||
|
||||
-- 上线前需在腾宇后台配置网关出口 IP 白名单,否则上游返回 407。
|
||||
-- 上游单接口限流 60 次/分;全量同步触发 429 时由下轮重试兜底。
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
INSERT INTO `t_sim_channel_template` (
|
||||
`temp_key`,
|
||||
`temp_name`,
|
||||
`temp_model`,
|
||||
`temp_config`,
|
||||
`temp_status`,
|
||||
`tenant_id`,
|
||||
`created_dept`,
|
||||
`created_by`,
|
||||
`updated_by`
|
||||
) VALUES (
|
||||
'sim_recharge_sdtywl_v1',
|
||||
'综合充值平台 API',
|
||||
'{}',
|
||||
'{"baseUrl":"http://www.sdtywl.cn/"}',
|
||||
0,
|
||||
'000000',
|
||||
100,
|
||||
1,
|
||||
1
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`temp_name` = VALUES(`temp_name`),
|
||||
`temp_model` = VALUES(`temp_model`),
|
||||
`temp_config` = VALUES(`temp_config`),
|
||||
`temp_status` = VALUES(`temp_status`),
|
||||
`updated_by` = VALUES(`updated_by`);
|
||||
|
||||
INSERT INTO `t_sim_channels` (
|
||||
`temp_key`,
|
||||
`chan_key`,
|
||||
`chan_name`,
|
||||
`chan_config`,
|
||||
`chan_status`,
|
||||
`chan_alias`,
|
||||
`region_code`,
|
||||
`app_key`,
|
||||
`app_secret`,
|
||||
`access_token`,
|
||||
`access_token_created`,
|
||||
`access_token_expire`,
|
||||
`refresh_token`,
|
||||
`login_url`,
|
||||
`tenant_id`,
|
||||
`created_dept`,
|
||||
`created_by`,
|
||||
`updated_by`
|
||||
) VALUES (
|
||||
'sim_recharge_sdtywl_v1',
|
||||
@recharge_chan_key,
|
||||
'仟所腾宇',
|
||||
'{}',
|
||||
0,
|
||||
'腾宇',
|
||||
'',
|
||||
@recharge_pwdkey,
|
||||
@recharge_pwdiv,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
'http://www.sdtywl.cn/',
|
||||
'000000',
|
||||
100,
|
||||
1,
|
||||
1
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`temp_key` = VALUES(`temp_key`),
|
||||
`chan_name` = VALUES(`chan_name`),
|
||||
`chan_config` = VALUES(`chan_config`),
|
||||
`chan_status` = VALUES(`chan_status`),
|
||||
`chan_alias` = VALUES(`chan_alias`),
|
||||
`region_code` = VALUES(`region_code`),
|
||||
`app_key` = VALUES(`app_key`),
|
||||
`app_secret` = VALUES(`app_secret`),
|
||||
`access_token` = NULL,
|
||||
`access_token_created` = NULL,
|
||||
`access_token_expire` = NULL,
|
||||
`refresh_token` = NULL,
|
||||
`login_url` = VALUES(`login_url`),
|
||||
`updated_by` = VALUES(`updated_by`);
|
||||
|
||||
COMMIT;
|
||||
@@ -0,0 +1,19 @@
|
||||
-- Public protocol configuration for the built-in templates.
|
||||
-- Run after the corresponding template rows exist.
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
INSERT INTO t_sim_channel_template
|
||||
(temp_key, temp_name, temp_model, temp_config, temp_status, tenant_id, created_dept, created_by, updated_by)
|
||||
VALUES
|
||||
('sim_yd_v5', 'China Mobile OneLink v5', 'direct',
|
||||
'{"api":{"baseUrl":"https://api.iot.10086.cn/v5/","timeout":"10s"},"token":{"path":"/ec/get/token"}}',
|
||||
1, '000000', 103, 1, 1),
|
||||
('sim_yd_mock_v5', 'China Mobile OneLink mock v5', 'direct',
|
||||
'{"api":{"baseUrl":"http://iotlcm.example.com/onelink-mock/v5/"}}',
|
||||
1, '000000', 103, 1, 1),
|
||||
('sim_dx_v1', 'China Telecom API v1', 'direct',
|
||||
'{"api":{"baseUrl":"https://cmp-api.ctwing.cn:20164"}}',
|
||||
1, '000000', 103, 1, 1)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
temp_model = VALUES(temp_model), temp_config = VALUES(temp_config),
|
||||
temp_status = VALUES(temp_status), updated_by = VALUES(updated_by);
|
||||
Reference in New Issue
Block a user