-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.go
54 lines (44 loc) · 1.26 KB
/
user.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package component_ktv_ai
import (
"errors"
"fmt"
//component_ktv_ai_lib "component_ktv_ai/lib"
component_ktv_ai_lib "github.com/tangwenru/go-component-ktv-ai/lib"
)
type User struct {
}
type UserDetailResult struct {
Success bool `json:"success"`
Message string `json:"message"`
Code string `json:"code"`
Data UserDetail `json:"data"`
}
type UserDetail struct {
Id int64 `json:"id"`
AccountName string `json:"accountName"`
Nickname string `json:"nickname"`
AvatarUrl string `json:"avatarUrl"`
Enabled bool `json:"enabled"`
Expired int64 `json:"expired"`
WebSid string `json:"webSid"`
Role string `json:"role"`
AppSid string `json:"appSid"`
ClientSid string `json:"clientSid"`
Created int64 `json:"created"`
}
func init() {
}
func (this *User) Detail(userId int64) (error, *UserDetail) {
userDetailResult := UserDetailResult{}
query := map[string]string{}
_, err := component_ktv_ai_lib.MainSystem(userId, "user/info", &query, &userDetailResult)
userDetail := UserDetail{}
if err != nil {
fmt.Println("user info err:", err)
return err, &userDetail
}
if !userDetailResult.Success {
return errors.New(userDetailResult.Message), &userDetail
}
return err, &userDetailResult.Data
}