33import cn .binarywang .wx .miniapp .api .WxMaLiveMemberService ;
44import cn .binarywang .wx .miniapp .api .WxMaService ;
55import cn .binarywang .wx .miniapp .constant .WxMaApiUrlConstants .Broadcast .Role ;
6+ import com .google .common .base .Joiner ;
67import com .google .gson .JsonArray ;
78import lombok .RequiredArgsConstructor ;
89import me .chanjar .weixin .common .error .WxErrorException ;
910import me .chanjar .weixin .common .util .json .GsonHelper ;
1011import me .chanjar .weixin .common .util .json .GsonParser ;
1112
13+ import java .util .HashMap ;
14+ import java .util .Map ;
15+
1216import static cn .binarywang .wx .miniapp .constant .WxMaApiUrlConstants .Broadcast .Role .LIST_BY_ROLE ;
1317
1418/**
@@ -35,8 +39,12 @@ public String deleteRole(String username, int role) throws WxErrorException {
3539
3640 @ Override
3741 public JsonArray listByRole (Integer role , Integer offset , Integer limit , String keyword ) throws WxErrorException {
38- final String response = this .service .get (LIST_BY_ROLE , GsonHelper .buildJsonObject ("role" , role , "offset" , offset ,
39- "limit" , limit , "keyword" , keyword ).toString ());
42+ Map <String , Object > params = new HashMap <>(8 );
43+ params .put ("role" , role );
44+ params .put ("offset" , offset );
45+ params .put ("limit" , limit );
46+ params .put ("keyword" , keyword );
47+ final String response = this .service .get (LIST_BY_ROLE , Joiner .on ("&" ).withKeyValueSeparator ("=" ).join (params ));
4048 return GsonParser .parse (response ).getAsJsonArray ("list" );
4149 }
4250}
0 commit comments