-
Notifications
You must be signed in to change notification settings - Fork 0
/
app-key.go
48 lines (38 loc) · 1.07 KB
/
app-key.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
package component_shipinlv
import (
"errors"
"fmt"
//component_shipinlv_lib "component_shipinlv/lib"
component_shipinlv_lib "github.com/tangwenru/go-component-shipinlv/lib"
)
type AppKey struct {
}
type AppKeyDetailResult struct {
Success bool `json:"success"`
Message string `json:"message"`
Code string `json:"code"`
Data AppKeyDetail `json:"data"`
}
type AppKeyDetail struct {
KeyType string `json:"keyType"`
AppKey string `json:"appKey"`
AppSecret string `json:"appSecret"`
}
func init() {
}
func (this *AppKey) DetailByUserId(userId int64, keyType string) (*AppKeyDetail, error) {
appKeyDetailResult := AppKeyDetailResult{}
query := map[string]string{
"keyType": keyType,
}
_, err := component_shipinlv_lib.MainSystem(userId, "appKey/detail", &query, &appKeyDetailResult)
appKeyDetail := AppKeyDetail{}
if err != nil {
fmt.Println("app key info err:", err)
return &appKeyDetail, err
}
if !appKeyDetailResult.Success {
return &appKeyDetail, errors.New(appKeyDetailResult.Message)
}
return &appKeyDetailResult.Data, err
}