This commit is contained in:
oneao committed 2025-08-14 21:45:18 +08:00
1 parent 4e42a01b97
commit 428d370874
8 files changed
+84 -44

No files matched your search

@@ -2,8 +2,8 @@ package db
import (
"base-framework/pkg/config"
"base-framework/pkg/reponse"
"base-framework/pkg/router"
"base-framework/pkg/utils/response"
"database/sql"
"fmt"
)
@@ -18,19 +18,19 @@ func NewClient(c *router.Context) *Client {
val, ok := c.Get("orgId")
fmt.Println(val)
if !ok {
response.Error(c).Code(response.CodeInvalidOrgCode).Send()
reponse.Error(c).Code(reponse.CodeInvalidOrgCode).Send()
return nil
}
orgId, ok := val.(string)
if !ok || orgId == "" {
response.Error(c).Code(response.CodeInvalidOrgCode).Send()
reponse.Error(c).Code(reponse.CodeInvalidOrgCode).Send()
return nil
}
conn, ok := config.GetDB(orgId)
if !ok || conn == nil {
response.Error(c).Code(response.CodeInvalidOrgCode).Send()
reponse.Error(c).Code(reponse.CodeInvalidOrgCode).Send()
return nil
}