├── .gitignore ├── LICENSE ├── README.md ├── client.go ├── client_test.go ├── go.mod ├── request ├── juitemssearch.go ├── sellercatslistget.go ├── shopcatslistget.go ├── shopgetbytitle.go ├── tbkactivitylinkget.go ├── tbkcouponget.go ├── tbkdgitemcouponget.go ├── tbkdgmaterialoptional.go ├── tbkdgnewuserorderget.go ├── tbkdgnewuserordersum.go ├── tbkdgoptimusmaterial.go ├── tbkitemconvert.go ├── tbkitemcouponget.go ├── tbkitemget.go ├── tbkiteminfoget.go ├── tbkitemrecommendget.go ├── tbkjutqgget.go ├── tbkprivilegeget.go ├── tbkscactivitylinktoolget.go ├── tbksccouponbrandrecommend.go ├── tbksccouponrealtimerecommend.go ├── tbkscinvitecodeget.go ├── tbkscmaterialoptional.go ├── tbkscnewuserorderget.go ├── tbkscnewuserordersum.go ├── tbkscoptimusmaterial.go ├── tbkscorderget.go ├── tbkscpublisherinfoget.go ├── tbkscpublisherinfosave.go ├── tbkshopconvert.go ├── tbkshopget.go ├── tbkshoprecommendget.go ├── tbkspreadget.go ├── tbktpwdconvert.go ├── tbktpwdcreate.go ├── tbkuatmfavoritesget.go ├── tbkuatmfavoritesitemget.go └── wirelesssharetpwdquery.go ├── response ├── juitemssearch.go ├── sellercatslistget.go ├── shopcatslistget.go ├── shopgetbytitle.go ├── tbkactivitylinkget.go ├── tbkcouponget.go ├── tbkdgitemcouponget.go ├── tbkdgmaterialoptional.go ├── tbkdgnewuserorderget.go ├── tbkdgnewuserordersum.go ├── tbkdgoptimusmaterial.go ├── tbkitemconvert.go ├── tbkitemcouponget.go ├── tbkitemget.go ├── tbkiteminfoget.go ├── tbkitemrecommendget.go ├── tbkjutqgget.go ├── tbkprivilegeget.go ├── tbkscactivitylinktoolget.go ├── tbksccouponbrandrecommend.go ├── tbksccouponrealtimerecommend.go ├── tbkscinvitecodeget.go ├── tbkscmaterialoptional.go ├── tbkscnewuserorderget.go ├── tbkscnewuserordersum.go ├── tbkscoptimusmaterial.go ├── tbkscorderget.go ├── tbkscpublisherinfoget.go ├── tbkscpublisherinfosave.go ├── tbkshopconvert.go ├── tbkshopget.go ├── tbkshoprecommendget.go ├── tbkspreadget.go ├── tbktpwdconvert.go ├── tbktpwdcreate.go ├── tbkuatmfavoritesget.go ├── tbkuatmfavoritesitemget.go ├── topresponse.go └── wirelesssharetpwdquery.go └── utils └── utils.go /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .DS_Store 3 | /test -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 leitao.zhang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 停止维护,建议使用 https://github.com/mimicode/tksdk 更全面 支持 拼多多、苏宁、唯品会、京东、淘宝 2 | 3 | # TAOBAO OPEN SDK 4 | 5 | ## Installation 6 | 7 | Download and install it: 8 | 9 | ```sh 10 | $ go get -u github.com/mimicode/taobaoopensdk 11 | ``` 12 | 13 | Import it in your code: 14 | 15 | ```go 16 | import "github.com/mimicode/taobaoopensdk" 17 | ``` 18 | 19 | Examples 20 | ``` 21 | appKey := "" 22 | appSecret := "" 23 | sessionKey := "" 24 | //初始化TopClient 25 | client := &TopClient{} 26 | client.Init(appKey, appSecret, sessionKey) 27 | 28 | //初始化请求接口信息 29 | getRequest := &request.TbkItemInfoGetRequest{} 30 | getRequest.AddParameter("num_iids", "583866215568,578307080718") 31 | getRequest.AddParameter("platform", "1") 32 | getRequest.AddParameter("ip", "11.22.33.43") 33 | //初始化结果类型 34 | var getResponse DefaultResponse = &response.TbkItemInfoGetResponse{} 35 | //执行请求接口得到结果 36 | err := client.Exec(getRequest, getResponse) 37 | if err != nil { 38 | t.Log(err) 39 | } else { 40 | tbkItemInfoGetResponse := getResponse.(*response.TbkItemInfoGetResponse) 41 | 42 | if tbkItemInfoGetResponse.IsError() { 43 | fmt.Println(tbkItemInfoGetResponse.Body) 44 | } else { 45 | items := tbkItemInfoGetResponse.TbkItemInfoGetResult.Results.NTbkItem 46 | for _, v := range items { 47 | fmt.Println(v.Title) 48 | } 49 | } 50 | 51 | } 52 | ``` 53 | 54 | API support list 55 | - [taobao.ju.items.search( 聚划算商品搜索接口 )](http://open.taobao.com/api.htm?docId=28762&docType=2&scopeId=11655) 56 | - [taobao.sellercats.list.get( 获取前台展示的店铺内卖家自定义商品类目 )](http://open.taobao.com/api.htm?docId=65&docType=2&scopeId=386) 57 | - [taobao.shopcats.list.get( 获取前台展示的店铺类目 )](http://open.taobao.com/api.htm?docId=64&docType=2&scopeId=386) 58 | - [taobao.shop.getbytitle( 根据店铺名称获取店铺信息 )](http://open.taobao.com/api.htm?docId=24852&docType=2&scopeId=386) 59 | - [taobao.tbk.activitylink.get( 淘宝联盟官方活动推广API-媒体 )](http://open.taobao.com/api.htm?docId=41918&docType=2&scopeId=11655) 60 | - [taobao.tbk.coupon.get( 阿里妈妈推广券信息查询 )](http://open.taobao.com/api.htm?docId=31106&docType=2&scopeId=11655) 61 | - [taobao.tbk.dg.item.coupon.get( 好券清单API【导购】 )](http://open.taobao.com/api.htm?docId=29821&docType=2&scopeId=11655) 62 | - [taobao.tbk.dg.material.optional( 通用物料搜索API(导购) )](http://open.taobao.com/api.htm?docId=35896&docType=2&scopeId=11655) 63 | - [taobao.tbk.dg.newuser.order.get( 淘宝客新用户订单API--导购 )](http://open.taobao.com/api.htm?docId=33892&docType=2&scopeId=11655) 64 | - [taobao.tbk.dg.newuser.order.sum( 拉新活动汇总API--导购 )](http://open.taobao.com/api.htm?docId=36836&docType=2&scopeId=11655) 65 | - [taobao.tbk.dg.optimus.material( 淘宝客物料下行-导购 )](http://open.taobao.com/api.htm?docId=33947&docType=2&scopeId=11655) 66 | - [taobao.tbk.item.convert( 淘宝客商品链接转换 )](http://open.taobao.com/api.htm?docId=24516&docType=2&scopeId=11653) 67 | - [taobao.tbk.item.coupon.get( 单品加券检索api )](http://open.taobao.com/api.htm?docId=28110&docType=2&scopeId=12332) 68 | - [taobao.tbk.item.get( 淘宝客商品查询 )](http://open.taobao.com/api.htm?docId=24515&docType=2&scopeId=11655) 69 | - [taobao.tbk.item.info.get( 淘宝客商品详情(简版) )](http://open.taobao.com/api.htm?docId=24518&docType=2) 70 | - [taobao.tbk.item.recommend.get( 淘宝客商品关联推荐查询 )](http://open.taobao.com/api.htm?docId=24517&docType=2&scopeId=11655) 71 | - [taobao.tbk.ju.tqg.get( 淘抢购api )](http://open.taobao.com/api.htm?docId=27543&docType=2&scopeId=11655) 72 | - [taobao.tbk.privilege.get( 单品券高效转链API )](http://open.taobao.com/api.htm?docId=28625&docType=2&scopeId=12403) 73 | - [taobao.tbk.sc.activitylink.toolget( 淘宝联盟官方活动推广API-工具 )](http://open.taobao.com/api.htm?docId=41921&docType=2&scopeId=15675) 74 | - [taobao.tbk.sc.coupon.brand.recommend( 品牌券API【社交】 )](http://open.taobao.com/api.htm?docId=29823&docType=2&scopeId=12331) 75 | - [taobao.tbk.sc.coupon.realtime.recommend( 好券直播API【社交】 )](http://open.taobao.com/api.htm?docId=29820&docType=2&scopeId=12331) 76 | - [taobao.tbk.sc.invitecode.get( 淘宝客邀请码生成-社交 )](http://open.taobao.com/api.htm?docId=38046&docType=2&scopeId=14474) 77 | - [taobao.tbk.sc.material.optional( 通用物料搜索API )](http://open.taobao.com/api.htm?docId=35263&docType=2&scopeId=13991) 78 | - [taobao.tbk.sc.newuser.order.get( 淘宝客新用户订单API--社交 )](http://open.taobao.com/api.htm?docId=33897&docType=2&scopeId=11655) 79 | - [taobao.tbk.sc.newuser.order.sum( 拉新活动汇总API--社交 )](http://open.taobao.com/api.htm?docId=36837&docType=2&scopeId=11655) 80 | - [taobao.tbk.sc.optimus.material( 淘宝客擎天柱通用物料API - 社交 )](http://open.taobao.com/api.htm?docId=37884&docType=2&scopeId=11655) 81 | - [taobao.tbk.sc.order.get( 淘宝客订单查询 - 社交 )](http://open.taobao.com/api.htm?docId=38078&docType=2&scopeId=14814) 82 | - [taobao.tbk.sc.publisher.info.get( 淘宝客信息查询 - 社交 )](http://open.taobao.com/api.htm?docId=37989&docType=2&scopeId=14474) 83 | - [taobao.tbk.sc.publisher.info.save( 淘宝客渠道信息备案 - 社交 )](http://open.taobao.com/api.htm?docId=37988&docType=2&scopeId=14474) 84 | - [taobao.tbk.shop.convert( 淘宝客店铺链接转换 )](http://open.taobao.com/api.htm?docId=24523&docType=2&scopeId=11653) 85 | - [taobao.tbk.shop.get( 淘宝客店铺查询 )](http://open.taobao.com/api.htm?docId=24521&docType=2&scopeId=11655) 86 | - [taobao.tbk.shop.recommend.get( 淘宝客店铺关联推荐查询 )](http://open.taobao.com/api.htm?docId=24522&docType=2&scopeId=11655) 87 | - [taobao.tbk.spread.get( 物料传播方式获取 )](http://open.taobao.com/api.htm?docId=27832&docType=2&scopeId=12340) 88 | - [taobao.tbk.tpwd.convert( 淘口令转链 )](http://open.taobao.com/api.htm?docId=32932&docType=2&scopeId=11653) 89 | - [taobao.tbk.tpwd.create( 淘宝客淘口令 )](http://open.taobao.com/api.htm?docId=31127&docType=2&scopeId=11655) 90 | - [taobao.tbk.uatm.favorites.get( 获取淘宝联盟选品库列表 )](http://open.taobao.com/api.htm?docId=26620&docType=2&scopeId=11655) 91 | - [taobao.tbk.uatm.favorites.item.get( 获取淘宝联盟选品库的宝贝信息 )](http://open.taobao.com/api.htm?docId=26619&docType=2&scopeId=11655) 92 | - [taobao.wireless.share.tpwd.query( 查询解析淘口令 )](http://open.taobao.com/api.htm?docId=32461&docType=2&scopeId=11998) 93 | -------------------------------------------------------------------------------- /client.go: -------------------------------------------------------------------------------- 1 | package taobaoopensdk 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "io/ioutil" 7 | "net/http" 8 | "net/url" 9 | "strings" 10 | "time" 11 | 12 | "github.com/mimicode/taobaoopensdk/utils" 13 | ) 14 | 15 | const ( 16 | ApiGatewayUrl = "http://gw.api.taobao.com/router/rest" 17 | ApiSignMethod = "md5" 18 | ApiFormat = "json" 19 | ApiVersion = "2.0" 20 | ) 21 | 22 | type DefaultRequest interface { 23 | AddParameter(string, string) 24 | GetParameters() url.Values 25 | GetApiName() string 26 | CheckParameters() 27 | } 28 | 29 | type DefaultResponse interface { 30 | //解析返回结果 31 | WrapResult(result string) 32 | IsError() bool 33 | } 34 | 35 | type TopClient struct { 36 | Appkey string 37 | AppSecret string 38 | SysParameters *url.Values //系统变量 39 | } 40 | 41 | func (u *TopClient) Init(appKey, appSecret, sessionkey string) { 42 | u.Appkey = appKey 43 | u.AppSecret = appSecret 44 | u.SysParameters = &url.Values{} 45 | //TOP分配给应用的AppKey 46 | u.SysParameters.Add("app_key", appKey) 47 | //签名的摘要算法,可选值为:hmac,md5 48 | u.SysParameters.Add("sign_method", ApiSignMethod) 49 | if sessionkey != "" { 50 | //用户登录授权成功后,TOP颁发给应用的授权信息,当此API的标签上注明:“需要授权”, 51 | // 则此参数必传;“不需要授权”,则此参数不需要传;“可选授权”,则此参数为可选 52 | u.SysParameters.Add("session", sessionkey) 53 | } 54 | //时间戳,格式为yyyy-MM-dd HH:mm:ss,时区为GMT+8,例如:2015-01-01 12:00:00。淘宝API服务端允许客户端请求最大时间误差为10分钟 55 | u.SysParameters.Add("timestamp", time.Now().Format("2006-01-02 15:04:05")) 56 | //响应格式。默认为xml格式,可选值:xml,json。 57 | u.SysParameters.Add("format", ApiFormat) 58 | //API协议版本,可选值:2.0 59 | u.SysParameters.Add("v", ApiVersion) 60 | 61 | //是否采用精简JSON返回格式,仅当format=json时有效,默认值为:false 62 | //u.SysParameters.Add("simplify","false") 63 | //合作伙伴身份标识 64 | //u.SysParameters.Add("partner_id","") 65 | //被调用的目标AppKey,仅当被调用的API为第三方ISV提供时有效 66 | //u.SysParameters.Add("target_app_key","") 67 | } 68 | 69 | func (u *TopClient) CreateSign(params url.Values) { 70 | 71 | //合并参数 72 | newParams := url.Values{} 73 | for k, v := range *u.SysParameters { 74 | 75 | for _, vv := range v { 76 | newParams.Add(k, vv) 77 | } 78 | } 79 | 80 | for k, v := range params { 81 | for _, vv := range v { 82 | newParams.Add(k, vv) 83 | } 84 | } 85 | //排序 86 | newParamsKey := utils.SortParamters(newParams) 87 | //拼装签名字符串 88 | signStr := u.AppSecret 89 | for _, k := range newParamsKey { 90 | signStr += k + newParams.Get(k) 91 | } 92 | signStr += u.AppSecret 93 | sign := strings.ToUpper(utils.Md5(signStr)) 94 | //API输入参数签名结果 95 | u.SysParameters.Set("sign", sign) 96 | } 97 | 98 | func (u *TopClient) CreateStrParam(params url.Values) string { 99 | 100 | //合并参数 101 | newParams := url.Values{} 102 | for k, v := range *u.SysParameters { 103 | 104 | for _, vv := range v { 105 | newParams.Add(k, vv) 106 | } 107 | } 108 | 109 | for k, v := range params { 110 | for _, vv := range v { 111 | newParams.Add(k, vv) 112 | } 113 | } 114 | 115 | return newParams.Encode() 116 | } 117 | 118 | //发送POST请求 119 | func (u *TopClient) PostRequest(uri string) (string, error) { 120 | client := http.DefaultClient 121 | request, err := http.NewRequest(http.MethodPost, ApiGatewayUrl, strings.NewReader(uri)) 122 | if err != nil { 123 | return "", nil 124 | } 125 | request.Header.Add("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8") 126 | response, err := client.Do(request) 127 | if err != nil { 128 | return "", err 129 | } 130 | defer response.Body.Close() 131 | //响应状态是不是 200 132 | if response.StatusCode != http.StatusOK { 133 | return "", errors.New(fmt.Sprintf("Response statusCode:%d", response.StatusCode)) 134 | } 135 | 136 | bytes, err := ioutil.ReadAll(response.Body) 137 | if err != nil { 138 | return "", err 139 | } 140 | return string(bytes), err 141 | 142 | } 143 | 144 | func (u *TopClient) Execute(params url.Values) (string, error) { 145 | //签名 146 | u.CreateSign(params) 147 | //拼装请求参数 148 | uri := u.CreateStrParam(params) 149 | 150 | return u.PostRequest(uri) 151 | } 152 | func (u *TopClient) Exec(request DefaultRequest, response DefaultResponse) error { 153 | //检测参数 154 | request.CheckParameters() 155 | //API接口名称 156 | method := request.GetApiName() 157 | if method == "" { 158 | panic("API name missing") 159 | } 160 | u.SysParameters.Set("method", method) 161 | 162 | //请求参数 163 | params := request.GetParameters() 164 | result, err := u.Execute(params) 165 | if err != nil { 166 | return err 167 | } 168 | response.WrapResult(result) 169 | return nil 170 | 171 | } 172 | -------------------------------------------------------------------------------- /client_test.go: -------------------------------------------------------------------------------- 1 | package taobaoopensdk 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "testing" 7 | 8 | "github.com/mimicode/taobaoopensdk/request" 9 | "github.com/mimicode/taobaoopensdk/response" 10 | ) 11 | 12 | func TestTbkiteminfoget(t *testing.T) { 13 | 14 | appKey := os.Getenv("APPKEY") 15 | appSecret := os.Getenv("APPSECRET") 16 | sessionKey := os.Getenv("SESSIONKEY") 17 | //初始化TopClient 18 | client := &TopClient{} 19 | client.Init(appKey, appSecret, sessionKey) 20 | 21 | //初始化请求接口信息 22 | getRequest := &request.TbkItemInfoGetRequest{} 23 | getRequest.AddParameter("num_iids", "583866215568,578307080718") 24 | getRequest.AddParameter("platform", "1") 25 | getRequest.AddParameter("ip", "11.22.33.43") 26 | //初始化结果类型 27 | var getResponse DefaultResponse = &response.TbkItemInfoGetResponse{} 28 | //执行请求接口得到结果 29 | err := client.Exec(getRequest, getResponse) 30 | if err != nil { 31 | t.Log(err) 32 | } else { 33 | result := getResponse.(*response.TbkItemInfoGetResponse) 34 | 35 | if result.IsError() { 36 | fmt.Println(result.Body) 37 | } else { 38 | items := result.TbkItemInfoGetResult.Results.NTbkItem 39 | for _, v := range items { 40 | fmt.Println(v.Title) 41 | } 42 | } 43 | 44 | } 45 | } 46 | 47 | func TestTbkPrivilegeGet(t *testing.T) { 48 | appKey := os.Getenv("APPKEY") 49 | appSecret := os.Getenv("APPSECRET") 50 | sessionKey := os.Getenv("SESSIONKEY") 51 | //fmt.Println(sessionKey) 52 | // 53 | //初始化TopClient 54 | client := &TopClient{} 55 | client.Init(appKey, appSecret, sessionKey) 56 | 57 | //初始化请求接口信息 58 | getRequest := &request.TbkPrivilegeGetRequest{} 59 | getRequest.AddParameter("adzone_id", "24546980") 60 | getRequest.AddParameter("site_id", "7418269") 61 | getRequest.AddParameter("item_id", "583866215568") 62 | 63 | getRequest.AddParameter("relation_id", "") 64 | getRequest.AddParameter("me", "") 65 | getRequest.AddParameter("platform", "1") 66 | 67 | //初始化结果类型 68 | var getResponse DefaultResponse = &response.TbkPrivilegeGetResponse{} 69 | //执行请求接口得到结果 70 | err := client.Exec(getRequest, getResponse) 71 | if err != nil { 72 | t.Log(err) 73 | } else { 74 | result := getResponse.(*response.TbkPrivilegeGetResponse) 75 | 76 | fmt.Println(result.TbkPrivilegeGetResult.Result.Data) 77 | 78 | } 79 | } 80 | 81 | func TestTbkScMaterialOptional(t *testing.T) { 82 | appKey := os.Getenv("APPKEY") 83 | appSecret := os.Getenv("APPSECRET") 84 | sessionKey := os.Getenv("SESSIONKEY") 85 | //fmt.Println(sessionKey) 86 | // 87 | //初始化TopClient 88 | client := &TopClient{} 89 | client.Init(appKey, appSecret, sessionKey) 90 | 91 | //初始化请求接口信息 92 | getRequest := &request.TbkScMaterialOptionalRequest{} 93 | getRequest.AddParameter("adzone_id", "24546980") 94 | getRequest.AddParameter("site_id", "7418269") 95 | 96 | getRequest.AddParameter("q", "女装") 97 | getRequest.AddParameter("platform", "1") 98 | getRequest.AddParameter("page_no", "1") 99 | getRequest.AddParameter("page_size", "1") 100 | 101 | //初始化结果类型 102 | var getResponse DefaultResponse = &response.TbkScMaterialOptionalResponse{} 103 | //执行请求接口得到结果 104 | err := client.Exec(getRequest, getResponse) 105 | if err != nil { 106 | t.Log(err) 107 | } else { 108 | result := getResponse.(*response.TbkScMaterialOptionalResponse) 109 | 110 | fmt.Println(result.TbkScMaterialOptionalResult) 111 | 112 | } 113 | } 114 | 115 | func TestTbkScActivitylinkToolget(t *testing.T) { 116 | appKey := os.Getenv("APPKEY") 117 | appSecret := os.Getenv("APPSECRET") 118 | sessionKey := os.Getenv("SESSIONKEY") 119 | //fmt.Println(sessionKey) 120 | // 121 | //初始化TopClient 122 | client := &TopClient{} 123 | client.Init(appKey, appSecret, sessionKey) 124 | 125 | //初始化请求接口信息 126 | getRequest := &request.TbkScActivitylinkToolgetRequest{} 127 | getRequest.AddParameter("adzone_id", "24546980") 128 | getRequest.AddParameter("site_id", "7418269") 129 | 130 | getRequest.AddParameter("promotion_scene_id", "8479247") 131 | 132 | //初始化结果类型 133 | var getResponse DefaultResponse = &response.TbkScActivitylinkToolgetResponse{} 134 | //执行请求接口得到结果 135 | err := client.Exec(getRequest, getResponse) 136 | if err != nil { 137 | t.Log(err) 138 | } else { 139 | result := getResponse.(*response.TbkScActivitylinkToolgetResponse) 140 | 141 | fmt.Println(result.TbkScActivitylinkToolgetResult) 142 | 143 | } 144 | } 145 | 146 | func TestTbkItemConvert(t *testing.T) { 147 | appKey := os.Getenv("APPKEY") 148 | appSecret := os.Getenv("APPSECRET") 149 | sessionKey := os.Getenv("SESSIONKEY") 150 | //fmt.Println(sessionKey) 151 | // 152 | //初始化TopClient 153 | client := &TopClient{} 154 | client.Init(appKey, appSecret, sessionKey) 155 | 156 | //初始化请求接口信息 157 | getRequest := &request.TbkItemConvertRequest{} 158 | getRequest.AddParameter("adzone_id", "24546980") 159 | getRequest.AddParameter("fields", "num_iid,click_url") 160 | 161 | getRequest.AddParameter("num_iids", "583866215568,578307080718") 162 | 163 | //初始化结果类型 164 | var getResponse DefaultResponse = &response.TbkItemConvertResponse{} 165 | //执行请求接口得到结果 166 | err := client.Exec(getRequest, getResponse) 167 | if err != nil { 168 | t.Log(err) 169 | } else { 170 | result := getResponse.(*response.TbkItemConvertResponse) 171 | 172 | fmt.Println(result.TbkItemConvertResult.Results.NTbkItem) 173 | 174 | } 175 | } 176 | 177 | func TestTbkShopConvert(t *testing.T) { 178 | appKey := os.Getenv("APPKEY") 179 | appSecret := os.Getenv("APPSECRET") 180 | sessionKey := os.Getenv("SESSIONKEY") 181 | //fmt.Println(sessionKey) 182 | // 183 | //初始化TopClient 184 | client := &TopClient{} 185 | client.Init(appKey, appSecret, sessionKey) 186 | 187 | //初始化请求接口信息 188 | getRequest := &request.TbkShopConvertRequest{} 189 | getRequest.AddParameter("adzone_id", "24546980") 190 | getRequest.AddParameter("fields", "user_id,click_url") 191 | 192 | getRequest.AddParameter("user_ids", "188124207,383602586") 193 | 194 | //初始化结果类型 195 | var getResponse DefaultResponse = &response.TbkShopConvertResponse{} 196 | //执行请求接口得到结果 197 | err := client.Exec(getRequest, getResponse) 198 | if err != nil { 199 | t.Log(err) 200 | } else { 201 | result := getResponse.(*response.TbkShopConvertResponse) 202 | 203 | fmt.Println(result.TbkShopConvertResult.Results) 204 | 205 | } 206 | } 207 | 208 | func TestTbkTpwdConvert(t *testing.T) { 209 | appKey := os.Getenv("APPKEY") 210 | appSecret := os.Getenv("APPSECRET") 211 | sessionKey := os.Getenv("SESSIONKEY") 212 | //fmt.Println(sessionKey) 213 | // 214 | //初始化TopClient 215 | client := &TopClient{} 216 | client.Init(appKey, appSecret, sessionKey) 217 | 218 | //初始化请求接口信息 219 | getRequest := &request.TbkTpwdConvertRequest{} 220 | getRequest.AddParameter("adzone_id", "24546980") 221 | getRequest.AddParameter("password_content", "(7q8mbttcjzE)") 222 | 223 | //初始化结果类型 224 | var getResponse DefaultResponse = &response.TbkTpwdConvertResponse{} 225 | //执行请求接口得到结果 226 | err := client.Exec(getRequest, getResponse) 227 | if err != nil { 228 | t.Log(err) 229 | } else { 230 | result := getResponse.(*response.TbkTpwdConvertResponse) 231 | 232 | fmt.Println(result.TbkTpwdConvertResult.Data) 233 | 234 | } 235 | } 236 | 237 | func TestTbkScOrderGet(t *testing.T) { 238 | appKey := os.Getenv("APPKEY") 239 | appSecret := os.Getenv("APPSECRET") 240 | sessionKey := os.Getenv("SESSIONKEY") 241 | //fmt.Println(sessionKey) 242 | // 243 | //初始化TopClient 244 | client := &TopClient{} 245 | client.Init(appKey, appSecret, sessionKey) 246 | 247 | //初始化请求接口信息 248 | getRequest := &request.TbkScOrderGetRequest{} 249 | getRequest.AddParameter("fields", "trade_parent_id,trade_id,num_iid,item_title,item_num,price,pay_price,seller_nick,seller_shop_title,commission,commission_rate,unid,create_time,earning_time,tk_status,tk3rd_type,tk3rd_pub_id,order_type,income_rate,pub_share_pre_fee,subsidy_rate,subsidy_type,terminal_type,auction_category,site_id,site_name,adzone_id,adzone_name,alipay_total_price,total_commission_rate,total_commission_fee,subsidy_fee,relation_id,click_time") 250 | getRequest.AddParameter("start_time", "2019-02-13 20:50:00") 251 | getRequest.AddParameter("span", "600") 252 | getRequest.AddParameter("order_query_type", "create_time") 253 | 254 | //初始化结果类型 255 | var getResponse DefaultResponse = &response.TbkScOrderGetResponse{} 256 | //执行请求接口得到结果 257 | err := client.Exec(getRequest, getResponse) 258 | if err != nil { 259 | t.Log(err) 260 | } else { 261 | result := getResponse.(*response.TbkScOrderGetResponse) 262 | 263 | fmt.Println(result.TbkScOrderGetResult.Results) 264 | 265 | } 266 | } 267 | 268 | func TestWirelessShareTpwdQuery(t *testing.T) { 269 | appKey := os.Getenv("APPKEY") 270 | appSecret := os.Getenv("APPSECRET") 271 | sessionKey := os.Getenv("SESSIONKEY") 272 | //fmt.Println(sessionKey) 273 | // 274 | //初始化TopClient 275 | client := &TopClient{} 276 | client.Init(appKey, appSecret, sessionKey) 277 | 278 | //初始化请求接口信息 279 | getRequest := &request.WirelessShareTpwdQueryRequest{} 280 | getRequest.AddParameter("password_content", "(7q8mbttcjzE)") 281 | 282 | //初始化结果类型 283 | var getResponse DefaultResponse = &response.WirelessShareTpwdQueryResponse{} 284 | //执行请求接口得到结果 285 | err := client.Exec(getRequest, getResponse) 286 | if err != nil { 287 | t.Log(err) 288 | } else { 289 | result := getResponse.(*response.WirelessShareTpwdQueryResponse) 290 | 291 | fmt.Println(result.WirelessShareTpwdQueryResult) 292 | 293 | } 294 | } 295 | 296 | func TestShopcatsListGet(t *testing.T) { 297 | appKey := os.Getenv("APPKEY") 298 | appSecret := os.Getenv("APPSECRET") 299 | sessionKey := os.Getenv("SESSIONKEY") 300 | //fmt.Println(sessionKey) 301 | // 302 | //初始化TopClient 303 | client := &TopClient{} 304 | client.Init(appKey, appSecret, sessionKey) 305 | 306 | //初始化请求接口信息 307 | getRequest := &request.ShopcatsListGetRequest{} 308 | getRequest.AddParameter("fields", "cid,parent_cid,name,is_parent") 309 | 310 | //初始化结果类型 311 | var getResponse DefaultResponse = &response.ShopcatsListGetResponse{} 312 | //执行请求接口得到结果 313 | err := client.Exec(getRequest, getResponse) 314 | if err != nil { 315 | t.Log(err) 316 | } else { 317 | result := getResponse.(*response.ShopcatsListGetResponse) 318 | 319 | fmt.Println(result.ShopcatsListGetResult.ShopCats) 320 | 321 | } 322 | } 323 | 324 | func TestSellercatsListGet(t *testing.T) { 325 | appKey := os.Getenv("APPKEY") 326 | appSecret := os.Getenv("APPSECRET") 327 | sessionKey := os.Getenv("SESSIONKEY") 328 | //fmt.Println(sessionKey) 329 | // 330 | //初始化TopClient 331 | client := &TopClient{} 332 | client.Init(appKey, appSecret, sessionKey) 333 | 334 | //初始化请求接口信息 335 | getRequest := &request.SellercatsListGetRequest{} 336 | getRequest.AddParameter("nick", "韩都衣舍旗舰店") 337 | 338 | //初始化结果类型 339 | var getResponse DefaultResponse = &response.SellercatsListGetResponse{} 340 | //执行请求接口得到结果 341 | err := client.Exec(getRequest, getResponse) 342 | if err != nil { 343 | t.Log(err) 344 | } else { 345 | result := getResponse.(*response.SellercatsListGetResponse) 346 | 347 | fmt.Println(result.SellercatsListGetResult.SellerCats) 348 | 349 | } 350 | } 351 | 352 | func TestShopGetbytitle(t *testing.T) { 353 | appKey := os.Getenv("APPKEY") 354 | appSecret := os.Getenv("APPSECRET") 355 | sessionKey := os.Getenv("SESSIONKEY") 356 | //fmt.Println(sessionKey) 357 | // 358 | //初始化TopClient 359 | client := &TopClient{} 360 | client.Init(appKey, appSecret, sessionKey) 361 | 362 | //初始化请求接口信息 363 | getRequest := &request.ShopGetbytitleRequest{} 364 | getRequest.AddParameter("title", "韩都衣舍旗舰店") 365 | 366 | //初始化结果类型 367 | var getResponse DefaultResponse = &response.ShopGetbytitleResponse{} 368 | //执行请求接口得到结果 369 | err := client.Exec(getRequest, getResponse) 370 | if err != nil { 371 | t.Log(err) 372 | } else { 373 | result := getResponse.(*response.ShopGetbytitleResponse) 374 | 375 | fmt.Println(result.ShopGetbytitleResult.ResultShop) 376 | 377 | } 378 | } 379 | 380 | func TestTbkScInvitecodeGet(t *testing.T) { 381 | appKey := os.Getenv("APPKEY") 382 | appSecret := os.Getenv("APPSECRET") 383 | sessionKey := os.Getenv("SESSIONKEY") 384 | //fmt.Println(sessionKey) 385 | // 386 | //初始化TopClient 387 | client := &TopClient{} 388 | client.Init(appKey, appSecret, sessionKey) 389 | 390 | //初始化请求接口信息 391 | getRequest := &request.TbkScInvitecodeGetRequest{} 392 | getRequest.AddParameter("relation_app", "common") 393 | getRequest.AddParameter("code_type", "1") 394 | 395 | //初始化结果类型 396 | var getResponse DefaultResponse = &response.TbkScInvitecodeGetResponse{} 397 | //执行请求接口得到结果 398 | err := client.Exec(getRequest, getResponse) 399 | if err != nil { 400 | t.Log(err) 401 | } else { 402 | result := getResponse.(*response.TbkScInvitecodeGetResponse) 403 | 404 | fmt.Println(result.TbkScInvitecodeGetResult.Data) 405 | 406 | } 407 | } 408 | 409 | //(未完成) 410 | func TestTbkScPublisherInfoGet(t *testing.T) { 411 | appKey := os.Getenv("APPKEY") 412 | appSecret := os.Getenv("APPSECRET") 413 | sessionKey := os.Getenv("SESSIONKEY") 414 | //fmt.Println(sessionKey) 415 | // 416 | //初始化TopClient 417 | client := &TopClient{} 418 | client.Init(appKey, appSecret, sessionKey) 419 | 420 | //初始化请求接口信息 421 | getRequest := &request.TbkScPublisherInfoGetRequest{} 422 | getRequest.AddParameter("relation_app", "common") 423 | getRequest.AddParameter("info_type", "1") 424 | 425 | //初始化结果类型 426 | var getResponse DefaultResponse = &response.TbkScPublisherInfoGetResponse{} 427 | //执行请求接口得到结果 428 | err := client.Exec(getRequest, getResponse) 429 | if err != nil { 430 | t.Log(err) 431 | } else { 432 | result := getResponse.(*response.TbkScPublisherInfoGetResponse) 433 | 434 | fmt.Println(result.Body) 435 | 436 | } 437 | } 438 | 439 | //(未完成) 440 | func TestTbkScPublisherInfoSave(t *testing.T) { 441 | appKey := os.Getenv("APPKEY") 442 | appSecret := os.Getenv("APPSECRET") 443 | sessionKey := os.Getenv("SESSIONKEY") 444 | //fmt.Println(sessionKey) 445 | // 446 | //初始化TopClient 447 | client := &TopClient{} 448 | client.Init(appKey, appSecret, sessionKey) 449 | 450 | //初始化请求接口信息 451 | getRequest := &request.TbkScPublisherInfoSaveRequest{} 452 | getRequest.AddParameter("inviter_code", "common") 453 | getRequest.AddParameter("info_type", "1") 454 | 455 | //初始化结果类型 456 | var getResponse DefaultResponse = &response.TbkScPublisherInfoGetResponse{} 457 | //执行请求接口得到结果 458 | err := client.Exec(getRequest, getResponse) 459 | if err != nil { 460 | t.Log(err) 461 | } else { 462 | result := getResponse.(*response.TbkScPublisherInfoGetResponse) 463 | 464 | fmt.Println(result.Body) 465 | 466 | } 467 | } 468 | 469 | func TestTbkScCouponRealtimeRecommend(t *testing.T) { 470 | appKey := os.Getenv("APPKEY") 471 | appSecret := os.Getenv("APPSECRET") 472 | sessionKey := os.Getenv("SESSIONKEY") 473 | //fmt.Println(sessionKey) 474 | // 475 | //初始化TopClient 476 | client := &TopClient{} 477 | client.Init(appKey, appSecret, sessionKey) 478 | 479 | //初始化请求接口信息 480 | getRequest := &request.TbkScCouponRealtimeRecommendRequest{} 481 | getRequest.AddParameter("adzone_id", "24546980") 482 | getRequest.AddParameter("site_id", "7418269") 483 | 484 | //初始化结果类型 485 | var getResponse DefaultResponse = &response.TbkScCouponRealtimeRecommendResponse{} 486 | //执行请求接口得到结果 487 | err := client.Exec(getRequest, getResponse) 488 | if err != nil { 489 | t.Log(err) 490 | } else { 491 | result := getResponse.(*response.TbkScCouponRealtimeRecommendResponse) 492 | 493 | fmt.Println(result.TbkScCouponRealtimeRecommendResult.Results.TbkCoupon) 494 | 495 | } 496 | } 497 | 498 | func TestTbkScCouponBrandRecommend(t *testing.T) { 499 | appKey := os.Getenv("APPKEY") 500 | appSecret := os.Getenv("APPSECRET") 501 | sessionKey := os.Getenv("SESSIONKEY") 502 | //fmt.Println(sessionKey) 503 | // 504 | //初始化TopClient 505 | client := &TopClient{} 506 | client.Init(appKey, appSecret, sessionKey) 507 | 508 | //初始化请求接口信息 509 | getRequest := &request.TbkScCouponBrandRecommendRequest{} 510 | getRequest.AddParameter("adzone_id", "24546980") 511 | getRequest.AddParameter("site_id", "7418269") 512 | 513 | //初始化结果类型 514 | var getResponse DefaultResponse = &response.TbkScCouponBrandRecommendResponse{} 515 | //执行请求接口得到结果 516 | err := client.Exec(getRequest, getResponse) 517 | if err != nil { 518 | t.Log(err) 519 | } else { 520 | result := getResponse.(*response.TbkScCouponBrandRecommendResponse) 521 | 522 | fmt.Println(result.TbkScCouponBrandRecommendResult.Results.TbkCoupon) 523 | 524 | } 525 | } 526 | 527 | func TestTbkSpreadGet(t *testing.T) { 528 | appKey := os.Getenv("APPKEY") 529 | appSecret := os.Getenv("APPSECRET") 530 | sessionKey := os.Getenv("SESSIONKEY") 531 | //fmt.Println(sessionKey) 532 | // 533 | //初始化TopClient 534 | client := &TopClient{} 535 | client.Init(appKey, appSecret, sessionKey) 536 | 537 | //初始化请求接口信息 538 | getRequest := &request.TbkSpreadGetRequest{} 539 | getRequest.AddParameter("requests", `[{"url":"https://uland.taobao.com/coupon/edetail?e=wog6mTjZv%2FIGQASttHIRqT8%2FTgo%2BDKYNn3MtPDDRCxLuFdGM%2Fy8ADJwJ6dLD4BPh4h5828KZV1siM37WwZ3M460TeAL%2BmcF1hLjdYI0pIJBwx7%2FmoMcv1BemP0hpIIPvjDppvlX%2Bob8NlNJBuapvQ2MDg9t1zp0R8pjV3C9qcwRg5t1bGd7ixKOQJ6Ic4SbV&traceId=0b0b40de15501301853222175e&union_lens=lensId:0b1832c2_0b51_168eaf5847e_8589&xId=vJinjnbsDyrka2dVuwvpFpBvPqgdfSmfEm3bA2Jig86yBLgQear0ZghwNkuOsiTtahUYTf5Kq7I6X8iIlkrpeU&activityId=d1204e96d378436cabe64bfebccc6f74"}]`) 540 | 541 | //初始化结果类型 542 | var getResponse DefaultResponse = &response.TbkSpreadGetResponse{} 543 | //执行请求接口得到结果 544 | err := client.Exec(getRequest, getResponse) 545 | if err != nil { 546 | t.Log(err) 547 | } else { 548 | result := getResponse.(*response.TbkSpreadGetResponse) 549 | 550 | fmt.Println(result.TbkSpreadGetResult.Results.TbkSpread) 551 | 552 | } 553 | } 554 | 555 | func TestTbkItemCouponGet(t *testing.T) { 556 | appKey := os.Getenv("APPKEY") 557 | appSecret := os.Getenv("APPSECRET") 558 | sessionKey := os.Getenv("SESSIONKEY") 559 | //fmt.Println(sessionKey) 560 | // 561 | //初始化TopClient 562 | client := &TopClient{} 563 | client.Init(appKey, appSecret, sessionKey) 564 | 565 | //初始化请求接口信息 566 | getRequest := &request.TbkItemCouponGetRequest{} 567 | getRequest.AddParameter("pid", "mm_27437251_7418269_24546980") 568 | 569 | //初始化结果类型 570 | var getResponse DefaultResponse = &response.TbkItemCouponGetResponse{} 571 | //执行请求接口得到结果 572 | err := client.Exec(getRequest, getResponse) 573 | if err != nil { 574 | t.Log(err) 575 | } else { 576 | result := getResponse.(*response.TbkItemCouponGetResponse) 577 | 578 | fmt.Println(result.TbkItemCouponGetResult.Results.TbkCoupon) 579 | 580 | } 581 | } 582 | 583 | func TestTbkitemGet(t *testing.T) { 584 | 585 | appKey := os.Getenv("APPKEY") 586 | appSecret := os.Getenv("APPSECRET") 587 | sessionKey := os.Getenv("SESSIONKEY") 588 | //初始化TopClient 589 | client := &TopClient{} 590 | client.Init(appKey, appSecret, sessionKey) 591 | 592 | //初始化请求接口信息 593 | getRequest := &request.TbkItemGetRequest{} 594 | getRequest.AddParameter("fields", "num_iid") 595 | getRequest.AddParameter("q", "连衣裙") 596 | getRequest.AddParameter("page_size", "40") 597 | //初始化结果类型 598 | var getResponse DefaultResponse = &response.TbkItemGetResponse{} 599 | //执行请求接口得到结果 600 | err := client.Exec(getRequest, getResponse) 601 | if err != nil { 602 | t.Log(err) 603 | } else { 604 | result := getResponse.(*response.TbkItemGetResponse) 605 | 606 | fmt.Println(result.TbkItemGetResult.Results.NTbkItem) 607 | 608 | } 609 | } 610 | 611 | func TestTbkItemRecommendGet(t *testing.T) { 612 | 613 | appKey := os.Getenv("APPKEY") 614 | appSecret := os.Getenv("APPSECRET") 615 | sessionKey := os.Getenv("SESSIONKEY") 616 | //初始化TopClient 617 | client := &TopClient{} 618 | client.Init(appKey, appSecret, sessionKey) 619 | 620 | //初始化请求接口信息 621 | getRequest := &request.TbkItemRecommendGetRequest{} 622 | getRequest.AddParameter("fields", "num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url,seller_id,volume,nick") 623 | getRequest.AddParameter("num_iid", "562775487987") 624 | getRequest.AddParameter("count", "20") 625 | //初始化结果类型 626 | var getResponse DefaultResponse = &response.TbkItemRecommendGetResponse{} 627 | //执行请求接口得到结果 628 | err := client.Exec(getRequest, getResponse) 629 | if err != nil { 630 | t.Log(err) 631 | } else { 632 | result := getResponse.(*response.TbkItemRecommendGetResponse) 633 | 634 | fmt.Println(result.TbkItemRecommendGetResult.Results.NTbkItem) 635 | 636 | } 637 | 638 | } 639 | 640 | func TestJuItemsSearch(t *testing.T) { 641 | 642 | appKey := os.Getenv("APPKEY") 643 | appSecret := os.Getenv("APPSECRET") 644 | sessionKey := os.Getenv("SESSIONKEY") 645 | //初始化TopClient 646 | client := &TopClient{} 647 | client.Init(appKey, appSecret, sessionKey) 648 | 649 | //初始化请求接口信息 650 | getRequest := &request.JuItemsSearchRequest{} 651 | getRequest.AddParameter("param_top_item_query", `{"current_page":1,"page_size":2,"pid":"mm_27437251_7418269_24546980"}`) 652 | 653 | //初始化结果类型 654 | var getResponse DefaultResponse = &response.JuItemsSearchResponse{} 655 | //执行请求接口得到结果 656 | err := client.Exec(getRequest, getResponse) 657 | if err != nil { 658 | t.Log(err) 659 | } else { 660 | result := getResponse.(*response.JuItemsSearchResponse) 661 | 662 | fmt.Println(result.JuItemsSearchResult.Result) 663 | 664 | } 665 | 666 | } 667 | 668 | func TestTbkActivitylinkGet(t *testing.T) { 669 | appKey := os.Getenv("APPKEY") 670 | appSecret := os.Getenv("APPSECRET") 671 | //sessionKey := os.Getenv("SESSIONKEY") 672 | //fmt.Println(sessionKey) 673 | // 674 | //初始化TopClient 675 | client := &TopClient{} 676 | client.Init(appKey, appSecret, "") 677 | 678 | //初始化请求接口信息 679 | getRequest := &request.TbkActivitylinkGetRequest{} 680 | getRequest.AddParameter("adzone_id", "24546980") 681 | 682 | getRequest.AddParameter("promotion_scene_id", "8493178") 683 | 684 | //初始化结果类型 685 | var getResponse DefaultResponse = &response.TbkActivitylinkGetResponse{} 686 | //执行请求接口得到结果 687 | err := client.Exec(getRequest, getResponse) 688 | if err != nil { 689 | t.Log(err) 690 | } else { 691 | result := getResponse.(*response.TbkActivitylinkGetResponse) 692 | 693 | fmt.Println(result.TbkActivitylinkGetResult) 694 | 695 | } 696 | } 697 | 698 | func TestTbkDgItemCouponGet(t *testing.T) { 699 | appKey := os.Getenv("APPKEY") 700 | appSecret := os.Getenv("APPSECRET") 701 | //sessionKey := os.Getenv("SESSIONKEY") 702 | //fmt.Println(sessionKey) 703 | // 704 | //初始化TopClient 705 | client := &TopClient{} 706 | client.Init(appKey, appSecret, "") 707 | 708 | //初始化请求接口信息 709 | getRequest := &request.TbkDgItemCouponGetRequest{} 710 | getRequest.AddParameter("adzone_id", "24546980") 711 | 712 | getRequest.AddParameter("cat", "16") 713 | getRequest.AddParameter("page_size", "2") 714 | 715 | //初始化结果类型 716 | var getResponse DefaultResponse = &response.TbkDgItemCouponGetResponse{} 717 | //执行请求接口得到结果 718 | err := client.Exec(getRequest, getResponse) 719 | if err != nil { 720 | t.Log(err) 721 | } else { 722 | result := getResponse.(*response.TbkDgItemCouponGetResponse) 723 | 724 | fmt.Println(result.TbkDgItemCouponGetResult.Results.TbkCoupon) 725 | 726 | } 727 | } 728 | 729 | func TestTbkDgMaterialOptional(t *testing.T) { 730 | appKey := os.Getenv("APPKEY") 731 | appSecret := os.Getenv("APPSECRET") 732 | //sessionKey := os.Getenv("SESSIONKEY") 733 | //fmt.Println(sessionKey) 734 | // 735 | //初始化TopClient 736 | client := &TopClient{} 737 | client.Init(appKey, appSecret, "") 738 | 739 | //初始化请求接口信息 740 | getRequest := &request.TbkDgMaterialOptionalRequest{} 741 | getRequest.AddParameter("adzone_id", "24546980") 742 | 743 | getRequest.AddParameter("cat", "16") 744 | getRequest.AddParameter("page_size", "2") 745 | 746 | //初始化结果类型 747 | var getResponse DefaultResponse = &response.TbkDgMaterialOptionalResponse{} 748 | //执行请求接口得到结果 749 | err := client.Exec(getRequest, getResponse) 750 | if err != nil { 751 | t.Log(err) 752 | } else { 753 | result := getResponse.(*response.TbkDgMaterialOptionalResponse) 754 | 755 | fmt.Println(result.TbkDgMaterialOptionalResult.ResultList.MapData) 756 | 757 | } 758 | } 759 | 760 | func TestTbkDgNewuserOrderGet(t *testing.T) { 761 | appKey := os.Getenv("APPKEY") 762 | appSecret := os.Getenv("APPSECRET") 763 | //sessionKey := os.Getenv("SESSIONKEY") 764 | //fmt.Println(sessionKey) 765 | // 766 | //初始化TopClient 767 | client := &TopClient{} 768 | client.Init(appKey, appSecret, "") 769 | 770 | //初始化请求接口信息 771 | getRequest := &request.TbkDgNewuserOrderGetRequest{} 772 | getRequest.AddParameter("activity_id", "119013_6") 773 | 774 | //初始化结果类型 775 | var getResponse DefaultResponse = &response.TbkDgNewuserOrderGetResponse{} 776 | //执行请求接口得到结果 777 | err := client.Exec(getRequest, getResponse) 778 | if err != nil { 779 | t.Log(err) 780 | } else { 781 | result := getResponse.(*response.TbkDgNewuserOrderGetResponse) 782 | 783 | fmt.Println(result.TbkDgNewuserOrderGetResult.Results.Data.Results.MapData) 784 | 785 | } 786 | } 787 | 788 | func TestTbkDgNewuserOrderSum(t *testing.T) { 789 | appKey := os.Getenv("APPKEY") 790 | appSecret := os.Getenv("APPSECRET") 791 | //sessionKey := os.Getenv("SESSIONKEY") 792 | //fmt.Println(sessionKey) 793 | // 794 | //初始化TopClient 795 | client := &TopClient{} 796 | client.Init(appKey, appSecret, "") 797 | 798 | //初始化请求接口信息 799 | getRequest := &request.TbkDgNewuserOrderSumRequest{} 800 | getRequest.AddParameter("activity_id", "119013_6") 801 | getRequest.AddParameter("page_size", "2") 802 | getRequest.AddParameter("page_no", "1") 803 | 804 | //初始化结果类型 805 | var getResponse DefaultResponse = &response.TbkDgNewuserOrderSumResponse{} 806 | //执行请求接口得到结果 807 | err := client.Exec(getRequest, getResponse) 808 | if err != nil { 809 | t.Log(err) 810 | } else { 811 | result := getResponse.(*response.TbkDgNewuserOrderSumResponse) 812 | 813 | fmt.Println(result.TbkDgNewuserOrderSumResult.Results.Data.Results) 814 | 815 | } 816 | } 817 | 818 | func TestTbkDgOptimusMaterial(t *testing.T) { 819 | appKey := os.Getenv("APPKEY") 820 | appSecret := os.Getenv("APPSECRET") 821 | //sessionKey := os.Getenv("SESSIONKEY") 822 | //fmt.Println(sessionKey) 823 | // 824 | //初始化TopClient 825 | client := &TopClient{} 826 | client.Init(appKey, appSecret, "") 827 | 828 | //初始化请求接口信息 829 | getRequest := &request.TbkDgOptimusMaterialRequest{} 830 | getRequest.AddParameter("adzone_id", "24546980") 831 | getRequest.AddParameter("material_id", "4093") 832 | 833 | getRequest.AddParameter("page_size", "2") 834 | getRequest.AddParameter("page_no", "1") 835 | 836 | //初始化结果类型 837 | var getResponse DefaultResponse = &response.TbkDgOptimusMaterialResponse{} 838 | //执行请求接口得到结果 839 | err := client.Exec(getRequest, getResponse) 840 | if err != nil { 841 | t.Log(err) 842 | } else { 843 | result := getResponse.(*response.TbkDgOptimusMaterialResponse) 844 | 845 | fmt.Println(result.TbkDgOptimusMaterialResult.ResultList.MapData) 846 | 847 | } 848 | } 849 | 850 | func TestTbkJuTqgGet(t *testing.T) { 851 | appKey := os.Getenv("APPKEY") 852 | appSecret := os.Getenv("APPSECRET") 853 | //sessionKey := os.Getenv("SESSIONKEY") 854 | //fmt.Println(sessionKey) 855 | // 856 | //初始化TopClient 857 | client := &TopClient{} 858 | client.Init(appKey, appSecret, "") 859 | 860 | //初始化请求接口信息 861 | getRequest := &request.TbkJuTqgGetRequest{} 862 | getRequest.AddParameter("adzone_id", "24546980") 863 | getRequest.AddParameter("fields", "click_url,pic_url,reserve_price,zk_final_price,total_amount,sold_num,title,category_name,start_time,end_time,num_iid") 864 | 865 | getRequest.AddParameter("start_time", "2019-02-15 07:00:00") 866 | getRequest.AddParameter("end_time", "2019-02-15 15:00:00") 867 | 868 | getRequest.AddParameter("page_size", "2") 869 | getRequest.AddParameter("page_no", "1") 870 | 871 | //初始化结果类型 872 | var getResponse DefaultResponse = &response.TbkJuTqgGetResponse{} 873 | //执行请求接口得到结果 874 | err := client.Exec(getRequest, getResponse) 875 | if err != nil { 876 | t.Log(err) 877 | } else { 878 | result := getResponse.(*response.TbkJuTqgGetResponse) 879 | 880 | fmt.Println(result.TbkJuTqgGetResult.Results.Results) 881 | 882 | } 883 | } 884 | 885 | func TestTbkCouponGet(t *testing.T) { 886 | appKey := os.Getenv("APPKEY") 887 | appSecret := os.Getenv("APPSECRET") 888 | //sessionKey := os.Getenv("SESSIONKEY") 889 | //fmt.Println(sessionKey) 890 | // 891 | //初始化TopClient 892 | client := &TopClient{} 893 | client.Init(appKey, appSecret, "") 894 | 895 | //初始化请求接口信息 896 | getRequest := &request.TbkCouponGetRequest{} 897 | getRequest.AddParameter("item_id", "573509331754") 898 | 899 | getRequest.AddParameter("activity_id", "335fa4c30e8a4f5da28596d122b48c28") 900 | 901 | //初始化结果类型 902 | var getResponse DefaultResponse = &response.TbkCouponGetResponse{} 903 | //执行请求接口得到结果 904 | err := client.Exec(getRequest, getResponse) 905 | if err != nil { 906 | t.Log(err) 907 | } else { 908 | result := getResponse.(*response.TbkCouponGetResponse) 909 | 910 | fmt.Println(result.TbkCouponGetResult.Data) 911 | 912 | } 913 | } 914 | 915 | func TestTbkTpwdCreate(t *testing.T) { 916 | appKey := os.Getenv("APPKEY") 917 | appSecret := os.Getenv("APPSECRET") 918 | //sessionKey := os.Getenv("SESSIONKEY") 919 | //fmt.Println(sessionKey) 920 | // 921 | //初始化TopClient 922 | client := &TopClient{} 923 | client.Init(appKey, appSecret, "") 924 | 925 | //初始化请求接口信息 926 | getRequest := &request.TbkTpwdCreateRequest{} 927 | getRequest.AddParameter("text", "573509331754") 928 | getRequest.AddParameter("url", "https://uland.taobao.com/coupon/edetail?e=mO4IEAPR5NAGQASttHIRqSS40sV7V7nidNcM7bsgMaPuFdGM%2Fy8ADJwJ6dLD4BPh4h5828KZV1siM37WwZ3M460TeAL%2BmcF1hLjdYI0pIJBwx7%2FmoMcv1BemP0hpIIPvjDppvlX%2Bob8NlNJBuapvQ2MDg9t1zp0R8pjV3C9qcwTuCTbQanBq6DXyPsc63NLC&traceId=0b15285b15502249874743900e&union_lens=lensId:0b0175f0_0bb6_168f09c1564_38e3&xId=9qB7wC7cWoDxvRAEWhBT5GywBdnahUokfIoYEnBxjUdmgTwHqmSiABnh5LI6gVcBmjPO7VeGfMM0Cqk2zkVD84&activityId=cd802bbce5554df0a9d0a2b93230ae65") 929 | 930 | //初始化结果类型 931 | var getResponse DefaultResponse = &response.TbkTpwdCreateResponse{} 932 | //执行请求接口得到结果 933 | err := client.Exec(getRequest, getResponse) 934 | if err != nil { 935 | t.Log(err) 936 | } else { 937 | result := getResponse.(*response.TbkTpwdCreateResponse) 938 | 939 | fmt.Println(result.Body) 940 | 941 | } 942 | } 943 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/mimicode/taobaoopensdk 2 | 3 | go 1.15 4 | -------------------------------------------------------------------------------- /request/juitemssearch.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | ) 6 | 7 | //taobao.ju.items.search( 聚划算商品搜索接口 ) 8 | //http://open.taobao.com/api.htm?docId=28762&docType=2&scopeId=11655 9 | type JuItemsSearchRequest struct { 10 | Parameters *url.Values //请求参数 11 | } 12 | 13 | func (tk *JuItemsSearchRequest) CheckParameters() { 14 | 15 | } 16 | 17 | //添加请求参数 18 | func (tk *JuItemsSearchRequest) AddParameter(key, val string) { 19 | if tk.Parameters == nil { 20 | tk.Parameters = &url.Values{} 21 | } 22 | tk.Parameters.Add(key, val) 23 | } 24 | 25 | //返回接口名称 26 | func (tk *JuItemsSearchRequest) GetApiName() string { 27 | return "taobao.ju.items.search" 28 | } 29 | 30 | //返回请求参数 31 | func (tk *JuItemsSearchRequest) GetParameters() url.Values { 32 | return *tk.Parameters 33 | } 34 | -------------------------------------------------------------------------------- /request/sellercatslistget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "github.com/mimicode/taobaoopensdk/utils" 5 | "net/url" 6 | ) 7 | 8 | //taobao.sellercats.list.get( 获取前台展示的店铺内卖家自定义商品类目 ) 9 | //http://open.taobao.com/api.htm?docId=65&docType=2&scopeId=386 10 | type SellercatsListGetRequest struct { 11 | Parameters *url.Values //请求参数 12 | } 13 | 14 | func (tk *SellercatsListGetRequest) CheckParameters() { 15 | utils.CheckNotNull(tk.Parameters.Get("nick"), "nick") 16 | } 17 | 18 | //添加请求参数 19 | func (tk *SellercatsListGetRequest) AddParameter(key, val string) { 20 | if tk.Parameters == nil { 21 | tk.Parameters = &url.Values{} 22 | } 23 | tk.Parameters.Add(key, val) 24 | } 25 | 26 | //返回接口名称 27 | func (tk *SellercatsListGetRequest) GetApiName() string { 28 | return "taobao.sellercats.list.get" 29 | } 30 | 31 | //返回请求参数 32 | func (tk *SellercatsListGetRequest) GetParameters() url.Values { 33 | return *tk.Parameters 34 | } 35 | -------------------------------------------------------------------------------- /request/shopcatslistget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | ) 6 | 7 | //taobao.shopcats.list.get( 获取前台展示的店铺类目 ) 8 | //http://open.taobao.com/api.htm?docId=64&docType=2&scopeId=386 9 | type ShopcatsListGetRequest struct { 10 | Parameters *url.Values //请求参数 11 | } 12 | 13 | func (tk *ShopcatsListGetRequest) CheckParameters() { 14 | } 15 | 16 | //添加请求参数 17 | func (tk *ShopcatsListGetRequest) AddParameter(key, val string) { 18 | if tk.Parameters == nil { 19 | tk.Parameters = &url.Values{} 20 | } 21 | tk.Parameters.Add(key, val) 22 | } 23 | 24 | //返回接口名称 25 | func (tk *ShopcatsListGetRequest) GetApiName() string { 26 | return "taobao.shopcats.list.get" 27 | } 28 | 29 | //返回请求参数 30 | func (tk *ShopcatsListGetRequest) GetParameters() url.Values { 31 | return *tk.Parameters 32 | } 33 | -------------------------------------------------------------------------------- /request/shopgetbytitle.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.shop.getbytitle( 根据店铺名称获取店铺信息 ) 10 | //http://open.taobao.com/api.htm?docId=24852&docType=2&scopeId=386 11 | type ShopGetbytitleRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *ShopGetbytitleRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("title"), "title") 17 | } 18 | 19 | //添加请求参数 20 | func (tk *ShopGetbytitleRequest) AddParameter(key, val string) { 21 | if tk.Parameters == nil { 22 | tk.Parameters = &url.Values{} 23 | } 24 | tk.Parameters.Add(key, val) 25 | } 26 | 27 | //返回接口名称 28 | func (tk *ShopGetbytitleRequest) GetApiName() string { 29 | return "taobao.shop.getbytitle" 30 | } 31 | 32 | //返回请求参数 33 | func (tk *ShopGetbytitleRequest) GetParameters() url.Values { 34 | return *tk.Parameters 35 | } 36 | -------------------------------------------------------------------------------- /request/tbkactivitylinkget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.activitylink.get( 淘宝联盟官方活动推广API-媒体 ) 10 | //http://open.taobao.com/api.htm?docId=41918&docType=2&scopeId=11655 11 | type TbkActivitylinkGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkActivitylinkGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 17 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 18 | utils.CheckNotNull(tk.Parameters.Get("promotion_scene_id"), "promotion_scene_id") 19 | utils.CheckNumber(tk.Parameters.Get("promotion_scene_id"), "promotion_scene_id") 20 | 21 | } 22 | 23 | //添加请求参数 24 | func (tk *TbkActivitylinkGetRequest) AddParameter(key, val string) { 25 | if tk.Parameters == nil { 26 | tk.Parameters = &url.Values{} 27 | } 28 | tk.Parameters.Add(key, val) 29 | } 30 | 31 | //返回接口名称 32 | func (tk *TbkActivitylinkGetRequest) GetApiName() string { 33 | return "taobao.tbk.activitylink.get" 34 | } 35 | 36 | //返回请求参数 37 | func (tk *TbkActivitylinkGetRequest) GetParameters() url.Values { 38 | return *tk.Parameters 39 | } 40 | -------------------------------------------------------------------------------- /request/tbkcouponget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | ) 7 | 8 | //taobao.tbk.coupon.get( 阿里妈妈推广券信息查询 ) 9 | //http://open.taobao.com/api.htm?docId=31106&docType=2&scopeId=11655 10 | type TbkCouponGetRequest struct { 11 | Parameters *url.Values //请求参数 12 | } 13 | 14 | func (tk *TbkCouponGetRequest) CheckParameters() { 15 | 16 | } 17 | 18 | //添加请求参数 19 | func (tk *TbkCouponGetRequest) AddParameter(key, val string) { 20 | if tk.Parameters == nil { 21 | tk.Parameters = &url.Values{} 22 | } 23 | tk.Parameters.Add(key, val) 24 | } 25 | 26 | //返回接口名称 27 | func (tk *TbkCouponGetRequest) GetApiName() string { 28 | return "taobao.tbk.coupon.get" 29 | } 30 | 31 | //返回请求参数 32 | func (tk *TbkCouponGetRequest) GetParameters() url.Values { 33 | return *tk.Parameters 34 | } 35 | -------------------------------------------------------------------------------- /request/tbkdgitemcouponget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.dg.item.coupon.get( 好券清单API【导购】 ) 10 | //http://open.taobao.com/api.htm?docId=29821&docType=2&scopeId=11655 11 | type TbkDgItemCouponGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkDgItemCouponGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 17 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 18 | 19 | } 20 | 21 | //添加请求参数 22 | func (tk *TbkDgItemCouponGetRequest) AddParameter(key, val string) { 23 | if tk.Parameters == nil { 24 | tk.Parameters = &url.Values{} 25 | } 26 | tk.Parameters.Add(key, val) 27 | } 28 | 29 | //返回接口名称 30 | func (tk *TbkDgItemCouponGetRequest) GetApiName() string { 31 | return "taobao.tbk.dg.item.coupon.get" 32 | } 33 | 34 | //返回请求参数 35 | func (tk *TbkDgItemCouponGetRequest) GetParameters() url.Values { 36 | return *tk.Parameters 37 | } 38 | -------------------------------------------------------------------------------- /request/tbkdgmaterialoptional.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.dg.material.optional( 通用物料搜索API(导购) ) 10 | //http://open.taobao.com/api.htm?docId=35896&docType=2&scopeId=11655 11 | type TbkDgMaterialOptionalRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkDgMaterialOptionalRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 17 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 18 | 19 | } 20 | 21 | //添加请求参数 22 | func (tk *TbkDgMaterialOptionalRequest) AddParameter(key, val string) { 23 | if tk.Parameters == nil { 24 | tk.Parameters = &url.Values{} 25 | } 26 | tk.Parameters.Add(key, val) 27 | } 28 | 29 | //返回接口名称 30 | func (tk *TbkDgMaterialOptionalRequest) GetApiName() string { 31 | return "taobao.tbk.dg.material.optional" 32 | } 33 | 34 | //返回请求参数 35 | func (tk *TbkDgMaterialOptionalRequest) GetParameters() url.Values { 36 | return *tk.Parameters 37 | } 38 | -------------------------------------------------------------------------------- /request/tbkdgnewuserorderget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.dg.newuser.order.get( 淘宝客新用户订单API--导购 ) 10 | //http://open.taobao.com/api.htm?docId=33892&docType=2&scopeId=11655 11 | type TbkDgNewuserOrderGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkDgNewuserOrderGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("activity_id"), "activity_id") 17 | 18 | } 19 | 20 | //添加请求参数 21 | func (tk *TbkDgNewuserOrderGetRequest) AddParameter(key, val string) { 22 | if tk.Parameters == nil { 23 | tk.Parameters = &url.Values{} 24 | } 25 | tk.Parameters.Add(key, val) 26 | } 27 | 28 | //返回接口名称 29 | func (tk *TbkDgNewuserOrderGetRequest) GetApiName() string { 30 | return "taobao.tbk.dg.newuser.order.get" 31 | } 32 | 33 | //返回请求参数 34 | func (tk *TbkDgNewuserOrderGetRequest) GetParameters() url.Values { 35 | return *tk.Parameters 36 | } 37 | -------------------------------------------------------------------------------- /request/tbkdgnewuserordersum.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.dg.newuser.order.sum( 拉新活动汇总API--导购 ) 10 | //http://open.taobao.com/api.htm?docId=36836&docType=2&scopeId=11655 11 | type TbkDgNewuserOrderSumRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkDgNewuserOrderSumRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("activity_id"), "activity_id") 17 | utils.CheckNotNull(tk.Parameters.Get("page_no"), "page_no") 18 | utils.CheckNumber(tk.Parameters.Get("page_no"), "page_no") 19 | utils.CheckNotNull(tk.Parameters.Get("page_size"), "page_size") 20 | utils.CheckNumber(tk.Parameters.Get("page_size"), "page_size") 21 | 22 | } 23 | 24 | //添加请求参数 25 | func (tk *TbkDgNewuserOrderSumRequest) AddParameter(key, val string) { 26 | if tk.Parameters == nil { 27 | tk.Parameters = &url.Values{} 28 | } 29 | tk.Parameters.Add(key, val) 30 | } 31 | 32 | //返回接口名称 33 | func (tk *TbkDgNewuserOrderSumRequest) GetApiName() string { 34 | return "taobao.tbk.dg.newuser.order.sum" 35 | } 36 | 37 | //返回请求参数 38 | func (tk *TbkDgNewuserOrderSumRequest) GetParameters() url.Values { 39 | return *tk.Parameters 40 | } 41 | -------------------------------------------------------------------------------- /request/tbkdgoptimusmaterial.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.dg.optimus.material( 淘宝客物料下行-导购 ) 10 | //http://open.taobao.com/api.htm?docId=33947&docType=2&scopeId=11655 11 | type TbkDgOptimusMaterialRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkDgOptimusMaterialRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 17 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 18 | 19 | } 20 | 21 | //添加请求参数 22 | func (tk *TbkDgOptimusMaterialRequest) AddParameter(key, val string) { 23 | if tk.Parameters == nil { 24 | tk.Parameters = &url.Values{} 25 | } 26 | tk.Parameters.Add(key, val) 27 | } 28 | 29 | //返回接口名称 30 | func (tk *TbkDgOptimusMaterialRequest) GetApiName() string { 31 | return "taobao.tbk.dg.optimus.material" 32 | } 33 | 34 | //返回请求参数 35 | func (tk *TbkDgOptimusMaterialRequest) GetParameters() url.Values { 36 | return *tk.Parameters 37 | } 38 | -------------------------------------------------------------------------------- /request/tbkitemconvert.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.item.convert( 淘宝客商品链接转换 ) 10 | //http://open.taobao.com/api.htm?docId=24516&docType=2&scopeId=11653 11 | type TbkItemConvertRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkItemConvertRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 17 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 18 | 19 | utils.CheckNotNull(tk.Parameters.Get("fields"), "fields") 20 | utils.CheckNotNull(tk.Parameters.Get("num_iids"), "num_iids") 21 | utils.CheckMaxListSize(tk.Parameters.Get("num_iids"), 40, "num_iids") 22 | } 23 | 24 | //添加请求参数 25 | func (tk *TbkItemConvertRequest) AddParameter(key, val string) { 26 | if tk.Parameters == nil { 27 | tk.Parameters = &url.Values{} 28 | } 29 | tk.Parameters.Add(key, val) 30 | } 31 | 32 | //返回接口名称 33 | func (tk *TbkItemConvertRequest) GetApiName() string { 34 | return "taobao.tbk.item.convert" 35 | } 36 | 37 | //返回请求参数 38 | func (tk *TbkItemConvertRequest) GetParameters() url.Values { 39 | return *tk.Parameters 40 | } 41 | -------------------------------------------------------------------------------- /request/tbkitemcouponget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.item.coupon.get( 单品加券检索api ) 10 | //http://open.taobao.com/api.htm?docId=28110&docType=2&scopeId=12332 11 | type TbkItemCouponGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkItemCouponGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("pid"), "pid") 17 | } 18 | 19 | //添加请求参数 20 | func (tk *TbkItemCouponGetRequest) AddParameter(key, val string) { 21 | if tk.Parameters == nil { 22 | tk.Parameters = &url.Values{} 23 | } 24 | tk.Parameters.Add(key, val) 25 | } 26 | 27 | //返回接口名称 28 | func (tk *TbkItemCouponGetRequest) GetApiName() string { 29 | return "taobao.tbk.item.coupon.get" 30 | } 31 | 32 | //返回请求参数 33 | func (tk *TbkItemCouponGetRequest) GetParameters() url.Values { 34 | return *tk.Parameters 35 | } 36 | -------------------------------------------------------------------------------- /request/tbkitemget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.item.get( 淘宝客商品查询 ) 10 | //http://open.taobao.com/api.htm?docId=24515&docType=2&scopeId=11655 11 | type TbkItemGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | //参数检测 16 | func (tk *TbkItemGetRequest) CheckParameters() { 17 | utils.CheckNotNull(tk.Parameters.Get("fields"), "fields") 18 | } 19 | 20 | //添加请求参数 21 | func (tk *TbkItemGetRequest) AddParameter(key, val string) { 22 | if tk.Parameters == nil { 23 | tk.Parameters = &url.Values{} 24 | } 25 | tk.Parameters.Add(key, val) 26 | } 27 | 28 | //返回接口名称 29 | func (tk *TbkItemGetRequest) GetApiName() string { 30 | return "taobao.tbk.item.get" 31 | } 32 | 33 | //返回请求参数 34 | func (tk *TbkItemGetRequest) GetParameters() url.Values { 35 | return *tk.Parameters 36 | } 37 | -------------------------------------------------------------------------------- /request/tbkiteminfoget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.item.info.get( 淘宝客商品详情(简版) ) 10 | //http://open.taobao.com/api.htm?docId=24518&docType=2 11 | type TbkItemInfoGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | //参数检测 16 | func (tk *TbkItemInfoGetRequest) CheckParameters() { 17 | utils.CheckNotNull(tk.Parameters.Get("num_iids"), "num_iids") 18 | utils.CheckMaxListSize(tk.Parameters.Get("num_iids"), 40, "num_iids") 19 | } 20 | 21 | //添加请求参数 22 | func (tk *TbkItemInfoGetRequest) AddParameter(key, val string) { 23 | if tk.Parameters == nil { 24 | tk.Parameters = &url.Values{} 25 | } 26 | tk.Parameters.Add(key, val) 27 | } 28 | 29 | //返回接口名称 30 | func (tk *TbkItemInfoGetRequest) GetApiName() string { 31 | return "taobao.tbk.item.info.get" 32 | } 33 | 34 | //返回请求参数 35 | func (tk *TbkItemInfoGetRequest) GetParameters() url.Values { 36 | return *tk.Parameters 37 | } 38 | -------------------------------------------------------------------------------- /request/tbkitemrecommendget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.item.recommend.get( 淘宝客商品关联推荐查询 ) 10 | //http://open.taobao.com/api.htm?docId=24517&docType=2&scopeId=11655 11 | type TbkItemRecommendGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | //参数检测 16 | func (tk *TbkItemRecommendGetRequest) CheckParameters() { 17 | utils.CheckNotNull(tk.Parameters.Get("fields"), "fields") 18 | utils.CheckNotNull(tk.Parameters.Get("num_iid"), "num_iid") 19 | } 20 | 21 | //添加请求参数 22 | func (tk *TbkItemRecommendGetRequest) AddParameter(key, val string) { 23 | if tk.Parameters == nil { 24 | tk.Parameters = &url.Values{} 25 | } 26 | tk.Parameters.Add(key, val) 27 | } 28 | 29 | //返回接口名称 30 | func (tk *TbkItemRecommendGetRequest) GetApiName() string { 31 | return "taobao.tbk.item.recommend.get" 32 | } 33 | 34 | //返回请求参数 35 | func (tk *TbkItemRecommendGetRequest) GetParameters() url.Values { 36 | return *tk.Parameters 37 | } 38 | -------------------------------------------------------------------------------- /request/tbkjutqgget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.ju.tqg.get( 淘抢购api ) 10 | //http://open.taobao.com/api.htm?docId=27543&docType=2&scopeId=11655 11 | type TbkJuTqgGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkJuTqgGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("fields"), "fields") 17 | utils.CheckNotNull(tk.Parameters.Get("start_time"), "start_time") 18 | utils.CheckNotNull(tk.Parameters.Get("end_time"), "end_time") 19 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 20 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 21 | 22 | } 23 | 24 | //添加请求参数 25 | func (tk *TbkJuTqgGetRequest) AddParameter(key, val string) { 26 | if tk.Parameters == nil { 27 | tk.Parameters = &url.Values{} 28 | } 29 | tk.Parameters.Add(key, val) 30 | } 31 | 32 | //返回接口名称 33 | func (tk *TbkJuTqgGetRequest) GetApiName() string { 34 | return "taobao.tbk.ju.tqg.get" 35 | } 36 | 37 | //返回请求参数 38 | func (tk *TbkJuTqgGetRequest) GetParameters() url.Values { 39 | return *tk.Parameters 40 | } 41 | -------------------------------------------------------------------------------- /request/tbkprivilegeget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.privilege.get( 单品券高效转链API ) 10 | //http://open.taobao.com/api.htm?docId=28625&docType=2&scopeId=12403 11 | type TbkPrivilegeGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkPrivilegeGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 17 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 18 | 19 | utils.CheckNotNull(tk.Parameters.Get("site_id"), "site_id") 20 | utils.CheckNumber(tk.Parameters.Get("site_id"), "site_id") 21 | 22 | } 23 | 24 | //添加请求参数 25 | func (tk *TbkPrivilegeGetRequest) AddParameter(key, val string) { 26 | if tk.Parameters == nil { 27 | tk.Parameters = &url.Values{} 28 | } 29 | tk.Parameters.Add(key, val) 30 | } 31 | 32 | //返回接口名称 33 | func (tk *TbkPrivilegeGetRequest) GetApiName() string { 34 | return "taobao.tbk.privilege.get" 35 | } 36 | 37 | //返回请求参数 38 | func (tk *TbkPrivilegeGetRequest) GetParameters() url.Values { 39 | return *tk.Parameters 40 | } 41 | -------------------------------------------------------------------------------- /request/tbkscactivitylinktoolget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.sc.activitylink.toolget( 淘宝联盟官方活动推广API-工具 ) 10 | //http://open.taobao.com/api.htm?docId=41921&docType=2&scopeId=15675 11 | type TbkScActivitylinkToolgetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkScActivitylinkToolgetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 17 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 18 | 19 | utils.CheckNotNull(tk.Parameters.Get("site_id"), "site_id") 20 | utils.CheckNumber(tk.Parameters.Get("site_id"), "site_id") 21 | 22 | utils.CheckNotNull(tk.Parameters.Get("promotion_scene_id"), "promotion_scene_id") 23 | } 24 | 25 | //添加请求参数 26 | func (tk *TbkScActivitylinkToolgetRequest) AddParameter(key, val string) { 27 | if tk.Parameters == nil { 28 | tk.Parameters = &url.Values{} 29 | } 30 | tk.Parameters.Add(key, val) 31 | } 32 | 33 | //返回接口名称 34 | func (tk *TbkScActivitylinkToolgetRequest) GetApiName() string { 35 | return "taobao.tbk.sc.activitylink.toolget" 36 | } 37 | 38 | //返回请求参数 39 | func (tk *TbkScActivitylinkToolgetRequest) GetParameters() url.Values { 40 | return *tk.Parameters 41 | } 42 | -------------------------------------------------------------------------------- /request/tbksccouponbrandrecommend.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.sc.coupon.brand.recommend( 品牌券API【社交】 ) 10 | //http://open.taobao.com/api.htm?docId=29823&docType=2&scopeId=12331 11 | type TbkScCouponBrandRecommendRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkScCouponBrandRecommendRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 17 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 18 | 19 | utils.CheckNumber(tk.Parameters.Get("site_id"), "site_id") 20 | utils.CheckNumber(tk.Parameters.Get("site_id"), "site_id") 21 | } 22 | 23 | //添加请求参数 24 | func (tk *TbkScCouponBrandRecommendRequest) AddParameter(key, val string) { 25 | if tk.Parameters == nil { 26 | tk.Parameters = &url.Values{} 27 | } 28 | tk.Parameters.Add(key, val) 29 | } 30 | 31 | //返回接口名称 32 | func (tk *TbkScCouponBrandRecommendRequest) GetApiName() string { 33 | return "taobao.tbk.sc.coupon.brand.recommend" 34 | } 35 | 36 | //返回请求参数 37 | func (tk *TbkScCouponBrandRecommendRequest) GetParameters() url.Values { 38 | return *tk.Parameters 39 | } 40 | -------------------------------------------------------------------------------- /request/tbksccouponrealtimerecommend.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.sc.coupon.realtime.recommend( 好券直播API【社交】 ) 10 | //http://open.taobao.com/api.htm?docId=29820&docType=2&scopeId=12331 11 | type TbkScCouponRealtimeRecommendRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkScCouponRealtimeRecommendRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 17 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 18 | 19 | utils.CheckNumber(tk.Parameters.Get("site_id"), "site_id") 20 | utils.CheckNumber(tk.Parameters.Get("site_id"), "site_id") 21 | } 22 | 23 | //添加请求参数 24 | func (tk *TbkScCouponRealtimeRecommendRequest) AddParameter(key, val string) { 25 | if tk.Parameters == nil { 26 | tk.Parameters = &url.Values{} 27 | } 28 | tk.Parameters.Add(key, val) 29 | } 30 | 31 | //返回接口名称 32 | func (tk *TbkScCouponRealtimeRecommendRequest) GetApiName() string { 33 | return "taobao.tbk.sc.coupon.realtime.recommend" 34 | } 35 | 36 | //返回请求参数 37 | func (tk *TbkScCouponRealtimeRecommendRequest) GetParameters() url.Values { 38 | return *tk.Parameters 39 | } 40 | -------------------------------------------------------------------------------- /request/tbkscinvitecodeget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.sc.invitecode.get( 淘宝客邀请码生成-社交 ) 10 | //http://open.taobao.com/api.htm?docId=38046&docType=2&scopeId=14474 11 | type TbkScInvitecodeGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkScInvitecodeGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("relation_app"), "relation_app") 17 | utils.CheckNotNull(tk.Parameters.Get("code_type"), "code_type") 18 | utils.CheckNumber(tk.Parameters.Get("code_type"), "code_type") 19 | } 20 | 21 | //添加请求参数 22 | func (tk *TbkScInvitecodeGetRequest) AddParameter(key, val string) { 23 | if tk.Parameters == nil { 24 | tk.Parameters = &url.Values{} 25 | } 26 | tk.Parameters.Add(key, val) 27 | } 28 | 29 | //返回接口名称 30 | func (tk *TbkScInvitecodeGetRequest) GetApiName() string { 31 | return "taobao.tbk.sc.invitecode.get" 32 | } 33 | 34 | //返回请求参数 35 | func (tk *TbkScInvitecodeGetRequest) GetParameters() url.Values { 36 | return *tk.Parameters 37 | } 38 | -------------------------------------------------------------------------------- /request/tbkscmaterialoptional.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.sc.material.optional( 通用物料搜索API ) 10 | //http://open.taobao.com/api.htm?docId=35263&docType=2&scopeId=13991 11 | type TbkScMaterialOptionalRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkScMaterialOptionalRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 17 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 18 | 19 | utils.CheckNotNull(tk.Parameters.Get("site_id"), "site_id") 20 | utils.CheckNumber(tk.Parameters.Get("site_id"), "site_id") 21 | 22 | utils.CheckMaxValue(tk.Parameters.Get("page_size"), 100, "page_size") 23 | 24 | } 25 | 26 | //添加请求参数 27 | func (tk *TbkScMaterialOptionalRequest) AddParameter(key, val string) { 28 | if tk.Parameters == nil { 29 | tk.Parameters = &url.Values{} 30 | } 31 | tk.Parameters.Add(key, val) 32 | } 33 | 34 | //返回接口名称 35 | func (tk *TbkScMaterialOptionalRequest) GetApiName() string { 36 | return "taobao.tbk.sc.material.optional" 37 | } 38 | 39 | //返回请求参数 40 | func (tk *TbkScMaterialOptionalRequest) GetParameters() url.Values { 41 | return *tk.Parameters 42 | } 43 | -------------------------------------------------------------------------------- /request/tbkscnewuserorderget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.sc.newuser.order.get( 淘宝客新用户订单API--社交 ) 10 | //http://open.taobao.com/api.htm?docId=33897&docType=2&scopeId=11655 11 | type TbkScNewuserOrderGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkScNewuserOrderGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("activity_id"), "activity_id") 17 | 18 | } 19 | 20 | //添加请求参数 21 | func (tk *TbkScNewuserOrderGetRequest) AddParameter(key, val string) { 22 | if tk.Parameters == nil { 23 | tk.Parameters = &url.Values{} 24 | } 25 | tk.Parameters.Add(key, val) 26 | } 27 | 28 | //返回接口名称 29 | func (tk *TbkScNewuserOrderGetRequest) GetApiName() string { 30 | return "taobao.tbk.sc.newuser.order.get" 31 | } 32 | 33 | //返回请求参数 34 | func (tk *TbkScNewuserOrderGetRequest) GetParameters() url.Values { 35 | return *tk.Parameters 36 | } 37 | -------------------------------------------------------------------------------- /request/tbkscnewuserordersum.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.sc.newuser.order.sum( 拉新活动汇总API--社交 ) 10 | //http://open.taobao.com/api.htm?docId=36837&docType=2&scopeId=11655 11 | type TbkScNewuserOrderSumRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkScNewuserOrderSumRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("activity_id"), "activity_id") 17 | utils.CheckNotNull(tk.Parameters.Get("page_no"), "page_no") 18 | utils.CheckNumber(tk.Parameters.Get("page_no"), "page_no") 19 | utils.CheckNotNull(tk.Parameters.Get("page_size"), "page_size") 20 | utils.CheckNumber(tk.Parameters.Get("page_size"), "page_size") 21 | 22 | } 23 | 24 | //添加请求参数 25 | func (tk *TbkScNewuserOrderSumRequest) AddParameter(key, val string) { 26 | if tk.Parameters == nil { 27 | tk.Parameters = &url.Values{} 28 | } 29 | tk.Parameters.Add(key, val) 30 | } 31 | 32 | //返回接口名称 33 | func (tk *TbkScNewuserOrderSumRequest) GetApiName() string { 34 | return "taobao.tbk.sc.newuser.order.sum" 35 | } 36 | 37 | //返回请求参数 38 | func (tk *TbkScNewuserOrderSumRequest) GetParameters() url.Values { 39 | return *tk.Parameters 40 | } 41 | -------------------------------------------------------------------------------- /request/tbkscoptimusmaterial.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.sc.optimus.material( 淘宝客擎天柱通用物料API - 社交 ) 10 | //http://open.taobao.com/api.htm?docId=37884&docType=2&scopeId=11655 11 | type TbkScOptimusMaterialRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkScOptimusMaterialRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 17 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 18 | utils.CheckNotNull(tk.Parameters.Get("site_id"), "site_id") 19 | utils.CheckNumber(tk.Parameters.Get("site_id"), "site_id") 20 | 21 | } 22 | 23 | //添加请求参数 24 | func (tk *TbkScOptimusMaterialRequest) AddParameter(key, val string) { 25 | if tk.Parameters == nil { 26 | tk.Parameters = &url.Values{} 27 | } 28 | tk.Parameters.Add(key, val) 29 | } 30 | 31 | //返回接口名称 32 | func (tk *TbkScOptimusMaterialRequest) GetApiName() string { 33 | return "taobao.tbk.sc.optimus.material" 34 | } 35 | 36 | //返回请求参数 37 | func (tk *TbkScOptimusMaterialRequest) GetParameters() url.Values { 38 | return *tk.Parameters 39 | } 40 | -------------------------------------------------------------------------------- /request/tbkscorderget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.sc.order.get( 淘宝客订单查询 - 社交 ) 10 | //http://open.taobao.com/api.htm?docId=38078&docType=2&scopeId=14814 11 | type TbkScOrderGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkScOrderGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("fields"), "fields") 17 | utils.CheckNotNull(tk.Parameters.Get("start_time"), "start_time") 18 | } 19 | 20 | //添加请求参数 21 | func (tk *TbkScOrderGetRequest) AddParameter(key, val string) { 22 | if tk.Parameters == nil { 23 | tk.Parameters = &url.Values{} 24 | } 25 | tk.Parameters.Add(key, val) 26 | } 27 | 28 | //返回接口名称 29 | func (tk *TbkScOrderGetRequest) GetApiName() string { 30 | return "taobao.tbk.sc.order.get" 31 | } 32 | 33 | //返回请求参数 34 | func (tk *TbkScOrderGetRequest) GetParameters() url.Values { 35 | return *tk.Parameters 36 | } 37 | -------------------------------------------------------------------------------- /request/tbkscpublisherinfoget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.sc.publisher.info.get( 淘宝客信息查询 - 社交 ) 10 | //http://open.taobao.com/api.htm?docId=37989&docType=2&scopeId=14474 11 | type TbkScPublisherInfoGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkScPublisherInfoGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("info_type"), "info_type") 17 | utils.CheckNumber(tk.Parameters.Get("info_type"), "info_type") 18 | utils.CheckNotNull(tk.Parameters.Get("relation_app"), "relation_app") 19 | } 20 | 21 | //添加请求参数 22 | func (tk *TbkScPublisherInfoGetRequest) AddParameter(key, val string) { 23 | if tk.Parameters == nil { 24 | tk.Parameters = &url.Values{} 25 | } 26 | tk.Parameters.Add(key, val) 27 | } 28 | 29 | //返回接口名称 30 | func (tk *TbkScPublisherInfoGetRequest) GetApiName() string { 31 | return "taobao.tbk.sc.publisher.info.get" 32 | } 33 | 34 | //返回请求参数 35 | func (tk *TbkScPublisherInfoGetRequest) GetParameters() url.Values { 36 | return *tk.Parameters 37 | } 38 | -------------------------------------------------------------------------------- /request/tbkscpublisherinfosave.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.sc.publisher.info.save( 淘宝客渠道信息备案 - 社交 ) 10 | //http://open.taobao.com/api.htm?docId=37988&docType=2&scopeId=14474 11 | type TbkScPublisherInfoSaveRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkScPublisherInfoSaveRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("inviter_code"), "inviter_code") 17 | utils.CheckNotNull(tk.Parameters.Get("info_type"), "info_type") 18 | utils.CheckNumber(tk.Parameters.Get("info_type"), "info_type") 19 | } 20 | 21 | //添加请求参数 22 | func (tk *TbkScPublisherInfoSaveRequest) AddParameter(key, val string) { 23 | if tk.Parameters == nil { 24 | tk.Parameters = &url.Values{} 25 | } 26 | tk.Parameters.Add(key, val) 27 | } 28 | 29 | //返回接口名称 30 | func (tk *TbkScPublisherInfoSaveRequest) GetApiName() string { 31 | return "taobao.tbk.sc.publisher.info.save" 32 | } 33 | 34 | //返回请求参数 35 | func (tk *TbkScPublisherInfoSaveRequest) GetParameters() url.Values { 36 | return *tk.Parameters 37 | } 38 | -------------------------------------------------------------------------------- /request/tbkshopconvert.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.shop.convert( 淘宝客店铺链接转换 ) 10 | //http://open.taobao.com/api.htm?docId=24523&docType=2&scopeId=11653 11 | type TbkShopConvertRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkShopConvertRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 17 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 18 | 19 | utils.CheckNotNull(tk.Parameters.Get("fields"), "fields") 20 | utils.CheckNotNull(tk.Parameters.Get("user_ids"), "user_ids") 21 | } 22 | 23 | //添加请求参数 24 | func (tk *TbkShopConvertRequest) AddParameter(key, val string) { 25 | if tk.Parameters == nil { 26 | tk.Parameters = &url.Values{} 27 | } 28 | tk.Parameters.Add(key, val) 29 | } 30 | 31 | //返回接口名称 32 | func (tk *TbkShopConvertRequest) GetApiName() string { 33 | return "taobao.tbk.shop.convert" 34 | } 35 | 36 | //返回请求参数 37 | func (tk *TbkShopConvertRequest) GetParameters() url.Values { 38 | return *tk.Parameters 39 | } 40 | -------------------------------------------------------------------------------- /request/tbkshopget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.shop.get( 淘宝客店铺查询 ) 10 | //http://open.taobao.com/api.htm?docId=24521&docType=2&scopeId=11655 11 | type TbkShopGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkShopGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("fields"), "fields") 17 | utils.CheckNotNull(tk.Parameters.Get("q"), "q") 18 | 19 | } 20 | 21 | //添加请求参数 22 | func (tk *TbkShopGetRequest) AddParameter(key, val string) { 23 | if tk.Parameters == nil { 24 | tk.Parameters = &url.Values{} 25 | } 26 | tk.Parameters.Add(key, val) 27 | } 28 | 29 | //返回接口名称 30 | func (tk *TbkShopGetRequest) GetApiName() string { 31 | return "taobao.tbk.shop.get" 32 | } 33 | 34 | //返回请求参数 35 | func (tk *TbkShopGetRequest) GetParameters() url.Values { 36 | return *tk.Parameters 37 | } 38 | -------------------------------------------------------------------------------- /request/tbkshoprecommendget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.shop.recommend.get( 淘宝客店铺关联推荐查询 ) 10 | //http://open.taobao.com/api.htm?docId=24522&docType=2&scopeId=11655 11 | type TbkShopRecommendGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkShopRecommendGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("fields"), "fields") 17 | utils.CheckNotNull(tk.Parameters.Get("user_id"), "user_id") 18 | utils.CheckNumber(tk.Parameters.Get("user_id"), "user_id") 19 | 20 | } 21 | 22 | //添加请求参数 23 | func (tk *TbkShopRecommendGetRequest) AddParameter(key, val string) { 24 | if tk.Parameters == nil { 25 | tk.Parameters = &url.Values{} 26 | } 27 | tk.Parameters.Add(key, val) 28 | } 29 | 30 | //返回接口名称 31 | func (tk *TbkShopRecommendGetRequest) GetApiName() string { 32 | return "taobao.tbk.shop.recommend.get" 33 | } 34 | 35 | //返回请求参数 36 | func (tk *TbkShopRecommendGetRequest) GetParameters() url.Values { 37 | return *tk.Parameters 38 | } 39 | -------------------------------------------------------------------------------- /request/tbkspreadget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.spread.get( 物料传播方式获取 ) 10 | //http://open.taobao.com/api.htm?docId=27832&docType=2&scopeId=12340 11 | type TbkSpreadGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkSpreadGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("requests"), "requests") 17 | } 18 | 19 | //添加请求参数 20 | func (tk *TbkSpreadGetRequest) AddParameter(key, val string) { 21 | if tk.Parameters == nil { 22 | tk.Parameters = &url.Values{} 23 | } 24 | tk.Parameters.Add(key, val) 25 | } 26 | 27 | //返回接口名称 28 | func (tk *TbkSpreadGetRequest) GetApiName() string { 29 | return "taobao.tbk.spread.get" 30 | } 31 | 32 | //返回请求参数 33 | func (tk *TbkSpreadGetRequest) GetParameters() url.Values { 34 | return *tk.Parameters 35 | } 36 | -------------------------------------------------------------------------------- /request/tbktpwdconvert.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.tpwd.convert( 淘口令转链 ) 10 | //http://open.taobao.com/api.htm?docId=32932&docType=2&scopeId=11653 11 | type TbkTpwdConvertRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkTpwdConvertRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 17 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 18 | 19 | utils.CheckNotNull(tk.Parameters.Get("password_content"), "password_content") 20 | } 21 | 22 | //添加请求参数 23 | func (tk *TbkTpwdConvertRequest) AddParameter(key, val string) { 24 | if tk.Parameters == nil { 25 | tk.Parameters = &url.Values{} 26 | } 27 | tk.Parameters.Add(key, val) 28 | } 29 | 30 | //返回接口名称 31 | func (tk *TbkTpwdConvertRequest) GetApiName() string { 32 | return "taobao.tbk.tpwd.convert" 33 | } 34 | 35 | //返回请求参数 36 | func (tk *TbkTpwdConvertRequest) GetParameters() url.Values { 37 | return *tk.Parameters 38 | } 39 | -------------------------------------------------------------------------------- /request/tbktpwdcreate.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.tpwd.create( 淘宝客淘口令 ) 10 | //http://open.taobao.com/api.htm?docId=31127&docType=2&scopeId=11655 11 | type TbkTpwdCreateRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkTpwdCreateRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("text"), "text") 17 | utils.CheckNotNull(tk.Parameters.Get("url"), "url") 18 | 19 | } 20 | 21 | //添加请求参数 22 | func (tk *TbkTpwdCreateRequest) AddParameter(key, val string) { 23 | if tk.Parameters == nil { 24 | tk.Parameters = &url.Values{} 25 | } 26 | tk.Parameters.Add(key, val) 27 | } 28 | 29 | //返回接口名称 30 | func (tk *TbkTpwdCreateRequest) GetApiName() string { 31 | return "taobao.tbk.tpwd.create" 32 | } 33 | 34 | //返回请求参数 35 | func (tk *TbkTpwdCreateRequest) GetParameters() url.Values { 36 | return *tk.Parameters 37 | } 38 | -------------------------------------------------------------------------------- /request/tbkuatmfavoritesget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.uatm.favorites.get( 获取淘宝联盟选品库列表 ) 10 | //http://open.taobao.com/api.htm?docId=26620&docType=2&scopeId=11655 11 | type TbkUatmFavoritesGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkUatmFavoritesGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("fields"), "fields") 17 | 18 | } 19 | 20 | //添加请求参数 21 | func (tk *TbkUatmFavoritesGetRequest) AddParameter(key, val string) { 22 | if tk.Parameters == nil { 23 | tk.Parameters = &url.Values{} 24 | } 25 | tk.Parameters.Add(key, val) 26 | } 27 | 28 | //返回接口名称 29 | func (tk *TbkUatmFavoritesGetRequest) GetApiName() string { 30 | return "taobao.tbk.uatm.favorites.get" 31 | } 32 | 33 | //返回请求参数 34 | func (tk *TbkUatmFavoritesGetRequest) GetParameters() url.Values { 35 | return *tk.Parameters 36 | } 37 | -------------------------------------------------------------------------------- /request/tbkuatmfavoritesitemget.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.tbk.uatm.favorites.item.get( 获取淘宝联盟选品库的宝贝信息 ) 10 | //http://open.taobao.com/api.htm?docId=26619&docType=2&scopeId=11655 11 | type TbkUatmFavoritesItemGetRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *TbkUatmFavoritesItemGetRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("fields"), "fields") 17 | utils.CheckNotNull(tk.Parameters.Get("adzone_id"), "adzone_id") 18 | utils.CheckNumber(tk.Parameters.Get("adzone_id"), "adzone_id") 19 | utils.CheckNotNull(tk.Parameters.Get("favorites_id"), "favorites_id") 20 | utils.CheckNumber(tk.Parameters.Get("favorites_id"), "favorites_id") 21 | 22 | } 23 | 24 | //添加请求参数 25 | func (tk *TbkUatmFavoritesItemGetRequest) AddParameter(key, val string) { 26 | if tk.Parameters == nil { 27 | tk.Parameters = &url.Values{} 28 | } 29 | tk.Parameters.Add(key, val) 30 | } 31 | 32 | //返回接口名称 33 | func (tk *TbkUatmFavoritesItemGetRequest) GetApiName() string { 34 | return "taobao.tbk.uatm.favorites.item.get" 35 | } 36 | 37 | //返回请求参数 38 | func (tk *TbkUatmFavoritesItemGetRequest) GetParameters() url.Values { 39 | return *tk.Parameters 40 | } 41 | -------------------------------------------------------------------------------- /request/wirelesssharetpwdquery.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/mimicode/taobaoopensdk/utils" 7 | ) 8 | 9 | //taobao.wireless.share.tpwd.query( 查询解析淘口令 ) 10 | //http://open.taobao.com/api.htm?docId=32461&docType=2&scopeId=11998 11 | type WirelessShareTpwdQueryRequest struct { 12 | Parameters *url.Values //请求参数 13 | } 14 | 15 | func (tk *WirelessShareTpwdQueryRequest) CheckParameters() { 16 | utils.CheckNotNull(tk.Parameters.Get("password_content"), "password_content") 17 | } 18 | 19 | //添加请求参数 20 | func (tk *WirelessShareTpwdQueryRequest) AddParameter(key, val string) { 21 | if tk.Parameters == nil { 22 | tk.Parameters = &url.Values{} 23 | } 24 | tk.Parameters.Add(key, val) 25 | } 26 | 27 | //返回接口名称 28 | func (tk *WirelessShareTpwdQueryRequest) GetApiName() string { 29 | return "taobao.wireless.share.tpwd.query" 30 | } 31 | 32 | //返回请求参数 33 | func (tk *WirelessShareTpwdQueryRequest) GetParameters() url.Values { 34 | return *tk.Parameters 35 | } 36 | -------------------------------------------------------------------------------- /response/juitemssearch.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.ju.items.search( 聚划算商品搜索接口 ) 6 | type JuItemsSearchResponse struct { 7 | TopResponse 8 | JuItemsSearchResult JuItemsSearchResult `json:"ju_items_search_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *JuItemsSearchResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type JuItemsSearchResult struct { 24 | Result JuItemsSearchResultItem `json:"result"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type JuItemsSearchResultItem struct { 29 | CurrentPage int64 `json:"current_page"` 30 | ModelList JuItemsSearchModelList `json:"model_list"` 31 | PageSize int64 `json:"page_size"` 32 | Success bool `json:"success"` 33 | TotalItem int64 `json:"total_item"` 34 | TotalPage int64 `json:"total_page"` 35 | TrackParams JuItemsSearchTrackParams `json:"track_params"` 36 | } 37 | 38 | type JuItemsSearchModelList struct { 39 | Items []JuItemsSearchItem `json:"items"` 40 | } 41 | 42 | type JuItemsSearchItem struct { 43 | ActPrice string `json:"act_price"` 44 | CategoryName string `json:"category_name"` 45 | ItemID int64 `json:"item_id"` 46 | ItemUspList JuItemsSearchList `json:"item_usp_list"` 47 | JuID int64 `json:"ju_id"` 48 | OnlineEndTime int64 `json:"online_end_time"` 49 | OnlineStartTime int64 `json:"online_start_time"` 50 | OrigPrice string `json:"orig_price"` 51 | PayPostage bool `json:"pay_postage"` 52 | PCURL string `json:"pc_url"` 53 | PicURLForPC string `json:"pic_url_for_p_c"` 54 | PicURLForWL string `json:"pic_url_for_w_l"` 55 | PlatformID int64 `json:"platform_id"` 56 | PriceUspList JuItemsSearchList `json:"price_usp_list"` 57 | ShowEndTime int64 `json:"show_end_time"` 58 | ShowStartTime int64 `json:"show_start_time"` 59 | TBFirstCatID int64 `json:"tb_first_cat_id"` 60 | Title string `json:"title"` 61 | UspDescList JuItemsSearchList `json:"usp_desc_list"` 62 | WAPURL string `json:"wap_url"` 63 | } 64 | 65 | type JuItemsSearchList struct { 66 | String []string `json:"string"` 67 | } 68 | 69 | type JuItemsSearchTrackParams struct { 70 | Empty bool `json:"empty"` 71 | } 72 | -------------------------------------------------------------------------------- /response/sellercatslistget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.sellercats.list.get( 获取前台展示的店铺内卖家自定义商品类目 ) 6 | type SellercatsListGetResponse struct { 7 | TopResponse 8 | SellercatsListGetResult SellercatsListGetResult `json:"sellercats_list_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *SellercatsListGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type SellercatsListGetResult struct { 24 | SellerCats SellercatsListGetSellerCats `json:"seller_cats"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type SellercatsListGetSellerCats struct { 29 | SellerCat []SellercatsListGetSellerCat `json:"seller_cat"` 30 | } 31 | 32 | type SellercatsListGetSellerCat struct { 33 | Cid int64 `json:"cid"` 34 | Name string `json:"name"` 35 | ParentCid int64 `json:"parent_cid"` 36 | PicURL string `json:"pic_url"` 37 | SortOrder int64 `json:"sort_order"` 38 | Type string `json:"type"` 39 | } 40 | -------------------------------------------------------------------------------- /response/shopcatslistget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.shopcats.list.get( 获取前台展示的店铺类目 ) 6 | type ShopcatsListGetResponse struct { 7 | TopResponse 8 | ShopcatsListGetResult ShopcatsListGetResult `json:"shopcats_list_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *ShopcatsListGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type ShopcatsListGetResult struct { 24 | ShopCats ShopcatsListGetShopCats `json:"shop_cats"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type ShopcatsListGetShopCats struct { 29 | ShopCat []ShopcatsListGetShopCat `json:"shop_cat"` 30 | } 31 | 32 | type ShopcatsListGetShopCat struct { 33 | Cid int64 `json:"cid"` 34 | IsParent bool `json:"is_parent"` 35 | Name string `json:"name"` 36 | ParentCid int64 `json:"parent_cid"` 37 | } -------------------------------------------------------------------------------- /response/shopgetbytitle.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.shop.getbytitle( 根据店铺名称获取店铺信息 ) 6 | type ShopGetbytitleResponse struct { 7 | TopResponse 8 | ShopGetbytitleResult ShopGetbytitleResult `json:"shop_getbytitle_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *ShopGetbytitleResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | 24 | 25 | type ShopGetbytitleResult struct { 26 | IsError bool `json:"is_error"` 27 | ResultShop string `json:"result_shop"` 28 | RequestID string `json:"request_id"` 29 | } -------------------------------------------------------------------------------- /response/tbkactivitylinkget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.activitylink.get( 淘宝联盟官方活动推广API-媒体 ) 6 | type TbkActivitylinkGetResponse struct { 7 | TopResponse 8 | TbkActivitylinkGetResult TbkActivitylinkGetResult `json:"tbk_activitylink_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkActivitylinkGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkActivitylinkGetResult struct { 24 | BizErrorCode int64 `json:"biz_error_code"` 25 | Data string `json:"data"` 26 | ResultCode int64 `json:"result_code"` 27 | RequestID string `json:"request_id"` 28 | } -------------------------------------------------------------------------------- /response/tbkcouponget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.coupon.get( 阿里妈妈推广券信息查询 ) 6 | type TbkCouponGetResponse struct { 7 | TopResponse 8 | TbkCouponGetResult TbkCouponGetResult `json:"tbk_coupon_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkCouponGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkCouponGetResult struct { 24 | Data TbkCouponGetData `json:"data"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkCouponGetData struct { 29 | CouponActivityID string `json:"coupon_activity_id"` 30 | CouponAmount string `json:"coupon_amount"` 31 | CouponEndTime string `json:"coupon_end_time"` 32 | CouponRemainCount int64 `json:"coupon_remain_count"` 33 | CouponSrcScene int64 `json:"coupon_src_scene"` 34 | CouponStartFee string `json:"coupon_start_fee"` 35 | CouponStartTime string `json:"coupon_start_time"` 36 | CouponTotalCount int64 `json:"coupon_total_count"` 37 | CouponType int64 `json:"coupon_type"` 38 | } 39 | -------------------------------------------------------------------------------- /response/tbkdgitemcouponget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.dg.item.coupon.get( 好券清单API【导购】 ) 6 | type TbkDgItemCouponGetResponse struct { 7 | TopResponse 8 | TbkDgItemCouponGetResult TbkDgItemCouponGetResult `json:"tbk_dg_item_coupon_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkDgItemCouponGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkDgItemCouponGetResult struct { 24 | Results TbkDgItemCouponGetResults `json:"results"` 25 | TotalResults int64 `json:"total_results"` 26 | RequestID string `json:"request_id"` 27 | } 28 | 29 | type TbkDgItemCouponGetResults struct { 30 | TbkCoupon []TbkDgItemCouponGetTbkCoupon `json:"tbk_coupon"` 31 | } 32 | 33 | type TbkDgItemCouponGetTbkCoupon struct { 34 | Category int64 `json:"category"` 35 | CommissionRate string `json:"commission_rate"` 36 | CouponClickURL string `json:"coupon_click_url"` 37 | CouponEndTime string `json:"coupon_end_time"` 38 | CouponInfo string `json:"coupon_info"` 39 | CouponRemainCount int64 `json:"coupon_remain_count"` 40 | CouponStartTime string `json:"coupon_start_time"` 41 | CouponTotalCount int64 `json:"coupon_total_count"` 42 | ItemDescription string `json:"item_description"` 43 | ItemURL string `json:"item_url"` 44 | Nick string `json:"nick"` 45 | NumIid int64 `json:"num_iid"` 46 | PictURL string `json:"pict_url"` 47 | SellerID int64 `json:"seller_id"` 48 | ShopTitle string `json:"shop_title"` 49 | SmallImages TbkDgItemCouponGetSmallImages `json:"small_images"` 50 | Title string `json:"title"` 51 | UserType int64 `json:"user_type"` 52 | Volume int64 `json:"volume"` 53 | ZkFinalPrice string `json:"zk_final_price"` 54 | } 55 | 56 | type TbkDgItemCouponGetSmallImages struct { 57 | String []string `json:"string"` 58 | } 59 | -------------------------------------------------------------------------------- /response/tbkdgmaterialoptional.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.dg.material.optional( 通用物料搜索API(导购) ) 6 | type TbkDgMaterialOptionalResponse struct { 7 | TopResponse 8 | TbkDgMaterialOptionalResult TbkDgMaterialOptionalResult `json:"tbk_dg_material_optional_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkDgMaterialOptionalResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkDgMaterialOptionalResult struct { 24 | ResultList TbkDgMaterialOptionalResultList `json:"result_list"` 25 | TotalResults int64 `json:"total_results"` 26 | RequestID string `json:"request_id"` 27 | } 28 | 29 | type TbkDgMaterialOptionalResultList struct { 30 | MapData []TbkDgMaterialOptionalMapDatum `json:"map_data"` 31 | } 32 | 33 | type TbkDgMaterialOptionalMapDatum struct { 34 | CategoryID int64 `json:"category_id"` 35 | CategoryName string `json:"category_name"` 36 | CommissionRate string `json:"commission_rate"` 37 | CommissionType string `json:"commission_type"` 38 | CouponID string `json:"coupon_id"` 39 | CouponInfo string `json:"coupon_info"` 40 | CouponShareURL string `json:"coupon_share_url"` 41 | CouponRemainCount int64 `json:"coupon_remain_count"` 42 | CouponTotalCount int64 `json:"coupon_total_count"` 43 | CouponStartTime string `json:"coupon_start_time"` 44 | CouponEndTime string `json:"coupon_end_time"` 45 | CouponStartFee string `json:"coupon_start_fee"` 46 | CouponAmount string `json:"coupon_amount"` 47 | IncludeDxjh string `json:"include_dxjh"` 48 | IncludeMkt string `json:"include_mkt"` 49 | InfoDxjh string `json:"info_dxjh"` 50 | ItemURL string `json:"item_url"` 51 | LevelOneCategoryID int64 `json:"level_one_category_id"` 52 | LevelOneCategoryName string `json:"level_one_category_name"` 53 | NumIid int64 `json:"num_iid"` 54 | PictURL string `json:"pict_url"` 55 | Provcity string `json:"provcity"` 56 | ReservePrice string `json:"reserve_price"` 57 | SellerID int64 `json:"seller_id"` 58 | Nick string `json:"nick"` 59 | ShopDsr int64 `json:"shop_dsr"` 60 | ShopTitle string `json:"shop_title"` 61 | ShortTitle string `json:"short_title"` 62 | SmallImages TbkDgMaterialOptionalSmallImages `json:"small_images"` 63 | Title string `json:"title"` 64 | TkTotalCommi string `json:"tk_total_commi"` 65 | TkTotalSales string `json:"tk_total_sales"` 66 | URL string `json:"url"` 67 | UserType int64 `json:"user_type"` 68 | Volume int64 `json:"volume"` 69 | WhiteImage string `json:"white_image"` 70 | XID string `json:"x_id"` 71 | ZkFinalPrice string `json:"zk_final_price"` 72 | } 73 | 74 | type TbkDgMaterialOptionalSmallImages struct { 75 | String []string `json:"string"` 76 | } 77 | -------------------------------------------------------------------------------- /response/tbkdgnewuserorderget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.dg.newuser.order.get( 淘宝客新用户订单API--导购 ) 6 | type TbkDgNewuserOrderGetResponse struct { 7 | TopResponse 8 | TbkDgNewuserOrderGetResult TbkDgNewuserOrderGetResult `json:"tbk_dg_newuser_order_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkDgNewuserOrderGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkDgNewuserOrderGetResult struct { 24 | Results TbkDgNewuserOrderGetResponseResults `json:"results"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkDgNewuserOrderGetResponseResults struct { 29 | Data TbkDgNewuserOrderGetResultsData `json:"data"` 30 | } 31 | 32 | type TbkDgNewuserOrderGetResultsData struct { 33 | HasNext bool `json:"has_next"` 34 | PageNo int64 `json:"page_no"` 35 | PageSize int64 `json:"page_size"` 36 | Results TbkDgNewuserOrderGetResultDataResults `json:"results"` 37 | } 38 | 39 | type TbkDgNewuserOrderGetResultDataResults struct { 40 | MapData []TbkDgNewuserOrderGetResultMapDatum `json:"map_data"` 41 | } 42 | 43 | type TbkDgNewuserOrderGetResultMapDatum struct { 44 | AcceptTime string `json:"accept_time"` 45 | ActivityID string `json:"activity_id"` 46 | ActivityType string `json:"activity_type"` 47 | AdzoneID int64 `json:"adzone_id"` 48 | AdzoneName string `json:"adzone_name"` 49 | BindTime string `json:"bind_time"` 50 | BizDate string `json:"biz_date"` 51 | BuyTime string `json:"buy_time"` 52 | MemberID int64 `json:"member_id"` 53 | Mobile string `json:"mobile"` 54 | OrderTkType int64 `json:"order_tk_type"` 55 | RegisterTime string `json:"register_time"` 56 | SiteID int64 `json:"site_id"` 57 | SiteName string `json:"site_name"` 58 | Status int64 `json:"status"` 59 | TBTradeParentID int64 `json:"tb_trade_parent_id"` 60 | UnionID string `json:"union_id"` 61 | } 62 | -------------------------------------------------------------------------------- /response/tbkdgnewuserordersum.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.dg.newuser.order.sum( 拉新活动汇总API--导购 ) 6 | type TbkDgNewuserOrderSumResponse struct { 7 | TopResponse 8 | TbkDgNewuserOrderSumResult TbkDgNewuserOrderSumResult `json:"tbk_dg_newuser_order_sum_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkDgNewuserOrderSumResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkDgNewuserOrderSumResult struct { 24 | Results TbkDgNewuserOrderSumResponseResults `json:"results"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkDgNewuserOrderSumResponseResults struct { 29 | Data TbkDgNewuserOrderSumData `json:"data"` 30 | } 31 | 32 | type TbkDgNewuserOrderSumData struct { 33 | HasNext bool `json:"has_next"` 34 | PageNo int64 `json:"page_no"` 35 | PageSize int64 `json:"page_size"` 36 | Results TbkDgNewuserOrderSumDataResults `json:"results"` 37 | } 38 | 39 | type TbkDgNewuserOrderSumDataResults struct { 40 | Map []TbkDgNewuserOrderSumMap `json:"map"` 41 | } 42 | 43 | type TbkDgNewuserOrderSumMap struct { 44 | ActivityID string `json:"activity_id"` 45 | AlipayUserCnt int64 `json:"alipay_user_cnt"` 46 | AlipayUserCPAPreAmt string `json:"alipay_user_cpa_pre_amt"` 47 | BindBuyUserCPAPreAmt string `json:"bind_buy_user_cpa_pre_amt"` 48 | LoginUserCnt int64 `json:"login_user_cnt"` 49 | RcvUserCnt int64 `json:"rcv_user_cnt"` 50 | RcvValidUserCnt int64 `json:"rcv_valid_user_cnt"` 51 | RegUserCnt int64 `json:"reg_user_cnt"` 52 | } 53 | -------------------------------------------------------------------------------- /response/tbkdgoptimusmaterial.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.dg.optimus.material( 淘宝客物料下行-导购 ) 6 | type TbkDgOptimusMaterialResponse struct { 7 | TopResponse 8 | TbkDgOptimusMaterialResult TbkDgOptimusMaterialResult `json:"tbk_dg_optimus_material_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkDgOptimusMaterialResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkDgOptimusMaterialResult struct { 24 | ResultList TbkDgOptimusMaterialResultList `json:"result_list"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkDgOptimusMaterialResultList struct { 29 | MapData []TbkDgOptimusMaterialMapDatum `json:"map_data"` 30 | } 31 | 32 | type TbkDgOptimusMaterialMapDatum struct { 33 | CategoryID int64 `json:"category_id"` 34 | ClickURL string `json:"click_url"` 35 | CommissionRate string `json:"commission_rate"` 36 | CouponAmount int64 `json:"coupon_amount"` 37 | CouponClickURL string `json:"coupon_click_url"` 38 | CouponEndTime string `json:"coupon_end_time"` 39 | CouponRemainCount int64 `json:"coupon_remain_count"` 40 | CouponStartFee string `json:"coupon_start_fee"` 41 | CouponStartTime string `json:"coupon_start_time"` 42 | CouponTotalCount int64 `json:"coupon_total_count"` 43 | ItemDescription string `json:"item_description"` 44 | ItemID int64 `json:"item_id"` 45 | LevelOneCategoryID int64 `json:"level_one_category_id"` 46 | LevelOneCategoryName string `json:"level_one_category_name"` 47 | PictURL string `json:"pict_url"` 48 | SellerID int64 `json:"seller_id"` 49 | ShopTitle string `json:"shop_title"` 50 | SmallImages TbkDgOptimusMaterialSmallImages `json:"small_images"` 51 | Title string `json:"title"` 52 | UserType int64 `json:"user_type"` 53 | Volume int64 `json:"volume"` 54 | WhiteImage string `json:"white_image"` 55 | ZkFinalPrice string `json:"zk_final_price"` 56 | } 57 | 58 | type TbkDgOptimusMaterialSmallImages struct { 59 | String []string `json:"string"` 60 | } 61 | -------------------------------------------------------------------------------- /response/tbkitemconvert.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.item.convert( 淘宝客商品链接转换 ) 6 | type TbkItemConvertResponse struct { 7 | TopResponse 8 | TbkItemConvertResult TbkItemConvertResult `json:"tbk_item_convert_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkItemConvertResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkItemConvertResult struct { 24 | Results TbkItemConvertResults `json:"results"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkItemConvertResults struct { 29 | NTbkItem []TbkItemConvertNTbkItem `json:"n_tbk_item"` 30 | } 31 | 32 | type TbkItemConvertNTbkItem struct { 33 | ClickURL string `json:"click_url"` 34 | NumIid int64 `json:"num_iid"` 35 | } 36 | -------------------------------------------------------------------------------- /response/tbkitemcouponget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.item.coupon.get( 单品加券检索api ) 6 | type TbkItemCouponGetResponse struct { 7 | TopResponse 8 | TbkItemCouponGetResult TbkItemCouponGetResult `json:"tbk_item_coupon_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkItemCouponGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkItemCouponGetResult struct { 24 | Results TbkItemCouponGetResults `json:"results"` 25 | TotalResults int64 `json:"total_results"` 26 | RequestID string `json:"request_id"` 27 | } 28 | 29 | type TbkItemCouponGetResults struct { 30 | TbkCoupon []TbkItemCouponGetTbkCoupon `json:"tbk_coupon"` 31 | } 32 | 33 | type TbkItemCouponGetTbkCoupon struct { 34 | Category int64 `json:"category"` 35 | CommissionRate string `json:"commission_rate"` 36 | CouponClickURL string `json:"coupon_click_url"` 37 | CouponEndTime string `json:"coupon_end_time"` 38 | CouponInfo string `json:"coupon_info"` 39 | CouponRemainCount int64 `json:"coupon_remain_count"` 40 | CouponStartTime string `json:"coupon_start_time"` 41 | CouponTotalCount int64 `json:"coupon_total_count"` 42 | ItemDescription string `json:"item_description"` 43 | ItemURL string `json:"item_url"` 44 | Nick string `json:"nick"` 45 | NumIid int64 `json:"num_iid"` 46 | PictURL string `json:"pict_url"` 47 | SellerID int64 `json:"seller_id"` 48 | ShopTitle string `json:"shop_title"` 49 | SmallImages *TbkItemCouponGetSmallImages `json:"small_images,omitempty"` 50 | Title string `json:"title"` 51 | UserType int64 `json:"user_type"` 52 | Volume int64 `json:"volume"` 53 | ZkFinalPrice string `json:"zk_final_price"` 54 | } 55 | 56 | type TbkItemCouponGetSmallImages struct { 57 | String []string `json:"string"` 58 | } 59 | -------------------------------------------------------------------------------- /response/tbkitemget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.item.get( 淘宝客商品查询 ) 6 | type TbkItemGetResponse struct { 7 | TopResponse 8 | TbkItemGetResult TbkItemGetResult `json:"tbk_item_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkItemGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkItemGetResult struct { 24 | Results TbkItemGetResults `json:"results"` 25 | TotalResults int64 `json:"total_results"` 26 | RequestID string `json:"request_id"` 27 | } 28 | 29 | type TbkItemGetResults struct { 30 | NTbkItem []TbkItemGetNTbkItem `json:"n_tbk_item"` 31 | } 32 | 33 | type TbkItemGetNTbkItem struct { 34 | ItemURL string `json:"item_url"` 35 | Nick string `json:"nick"` 36 | NumIid int64 `json:"num_iid"` 37 | PictURL string `json:"pict_url"` 38 | Provcity string `json:"provcity"` 39 | ReservePrice string `json:"reserve_price"` 40 | SellerID int64 `json:"seller_id"` 41 | SmallImages TbkItemGetSmallImages `json:"small_images"` 42 | Title string `json:"title"` 43 | UserType int64 `json:"user_type"` 44 | Volume int64 `json:"volume"` 45 | ZkFinalPrice string `json:"zk_final_price"` 46 | } 47 | 48 | type TbkItemGetSmallImages struct { 49 | String []string `json:"string"` 50 | } -------------------------------------------------------------------------------- /response/tbkiteminfoget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //淘宝客商品详情查询(简版) 免费 不需要授权 6 | type TbkItemInfoGetResponse struct { 7 | TopResponse 8 | TbkItemInfoGetResult TbkItemInfoGetResult `json:"tbk_item_info_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkItemInfoGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkItemInfoGetResult struct { 24 | Results TbkItemInfoGeResults `json:"results"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkItemInfoGeResults struct { 29 | NTbkItem []TbkItemInfoGeNTbkItem `json:"n_tbk_item"` 30 | } 31 | 32 | type TbkItemInfoGeNTbkItem struct { 33 | CatLeafName string `json:"cat_leaf_name"` 34 | CatName string `json:"cat_name"` 35 | ItemURL string `json:"item_url"` 36 | MaterialLIBType string `json:"material_lib_type"` 37 | Nick string `json:"nick"` 38 | NumIid int64 `json:"num_iid"` 39 | PictURL string `json:"pict_url"` 40 | Provcity string `json:"provcity"` 41 | ReservePrice string `json:"reserve_price"` 42 | SellerID int64 `json:"seller_id"` 43 | SmallImages TbkItemInfoGeSmallImages `json:"small_images"` 44 | Title string `json:"title"` 45 | UserType int64 `json:"user_type"` 46 | Volume int64 `json:"volume"` 47 | ZkFinalPrice string `json:"zk_final_price"` 48 | } 49 | 50 | type TbkItemInfoGeSmallImages struct { 51 | String []string `json:"string"` 52 | } 53 | -------------------------------------------------------------------------------- /response/tbkitemrecommendget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.item.recommend.get( 淘宝客商品关联推荐查询 ) 6 | type TbkItemRecommendGetResponse struct { 7 | TopResponse 8 | TbkItemRecommendGetResult TbkItemRecommendGetResult `json:"tbk_item_recommend_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkItemRecommendGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkItemRecommendGetResult struct { 24 | Results TbkItemRecommendGetResults `json:"results"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkItemRecommendGetResults struct { 29 | NTbkItem []TbkItemRecommendGetNTbkItem `json:"n_tbk_item"` 30 | } 31 | 32 | type TbkItemRecommendGetNTbkItem struct { 33 | ItemURL string `json:"item_url"` 34 | Nick string `json:"nick"` 35 | NumIid int64 `json:"num_iid"` 36 | PictURL string `json:"pict_url"` 37 | Provcity string `json:"provcity"` 38 | ReservePrice string `json:"reserve_price"` 39 | SellerID int64 `json:"seller_id"` 40 | SmallImages TbkItemRecommendGetSmallImages `json:"small_images"` 41 | Title string `json:"title"` 42 | UserType int64 `json:"user_type"` 43 | Volume int64 `json:"volume"` 44 | ZkFinalPrice string `json:"zk_final_price"` 45 | } 46 | 47 | type TbkItemRecommendGetSmallImages struct { 48 | String []string `json:"string"` 49 | } 50 | -------------------------------------------------------------------------------- /response/tbkjutqgget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.ju.tqg.get( 淘抢购api ) 6 | type TbkJuTqgGetResponse struct { 7 | TopResponse 8 | TbkJuTqgGetResult TbkJuTqgGetResult `json:"tbk_ju_tqg_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkJuTqgGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkJuTqgGetResult struct { 24 | Results TbkJuTqgGetResults `json:"results"` 25 | TotalResults int64 `json:"total_results"` 26 | RequestID string `json:"request_id"` 27 | } 28 | 29 | type TbkJuTqgGetResults struct { 30 | Results []TbkJuTqgGetResultResults `json:"results"` 31 | } 32 | 33 | type TbkJuTqgGetResultResults struct { 34 | CategoryName string `json:"category_name"` 35 | ClickURL string `json:"click_url"` 36 | EndTime string `json:"end_time"` 37 | NumIid int64 `json:"num_iid"` 38 | PicURL string `json:"pic_url"` 39 | ReservePrice string `json:"reserve_price"` 40 | SoldNum int64 `json:"sold_num"` 41 | StartTime string `json:"start_time"` 42 | Title string `json:"title"` 43 | TotalAmount int64 `json:"total_amount"` 44 | ZkFinalPrice string `json:"zk_final_price"` 45 | } 46 | -------------------------------------------------------------------------------- /response/tbkprivilegeget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //淘宝客商品详情查询(简版) 免费 不需要授权 6 | type TbkPrivilegeGetResponse struct { 7 | TopResponse 8 | TbkPrivilegeGetResult TbkPrivilegeGetResult `json:"tbk_privilege_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkPrivilegeGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkPrivilegeGetResult struct { 24 | Result TbkPrivilegeGetResultData `json:"result"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkPrivilegeGetResultData struct { 29 | Data TbkPrivilegeGetData `json:"data"` 30 | } 31 | 32 | type TbkPrivilegeGetData struct { 33 | CategoryID int64 `json:"category_id"` 34 | CouponClickURL string `json:"coupon_click_url"` 35 | CouponEndTime string `json:"coupon_end_time"` 36 | CouponInfo string `json:"coupon_info"` 37 | CouponRemainCount int64 `json:"coupon_remain_count"` 38 | CouponStartTime string `json:"coupon_start_time"` 39 | CouponTotalCount int64 `json:"coupon_total_count"` 40 | CouponType int64 `json:"coupon_type"` 41 | ItemID int64 `json:"item_id"` 42 | ItemURL string `json:"item_url"` 43 | MaxCommissionRate string `json:"max_commission_rate"` 44 | } 45 | -------------------------------------------------------------------------------- /response/tbkscactivitylinktoolget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.sc.activitylink.toolget( 淘宝联盟官方活动推广API-工具 ) 6 | type TbkScActivitylinkToolgetResponse struct { 7 | TopResponse 8 | TbkScActivitylinkToolgetResult TbkScActivitylinkToolgetResult `json:"tbk_sc_activitylink_toolget_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkScActivitylinkToolgetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkScActivitylinkToolgetResult struct { 24 | BizErrorCode int64 `json:"biz_error_code"` 25 | Data string `json:"data"` 26 | ResultCode int64 `json:"result_code"` 27 | RequestID string `json:"request_id"` 28 | } 29 | -------------------------------------------------------------------------------- /response/tbksccouponbrandrecommend.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.sc.coupon.brand.recommend( 品牌券API【社交】 ) 6 | type TbkScCouponBrandRecommendResponse struct { 7 | TopResponse 8 | TbkScCouponBrandRecommendResult TbkScCouponBrandRecommendResult `json:"tbk_sc_coupon_brand_recommend_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkScCouponBrandRecommendResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkScCouponBrandRecommendResult struct { 24 | Results TbkScCouponBrandRecommendResults `json:"results"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkScCouponBrandRecommendResults struct { 29 | TbkCoupon []TbkScCouponBrandRecommendTbkCoupon `json:"tbk_coupon"` 30 | } 31 | 32 | type TbkScCouponBrandRecommendTbkCoupon struct { 33 | Category int64 `json:"category"` 34 | CommissionRate string `json:"commission_rate"` 35 | CouponEndTime string `json:"coupon_end_time"` 36 | CouponInfo string `json:"coupon_info"` 37 | CouponRemainCount int64 `json:"coupon_remain_count"` 38 | CouponStartTime string `json:"coupon_start_time"` 39 | CouponTotalCount int64 `json:"coupon_total_count"` 40 | ItemDescription string `json:"item_description"` 41 | ItemURL string `json:"item_url"` 42 | Nick string `json:"nick"` 43 | NumIid int64 `json:"num_iid"` 44 | PictURL string `json:"pict_url"` 45 | SellerID int64 `json:"seller_id"` 46 | ShopTitle string `json:"shop_title"` 47 | SmallImages TbkScCouponBrandRecommendSmallImages `json:"small_images"` 48 | Title string `json:"title"` 49 | UserType int64 `json:"user_type"` 50 | Volume int64 `json:"volume"` 51 | ZkFinalPrice string `json:"zk_final_price"` 52 | } 53 | 54 | type TbkScCouponBrandRecommendSmallImages struct { 55 | String []string `json:"string"` 56 | } 57 | -------------------------------------------------------------------------------- /response/tbksccouponrealtimerecommend.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.sc.coupon.realtime.recommend( 好券直播API【社交】 ) 6 | type TbkScCouponRealtimeRecommendResponse struct { 7 | TopResponse 8 | TbkScCouponRealtimeRecommendResult TbkScCouponRealtimeRecommendResult `json:"tbk_sc_coupon_realtime_recommend_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkScCouponRealtimeRecommendResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkScCouponRealtimeRecommendResult struct { 24 | Results TbkScCouponRealtimeRecommendResults `json:"results"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkScCouponRealtimeRecommendResults struct { 29 | TbkCoupon []TbkScCouponRealtimeRecommendTbkCoupon `json:"tbk_coupon"` 30 | } 31 | 32 | type TbkScCouponRealtimeRecommendTbkCoupon struct { 33 | Category int64 `json:"category"` 34 | CommissionRate string `json:"commission_rate"` 35 | CouponEndTime string `json:"coupon_end_time"` 36 | CouponInfo string `json:"coupon_info"` 37 | CouponRemainCount int64 `json:"coupon_remain_count"` 38 | CouponStartTime string `json:"coupon_start_time"` 39 | CouponTotalCount int64 `json:"coupon_total_count"` 40 | ItemDescription string `json:"item_description"` 41 | ItemURL string `json:"item_url"` 42 | Nick string `json:"nick"` 43 | NumIid int64 `json:"num_iid"` 44 | PictURL string `json:"pict_url"` 45 | SellerID int64 `json:"seller_id"` 46 | ShopTitle string `json:"shop_title"` 47 | SmallImages TbkScCouponRealtimeRecommendSmallImages `json:"small_images"` 48 | Title string `json:"title"` 49 | UserType int64 `json:"user_type"` 50 | Volume int64 `json:"volume"` 51 | ZkFinalPrice string `json:"zk_final_price"` 52 | } 53 | 54 | type TbkScCouponRealtimeRecommendSmallImages struct { 55 | String []string `json:"string"` 56 | } 57 | -------------------------------------------------------------------------------- /response/tbkscinvitecodeget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.sc.invitecode.get( 淘宝客邀请码生成-社交 ) 6 | type TbkScInvitecodeGetResponse struct { 7 | TopResponse 8 | TbkScInvitecodeGetResult TbkScInvitecodeGetResult `json:"tbk_sc_invitecode_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkScInvitecodeGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkScInvitecodeGetResult struct { 24 | Data TbkScInvitecodeGetData `json:"data"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkScInvitecodeGetData struct { 29 | InviterCode string `json:"inviter_code"` 30 | } 31 | 32 | -------------------------------------------------------------------------------- /response/tbkscmaterialoptional.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.sc.material.optional( 通用物料搜索API ) 6 | type TbkScMaterialOptionalResponse struct { 7 | TopResponse 8 | TbkScMaterialOptionalResult TbkScMaterialOptionalResult `json:"tbk_sc_material_optional_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkScMaterialOptionalResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkScMaterialOptionalResult struct { 24 | ResultList TbkScMaterialOptionalResultList `json:"result_list"` 25 | TotalResults int64 `json:"total_results"` 26 | RequestID string `json:"request_id"` 27 | } 28 | 29 | type TbkScMaterialOptionalResultList struct { 30 | MapData []TbkScMaterialOptionalMapDatum `json:"map_data"` 31 | } 32 | 33 | type TbkScMaterialOptionalMapDatum struct { 34 | CategoryID int64 `json:"category_id"` 35 | CategoryName string `json:"category_name"` 36 | CommissionRate string `json:"commission_rate"` 37 | CommissionType string `json:"commission_type"` 38 | CouponID string `json:"coupon_id"` 39 | CouponInfo string `json:"coupon_info"` 40 | CouponRemainCount int64 `json:"coupon_remain_count"` 41 | CouponTotalCount int64 `json:"coupon_total_count"` 42 | IncludeDxjh string `json:"include_dxjh"` 43 | IncludeMkt string `json:"include_mkt"` 44 | InfoDxjh string `json:"info_dxjh"` 45 | ItemURL string `json:"item_url"` 46 | LevelOneCategoryID int64 `json:"level_one_category_id"` 47 | LevelOneCategoryName string `json:"level_one_category_name"` 48 | NumIid int64 `json:"num_iid"` 49 | PictURL string `json:"pict_url"` 50 | Provcity string `json:"provcity"` 51 | ReservePrice string `json:"reserve_price"` 52 | SellerID int64 `json:"seller_id"` 53 | ShopDsr int64 `json:"shop_dsr"` 54 | ShopTitle string `json:"shop_title"` 55 | ShortTitle string `json:"short_title"` 56 | SmallImages TbkScMaterialOptionalSmallImages `json:"small_images"` 57 | Title string `json:"title"` 58 | TkTotalCommi string `json:"tk_total_commi"` 59 | TkTotalSales string `json:"tk_total_sales"` 60 | URL string `json:"url"` 61 | UserType int64 `json:"user_type"` 62 | Volume int64 `json:"volume"` 63 | WhiteImage string `json:"white_image"` 64 | ZkFinalPrice string `json:"zk_final_price"` 65 | } 66 | 67 | type TbkScMaterialOptionalSmallImages struct { 68 | String []string `json:"string"` 69 | } 70 | -------------------------------------------------------------------------------- /response/tbkscnewuserorderget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.sc.newuser.order.get( 淘宝客新用户订单API--社交 ) 6 | type TbkScNewuserOrderGetResponse struct { 7 | TopResponse 8 | } 9 | 10 | //解析输出结果 11 | func (t *TbkScNewuserOrderGetResponse) WrapResult(result string) { 12 | unmarshal := json.Unmarshal([]byte(result), t) 13 | //保存原始信息 14 | t.Body = result 15 | //解析错误 16 | if unmarshal != nil { 17 | t.ErrorResponse.Code = -1 18 | t.ErrorResponse.Msg = unmarshal.Error() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /response/tbkscnewuserordersum.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.sc.newuser.order.sum( 拉新活动汇总API--社交 ) 6 | type TbkScNewuserOrderSumResponse struct { 7 | TopResponse 8 | } 9 | 10 | //解析输出结果 11 | func (t *TbkScNewuserOrderSumResponse) WrapResult(result string) { 12 | unmarshal := json.Unmarshal([]byte(result), t) 13 | //保存原始信息 14 | t.Body = result 15 | //解析错误 16 | if unmarshal != nil { 17 | t.ErrorResponse.Code = -1 18 | t.ErrorResponse.Msg = unmarshal.Error() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /response/tbkscoptimusmaterial.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.sc.optimus.material( 淘宝客擎天柱通用物料API - 社交 ) 6 | type TbkScOptimusMaterialResponse struct { 7 | TopResponse 8 | } 9 | 10 | //解析输出结果 11 | func (t *TbkScOptimusMaterialResponse) WrapResult(result string) { 12 | unmarshal := json.Unmarshal([]byte(result), t) 13 | //保存原始信息 14 | t.Body = result 15 | //解析错误 16 | if unmarshal != nil { 17 | t.ErrorResponse.Code = -1 18 | t.ErrorResponse.Msg = unmarshal.Error() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /response/tbkscorderget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.sc.order.get( 淘宝客订单查询 - 社交 ) 6 | type TbkScOrderGetResponse struct { 7 | TopResponse 8 | TbkScOrderGetResult TbkScOrderGetResult `json:"tbk_sc_order_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkScOrderGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkScOrderGetResult struct { 24 | Results TbkScOrderGetResults `json:"results"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkScOrderGetResults struct { 29 | NTbkOrder []TbkScOrderGetNTbkOrder `json:"n_tbk_order"` 30 | } 31 | 32 | type TbkScOrderGetNTbkOrder struct { 33 | AdzoneID string `json:"adzone_id"` 34 | AdzoneName string `json:"adzone_name"` 35 | AlipayTotalPrice string `json:"alipay_total_price"` 36 | AuctionCategory string `json:"auction_category"` 37 | ClickTime string `json:"click_time"` 38 | Commission string `json:"commission"` 39 | CommissionRate string `json:"commission_rate"` 40 | CreateTime string `json:"create_time"` 41 | IncomeRate string `json:"income_rate"` 42 | ItemNum int64 `json:"item_num"` 43 | ItemTitle string `json:"item_title"` 44 | NumIid int64 `json:"num_iid"` 45 | OrderType string `json:"order_type"` 46 | PayPrice string `json:"pay_price"` 47 | Price string `json:"price"` 48 | PubSharePreFee string `json:"pub_share_pre_fee"` 49 | SellerNick string `json:"seller_nick"` 50 | SellerShopTitle string `json:"seller_shop_title"` 51 | SiteID string `json:"site_id"` 52 | SiteName string `json:"site_name"` 53 | SubsidyRate string `json:"subsidy_rate"` 54 | SubsidyType string `json:"subsidy_type"` 55 | TerminalType string `json:"terminal_type"` 56 | Tk3RDType string `json:"tk3rd_type"` 57 | TkStatus int64 `json:"tk_status"` 58 | TotalCommissionRate string `json:"total_commission_rate"` 59 | TradeID int64 `json:"trade_id"` 60 | TradeParentID int64 `json:"trade_parent_id"` 61 | } 62 | 63 | -------------------------------------------------------------------------------- /response/tbkscpublisherinfoget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.sc.publisher.info.get( 淘宝客信息查询 - 社交 ) 6 | type TbkScPublisherInfoGetResponse struct { 7 | TopResponse 8 | } 9 | 10 | //解析输出结果 11 | func (t *TbkScPublisherInfoGetResponse) WrapResult(result string) { 12 | unmarshal := json.Unmarshal([]byte(result), t) 13 | //保存原始信息 14 | t.Body = result 15 | //解析错误 16 | if unmarshal != nil { 17 | t.ErrorResponse.Code = -1 18 | t.ErrorResponse.Msg = unmarshal.Error() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /response/tbkscpublisherinfosave.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.sc.publisher.info.save( 淘宝客渠道信息备案 - 社交 ) 6 | type TbkScPublisherInfoSaveResponse struct { 7 | TopResponse 8 | } 9 | 10 | //解析输出结果 11 | func (t *TbkScPublisherInfoSaveResponse) WrapResult(result string) { 12 | unmarshal := json.Unmarshal([]byte(result), t) 13 | //保存原始信息 14 | t.Body = result 15 | //解析错误 16 | if unmarshal != nil { 17 | t.ErrorResponse.Code = -1 18 | t.ErrorResponse.Msg = unmarshal.Error() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /response/tbkshopconvert.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.shop.convert( 淘宝客店铺链接转换 ) 6 | type TbkShopConvertResponse struct { 7 | TopResponse 8 | TbkShopConvertResult TbkShopConvertResult `json:"tbk_shop_convert_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkShopConvertResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkShopConvertResult struct { 24 | Results TbkShopConvertResults `json:"results"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkShopConvertResults struct { 29 | NTbkShop []TbkShopConvertNTbkShop `json:"n_tbk_shop"` 30 | } 31 | 32 | type TbkShopConvertNTbkShop struct { 33 | ClickURL string `json:"click_url"` 34 | UserID int64 `json:"user_id"` 35 | } 36 | -------------------------------------------------------------------------------- /response/tbkshopget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.shop.get( 淘宝客店铺查询 ) 6 | type TbkShopGetResponse struct { 7 | TopResponse 8 | } 9 | 10 | //解析输出结果 11 | func (t *TbkShopGetResponse) WrapResult(result string) { 12 | unmarshal := json.Unmarshal([]byte(result), t) 13 | //保存原始信息 14 | t.Body = result 15 | //解析错误 16 | if unmarshal != nil { 17 | t.ErrorResponse.Code = -1 18 | t.ErrorResponse.Msg = unmarshal.Error() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /response/tbkshoprecommendget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.shop.recommend.get( 淘宝客店铺关联推荐查询 ) 6 | type TbkShopRecommendGetResponse struct { 7 | TopResponse 8 | } 9 | 10 | //解析输出结果 11 | func (t *TbkShopRecommendGetResponse) WrapResult(result string) { 12 | unmarshal := json.Unmarshal([]byte(result), t) 13 | //保存原始信息 14 | t.Body = result 15 | //解析错误 16 | if unmarshal != nil { 17 | t.ErrorResponse.Code = -1 18 | t.ErrorResponse.Msg = unmarshal.Error() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /response/tbkspreadget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.spread.get( 物料传播方式获取 ) 6 | type TbkSpreadGetResponse struct { 7 | TopResponse 8 | TbkSpreadGetResult TbkSpreadGetResult `json:"tbk_spread_get_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkSpreadGetResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkSpreadGetResult struct { 24 | Results TbkSpreadGetResults `json:"results"` 25 | TotalResults int64 `json:"total_results"` 26 | RequestID string `json:"request_id"` 27 | } 28 | 29 | type TbkSpreadGetResults struct { 30 | TbkSpread []TbkSpreadGetTbkSpread `json:"tbk_spread"` 31 | } 32 | 33 | type TbkSpreadGetTbkSpread struct { 34 | Content string `json:"content"` 35 | ErrMsg string `json:"err_msg"` 36 | } 37 | -------------------------------------------------------------------------------- /response/tbktpwdconvert.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.tpwd.convert( 淘口令转链 ) 6 | type TbkTpwdConvertResponse struct { 7 | TopResponse 8 | TbkTpwdConvertResult TbkTpwdConvertResult `json:"tbk_tpwd_convert_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkTpwdConvertResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkTpwdConvertResult struct { 24 | Data TbkTpwdConvertData `json:"data"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkTpwdConvertData struct { 29 | ClickURL string `json:"click_url"` 30 | NumIid string `json:"num_iid"` 31 | } 32 | -------------------------------------------------------------------------------- /response/tbktpwdcreate.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.tpwd.create( 淘宝客淘口令 ) 6 | type TbkTpwdCreateResponse struct { 7 | TopResponse 8 | TbkTpwdCreateResult TbkTpwdCreateResult `json:"tbk_tpwd_create_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *TbkTpwdCreateResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type TbkTpwdCreateResult struct { 24 | Data TbkTpwdCreateData `json:"data"` 25 | RequestID string `json:"request_id"` 26 | } 27 | 28 | type TbkTpwdCreateData struct { 29 | Model string `json:"model"` 30 | PasswordSimple string `json:"password_simple"` 31 | } 32 | -------------------------------------------------------------------------------- /response/tbkuatmfavoritesget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.uatm.favorites.get( 获取淘宝联盟选品库列表 ) 6 | type TbkUatmFavoritesGetResponse struct { 7 | TopResponse 8 | } 9 | 10 | //解析输出结果 11 | func (t *TbkUatmFavoritesGetResponse) WrapResult(result string) { 12 | unmarshal := json.Unmarshal([]byte(result), t) 13 | //保存原始信息 14 | t.Body = result 15 | //解析错误 16 | if unmarshal != nil { 17 | t.ErrorResponse.Code = -1 18 | t.ErrorResponse.Msg = unmarshal.Error() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /response/tbkuatmfavoritesitemget.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.tbk.uatm.favorites.item.get( 获取淘宝联盟选品库的宝贝信息 ) 6 | type TbkUatmFavoritesItemGetResponse struct { 7 | TopResponse 8 | } 9 | 10 | //解析输出结果 11 | func (t *TbkUatmFavoritesItemGetResponse) WrapResult(result string) { 12 | unmarshal := json.Unmarshal([]byte(result), t) 13 | //保存原始信息 14 | t.Body = result 15 | //解析错误 16 | if unmarshal != nil { 17 | t.ErrorResponse.Code = -1 18 | t.ErrorResponse.Msg = unmarshal.Error() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /response/topresponse.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | //错误等通用信息 4 | type TopResponse struct { 5 | ErrorResponse ErrorInfo `json:"error_response"` //错误信息 6 | Body string `json:"body"` //原始信息 7 | } 8 | 9 | func (t *TopResponse) IsError() bool { 10 | return t.ErrorResponse.Code != 0 || t.ErrorResponse.SubCode != "" 11 | } 12 | 13 | type ErrorInfo struct { 14 | Code int64 `json:"code"` //主错误 15 | Msg string `json:"msg"` //主错误提示 16 | SubCode string `json:"sub_code"` 17 | SubMsg string `json:"sub_msg"` 18 | RequestID string `json:"request_id"` 19 | } 20 | -------------------------------------------------------------------------------- /response/wirelesssharetpwdquery.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "encoding/json" 4 | 5 | //taobao.wireless.share.tpwd.query( 查询解析淘口令 ) 6 | type WirelessShareTpwdQueryResponse struct { 7 | TopResponse 8 | WirelessShareTpwdQueryResult WirelessShareTpwdQueryResult `json:"wireless_share_tpwd_query_response"` 9 | } 10 | 11 | //解析输出结果 12 | func (t *WirelessShareTpwdQueryResponse) WrapResult(result string) { 13 | unmarshal := json.Unmarshal([]byte(result), t) 14 | //保存原始信息 15 | t.Body = result 16 | //解析错误 17 | if unmarshal != nil { 18 | t.ErrorResponse.Code = -1 19 | t.ErrorResponse.Msg = unmarshal.Error() 20 | } 21 | } 22 | 23 | type WirelessShareTpwdQueryResult struct { 24 | Content string `json:"content"` 25 | NativeURL string `json:"native_url"` 26 | PicURL string `json:"pic_url"` 27 | Suc bool `json:"suc"` 28 | ThumbPicURL string `json:"thumb_pic_url"` 29 | Title string `json:"title"` 30 | URL string `json:"url"` 31 | RequestID string `json:"request_id"` 32 | } -------------------------------------------------------------------------------- /utils/utils.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/hex" 6 | "fmt" 7 | "net/url" 8 | "regexp" 9 | "sort" 10 | "strconv" 11 | "strings" 12 | ) 13 | 14 | //参数排序返回排序的KEY 通过KEY循环取出 15 | func SortParamters(params url.Values) []string { 16 | var keys []string 17 | for k := range params { 18 | keys = append(keys, k) 19 | } 20 | sort.Strings(keys) 21 | return keys 22 | } 23 | 24 | func Md5(data string) string { 25 | md5obj := md5.New() 26 | if _, err := md5obj.Write([]byte(data)); err != nil { 27 | return "" 28 | } 29 | md5Data := md5obj.Sum([]byte("")) 30 | return hex.EncodeToString(md5Data) 31 | } 32 | 33 | //检验字段fieldName的值value 的长度 34 | func CheckMaxLength(value string, maxLength int, fieldName string) { 35 | 36 | if len(value) > maxLength { 37 | panic(fmt.Sprintf("Invalid Arguments:the length of %s can not be larger than %d.", fieldName, maxLength)) 38 | } 39 | } 40 | 41 | //检验字段fieldName的值value的最大列表长度 42 | func CheckMaxListSize(value string, maxSize int, fieldName string) { 43 | 44 | if !CheckEmpty(value) && len(strings.Split(value, ",")) > maxSize { 45 | panic(fmt.Sprintf("Invalid Arguments:the listsize(the string split by \",\") of %s must be less than %d .", fieldName, maxSize)) 46 | } 47 | } 48 | 49 | //检测最大值 50 | func CheckMaxValue(value string, maxValue int, fieldName string) { 51 | if CheckEmpty(value) { 52 | return 53 | } 54 | if i, e := strconv.Atoi(value); e != nil { 55 | panic("fieldName cid Value Is Not Number") 56 | } else { 57 | if i > maxValue { 58 | panic(fmt.Sprintf("Invalid Arguments:the value of %s can not be larger than %d .", fieldName, maxValue)) 59 | } 60 | } 61 | } 62 | 63 | //检测最小值 64 | func CheckMinValue(value string, minVal int, fieldName string) { 65 | 66 | if CheckEmpty(value) { 67 | return 68 | } 69 | if i, e := strconv.Atoi(value); e != nil { 70 | panic("fieldName cid Value Is Not Number") 71 | } else { 72 | if i < minVal { 73 | panic(fmt.Sprintf("Invalid Arguments:the value of %s can not be less than %d .", fieldName, minVal)) 74 | } 75 | } 76 | 77 | } 78 | 79 | //检测非空 80 | func CheckNotNull(value, fieldName string) { 81 | if CheckEmpty(value) { 82 | panic(fmt.Sprintf("Missing Required Arguments: %s", fieldName)) 83 | } 84 | } 85 | 86 | //检测是否为空 空则返回真 87 | func CheckEmpty(value string) bool { 88 | return len(strings.TrimSpace(value)) == 0 89 | } 90 | //检测是否为数字 91 | func CheckNumber(value, fieldName string) { 92 | compile := regexp.MustCompile(`\d+`) 93 | if !compile.MatchString(value) { 94 | panic(fmt.Sprintf("Invalid Arguments:the value of %s is not number : %s.", fieldName, value)) 95 | } 96 | } 97 | --------------------------------------------------------------------------------