|
- package arkid
-
- import (
- "applet/app/cfg"
- "applet/app/utils"
- "applet/app/utils/cache"
- )
-
- // Init is cache token to redis
- func Init() (*ArkIDUser, error) {
- arkidsdk := NewArkID()
- arkadmin := new(ArkIDUser)
- err := arkidsdk.SelectFunction("arkid_login").WithArgs(RequestBody{
- Username: cfg.ArkID.Admin,
- Password: cfg.ArkID.AdminPassword,
- }).Result(arkadmin)
- if err != nil {
- panic(err)
- }
-
- // token 默认30天过期
- cache.SetEx(ARKID_ADMIN_TOKEN, utils.Serialize(arkadmin), 2592000)
- return arkadmin, err
- }
|