Documentation ¶
Index ¶
Constants ¶
View Source
const (
// DGBaseURL api基础路由
DGBaseURL = "https://openplatform.dg-work.cn"
)
Variables ¶
This section is empty.
Functions ¶
func ComputeHmac256 ¶
ComputeHmac256 ComputeHmac256
func GetFirstMacAddress ¶
func GetFirstMacAddress() (macAddress string)
GetFirstMacAddress 获取本机的MAC地址
Types ¶
type Cache ¶
type Cache interface { Get(key string) interface{} GetMulti(keys []string) []interface{} Put(key string, val interface{}, timeout time.Duration) error Delete(key string) error Incr(key string) error Decr(key string) error IsExist(key string) bool ClearAll() error StartAndGC(config string) error }
Cache Cache
type Client ¶
type Client struct { AppKey string AppSecret string CacheToken Token // contains filtered or unexported fields }
Client 主要处理Client
func (*Client) GetToken ¶
GetToken 获取access_token 应该全局缓存该token,不能频繁刷新 https://openplatform-portal.dg-work.cn/#/docs?apiType=serverapi&docKey=2674862
func (*Client) GetUserInfo ¶
GetUserInfo 获取成员详情
func (*Client) RefreshToken ¶
RefreshToken 刷新access_token
type CommonReply ¶
type CommonReply struct { RequestId string `json:"_RequestId"` Success bool `json:"success"` Content *Content `json:"content"` Message string `json:"Message"` //sucess为false返回以下字段 ErrorCode string `json:"errorCode"` HostId string `json:"HostId"` Code string `json:"Code"` BizErrorCode string `json:"bizErrorCode"` ErrorMsg string `json:"errorMsg"` ErrorLevel string `json:"errorLevel"` }
CommonReply CommonReply
func (CommonReply) GetData ¶
func (rep CommonReply) GetData() (data interface{}, err error)
GetData GetData
type Content ¶
type Content struct { Success bool `json:"success"` Data interface{} `json:"data"` ResponseMessage string `json:"responseMessage"` ResponseCode string `json:"responseCode"` }
Content Content
type Token ¶
type Token struct { ExpiresIn int `json:"expiresIn"` // 过期时间 AccessToken string `json:"accessToken"` // 获取到的凭证 }
Token Token
type UserInfo ¶
type UserInfo struct { Account string `json:"account"` // 账号名 AccountID int64 `json:"accountId"` // 账号id ClientId string `json:"clientId"` // 应用名 EmployeeCode string `json:"employeeCode"` // 租户下人员编码 NameSpace string `json:"namespace"` // 账号类型 NickNameCn string `json:"nickNameCn"` // 昵称 RealmId int64 `json:"realmId"` // 租户id RealmName string `json:"realmName"` // 租户名称 LastName string `json:"lastName"` // 姓名 OpenID string `json:"openid"` // 应用+用户唯一标识 TenantUserId string `json:"tenantUserId"` // 租户+用户唯一标识 }
UserInfo UserInfo
Click to show internal directories.
Click to hide internal directories.