1 Star 0 Fork 0

carlmax_my/console-core-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
authing_login.go 3.17 KB
一键复制 编辑 原始数据 按行查看 历史
carlmax_my 提交于 2024-12-02 21:32 . init project
package authing_v2
import (
"fmt"
"net/http"
jsoniter "github.com/json-iterator/go"
)
func (a *AuthingCli) PostAccountLogin(appId, tenantId string, payload interface{}) (interface{}, error) {
url := "/api/v2/login/account"
b, err := SendHttpRestRequest_fix(a.Cli, a.Cli.Host, url, http.MethodPost, payload, appId, tenantId, a.UserPoolId)
if err != nil {
return false, err
}
var resp map[string]interface{}
e := jsoniter.Unmarshal(b, &resp)
return &resp, e
}
func (a *AuthingCli) PostPhoneCodeLogin(appId, tenantId string, payload interface{}) (interface{}, error) {
url := "/api/v2/login/phone-code"
b, err := SendHttpRestRequest_fix(a.Cli, a.Cli.Host, url, http.MethodPost, payload, appId, tenantId, a.UserPoolId)
if err != nil {
return false, err
}
var resp map[string]interface{}
e := jsoniter.Unmarshal(b, &resp)
return &resp, e
}
func (a *AuthingCli) PostEmailCodeLogin(appId, tenantId string, payload interface{}) (interface{}, error) {
url := "/api/v2/login/email-code"
b, err := SendHttpRestRequest_fix(a.Cli, a.Cli.Host, url, http.MethodPost, payload, appId, tenantId, a.UserPoolId)
if err != nil {
return false, err
}
var resp map[string]interface{}
e := jsoniter.Unmarshal(b, &resp)
return &resp, e
}
func (a *AuthingCli) GetLoginStatus(appId, tenantId string, payload interface{}) (interface{}, error) {
url := "/api/v2/users/login/check-status"
b, err := SendHttpRestRequest_fix(a.Cli, a.Cli.Host, url, http.MethodPost, payload, appId, tenantId, a.UserPoolId)
if err != nil {
return false, err
}
var resp map[string]interface{}
e := jsoniter.Unmarshal(b, &resp)
return &resp, e
}
func (a *AuthingCli) GetMeInfo(appId, tenantId, authorization string) (interface{}, error) {
url := fmt.Sprintf("%s/api/v2/users/me", a.Cli.Host)
b, err := SendHttpRestRequest_with_auth(url, http.MethodGet, appId, tenantId, a.UserPoolId, authorization)
if err != nil {
return false, err
}
var resp map[string]interface{}
e := jsoniter.Unmarshal(b, &resp)
return &resp, e
}
func (a *AuthingCli) FindUserWhenLogin(appId, tenantId, key, loginType string) (interface{}, error) {
url := fmt.Sprintf("/api/v2/users/find?userPoolId=%s&key=%s&type=%s", a.UserPoolId, key, loginType)
b, err := SendHttpRestRequest_fix(a.Cli, a.Cli.Host, url, http.MethodGet, nil, appId, tenantId, a.UserPoolId)
if err != nil {
return false, err
}
var resp map[string]interface{}
e := jsoniter.Unmarshal(b, &resp)
return &resp, e
}
func (a *AuthingCli) SendEmailWhenLogin(appId, tenantId string, payload interface{}) (interface{}, error) {
url := "/api/v2/email/send"
b, err := SendHttpRestRequest_fix(a.Cli, a.Cli.Host, url, http.MethodPost, payload, appId, tenantId, a.UserPoolId)
if err != nil {
return false, err
}
var resp map[string]interface{}
e := jsoniter.Unmarshal(b, &resp)
return &resp, e
}
func (a *AuthingCli) SendSmsWhenLogin(appId, tenantId string, payload interface{}) (interface{}, error) {
url := "/api/v2/sms/send"
b, err := SendHttpRestRequest_fix(a.Cli, a.Cli.Host, url, http.MethodPost, payload, appId, tenantId, a.UserPoolId)
if err != nil {
return false, err
}
var resp map[string]interface{}
e := jsoniter.Unmarshal(b, &resp)
return &resp, e
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/carlmax_my/console-core-go.git
git@gitee.com:carlmax_my/console-core-go.git
carlmax_my
console-core-go
console-core-go
v0.0.10

搜索帮助

0d507c66 1850385 C8b1a773 1850385