租户库共库分表实现

This commit is contained in:
richjohnrambo
2026-09-23 09:36:17 +08:00
parent 137d6fb6da
commit 7c1fab5065
4 changed files with 131 additions and 27 deletions
+9 -8
View File
@@ -196,7 +196,7 @@ func (a *audit) run() {
a.testHTTP("5", "5.qr-resolve", "二维码解析", "POST", "/v1/im/qrcodes/resolve", map[string]any{"token": a.meQR, "purpose": a.meQRPurpose}, a.tokenB, true, []int{200}, nil)
}
a.testHTTP("6", "6.create", "创建群", "POST", "/v1/im/groups", map[string]any{"name": "联调群" + suffix, "description": "自动化测试群", "member_user_ids": []string{a.userB}, "avatar_file_id": ""}, a.tokenA, true, []int{200}, func(r imResp) string {
a.testHTTP("6", "6.create", "创建群", "POST", "/v1/im/groups", map[string]any{"name": "auditgroup" + suffix, "description": "audit group", "member_user_ids": []string{a.userB}, "avatar_file_id": ""}, a.tokenA, true, []int{200}, func(r imResp) string {
a.groupTopic = asString(r.Data["topic"])
a.groupVer = asInt(r.Data["version"])
return fmt.Sprintf("topic=%s version=%d", a.groupTopic, a.groupVer)
@@ -446,13 +446,14 @@ func (a *audit) wsRegister(username, phone, password, challenge, verification st
accID := "acc-" + username
secret := base64.StdEncoding.EncodeToString([]byte(username + ":" + password))
err = conn.WriteJSON(map[string]any{"acc": map[string]any{
"id": accID,
"user": "new",
"scheme": "basic",
"username": username,
"phone": phone,
"secret": secret,
"login": true,
"id": accID,
"user": "new",
"scheme": "basic",
"username": username,
"phone": phone,
"registration_type": 1,
"secret": secret,
"login": true,
"cred": []map[string]any{{
"meth": "tel",
"val": phone,
+14 -12
View File
@@ -637,13 +637,14 @@ func (a *audit) register(username, phone, password string) (string, string, erro
id := "acc-" + username
secret := base64.StdEncoding.EncodeToString([]byte(username + ":" + password))
if err = c.write(map[string]any{"acc": map[string]any{
"id": id,
"user": "new",
"scheme": "basic",
"username": username,
"phone": phone,
"secret": secret,
"login": true,
"id": id,
"user": "new",
"scheme": "basic",
"username": username,
"phone": phone,
"registration_type": 1,
"secret": secret,
"login": true,
"cred": []map[string]any{{
"meth": "tel",
"val": phone,
@@ -724,8 +725,8 @@ func (a *audit) createFriendship() (string, error) {
func (a *audit) createGroup(suffix string) (string, error) {
status, r, err := a.call("POST", "/v1/im/groups", map[string]any{
"name": "WS协议群" + suffix,
"description": "WS audit group",
"name": "auditgroup" + suffix,
"description": "audit group",
"member_user_ids": []string{a.userB},
"avatar_file_id": "",
}, a.tokenA)
@@ -827,9 +828,10 @@ func (a *audit) openBasicLoggedIn(name, username, password string) (*wsClient, e
loginID := "login-" + strings.ToLower(name)
secret := base64.StdEncoding.EncodeToString([]byte(username + ":" + password))
if err = c.write(map[string]any{"login": map[string]any{
"id": loginID,
"scheme": "basic",
"secret": secret,
"id": loginID,
"scheme": "basic",
"login_type": 1,
"secret": secret,
}}); err != nil {
_ = c.conn.Close()
return nil, err