github.com/fastwego/offiaccount@v1.0.1/apis/store/group/group.go (about) 1 // Copyright 2020 FastWeGo 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Package group 微信小店/分组管理 16 package group 17 18 import ( 19 "bytes" 20 21 "github.com/fastwego/offiaccount" 22 ) 23 24 const ( 25 apiAdd = "/merchant/group/add" 26 apiDel = "/merchant/group/del" 27 apiPropertyMod = "/merchant/group/propertymod" 28 apiProductMod = "/merchant/group/productmod" 29 apiGetAll = "/merchant/group/getall" 30 apiGetById = "/merchant/group/getbyid" 31 ) 32 33 /* 34 增加分组 35 36 37 38 See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html 39 40 POST https://api.weixin.qq.com/merchant/group/add?access_token=ACCESS_TOKEN 41 */ 42 func Add(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error) { 43 return ctx.Client.HTTPPost(apiAdd, bytes.NewReader(payload), "application/json;charset=utf-8") 44 } 45 46 /* 47 删除分组 48 49 50 51 See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html 52 53 POST https://api.weixin.qq.com/merchant/group/del?access_token=ACCESS_TOKEN 54 */ 55 func Del(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error) { 56 return ctx.Client.HTTPPost(apiDel, bytes.NewReader(payload), "application/json;charset=utf-8") 57 } 58 59 /* 60 修改分组属性 61 62 63 64 See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html 65 66 POST https://api.weixin.qq.com/merchant/group/propertymod?access_token=ACCESS_TOKEN 67 */ 68 func PropertyMod(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error) { 69 return ctx.Client.HTTPPost(apiPropertyMod, bytes.NewReader(payload), "application/json;charset=utf-8") 70 } 71 72 /* 73 修改分组商品 74 75 76 77 See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html 78 79 POST https://api.weixin.qq.com/merchant/group/productmod?access_token=ACCESS_TOKEN 80 */ 81 func ProductMod(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error) { 82 return ctx.Client.HTTPPost(apiProductMod, bytes.NewReader(payload), "application/json;charset=utf-8") 83 } 84 85 /* 86 获取所有分组 87 88 89 90 See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html 91 92 GET https://api.weixin.qq.com/merchant/group/getall?access_token=ACCESS_TOKEN 93 */ 94 func GetAll(ctx *offiaccount.OffiAccount) (resp []byte, err error) { 95 return ctx.Client.HTTPGet(apiGetAll) 96 } 97 98 /* 99 根据分组ID获取分组信息 100 101 102 103 See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html 104 105 POST https://api.weixin.qq.com/merchant/group/getbyid?access_token=ACCESS_TOKEN 106 */ 107 func GetById(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error) { 108 return ctx.Client.HTTPPost(apiGetById, bytes.NewReader(payload), "application/json;charset=utf-8") 109 }