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.
 
 
 

25 lines
519 B

  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. }