GetGroupNotice 获取群公告
(groupUin uint32)
| 1126 | |
| 1127 | // GetGroupNotice 获取群公告 |
| 1128 | func (c *QQClient) GetGroupNotice(groupUin uint32) (l []*entity.GroupNoticeFeed, err error) { |
| 1129 | bkn, err := c.GetCsrfToken() |
| 1130 | if err != nil { |
| 1131 | return nil, err |
| 1132 | } |
| 1133 | v := url.Values{} |
| 1134 | v.Set("bkn", strconv.Itoa(bkn)) |
| 1135 | v.Set("qid", strconv.FormatInt(int64(groupUin), 10)) |
| 1136 | v.Set("ft", "23") |
| 1137 | v.Set("ni", "1") |
| 1138 | v.Set("n", "1") |
| 1139 | v.Set("i", "1") |
| 1140 | v.Set("log_read", "1") |
| 1141 | v.Set("platform", "1") |
| 1142 | v.Set("s", "-1") |
| 1143 | v.Set("n", "20") |
| 1144 | req, _ := http.NewRequest(http.MethodGet, "https://web.qun.qq.com/cgi-bin/announce/get_t_list?"+v.Encode(), nil) |
| 1145 | resp, err := c.SendRequestWithCookie(req) |
| 1146 | if err != nil { |
| 1147 | return nil, err |
| 1148 | } |
| 1149 | if resp.StatusCode != http.StatusOK { |
| 1150 | return nil, fmt.Errorf("error resp code %d", resp.StatusCode) |
| 1151 | } |
| 1152 | r := entity.GroupNoticeRsp{} |
| 1153 | if err = json.NewDecoder(resp.Body).Decode(&r); err != nil { |
| 1154 | return |
| 1155 | } |
| 1156 | _ = resp.Body.Close() |
| 1157 | o := make([]*entity.GroupNoticeFeed, 0, len(r.Feeds)+len(r.Inst)) |
| 1158 | o = append(o, r.Feeds...) |
| 1159 | o = append(o, r.Inst...) |
| 1160 | return o, nil |
| 1161 | } |
| 1162 | |
| 1163 | func (c *QQClient) uploadGroupNoticePic(bkn int, img []byte) (*entity.NoticeImage, error) { |
| 1164 | ret := &entity.NoticeImage{} |
nothing calls this directly
no test coverage detected