chore: 初始开源发布

iotlcm-upstream-chan:运营商上游通道适配服务(统一 /sim/* 协议)。

- 内联原私有依赖:yunze-public → internal/pub/(10 包 18 文件),
  yunze-pb/pb → internal/pb/(9 文件);Consul 注册改用官方
  gogf/gf/contrib/registry/consul/v2(API 兼容)
- Go module:yz-svr → git.5iot.com/iotlcm-public/iotlcm-upstream-chan
- 修复 mingqian 包测试:实现重构后 `adapter.operations` 字段已移除,
  测试断言按当前实现语义重写(不改产品行为)
- 凭据与内部标识脱敏:MySQL/Redis/Consul 凭据、私网与生产 IP、
  内网域名、真实手机号、注释里的真实 token/transid
- 移除内部资产:CI 触发器、生产通道种子 SQL、真实凭据测试资源文档
- Dockerfile 改用公共基础镜像,移除写死的 registry 凭据
- 补 Apache-2.0 LICENSE,重写 README,LF 行尾 + .gitattributes
This commit is contained in:
MiFaZhan
2026-10-22 15:42:29 +08:00
commit 96b1edff45
191 changed files with 30805 additions and 0 deletions
@@ -0,0 +1,64 @@
package upstreamimpl
import (
"context"
"testing"
)
func TestYundaMonthAndDate(t *testing.T) {
tests := []struct {
input string
month string
date string
}{
{input: "20260921", month: "2026-09", date: "2026-09-21"},
{input: "2026-09-21", month: "2026-09", date: "2026-09-21"},
}
for _, test := range tests {
month, date, err := yundaMonthAndDate(test.input)
if err != nil || month != test.month || date != test.date {
t.Fatalf("input=%s month=%s date=%s err=%v", test.input, month, date, err)
}
}
}
func TestYundaMonthAndDateRejectsInvalidValue(t *testing.T) {
if _, _, err := yundaMonthAndDate("202609"); err == nil {
t.Fatal("expected invalid daily date")
}
}
func TestMapYundaCardStatus(t *testing.T) {
for _, tc := range []struct {
input string
want int
}{
{"0", 6}, {"1", 1}, {"2", 7}, {"3", 2}, {"正使用", 2}, {"4", 4}, {"已停机", 4}, {"5", 9}, {"已销户", 9},
} {
got, err := mapYundaCardStatus(tc.input)
if err != nil || got != tc.want {
t.Fatalf("mapYundaCardStatus(%q) = %d, %v; want %d", tc.input, got, err, tc.want)
}
}
if _, err := mapYundaCardStatus("unknown"); err == nil {
t.Fatal("expected unsupported Yunda status to return an error")
}
}
func TestTelecomCardStatusSourcesDiffer(t *testing.T) {
if got := convertDxCardStatus(context.Background(), "3"); got != 7 {
t.Fatalf("single-card product state 3 = %d, want inventory 7", got)
}
if got := convertDXBatchCardStatus(context.Background(), "3"); got != 6 {
t.Fatalf("BQ018 test deactivation 3 = %d, want testable 6", got)
}
if got := mapDXBatchInfoToBasicInfo(dxBatchInfoItem{SimStatus: "4"}).SimStatus; got != "2" {
t.Fatalf("BQ018 in-use state 4 = %q, want activated 2", got)
}
}
func TestMapDXLegacyBasicStatusKeepsMissingValueEmpty(t *testing.T) {
if got := mapDXLegacyBasicStatus(context.Background(), ""); got != "" {
t.Fatalf("missing telecom status = %q, want empty", got)
}
}