租户库共库分表实现

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
+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