11package me .chanjar .weixin .mp .api .impl ;
22
3+ import java .util .List ;
4+
5+ import org .slf4j .Logger ;
6+ import org .slf4j .LoggerFactory ;
7+
38import com .google .gson .JsonObject ;
9+
410import me .chanjar .weixin .common .exception .WxErrorException ;
5- import me .chanjar .weixin .common .util .http .SimplePostRequestExecutor ;
611import me .chanjar .weixin .mp .api .WxMpService ;
712import me .chanjar .weixin .mp .api .WxMpUserTagService ;
813import me .chanjar .weixin .mp .bean .tag .WxUserTag ;
9- import org .slf4j .Logger ;
10- import org .slf4j .LoggerFactory ;
1114
1215/**
1316 *
1417 * @author binarywang(https://github.com/binarywang)
1518 * Created by Binary Wang on 2016/9/2.
1619 */
1720public class WxMpUserTagServiceImpl implements WxMpUserTagService {
18- protected final Logger log = LoggerFactory .getLogger (WxMpDataCubeServiceImpl .class );
21+ protected final Logger log = LoggerFactory
22+ .getLogger (WxMpDataCubeServiceImpl .class );
1923 private static final String API_URL_PREFIX = "https://api.weixin.qq.com/cgi-bin/tags" ;
2024
2125 private WxMpService wxMpService ;
@@ -32,11 +36,19 @@ public WxUserTag tagCreate(String name) throws WxErrorException {
3236 groupJson .addProperty ("name" , name );
3337 json .add ("tag" , groupJson );
3438
35- String responseContent = this .wxMpService .execute (
36- new SimplePostRequestExecutor (),
37- url ,
38- json .toString ());
39- this .log .debug ("\n url:{}\n params:{}\n response:{}" ,url , name , responseContent );
39+ String responseContent = this .wxMpService .post (url , json .toString ());
40+ this .log .debug ("\n url:{}\n params:{}\n response:{}" , url , name ,
41+ responseContent );
4042 return WxUserTag .fromJson (responseContent );
4143 }
44+
45+ @ Override
46+ public List <WxUserTag > tagGet () throws WxErrorException {
47+ String url = API_URL_PREFIX + "/get" ;
48+
49+ String responseContent = this .wxMpService .get (url , null );
50+ this .log .debug ("\n url:{}\n params:{}\n response:{}" , url , "[empty]" ,
51+ responseContent );
52+ return WxUserTag .listFromJson (responseContent );
53+ }
4254}
0 commit comments