push_ticket.go 1.0KB

12345678910111213141516171819202122232425262728293031323334
  1. /**
  2. * Copyright (c) 2022 Yansen Zhang
  3. * wxcomponent is licensed under Mulan PSL v2.
  4. * You can use this software according to the terms and conditions of the Mulan PSL v2.
  5. * You may obtain a copy of Mulan PSL v2 at:
  6. * http://license.coscl.org.cn/MulanPSL2
  7. * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  8. * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  9. * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  10. * See the Mulan PSL v2 for more details.
  11. **/
  12. package authorization
  13. import (
  14. "gitee.com/yansen_zh/wxcomponent/config"
  15. "gitee.com/yansen_zh/wxcomponent/utils/request"
  16. )
  17. const (
  18. apiStartPushTicket = "https://apies.weixin.qq.com/cgi-bin/component/api_start_push_ticket"
  19. )
  20. // StartPushTicket 启动 ticket 推送服务
  21. func StartPushTicket() error {
  22. data := map[string]string{
  23. "component_appid": config.GetAppID(),
  24. "component_secret": config.GetAppSecret(),
  25. }
  26. _, err := request.PostJSON(apiStartPushTicket, nil, data)
  27. return err
  28. }