golang 的 rabbitmq 消费项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

init.go 519 B

6 months ago
123456789101112131415161718192021222324
  1. package arkid
  2. import (
  3. "applet/app/cfg"
  4. "applet/app/utils"
  5. "applet/app/utils/cache"
  6. )
  7. // Init is cache token to redis
  8. func Init() (*ArkIDUser, error) {
  9. arkidsdk := NewArkID()
  10. arkadmin := new(ArkIDUser)
  11. err := arkidsdk.SelectFunction("arkid_login").WithArgs(RequestBody{
  12. Username: cfg.ArkID.Admin,
  13. Password: cfg.ArkID.AdminPassword,
  14. }).Result(arkadmin)
  15. if err != nil {
  16. panic(err)
  17. }
  18. // token 默认30天过期
  19. cache.SetEx(ARKID_ADMIN_TOKEN, utils.Serialize(arkadmin), 2592000)
  20. return arkadmin, err
  21. }