diff --git a/internal/demo/register/login.go b/internal/demo/register/login.go index 628828f4a..bc2605e08 100644 --- a/internal/demo/register/login.go +++ b/internal/demo/register/login.go @@ -5,14 +5,13 @@ import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/log" + "Open_IM/pkg/utils" "bytes" "encoding/json" "fmt" + "github.com/gin-gonic/gin" "io/ioutil" "net/http" - - "github.com/gin-gonic/gin" - "github.com/spf13/viper" ) type ParamsLogin struct { @@ -89,7 +88,7 @@ func Login(c *gin.Context) { } func OpenIMToken(Account string, platform int32) (*http.Response, error) { - url := fmt.Sprintf("http://%s:10000/auth/user_token", viper.GetString("endpoints.api")) + url := fmt.Sprintf("http://%s:10000/auth/user_token", utils.ServerIP) client := &http.Client{} params := make(map[string]interface{}) diff --git a/internal/demo/register/set_password.go b/internal/demo/register/set_password.go index abd2358c2..7dca79dc6 100644 --- a/internal/demo/register/set_password.go +++ b/internal/demo/register/set_password.go @@ -6,15 +6,14 @@ import ( "Open_IM/pkg/common/db" "Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/log" + "Open_IM/pkg/utils" "bytes" "encoding/json" "fmt" - "io/ioutil" - "net/http" - "github.com/garyburd/redigo/redis" "github.com/gin-gonic/gin" - "github.com/spf13/viper" + "io/ioutil" + "net/http" ) type ParamsSetPassword struct { @@ -120,7 +119,7 @@ openIMRegisterTab: } func OpenIMRegister(account string) (*http.Response, error) { - url := fmt.Sprintf("http://%s:10000/auth/user_register", viper.GetString("endpoints.api")) + url := fmt.Sprintf("http://%s:10000/auth/user_register", utils.ServerIP) fmt.Println("1:", config.Config.Secret) client := &http.Client{}