github.com/chanxuehong/wechat@v0.0.0-20230222024006-36f0325263cd/mp/poi/category.go (about)

     1  package poi
     2  
     3  import (
     4  	"github.com/chanxuehong/wechat/mp/core"
     5  )
     6  
     7  // CategoryList 获取门店类目表.
     8  func CategoryList(clt *core.Client) (list []string, err error) {
     9  	const incompleteURL = "https://api.weixin.qq.com/cgi-bin/api_getwxcategory?access_token="
    10  
    11  	var result struct {
    12  		core.Error
    13  		CategoryList []string `json:"category_list"`
    14  	}
    15  	if err = clt.GetJSON(incompleteURL, &result); err != nil {
    16  		return
    17  	}
    18  	if result.ErrCode != core.ErrCodeOK {
    19  		err = &result.Error
    20  		return
    21  	}
    22  	list = result.CategoryList
    23  	return
    24  }