repo stringclasses 1k values | file_url stringlengths 96 373 | file_path stringlengths 11 294 | content stringlengths 0 32.8k | language stringclasses 1 value | license stringclasses 6 values | commit_sha stringclasses 1k values | retrieved_at stringdate 2026-01-04 14:45:56 2026-01-04 18:30:23 | truncated bool 2 classes |
|---|---|---|---|---|---|---|---|---|
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/manage/model/BoardingPass.java | src/main/java/org/jeewx/api/coupon/manage/model/BoardingPass.java | package org.jeewx.api.coupon.manage.model;
/**
* 飞机票。
*
* @author mcl
* @version v1.0
*/
public class BoardingPass {
// 基本的卡券数据,见下表,所有卡券通用
private BaseInfo base_info;
// 起点,上限为18 个汉字。
private String from;
// 终点,上限为18 个汉字。
private String to;
// 航班。
private String flight;
// 起飞时间。Unix 时间戳格式。
private Long departure_time;
// 降落时间。Unix 时间戳格式。
private Long landing_time;
// 在线值机的链接。
private String check_in_url;
// 登机口。如发生登机口变更,建议商家实时调用该接口变更。
private String gate;
// 登机时间,只显示“时分”不显示日期,按时间戳格式填写。如发生登机时间变更,建议商家实时调用该接口变更。
private Long boarding_time;
// 机型,上限为8 个汉字
private String air_model;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public String getFlight() {
return flight;
}
public void setFlight(String flight) {
this.flight = flight;
}
public Long getDeparture_time() {
return departure_time;
}
public void setDeparture_time(Long departure_time) {
this.departure_time = departure_time;
}
public Long getLanding_time() {
return landing_time;
}
public void setLanding_time(Long landing_time) {
this.landing_time = landing_time;
}
public String getCheck_in_url() {
return check_in_url;
}
public void setCheck_in_url(String check_in_url) {
this.check_in_url = check_in_url;
}
public String getGate() {
return gate;
}
public void setGate(String gate) {
this.gate = gate;
}
public Long getBoarding_time() {
return boarding_time;
}
public void setBoarding_time(Long boarding_time) {
this.boarding_time = boarding_time;
}
public String getAir_model() {
return air_model;
}
public void setAir_model(String air_model) {
this.air_model = air_model;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/manage/model/DelRtnInfo.java | src/main/java/org/jeewx/api/coupon/manage/model/DelRtnInfo.java | package org.jeewx.api.coupon.manage.model;
public class DelRtnInfo {
// 错误码
private String errcode;
// 错误信息
private String errmsg;
public String getErrcode() {
return errcode;
}
public void setErrcode(String errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/manage/model/DateInfo.java | src/main/java/org/jeewx/api/coupon/manage/model/DateInfo.java | package org.jeewx.api.coupon.manage.model;
/**
* 卡券的使用日期,有效期的信息。
* @author mcl
* @version v1.0
*/
public class DateInfo {
// 使用时间的类型。1:固定日期区间,2:固定时长(自领取后按天算)
private Integer type;
// 固定日期区间专用,表示起用时间
private Long begin_timestamp;
// 固定日期区间专用,表示结束时间
private Long end_timestamp;
// 固定时长专用,表示自领取后多少天内有效。(单位为天)
private Integer fixed_term;
// 固定时长专用,表示自领取后多少天开始生效。(单位为天)
private Integer fixed_begin_term;
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Long getBegin_timestamp() {
return begin_timestamp;
}
public void setBegin_timestamp(Long begin_timestamp) {
this.begin_timestamp = begin_timestamp;
}
public Long getEnd_timestamp() {
return end_timestamp;
}
public void setEnd_timestamp(Long end_timestamp) {
this.end_timestamp = end_timestamp;
}
public Integer getFixed_term() {
return fixed_term;
}
public void setFixed_term(Integer fixed_term) {
this.fixed_term = fixed_term;
}
public Integer getFixed_begin_term() {
return fixed_begin_term;
}
public void setFixed_begin_term(Integer fixed_begin_term) {
this.fixed_begin_term = fixed_begin_term;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/manage/model/DateInfoUpdate.java | src/main/java/org/jeewx/api/coupon/manage/model/DateInfoUpdate.java | package org.jeewx.api.coupon.manage.model;
/**
* 可以被更新的卡券的使用日期信息。
* @author mcl
* @version v1.0
*/
public class DateInfoUpdate {
// 使用时间的类型。1:固定日期区间,2:固定时长(自领取后按天算)
private Integer type;
// 固定日期区间专用,表示起用时间
private Long begin_timestamp;
// 固定日期区间专用,表示结束时间
private Long end_timestamp;
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Long getBegin_timestamp() {
return begin_timestamp;
}
public void setBegin_timestamp(Long begin_timestamp) {
this.begin_timestamp = begin_timestamp;
}
public Long getEnd_timestamp() {
return end_timestamp;
}
public void setEnd_timestamp(Long end_timestamp) {
this.end_timestamp = end_timestamp;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/manage/model/CardUpdate.java | src/main/java/org/jeewx/api/coupon/manage/model/CardUpdate.java | package org.jeewx.api.coupon.manage.model;
/**
* 可以被更新的卡券详细信息
* @author mcl
* @version v1.0
*/
public class CardUpdate {
//卡券id.
private String card_id;
//会员卡
private MemberCard member_card;
//飞机票
private BoardingPass boarding_pass;
//门票
private ScenicTicket scenic_ticket;
//电影票
private MovieTicket movie_ticket;
//会议门票
private MeetingTicket meeting_ticket;
public String getCard_id() {
return card_id;
}
public void setCard_id(String card_id) {
this.card_id = card_id;
}
public MemberCard getMember_card() {
return member_card;
}
public void setMember_card(MemberCard member_card) {
this.member_card = member_card;
}
public BoardingPass getBoarding_pass() {
return boarding_pass;
}
public void setBoarding_pass(BoardingPass boarding_pass) {
this.boarding_pass = boarding_pass;
}
public ScenicTicket getScenic_ticket() {
return scenic_ticket;
}
public void setScenic_ticket(ScenicTicket scenic_ticket) {
this.scenic_ticket = scenic_ticket;
}
public MovieTicket getMovie_ticket() {
return movie_ticket;
}
public void setMovie_ticket(MovieTicket movie_ticket) {
this.movie_ticket = movie_ticket;
}
public MeetingTicket getMeeting_ticket() {
return meeting_ticket;
}
public void setMeeting_ticket(MeetingTicket meeting_ticket) {
this.meeting_ticket = meeting_ticket;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/manage/model/Card.java | src/main/java/org/jeewx/api/coupon/manage/model/Card.java | package org.jeewx.api.coupon.manage.model;
public class Card {
/**
* 卡券类型: 目前支持11中类型,具体参考CardConsts.CardType常量类.
* 团购券:GROUPON;
* 折扣券:DISCOUNT;
* 礼品券:GIFT;
* 代金券:CASH;
* 通用券:GENERAL_COUPON;
* 会员卡:MEMBER_CARD;
* 景点门票:SCENIC_TICKET;
* 电影票:MOVIE_TICKET;
* 飞机票:BOARDING_PASS;
* 会议门票:MEETING_TICKET;
* 汽车票:BUS_TICKET;
*/
private String card_type;
//通用券
private GeneralCoupon general_coupon;
//团购券
private Groupon groupon;
//礼品券
private Gift gift;
//代金券
private Cash cash;
//折扣券
private Discount discount;
//会员卡
private MemberCard member_card;
//门票
private ScenicTicket scenic_ticket;
//电影票
private MovieTicket movie_ticket;
//飞机票
private BoardingPass boarding_pass;
//红包
private LuckyMoney lucky_money;
//会议门票
private MeetingTicket meeting_ticket;
public String getCard_type() {
return card_type;
}
public void setCard_type(String card_type) {
this.card_type = card_type;
}
public GeneralCoupon getGeneral_coupon() {
return general_coupon;
}
public void setGeneral_coupon(GeneralCoupon general_coupon) {
this.general_coupon = general_coupon;
}
public Groupon getGroupon() {
return groupon;
}
public void setGroupon(Groupon groupon) {
this.groupon = groupon;
}
public Gift getGift() {
return gift;
}
public void setGift(Gift gift) {
this.gift = gift;
}
public Cash getCash() {
return cash;
}
public void setCash(Cash cash) {
this.cash = cash;
}
public Discount getDiscount() {
return discount;
}
public void setDiscount(Discount discount) {
this.discount = discount;
}
public MemberCard getMember_card() {
return member_card;
}
public void setMember_card(MemberCard member_card) {
this.member_card = member_card;
}
public ScenicTicket getScenic_ticket() {
return scenic_ticket;
}
public void setScenic_ticket(ScenicTicket scenic_ticket) {
this.scenic_ticket = scenic_ticket;
}
public MovieTicket getMovie_ticket() {
return movie_ticket;
}
public void setMovie_ticket(MovieTicket movie_ticket) {
this.movie_ticket = movie_ticket;
}
public BoardingPass getBoarding_pass() {
return boarding_pass;
}
public void setBoarding_pass(BoardingPass boarding_pass) {
this.boarding_pass = boarding_pass;
}
public LuckyMoney getLucky_money() {
return lucky_money;
}
public void setLucky_money(LuckyMoney lucky_money) {
this.lucky_money = lucky_money;
}
public MeetingTicket getMeeting_ticket() {
return meeting_ticket;
}
public void setMeeting_ticket(MeetingTicket meeting_ticket) {
this.meeting_ticket = meeting_ticket;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/manage/model/Groupon.java | src/main/java/org/jeewx/api/coupon/manage/model/Groupon.java | package org.jeewx.api.coupon.manage.model;
/**
* 团购券。
* @author mcl
* @version v1.0
*/
public class Groupon {
// 基本的卡券数据,见下表,所有卡券通用
private BaseInfo base_info;
// 团购详情。
private String deal_detail;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
public String getDeal_detail() {
return deal_detail;
}
public void setDeal_detail(String deal_detail) {
this.deal_detail = deal_detail;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/manage/model/MemberCard.java | src/main/java/org/jeewx/api/coupon/manage/model/MemberCard.java | package org.jeewx.api.coupon.manage.model;
/**
* 会员卡。
*
* @author mcl
* @version v1.0
*/
public class MemberCard {
// 基本的卡券数据,见下表,所有卡券通用
private BaseInfo base_info;
// 是否支持积分,填写true 或false,如填写true,积分相关字段均为必填。填写false,积分字段无需填写。储值字段处理方式相同。
private boolean supply_bonus;
// 是否支持储值,填写true 或false
private boolean supply_balance;
// 积分清零规则
private String bonus_cleared;
// 积分规则
private String bonus_rules;
// 储值说明
private String balance_rules;
// 特权说明
private String prerogative;
//绑定旧卡的url。与“activate_url”二选一必填。
private String bind_old_card_url;
//激活会员卡的url。与“bind_old_card_url”二选一必填。
private String activate_url;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
public boolean isSupply_bonus() {
return supply_bonus;
}
public void setSupply_bonus(boolean supply_bonus) {
this.supply_bonus = supply_bonus;
}
public boolean isSupply_balance() {
return supply_balance;
}
public void setSupply_balance(boolean supply_balance) {
this.supply_balance = supply_balance;
}
public String getBonus_cleared() {
return bonus_cleared;
}
public void setBonus_cleared(String bonus_cleared) {
this.bonus_cleared = bonus_cleared;
}
public String getBonus_rules() {
return bonus_rules;
}
public void setBonus_rules(String bonus_rules) {
this.bonus_rules = bonus_rules;
}
public String getBalance_rules() {
return balance_rules;
}
public void setBalance_rules(String balance_rules) {
this.balance_rules = balance_rules;
}
public String getPrerogative() {
return prerogative;
}
public void setPrerogative(String prerogative) {
this.prerogative = prerogative;
}
public String getBind_old_card_url() {
return bind_old_card_url;
}
public void setBind_old_card_url(String bind_old_card_url) {
this.bind_old_card_url = bind_old_card_url;
}
public String getActivate_url() {
return activate_url;
}
public void setActivate_url(String activate_url) {
this.activate_url = activate_url;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/manage/model/Gift.java | src/main/java/org/jeewx/api/coupon/manage/model/Gift.java | package org.jeewx.api.coupon.manage.model;
/**
* 礼品券。
*
* @author mcl
* @version v1.0
*/
public class Gift {
// 基本的卡券数据,见下表,所有卡券通用
private BaseInfo base_info;
// 礼品券专用,表示礼品名字。
private String gift;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
public String getGift() {
return gift;
}
public void setGift(String gift) {
this.gift = gift;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/manage/model/BaseInfo.java | src/main/java/org/jeewx/api/coupon/manage/model/BaseInfo.java | package org.jeewx.api.coupon.manage.model;
import java.util.List;
/**
* 基本的卡券数据.
* @author mcl
* @version v1.0
*/
public class BaseInfo {
// card_id
private String id;
// 卡券的商户logo
private String logo_url;
// code 码展示类型 请参考常量类 CardConsts.CodeType
private String code_type;
// 商户名字
private String brand_name;
// 券名
private String title;
// 券颜色。色彩规范标注值对应的色值。如#3373bb
private String color;
// 使用提醒。(一句话描述,展示在首页)
private String notice;
// 客服电话
private String service_phone;
// 使用说明。长文本描述,可以分行。
private String description;
// 每人使用次数限制。
private Integer use_limit;
// 每人最大领取次数。
private Integer get_limit;
// 是否自定义code 码。
private String use_custom_code;
// 是否指定用户领取。
private String bind_openid;
// 领取卡券原生页面是否可分享,填写 true 或false,true 代表可分享。默认可分享。
private boolean can_share;
// 卡券是否可转赠,填写true 或false,true 代表可转赠。默认可转赠。
private boolean can_give_friend;
// 门店位置ID。
private List<Integer> location_id_list;
//update-begin----author:scott-----date:20150825---for:礼券获取详细信息报错处理-----
private List<String> js_oauth_uin_list;
public List<String> getJs_oauth_uin_list() {
return js_oauth_uin_list;
}
public void setJs_oauth_uin_list(List<String> js_oauth_uin_list) {
this.js_oauth_uin_list = js_oauth_uin_list;
}
//update-end----author:scott-----date:20150825---for:礼券获取详细信息报错处理-----
// 使用日期,有效期的信息。
private DateInfo date_info;
// 商品信息。
private Sku sku;
// 商户自定义cell 名称,与custom_url 字段共同使用,目前支持类型参考 常量类CardConsts.UrlNameType。
private String url_name_type;
// 商户自定义cell 跳转外链的地址链 接,跳转页面内容需与自定义cell 名称保持一致。
private String custom_url;
// 第三方来源名,例如同程旅游、格瓦拉。
private String source;
// 卡券状态,请参考常量类 CardConsts.Status
private String status;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLogo_url() {
return logo_url;
}
public void setLogo_url(String logo_url) {
this.logo_url = logo_url;
}
public String getCode_type() {
return code_type;
}
public void setCode_type(String code_type) {
this.code_type = code_type;
}
public String getBrand_name() {
return brand_name;
}
public void setBrand_name(String brand_name) {
this.brand_name = brand_name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getNotice() {
return notice;
}
public void setNotice(String notice) {
this.notice = notice;
}
public String getService_phone() {
return service_phone;
}
public void setService_phone(String service_phone) {
this.service_phone = service_phone;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getUse_limit() {
return use_limit;
}
public void setUse_limit(Integer use_limit) {
this.use_limit = use_limit;
}
public Integer getGet_limit() {
return get_limit;
}
public void setGet_limit(Integer get_limit) {
this.get_limit = get_limit;
}
public String getUse_custom_code() {
return use_custom_code;
}
public void setUse_custom_code(String use_custom_code) {
this.use_custom_code = use_custom_code;
}
public String getBind_openid() {
return bind_openid;
}
public void setBind_openid(String bind_openid) {
this.bind_openid = bind_openid;
}
public boolean isCan_share() {
return can_share;
}
public void setCan_share(boolean can_share) {
this.can_share = can_share;
}
public boolean isCan_give_friend() {
return can_give_friend;
}
public void setCan_give_friend(boolean can_give_friend) {
this.can_give_friend = can_give_friend;
}
public List<Integer> getLocation_id_list() {
return location_id_list;
}
public void setLocation_id_list(List<Integer> location_id_list) {
this.location_id_list = location_id_list;
}
public DateInfo getDate_info() {
return date_info;
}
public void setDate_info(DateInfo date_info) {
this.date_info = date_info;
}
public Sku getSku() {
return sku;
}
public void setSku(Sku sku) {
this.sku = sku;
}
public String getUrl_name_type() {
return url_name_type;
}
public void setUrl_name_type(String url_name_type) {
this.url_name_type = url_name_type;
}
public String getCustom_url() {
return custom_url;
}
public void setCustom_url(String custom_url) {
this.custom_url = custom_url;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/JwLocationAPI.java | src/main/java/org/jeewx/api/coupon/location/JwLocationAPI.java | package org.jeewx.api.coupon.location;
import com.alibaba.fastjson.JSONObject;
import org.jeewx.api.core.exception.WexinReqException;
import org.jeewx.api.core.req.WeiXinReqService;
import org.jeewx.api.coupon.location.model.*;
/**
* 微信卡券 - 创建卡券
* @author lihongxuan
*
*/
public class JwLocationAPI {
/*// 上传LOGO 大小限制1MB,像素为300*300,支持JPG格式。
private static String uploadimg_location_url = "https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token=ACCESS_TOKEN";
*/// 批量导入门店信息
private static String batchadd_location_url = "https://api.weixin.qq.com/card/location/batchadd?access_token=ACCESS_TOKEN";
// 拉取门店列表
private static String batchget_location_url = "https://api.weixin.qq.com/card/location/batchget?access_token=ACCESS_TOKEN";
// 获取颜色列表
private static String getcolors_location_url = "https://api.weixin.qq.com/card/getcolors?access_token=ACCESS_TOKEN";
// CreateCard 创建卡
private static String add_card_url = "https://api.weixin.qq.com/card/create?access_token=ACCESS_TOKEN";
/**
* 批量导入门店信息
* @throws WexinReqException
*/
public BatchaddRtn doBatchadd(String accesstoken,Batchadd batchadd) throws WexinReqException {
if (accesstoken != null) {
batchadd.setAccess_token(accesstoken);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(batchadd);
BatchaddRtn batchaddRtn = (BatchaddRtn)JSONObject.toJavaObject(result, BatchaddRtn.class);
return batchaddRtn;
}
return null;
}
/**
* 拉取门店列表
*/
public BatchgetRtn doBatchget(String accesstoken,Batchget batchget) throws WexinReqException{
if (accesstoken != null) {
batchget.setAccess_token(accesstoken);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(batchget);
BatchgetRtn batchgetRtn = (BatchgetRtn)JSONObject.toJavaObject(result, BatchgetRtn.class);
return batchgetRtn;
}
return null;
}
/**
* 获取颜色列表
*/
public GetcolorsRtn doGetcolors(String accesstoken) throws WexinReqException {
if (accesstoken != null) {
Getcolors gk = new Getcolors();
gk.setAccess_token(accesstoken);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(gk);
GetcolorsRtn getcolorsRtn = (GetcolorsRtn)JSONObject.toJavaObject(result, GetcolorsRtn.class);
return getcolorsRtn;
}
return null;
}
/**
* CreateCard 创建卡
*/
public CardInfoRtn doAddCard(String accesstoken,CardInfo cardInfo) throws WexinReqException{
if (accesstoken != null) {
cardInfo.setAccess_token(accesstoken);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(cardInfo);
CardInfoRtn cardInfoRtn = (CardInfoRtn)JSONObject.toJavaObject(result, CardInfoRtn.class);
return cardInfoRtn;
}
return null;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/CardInfoRtn.java | src/main/java/org/jeewx/api/coupon/location/model/CardInfoRtn.java | package org.jeewx.api.coupon.location.model;
import java.util.List;
public class CardInfoRtn {
// 错误码
private String errcode;
// 错误信息
private String errmsg;
//卡券ID
private String card_id;
public String getErrcode() {
return errcode;
}
public void setErrcode(String errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
public String getCard_id() {
return card_id;
}
public void setCard_id(String card_id) {
this.card_id = card_id;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/UrlInfo.java | src/main/java/org/jeewx/api/coupon/location/model/UrlInfo.java | package org.jeewx.api.coupon.location.model;
public class UrlInfo {
// 图片地址
private String url;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/Batchget.java | src/main/java/org/jeewx/api/coupon/location/model/Batchget.java | package org.jeewx.api.coupon.location.model;
import org.jeewx.api.core.annotation.ReqType;
import org.jeewx.api.core.req.model.WeixinReqParam;
@ReqType("getBatchget")
public class Batchget extends WeixinReqParam{
//偏移量,0 开始
private Integer offset ;
//拉取数量
private Integer count ;
public Integer getOffset() {
return offset;
}
public void setOffset(Integer offset) {
this.offset = offset;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/LocationInfo.java | src/main/java/org/jeewx/api/coupon/location/model/LocationInfo.java | package org.jeewx.api.coupon.location.model;
import org.jeewx.api.core.annotation.ReqType;
import org.jeewx.api.core.req.model.WeixinReqParam;
@ReqType("getLocationInfo")
public class LocationInfo extends WeixinReqParam {
// 图片地址
private String filePathName;
public String getFilePathName() {
return filePathName;
}
public void setFilePathName(String filePathName) {
this.filePathName = filePathName;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/LuckyMoney.java | src/main/java/org/jeewx/api/coupon/location/model/LuckyMoney.java | package org.jeewx.api.coupon.location.model;
public class LuckyMoney extends BaseInfo{
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/ScenicTicket.java | src/main/java/org/jeewx/api/coupon/location/model/ScenicTicket.java | package org.jeewx.api.coupon.location.model;
public class ScenicTicket {
//基本的卡券数
private BaseInfo base_info;
//票类型
private String ticket_class;
//导览图url
private String guide_url;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
public String getTicket_class() {
return ticket_class;
}
public void setTicket_class(String ticket_class) {
this.ticket_class = ticket_class;
}
public String getGuide_url() {
return guide_url;
}
public void setGuide_url(String guide_url) {
this.guide_url = guide_url;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/CardInfo.java | src/main/java/org/jeewx/api/coupon/location/model/CardInfo.java | package org.jeewx.api.coupon.location.model;
import org.jeewx.api.core.annotation.ReqType;
import org.jeewx.api.core.req.model.WeixinReqParam;
@ReqType("getCardInfo")
public class CardInfo extends WeixinReqParam{
//卡券类型
private String card_type ;
//基本的卡券数据,见下表,所有卡券通用,描述
private GeneralCoupon general_coupon;
//文本卡卷
private Groupon groupon;
//礼品卡卷
private Gift gift;
//代金卡卷
private Cash cash;
//折扣卡卷
private Discount discount;
//积分卷
private MemberCard member_card;
//票类型
private ScenicTicket scenic_ticket;
//电影卡卷
private MovieTicket movie_ticket;
//机票卡卷
private BoardingPass boarding_pass;
//红包
private LuckyMoney lucky_money ;
//会议详情
private MeetingTicket meeting_ticket;
public String getCard_type() {
return card_type;
}
public void setCard_type(String card_type) {
this.card_type = card_type;
}
public GeneralCoupon getGeneral_coupon() {
return general_coupon;
}
public void setGeneral_coupon(GeneralCoupon general_coupon) {
this.general_coupon = general_coupon;
}
public Groupon getGroupon() {
return groupon;
}
public void setGroupon(Groupon groupon) {
this.groupon = groupon;
}
public Gift getGift() {
return gift;
}
public void setGift(Gift gift) {
this.gift = gift;
}
public Cash getCash() {
return cash;
}
public void setCash(Cash cash) {
this.cash = cash;
}
public Discount getDiscount() {
return discount;
}
public void setDiscount(Discount discount) {
this.discount = discount;
}
public MemberCard getMember_card() {
return member_card;
}
public void setMember_card(MemberCard member_card) {
this.member_card = member_card;
}
public ScenicTicket getScenic_ticket() {
return scenic_ticket;
}
public void setScenic_ticket(ScenicTicket scenic_ticket) {
this.scenic_ticket = scenic_ticket;
}
public MovieTicket getMovie_ticket() {
return movie_ticket;
}
public void setMovie_ticket(MovieTicket movie_ticket) {
this.movie_ticket = movie_ticket;
}
public BoardingPass getBoarding_pass() {
return boarding_pass;
}
public void setBoarding_pass(BoardingPass boarding_pass) {
this.boarding_pass = boarding_pass;
}
public LuckyMoney getLucky_money() {
return lucky_money;
}
public void setLucky_money(LuckyMoney lucky_money) {
this.lucky_money = lucky_money;
}
public MeetingTicket getMeeting_ticket() {
return meeting_ticket;
}
public void setMeeting_ticket(MeetingTicket meeting_ticket) {
this.meeting_ticket = meeting_ticket;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/Discount.java | src/main/java/org/jeewx/api/coupon/location/model/Discount.java | package org.jeewx.api.coupon.location.model;
public class Discount {
//基本的卡券数据
private BaseInfo base_info;
//折扣券专用,表示打折额度
private Integer discount;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
public Integer getDiscount() {
return discount;
}
public void setDiscount(Integer discount) {
this.discount = discount;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/MovieTicket.java | src/main/java/org/jeewx/api/coupon/location/model/MovieTicket.java | package org.jeewx.api.coupon.location.model;
public class MovieTicket {
//基本的卡券数据
private BaseInfo base_info;
//电影票详情
private String detail;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/MeetingTicket.java | src/main/java/org/jeewx/api/coupon/location/model/MeetingTicket.java | package org.jeewx.api.coupon.location.model;
public class MeetingTicket {
//基本的卡券数据
private BaseInfo base_info;
//会议详情
private String meeting_detail;
//会场导览图
private String map_url;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
public String getMeeting_detail() {
return meeting_detail;
}
public void setMeeting_detail(String meeting_detail) {
this.meeting_detail = meeting_detail;
}
public String getMap_url() {
return map_url;
}
public void setMap_url(String map_url) {
this.map_url = map_url;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/Color.java | src/main/java/org/jeewx/api/coupon/location/model/Color.java | package org.jeewx.api.coupon.location.model;
public class Color {
//颜色名称
private String name ;
//颜色值
private String value ;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/LocationRtnInfo.java | src/main/java/org/jeewx/api/coupon/location/model/LocationRtnInfo.java | package org.jeewx.api.coupon.location.model;
public class LocationRtnInfo {
// 错误码
private String errcode;
// 错误信息
private String errmsg;
// 错误信息
private UrlInfo url;
public String getErrcode() {
return errcode;
}
public void setErrcode(String errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
public UrlInfo getUrl() {
return url;
}
public void setUrl(UrlInfo url) {
this.url = url;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/GetcolorsRtn.java | src/main/java/org/jeewx/api/coupon/location/model/GetcolorsRtn.java | package org.jeewx.api.coupon.location.model;
import java.util.List;
public class GetcolorsRtn {
// 错误码
private String errcode;
// 错误信息
private String errmsg;
//颜色集合
private List<Color> colors;
public String getErrcode() {
return errcode;
}
public void setErrcode(String errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
public List<Color> getColors() {
return colors;
}
public void setColors(List<Color> colors) {
this.colors = colors;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/Getcolors.java | src/main/java/org/jeewx/api/coupon/location/model/Getcolors.java | package org.jeewx.api.coupon.location.model;
import org.jeewx.api.core.annotation.ReqType;
import org.jeewx.api.core.req.model.WeixinReqParam;
@ReqType("getGetcolors")
public class Getcolors extends WeixinReqParam{
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/GeneralCoupon.java | src/main/java/org/jeewx/api/coupon/location/model/GeneralCoupon.java | package org.jeewx.api.coupon.location.model;
public class GeneralCoupon {
// 基本的卡券数据,见下表,所有卡券通用。
private BaseInfo base_info;
//描述文
private String default_detail;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
public String getDefault_detail() {
return default_detail;
}
public void setDefault_detail(String default_detail) {
this.default_detail = default_detail;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/DataInfo.java | src/main/java/org/jeewx/api/coupon/location/model/DataInfo.java | package org.jeewx.api.coupon.location.model;
import java.util.Date;
public class DataInfo {
private String type;
private Date begin_timestamp ;
private Date end_timestamp;
private String fixed_term ;
private String fixed_begin_term;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Date getBegin_timestamp() {
return begin_timestamp;
}
public void setBegin_timestamp(Date begin_timestamp) {
this.begin_timestamp = begin_timestamp;
}
public Date getEnd_timestamp() {
return end_timestamp;
}
public void setEnd_timestamp(Date end_timestamp) {
this.end_timestamp = end_timestamp;
}
public String getFixed_term() {
return fixed_term;
}
public void setFixed_term(String fixed_term) {
this.fixed_term = fixed_term;
}
public String getFixed_begin_term() {
return fixed_begin_term;
}
public void setFixed_begin_term(String fixed_begin_term) {
this.fixed_begin_term = fixed_begin_term;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/Cash.java | src/main/java/org/jeewx/api/coupon/location/model/Cash.java | package org.jeewx.api.coupon.location.model;
public class Cash {
//基本的卡券
private BaseInfo base_info;
//代金券专用,表示起用金额
private Double least_cost;
//代金券专用,表示减免金额
private Double reduce_cost;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
public Double getLeast_cost() {
return least_cost;
}
public void setLeast_cost(Double least_cost) {
this.least_cost = least_cost;
}
public Double getReduce_cost() {
return reduce_cost;
}
public void setReduce_cost(Double reduce_cost) {
this.reduce_cost = reduce_cost;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/BoardingPass.java | src/main/java/org/jeewx/api/coupon/location/model/BoardingPass.java | package org.jeewx.api.coupon.location.model;
import java.util.Date;
public class BoardingPass {
//基本的卡券数据
private BaseInfo base_info;
//起点
private String from;
//终点
private String to;
//航班
private String flight;
//起飞时间
private Date departure_time;
//降落时间
private Date landing_time;
//降落时间在线值机的链接
private String check_in_url;
//登机口
private String gate;
//登机时间
private Date boarding_time;
//机型
private String air_model;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public String getFlight() {
return flight;
}
public void setFlight(String flight) {
this.flight = flight;
}
public Date getDeparture_time() {
return departure_time;
}
public void setDeparture_time(Date departure_time) {
this.departure_time = departure_time;
}
public Date getLanding_time() {
return landing_time;
}
public void setLanding_time(Date landing_time) {
this.landing_time = landing_time;
}
public String getCheck_in_url() {
return check_in_url;
}
public void setCheck_in_url(String check_in_url) {
this.check_in_url = check_in_url;
}
public String getGate() {
return gate;
}
public void setGate(String gate) {
this.gate = gate;
}
public Date getBoarding_time() {
return boarding_time;
}
public void setBoarding_time(Date boarding_time) {
this.boarding_time = boarding_time;
}
public String getAir_model() {
return air_model;
}
public void setAir_model(String air_model) {
this.air_model = air_model;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/BatchaddRtn.java | src/main/java/org/jeewx/api/coupon/location/model/BatchaddRtn.java | package org.jeewx.api.coupon.location.model;
import java.util.List;
public class BatchaddRtn {
// 错误码
private String errcode;
// 错误信息
private String errmsg;
//门店ID
private List<String> location_id_list;
public String getErrcode() {
return errcode;
}
public void setErrcode(String errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
public List<String> getLocation_id_list() {
return location_id_list;
}
public void setLocation_id_list(List<String> location_id_list) {
this.location_id_list = location_id_list;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/Batchadd.java | src/main/java/org/jeewx/api/coupon/location/model/Batchadd.java | package org.jeewx.api.coupon.location.model;
import java.util.List;
import org.jeewx.api.core.annotation.ReqType;
import org.jeewx.api.core.req.model.WeixinReqParam;
@ReqType("getBatchadd")
public class Batchadd extends WeixinReqParam{
//门店信息
private List<LocationList> location_list;
public List<LocationList> getLocation_list() {
return location_list;
}
public void setLocation_list(List<LocationList> location_list) {
this.location_list = location_list;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/BatchgetRtn.java | src/main/java/org/jeewx/api/coupon/location/model/BatchgetRtn.java | package org.jeewx.api.coupon.location.model;
import java.util.List;
public class BatchgetRtn {
// 错误码
private String errcode;
// 错误信息
private String errmsg;
// 错误信息
private Integer count;
//门店信息
private List<LocationList> location_list;
public String getErrcode() {
return errcode;
}
public void setErrcode(String errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public List<LocationList> getLocation_list() {
return location_list;
}
public void setLocation_list(List<LocationList> location_list) {
this.location_list = location_list;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/LocationList.java | src/main/java/org/jeewx/api/coupon/location/model/LocationList.java | package org.jeewx.api.coupon.location.model;
public class LocationList {
//门店名称
private String business_name ;
//分店名
private String branch_name ;
//门店所在的省
private String province ;
//门店所在的市
private String city ;
//门店所在的区
private String district ;
//门店所在的详细街道地址
private String address ;
//门店的电话
private String telephone ;
//门店的类型(酒店、餐饮、购物...)
private String category ;
//门店所在地理位置的经度(建议使用腾讯地图定位经纬度)
private String longitude ;
//纬度
private String latitude;
/*//门店ID
private String location_id;
//联系电话
private String phone;*/
public String getBusiness_name() {
return business_name;
}
public void setBusiness_name(String business_name) {
this.business_name = business_name;
}
public String getBranch_name() {
return branch_name;
}
public void setBranch_name(String branch_name) {
this.branch_name = branch_name;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
/*public String getLocation_id() {
return location_id;
}
public void setLocation_id(String location_id) {
this.location_id = location_id;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}*/
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/Groupon.java | src/main/java/org/jeewx/api/coupon/location/model/Groupon.java | package org.jeewx.api.coupon.location.model;
public class Groupon {
//基本的卡券
private BaseInfo base_info;
//团购券专用
private String deal_detail;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
public String getDeal_detail() {
return deal_detail;
}
public void setDeal_detail(String deal_detail) {
this.deal_detail = deal_detail;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/MemberCard.java | src/main/java/org/jeewx/api/coupon/location/model/MemberCard.java | package org.jeewx.api.coupon.location.model;
public class MemberCard {
//基本的卡券数据
private BaseInfo base_info;
//是否支持积分
private Boolean supply_bonus;
//是否支持储值
private Boolean supply_balance ;
//积分清零规则
private String bonus_cleared;
//积分规规则
private String bonus_rules;
//储值说明
private String balance_rules;
//特权说明
private String prerogative;
//绑定旧卡的url
private String bind_old_card_url;
//激活会员卡的url
private String activate_url;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
public Boolean getSupply_bonus() {
return supply_bonus;
}
public void setSupply_bonus(Boolean supply_bonus) {
this.supply_bonus = supply_bonus;
}
public Boolean getSupply_balance() {
return supply_balance;
}
public void setSupply_balance(Boolean supply_balance) {
this.supply_balance = supply_balance;
}
public String getBonus_cleared() {
return bonus_cleared;
}
public void setBonus_cleared(String bonus_cleared) {
this.bonus_cleared = bonus_cleared;
}
public String getBonus_rules() {
return bonus_rules;
}
public void setBonus_rules(String bonus_rules) {
this.bonus_rules = bonus_rules;
}
public String getBalance_rules() {
return balance_rules;
}
public void setBalance_rules(String balance_rules) {
this.balance_rules = balance_rules;
}
public String getPrerogative() {
return prerogative;
}
public void setPrerogative(String prerogative) {
this.prerogative = prerogative;
}
public String getBind_old_card_url() {
return bind_old_card_url;
}
public void setBind_old_card_url(String bind_old_card_url) {
this.bind_old_card_url = bind_old_card_url;
}
public String getActivate_url() {
return activate_url;
}
public void setActivate_url(String activate_url) {
this.activate_url = activate_url;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/Gift.java | src/main/java/org/jeewx/api/coupon/location/model/Gift.java | package org.jeewx.api.coupon.location.model;
public class Gift {
//基本的卡券
private BaseInfo base_info;
//礼品券专用
private String gift;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
public String getGift() {
return gift;
}
public void setGift(String gift) {
this.gift = gift;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/location/model/BaseInfo.java | src/main/java/org/jeewx/api/coupon/location/model/BaseInfo.java | package org.jeewx.api.coupon.location.model;
import org.jeewx.api.wxstore.product.model.Sku;
public class BaseInfo {
//卡券的商户logo,尺寸为300*300。
private String logo_url;
//code 码展示类型
private String code_type ;
//商户名字,字数上限为12 个汉字
private String brand_name;
//券名
private String title ;
//券名的副标题
private String sub_title;
//券颜色
private String color;
//使用提醒
private String notice ;
//使用说明
private String description;
//门店位置ID
private String location_id_list;
//是否自定义code
private Boolean use_custom_code;
//是否指定用户领取
private Boolean bind_openid;
//领取卡券原生页面是否可分享
private Boolean can_share;
//卡券是否可转赠
private Boolean can_give_friend;
//每人最大领取次数
private Integer get_limit;
//客服电话
private String service_phone;
//第三方来源名
private String source;
//商户自定义cell 名称
private String url_name_type;
//商户自定义cell 跳转外链的地址链接
private String custom_url;
//商品信息
private Sku sku;
//使用日期,有效期的信息
private DataInfo dataInfo;
public String getLogo_url() {
return logo_url;
}
public void setLogo_url(String logo_url) {
this.logo_url = logo_url;
}
public String getCode_type() {
return code_type;
}
public void setCode_type(String code_type) {
this.code_type = code_type;
}
public String getBrand_name() {
return brand_name;
}
public void setBrand_name(String brand_name) {
this.brand_name = brand_name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getSub_title() {
return sub_title;
}
public void setSub_title(String sub_title) {
this.sub_title = sub_title;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getNotice() {
return notice;
}
public void setNotice(String notice) {
this.notice = notice;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getLocation_id_list() {
return location_id_list;
}
public void setLocation_id_list(String location_id_list) {
this.location_id_list = location_id_list;
}
public Boolean getUse_custom_code() {
return use_custom_code;
}
public void setUse_custom_code(Boolean use_custom_code) {
this.use_custom_code = use_custom_code;
}
public Boolean getBind_openid() {
return bind_openid;
}
public void setBind_openid(Boolean bind_openid) {
this.bind_openid = bind_openid;
}
public Boolean getCan_share() {
return can_share;
}
public void setCan_share(Boolean can_share) {
this.can_share = can_share;
}
public Boolean getCan_give_friend() {
return can_give_friend;
}
public void setCan_give_friend(Boolean can_give_friend) {
this.can_give_friend = can_give_friend;
}
public Integer getGet_limit() {
return get_limit;
}
public void setGet_limit(Integer get_limit) {
this.get_limit = get_limit;
}
public String getService_phone() {
return service_phone;
}
public void setService_phone(String service_phone) {
this.service_phone = service_phone;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getUrl_name_type() {
return url_name_type;
}
public void setUrl_name_type(String url_name_type) {
this.url_name_type = url_name_type;
}
public String getCustom_url() {
return custom_url;
}
public void setCustom_url(String custom_url) {
this.custom_url = custom_url;
}
public Sku getSku() {
return sku;
}
public void setSku(Sku sku) {
this.sku = sku;
}
public DataInfo getDataInfo() {
return dataInfo;
}
public void setDataInfo(DataInfo dataInfo) {
this.dataInfo = dataInfo;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/qrcode/JwQrcodeAPI.java | src/main/java/org/jeewx/api/coupon/qrcode/JwQrcodeAPI.java | package org.jeewx.api.coupon.qrcode;
import com.alibaba.fastjson.JSONObject;
import org.jeewx.api.core.exception.WexinReqException;
import org.jeewx.api.core.req.WeiXinReqService;
import org.jeewx.api.coupon.qrcode.model.Getticket;
import org.jeewx.api.coupon.qrcode.model.GetticketRtn;
import org.jeewx.api.coupon.qrcode.model.QrcodeInfo;
import org.jeewx.api.coupon.qrcode.model.QrcodeRtnInfo;
/**
* 微信卡券 - 卡券投放
* @author lihongxuan
*
*/
public class JwQrcodeAPI {
/**
* 创建二维码
* @throws WexinReqException
*/
public static QrcodeRtnInfo doAddQrcode(String accesstoken,QrcodeInfo qrcodeInfo) throws WexinReqException {
if (accesstoken != null) {
qrcodeInfo.setAccess_token(accesstoken);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(qrcodeInfo);
QrcodeRtnInfo qrcodeRtnInfo = (QrcodeRtnInfo)JSONObject.toJavaObject(result, QrcodeRtnInfo.class);
return qrcodeRtnInfo;
}
return null;
}
/**
* 获取api_ticket
*/
public static GetticketRtn doGetticket(String accesstoken)throws WexinReqException {
if (accesstoken != null) {
Getticket gk = new Getticket();
gk.setAccess_token(accesstoken);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(gk);
GetticketRtn getticketRtn = (GetticketRtn)JSONObject.toJavaObject(result, GetticketRtn.class);
return getticketRtn;
}
return null;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/qrcode/model/Getticket.java | src/main/java/org/jeewx/api/coupon/qrcode/model/Getticket.java | package org.jeewx.api.coupon.qrcode.model;
import org.jeewx.api.core.annotation.ReqType;
import org.jeewx.api.core.req.model.WeixinReqParam;
@ReqType("getGetticket")
public class Getticket extends WeixinReqParam{
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/qrcode/model/QrcodeRtnInfo.java | src/main/java/org/jeewx/api/coupon/qrcode/model/QrcodeRtnInfo.java | package org.jeewx.api.coupon.qrcode.model;
public class QrcodeRtnInfo {
// 错误码
private String errcode;
// 错误信息
private String errmsg;
//获取的二维码ticket,凭借此ticket 可以在有效时间内换取二维码。
private String ticket;
public String getErrcode() {
return errcode;
}
public void setErrcode(String errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
public String getTicket() {
return ticket;
}
public void setTicket(String ticket) {
this.ticket = ticket;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/qrcode/model/QrcodeInfo.java | src/main/java/org/jeewx/api/coupon/qrcode/model/QrcodeInfo.java | package org.jeewx.api.coupon.qrcode.model;
import org.jeewx.api.core.annotation.ReqType;
import org.jeewx.api.core.req.model.WeixinReqParam;
@ReqType("getGrcodeInfo")
public class QrcodeInfo extends WeixinReqParam{
// 名称
private String action_name;
// 卡卷对象
private ActionInfo action_info;
public String getAction_name() {
return action_name;
}
public void setAction_name(String action_name) {
this.action_name = action_name;
}
public ActionInfo getAction_info() {
return action_info;
}
public void setAction_info(ActionInfo action_info) {
this.action_info = action_info;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/qrcode/model/GetticketRtn.java | src/main/java/org/jeewx/api/coupon/qrcode/model/GetticketRtn.java | package org.jeewx.api.coupon.qrcode.model;
public class GetticketRtn {
// 错误码
private String errcode;
// 错误信息
private String errmsg;
//api_ticket,签名中所需凭证
private String ticket;
//有效时间
private String expires_in;
public String getErrcode() {
return errcode;
}
public void setErrcode(String errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
public String getTicket() {
return ticket;
}
public void setTicket(String ticket) {
this.ticket = ticket;
}
public String getExpires_in() {
return expires_in;
}
public void setExpires_in(String expires_in) {
this.expires_in = expires_in;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/qrcode/model/ActionInfo.java | src/main/java/org/jeewx/api/coupon/qrcode/model/ActionInfo.java | package org.jeewx.api.coupon.qrcode.model;
public class ActionInfo extends Card {
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/coupon/qrcode/model/Card.java | src/main/java/org/jeewx/api/coupon/qrcode/model/Card.java | package org.jeewx.api.coupon.qrcode.model;
public class Card {
//卡券ID
private String card_id ;
//指定卡券code 码,只能被领一次
private String code ;
//指定领取者的openid,只有该用户能领取
private String openid ;
//指定二维码的有效时间,范围是60 ~ 1800 秒。不填默认为永久有效。
private Integer expire_seconds ;
//指定下发二维码
private Boolean is_unique_code ;
//红包余额
private String balance ;
//领取场景值
private Long outer_id ;
public String getCard_id() {
return card_id;
}
public void setCard_id(String card_id) {
this.card_id = card_id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public Integer getExpire_seconds() {
return expire_seconds;
}
public void setExpire_seconds(Integer expire_seconds) {
this.expire_seconds = expire_seconds;
}
public Boolean getIs_unique_code() {
return is_unique_code;
}
public void setIs_unique_code(Boolean is_unique_code) {
this.is_unique_code = is_unique_code;
}
public String getBalance() {
return balance;
}
public void setBalance(String balance) {
this.balance = balance;
}
public Long getOuter_id() {
return outer_id;
}
public void setOuter_id(Long outer_id) {
this.outer_id = outer_id;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/mp/JwMpAPI.java | src/main/java/org/jeewx/api/mp/JwMpAPI.java | package org.jeewx.api.mp;
import java.io.StringReader;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.jeewx.api.core.exception.WexinReqException;
import org.jeewx.api.mp.aes.WXBizMsgCrypt;
import org.jeewx.api.wxaccount.model.WxQrcode;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/**
* 微信--消息加解密接入
* @author lihongxuan
*
* 提供接收和推送给公众平台消息的加解密接口(UTF8编码的字符串).
* <ol>
* <li>第三方回复加密消息给公众平台</li>
* <li>第三方收到公众平台发送的消息,验证消息的安全性,并对消息进行解密。</li>
* </ol>
* 说明:异常java.security.InvalidKeyException:illegal Key Size的解决方案
* <ol>
* <li>在官方网站下载JCE无限制权限策略文件(JDK7的下载地址:
* http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html</li>
* <li>下载后解压,可以看到local_policy.jar和US_export_policy.jar以及readme.txt</li>
* <li>如果安装了JRE,将两个jar文件放到%JRE_HOME%\lib\security目录下覆盖原来的文件</li>
* <li>如果安装了JDK,将两个jar文件放到%JDK_HOME%\jre\lib\security目录下覆盖原来文件</li>
* </ol>
*/
public class JwMpAPI {
/**
* 随机串,可以自己生成,也可以用URL参数的nonce
*/
public static String nonce = "xxxxxx";
/**
* 时间戳,可以自己生成,也可以用URL参数的timestamp
*/
public static String timestamp = "1409304348";
/*
*@param token: 第三方平台申请时填写的接收消息的校验token
*@param encodingAesKey: 公众号第三方平台的 EncodingAESKey(申请公众号第三方平台时填写的接收消息的加密symmetric_key)
*@param appId: 公众号第三方平台的appid
*@param replyMsg: 公众号待回复用户的消息,xml格式的字符串
*/
public static String miwen(String token, String encodingAesKey,
String appId, String replyMsg) throws Exception {
WXBizMsgCrypt pc = new WXBizMsgCrypt(token, encodingAesKey, appId);
String mingwen = pc.encryptMsg(replyMsg, timestamp, nonce);
return mingwen;
}
/*
*@param minwen: 秘文
*@param token: 第三方平台申请时填写的接收消息的校验token
*@param encodingAesKey: 公众号第三方平台的 EncodingAESKey(申请公众号第三方平台时填写的接收消息的加密symmetric_key)
*@param appId: 公众号第三方平台的appid
*@param replyMsg: 解密后的明文,当return返回0时有效
*/
public static String mingwen(String miwen,String token, String encodingAesKey,String appId) throws Exception{
WXBizMsgCrypt pc = new WXBizMsgCrypt(token, encodingAesKey, appId);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
StringReader sr = new StringReader(miwen);
InputSource is = new InputSource(sr);
Document document = db.parse(is);
Element root = document.getDocumentElement();
NodeList nodelist1 = root.getElementsByTagName("Encrypt");
NodeList nodelist2 = root.getElementsByTagName("MsgSignature");
String encrypt = nodelist1.item(0).getTextContent();
String msgSignature = nodelist2.item(0).getTextContent();
String format = "<xml>" +
"<ToUserName><![CDATA[toUser]]></ToUserName>" +
"<Encrypt><![CDATA[%1$s]]></Encrypt>" +
"</xml>";
String fromXML = String.format(format, encrypt);
String result2 = pc.decryptMsg(msgSignature, timestamp, nonce, fromXML);
return result2;
}
public static void main(String[] args) throws Exception {
String encodingAesKey = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFG";
String token = "pamtest";
String appId = "wxb11529c136998cb6";
String replyMsg = " 中文" +
"<xml>" +
"<ToUserName><![CDATA[oia2TjjewbmiOUlr6X-1crbLOvLw]]></ToUserName>" +
"<FromUserName><![CDATA[gh_7f083739789a]]></FromUserName>" +
"<CreateTime>1407743423</CreateTime>" +
"<MsgType><![CDATA[video]]></MsgType>" +
"<Video>" +
"<MediaId><![CDATA[eYJ1MbwPRJtOvIEabaxHs7TX2D-HV71s79GUxqdUkjm6Gs2Ed1KF3ulAOA9H1xG0]]></MediaId>" +
"<Title><![CDATA[testCallBackReplyVideo]]></Title>" +
"<Description><![CDATA[testCallBackReplyVideo]]></Description>" +
"</Video>" +
"</xml>";
String mingwen = JwMpAPI.miwen(token, encodingAesKey, appId, replyMsg);
System.out.println("mingwen: " + mingwen);
String miwen =JwMpAPI.mingwen(mingwen, token, encodingAesKey, appId);
System.out.println("miwen: " + miwen);
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/mp/aes/WXBizMsgCrypt.java | src/main/java/org/jeewx/api/mp/aes/WXBizMsgCrypt.java | /**
* 对公众平台发送给公众账号的消息加解密示例代码.
*
* @copyright Copyright (c) 1998-2014 Tencent Inc.
*/
// ------------------------------------------------------------------------
/**
* 针对org.apache.commons.codec.binary.Base64,
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
*/
package org.jeewx.api.mp.aes;
import java.nio.charset.Charset;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Random;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
/**
* 提供接收和推送给公众平台消息的加解密接口(UTF8编码的字符串).
* <ol>
* <li>第三方回复加密消息给公众平台</li>
* <li>第三方收到公众平台发送的消息,验证消息的安全性,并对消息进行解密。</li>
* </ol>
* 说明:异常java.security.InvalidKeyException:illegal Key Size的解决方案
* <ol>
* <li>在官方网站下载JCE无限制权限策略文件(JDK7的下载地址:
* http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html</li>
* <li>下载后解压,可以看到local_policy.jar和US_export_policy.jar以及readme.txt</li>
* <li>如果安装了JRE,将两个jar文件放到%JRE_HOME%\lib\security目录下覆盖原来的文件</li>
* <li>如果安装了JDK,将两个jar文件放到%JDK_HOME%\jre\lib\security目录下覆盖原来文件</li>
* </ol>
*/
public class WXBizMsgCrypt {
static Charset CHARSET = Charset.forName("utf-8");
Base64 base64 = new Base64();
byte[] aesKey;
String token;
String appId;
/**
* 构造函数
* @param token 公众平台上,开发者设置的token
* @param encodingAesKey 公众平台上,开发者设置的EncodingAESKey
* @param appId 公众平台appid
*
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
*/
public WXBizMsgCrypt(String token, String encodingAesKey, String appId) throws AesException {
if (encodingAesKey.length() != 43) {
throw new AesException(AesException.IllegalAesKey);
}
this.token = token;
this.appId = appId;
aesKey = Base64.decodeBase64(encodingAesKey + "=");
}
// 生成4个字节的网络字节序
byte[] getNetworkBytesOrder(int sourceNumber) {
byte[] orderBytes = new byte[4];
orderBytes[3] = (byte) (sourceNumber & 0xFF);
orderBytes[2] = (byte) (sourceNumber >> 8 & 0xFF);
orderBytes[1] = (byte) (sourceNumber >> 16 & 0xFF);
orderBytes[0] = (byte) (sourceNumber >> 24 & 0xFF);
return orderBytes;
}
// 还原4个字节的网络字节序
int recoverNetworkBytesOrder(byte[] orderBytes) {
int sourceNumber = 0;
for (int i = 0; i < 4; i++) {
sourceNumber <<= 8;
sourceNumber |= orderBytes[i] & 0xff;
}
return sourceNumber;
}
// 随机生成16位字符串
String getRandomStr() {
String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
Random random = new Random();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 16; i++) {
int number = random.nextInt(base.length());
sb.append(base.charAt(number));
}
return sb.toString();
}
/**
* 对明文进行加密.
*
* @param text 需要加密的明文
* @return 加密后base64编码的字符串
* @throws AesException aes加密失败
*/
String encrypt(String randomStr, String text) throws AesException {
ByteGroup byteCollector = new ByteGroup();
byte[] randomStrBytes = randomStr.getBytes(CHARSET);
try {
SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
secureRandom.setSeed(text.getBytes());
} catch (Exception e1) {
e1.printStackTrace();
}
byte[] textBytes = text.getBytes(CHARSET);
byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length);
byte[] appidBytes = appId.getBytes(CHARSET);
// randomStr + networkBytesOrder + text + appid
byteCollector.addBytes(randomStrBytes);
byteCollector.addBytes(networkBytesOrder);
byteCollector.addBytes(textBytes);
byteCollector.addBytes(appidBytes);
// ... + pad: 使用自定义的填充方式对明文进行补位填充
byte[] padBytes = PKCS7Encoder.encode(byteCollector.size());
byteCollector.addBytes(padBytes);
// 获得最终的字节流, 未加密
byte[] unencrypted = byteCollector.toBytes();
try {
// 设置加密模式为AES的CBC模式
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES");
IvParameterSpec iv = new IvParameterSpec(aesKey, 0, 16);
cipher.init(Cipher.ENCRYPT_MODE, keySpec, iv);
// 加密
byte[] encrypted = cipher.doFinal(unencrypted);
// 使用BASE64对加密后的字符串进行编码
String base64Encrypted = base64.encodeToString(encrypted);
return base64Encrypted;
} catch (Exception e) {
e.printStackTrace();
throw new AesException(AesException.EncryptAESError);
}
}
/**
* 对密文进行解密.
*
* @param text 需要解密的密文
* @return 解密得到的明文
* @throws AesException aes解密失败
*/
String decrypt(String text) throws AesException {
byte[] original;
try {
// 设置解密模式为AES的CBC模式
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
SecretKeySpec key_spec = new SecretKeySpec(aesKey, "AES");
IvParameterSpec iv = new IvParameterSpec(Arrays.copyOfRange(aesKey, 0, 16));
cipher.init(Cipher.DECRYPT_MODE, key_spec, iv);
// 使用BASE64对密文进行解码
byte[] encrypted = Base64.decodeBase64(text);
// 解密
original = cipher.doFinal(encrypted);
} catch (Exception e) {
e.printStackTrace();
throw new AesException(AesException.DecryptAESError);
}
String xmlContent, from_appid;
try {
// 去除补位字符
byte[] bytes = PKCS7Encoder.decode(original);
// 分离16位随机字符串,网络字节序和AppId
byte[] networkOrder = Arrays.copyOfRange(bytes, 16, 20);
int xmlLength = recoverNetworkBytesOrder(networkOrder);
xmlContent = new String(Arrays.copyOfRange(bytes, 20, 20 + xmlLength), CHARSET);
from_appid = new String(Arrays.copyOfRange(bytes, 20 + xmlLength, bytes.length),
CHARSET);
} catch (Exception e) {
e.printStackTrace();
throw new AesException(AesException.IllegalBuffer);
}
// appid不相同的情况
if (!from_appid.equals(appId)) {
throw new AesException(AesException.ValidateAppidError);
}
return xmlContent;
}
/**
* 将公众平台回复用户的消息加密打包.
* <ol>
* <li>对要发送的消息进行AES-CBC加密</li>
* <li>生成安全签名</li>
* <li>将消息密文和安全签名打包成xml格式</li>
* </ol>
*
* @param replyMsg 公众平台待回复用户的消息,xml格式的字符串
* @param timeStamp 时间戳,可以自己生成,也可以用URL参数的timestamp
* @param nonce 随机串,可以自己生成,也可以用URL参数的nonce
*
* @return 加密后的可以直接回复用户的密文,包括msg_signature, timestamp, nonce, encrypt的xml格式的字符串
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
*/
public String encryptMsg(String replyMsg, String timeStamp, String nonce) throws AesException {
// 加密
String encrypt = encrypt(getRandomStr(), replyMsg);
// 生成安全签名
if (timeStamp == "") {
timeStamp = Long.toString(System.currentTimeMillis());
}
String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt);
// System.out.println("发送给平台的签名是: " + signature[1].toString());
// 生成发送的xml
String result = XMLParse.generate(encrypt, signature, timeStamp, nonce);
return result;
}
/**
* 检验消息的真实性,并且获取解密后的明文.
* <ol>
* <li>利用收到的密文生成安全签名,进行签名验证</li>
* <li>若验证通过,则提取xml中的加密消息</li>
* <li>对消息进行解密</li>
* </ol>
*
* @param msgSignature 签名串,对应URL参数的msg_signature
* @param timeStamp 时间戳,对应URL参数的timestamp
* @param nonce 随机串,对应URL参数的nonce
* @param postData 密文,对应POST请求的数据
*
* @return 解密后的原文
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
*/
public String decryptMsg(String msgSignature, String timeStamp, String nonce, String postData)
throws AesException {
// 密钥,公众账号的app secret
// 提取密文
Object[] encrypt = XMLParse.extract(postData);
// 验证安全签名
String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt[1].toString());
// 和URL中的签名比较是否相等
// System.out.println("第三方收到URL中的签名:" + msg_sign);
// System.out.println("第三方校验签名:" + signature);
if (!signature.equals(msgSignature)) {
throw new AesException(AesException.ValidateSignatureError);
}
// 解密
String result = decrypt(encrypt[1].toString());
return result;
}
/**
* 验证URL
* @param msgSignature 签名串,对应URL参数的msg_signature
* @param timeStamp 时间戳,对应URL参数的timestamp
* @param nonce 随机串,对应URL参数的nonce
* @param echoStr 随机串,对应URL参数的echostr
*
* @return 解密之后的echostr
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
*/
public String verifyUrl(String msgSignature, String timeStamp, String nonce, String echoStr)
throws AesException {
String signature = SHA1.getSHA1(token, timeStamp, nonce, echoStr);
if (!signature.equals(msgSignature)) {
throw new AesException(AesException.ValidateSignatureError);
}
String result = decrypt(echoStr);
return result;
}
} | java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/mp/aes/XMLParse.java | src/main/java/org/jeewx/api/mp/aes/XMLParse.java | /**
* 对公众平台发送给公众账号的消息加解密示例代码.
*
* @copyright Copyright (c) 1998-2014 Tencent Inc.
*/
// ------------------------------------------------------------------------
package org.jeewx.api.mp.aes;
import java.io.StringReader;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/**
* XMLParse class
*
* 提供提取消息格式中的密文及生成回复消息格式的接口.
*/
class XMLParse {
/**
* 提取出xml数据包中的加密消息
* @param xmltext 待提取的xml字符串
* @return 提取出的加密消息字符串
* @throws AesException
*/
public static Object[] extract(String xmltext) throws AesException {
Object[] result = new Object[3];
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
StringReader sr = new StringReader(xmltext);
InputSource is = new InputSource(sr);
Document document = db.parse(is);
Element root = document.getDocumentElement();
NodeList nodelist1 = root.getElementsByTagName("Encrypt");
NodeList nodelist2 = root.getElementsByTagName("ToUserName");
result[0] = 0;
result[1] = nodelist1.item(0).getTextContent();
if(nodelist2!=null){
result[2] = nodelist2.item(0)!=null?nodelist2.item(0).getTextContent():null;
}
return result;
} catch (Exception e) {
e.printStackTrace();
throw new AesException(AesException.ParseXmlError);
}
}
/**
* 生成xml消息
* @param encrypt 加密后的消息密文
* @param signature 安全签名
* @param timestamp 时间戳
* @param nonce 随机字符串
* @return 生成的xml字符串
*/
public static String generate(String encrypt, String signature, String timestamp, String nonce) {
String format = "<xml>\n" + "<Encrypt><![CDATA[%1$s]]></Encrypt>\n"
+ "<MsgSignature><![CDATA[%2$s]]></MsgSignature>\n"
+ "<TimeStamp>%3$s</TimeStamp>\n" + "<Nonce><![CDATA[%4$s]]></Nonce>\n" + "</xml>";
return String.format(format, encrypt, signature, timestamp, nonce);
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/mp/aes/AesException.java | src/main/java/org/jeewx/api/mp/aes/AesException.java | package org.jeewx.api.mp.aes;
@SuppressWarnings("serial")
public class AesException extends Exception {
public final static int OK = 0;
public final static int ValidateSignatureError = -40001;
public final static int ParseXmlError = -40002;
public final static int ComputeSignatureError = -40003;
public final static int IllegalAesKey = -40004;
public final static int ValidateAppidError = -40005;
public final static int EncryptAESError = -40006;
public final static int DecryptAESError = -40007;
public final static int IllegalBuffer = -40008;
//public final static int EncodeBase64Error = -40009;
//public final static int DecodeBase64Error = -40010;
//public final static int GenReturnXmlError = -40011;
private int code;
private static String getMessage(int code) {
switch (code) {
case ValidateSignatureError:
return "签名验证错误";
case ParseXmlError:
return "xml解析失败";
case ComputeSignatureError:
return "sha加密生成签名失败";
case IllegalAesKey:
return "SymmetricKey非法";
case ValidateAppidError:
return "appid校验失败";
case EncryptAESError:
return "aes加密失败";
case DecryptAESError:
return "aes解密失败";
case IllegalBuffer:
return "解密后得到的buffer非法";
// case EncodeBase64Error:
// return "base64加密错误";
// case DecodeBase64Error:
// return "base64解密错误";
// case GenReturnXmlError:
// return "xml生成失败";
default:
return null; // cannot be
}
}
public int getCode() {
return code;
}
AesException(int code) {
super(getMessage(code));
this.code = code;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/mp/aes/SHA1.java | src/main/java/org/jeewx/api/mp/aes/SHA1.java | /**
* 对公众平台发送给公众账号的消息加解密示例代码.
*
* @copyright Copyright (c) 1998-2014 Tencent Inc.
*/
// ------------------------------------------------------------------------
package org.jeewx.api.mp.aes;
import java.security.MessageDigest;
import java.util.Arrays;
/**
* SHA1 class
*
* 计算公众平台的消息签名接口.
*/
class SHA1 {
/**
* 用SHA1算法生成安全签名
* @param token 票据
* @param timestamp 时间戳
* @param nonce 随机字符串
* @param encrypt 密文
* @return 安全签名
* @throws AesException
*/
public static String getSHA1(String token, String timestamp, String nonce, String encrypt) throws AesException
{
try {
String[] array = new String[] { token, timestamp, nonce, encrypt };
StringBuffer sb = new StringBuffer();
// 字符串排序
Arrays.sort(array);
for (int i = 0; i < 4; i++) {
sb.append(array[i]);
}
String str = sb.toString();
// SHA1签名生成
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(str.getBytes());
byte[] digest = md.digest();
StringBuffer hexstr = new StringBuffer();
String shaHex = "";
for (int i = 0; i < digest.length; i++) {
shaHex = Integer.toHexString(digest[i] & 0xFF);
if (shaHex.length() < 2) {
hexstr.append(0);
}
hexstr.append(shaHex);
}
return hexstr.toString();
} catch (Exception e) {
e.printStackTrace();
throw new AesException(AesException.ComputeSignatureError);
}
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/mp/aes/ByteGroup.java | src/main/java/org/jeewx/api/mp/aes/ByteGroup.java | package org.jeewx.api.mp.aes;
import java.util.ArrayList;
class ByteGroup {
ArrayList<Byte> byteContainer = new ArrayList<Byte>();
public byte[] toBytes() {
byte[] bytes = new byte[byteContainer.size()];
for (int i = 0; i < byteContainer.size(); i++) {
bytes[i] = byteContainer.get(i);
}
return bytes;
}
public ByteGroup addBytes(byte[] bytes) {
for (byte b : bytes) {
byteContainer.add(b);
}
return this;
}
public int size() {
return byteContainer.size();
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/mp/aes/PKCS7Encoder.java | src/main/java/org/jeewx/api/mp/aes/PKCS7Encoder.java | /**
* 对公众平台发送给公众账号的消息加解密示例代码.
*
* @copyright Copyright (c) 1998-2014 Tencent Inc.
*/
// ------------------------------------------------------------------------
package org.jeewx.api.mp.aes;
import java.nio.charset.Charset;
import java.util.Arrays;
/**
* 提供基于PKCS7算法的加解密接口.
*/
class PKCS7Encoder {
static Charset CHARSET = Charset.forName("utf-8");
static int BLOCK_SIZE = 32;
/**
* 获得对明文进行补位填充的字节.
*
* @param count 需要进行填充补位操作的明文字节个数
* @return 补齐用的字节数组
*/
static byte[] encode(int count) {
// 计算需要填充的位数
int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE);
if (amountToPad == 0) {
amountToPad = BLOCK_SIZE;
}
// 获得补位所用的字符
char padChr = chr(amountToPad);
String tmp = new String();
for (int index = 0; index < amountToPad; index++) {
tmp += padChr;
}
return tmp.getBytes(CHARSET);
}
/**
* 删除解密后明文的补位字符
*
* @param decrypted 解密后的明文
* @return 删除补位字符后的明文
*/
static byte[] decode(byte[] decrypted) {
int pad = (int) decrypted[decrypted.length - 1];
if (pad < 1 || pad > 32) {
pad = 0;
}
return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad);
}
/**
* 将数字转化成ASCII码对应的字符,用于对明文进行补码
*
* @param a 需要转化的数字
* @return 转化得到的字符
*/
static char chr(int a) {
byte target = (byte) (a & 0xFF);
return (char) target;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxshop/JwShopAPI.java | src/main/java/org/jeewx/api/wxshop/JwShopAPI.java | package org.jeewx.api.wxshop;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils;
import org.jeewx.api.core.common.JSONHelper;
import org.jeewx.api.core.common.WxstoreUtils;
import org.jeewx.api.coupon.location.model.BaseInfo;
import org.jeewx.api.wxshop.model.Business;
import org.jeewx.api.wxshop.model.BusinessReq;
import org.jeewx.api.wxshop.model.PoiId;
import org.jeewx.api.wxshop.model.ShopRtnInfo;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
/**
* 微信门店
* @author lihongxuan
*
*/
public class JwShopAPI {
// 创建门店
private static String create_shop_url = "https://api.weixin.qq.com/cgi-bin/poi/addpoi?access_token=TOKEN";
// 查询门店信息
private static String get_shop_url = "https://api.weixin.qq.com/cgi-bin/poi/getpoi?access_token=TOKEN";
// 查询门店列表
private static String search_shop_url = "https://api.weixin.qq.com/cgi-bin/poi/getpoilist?access_token=TOKEN";
// 删除门店
private static String del_shop_url = "https://api.weixin.qq.com/cgi-bin/poi/delpoi?access_token=TOKEN";
// 上传图片
private static String upload_img_shop_url = "https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token=ACCESS_TOKEN";
// 修改门店服务信息
private static String updatebystatus_shop_url = "https://api.weixin.qq.com/cgi-bin/poi/updatepoi?access_token=TOKEN";
// 门店类目表
private static String shop_category_url = "https://api.weixin.qq.com/cgi-bin/api_getwxcategory?access_token=TOKEN";
/**
* 增加门店
*/
public static String getShopCategorys(String newAccessToken) {
if (newAccessToken != null) {
String requestUrl = shop_category_url.replace("ACCESS_TOKEN", newAccessToken);
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "GET",null);
JSONArray info = result.getJSONArray("category_list");
String str = null;
str = JSONHelper.toBean(info, String.class);
return str;
}
return null;
}
/**
* 增加门店
*/
public static ShopRtnInfo doAddshop(String newAccessToken, Business business) {
if (newAccessToken != null) {
String requestUrl = create_shop_url.replace("ACCESS_TOKEN", newAccessToken);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(business));
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
ShopRtnInfo shopRtnInfo = (ShopRtnInfo)JSONObject.toJavaObject(result, ShopRtnInfo.class);
return shopRtnInfo;
}
return null;
}
/**
* 修改门店服务信息
*/
public static ShopRtnInfo updateShop(String newAccessToken, Business business) {
if (newAccessToken != null) {
String requestUrl = updatebystatus_shop_url.replace("ACCESS_TOKEN", newAccessToken);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(business));
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
ShopRtnInfo shopRtnInfo = (ShopRtnInfo)JSONObject.toJavaObject(result, ShopRtnInfo.class);
return shopRtnInfo;
}
return null;
}
/**
* 删除门店
*/
public static ShopRtnInfo delShop(String newAccessToken, PoiId poiId) {
if (newAccessToken != null) {
String requestUrl = del_shop_url.replace("ACCESS_TOKEN", newAccessToken);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(poiId));
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
ShopRtnInfo shopRtnInfo = (ShopRtnInfo)JSONObject.toJavaObject(result, ShopRtnInfo.class);
return shopRtnInfo;
}
return null;
}
/**
* 查询门店信息
*/
public static BaseInfo getshop(String newAccessToken, PoiId poiId) {
if (newAccessToken != null) {
String requestUrl = get_shop_url.replace("ACCESS_TOKEN", newAccessToken);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(poiId));
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
JSONObject info = result.getJSONObject("business");
BaseInfo baseInfo = null;
baseInfo = (BaseInfo)JSONObject.toJavaObject(info, BaseInfo.class);
return baseInfo;
}
return null;
}
/**
* 查询门店列表
*/
public static List<BaseInfo> getshops(String newAccessToken, BusinessReq businessReq) {
if (newAccessToken != null) {
String requestUrl = search_shop_url.replace("ACCESS_TOKEN", newAccessToken);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(businessReq));
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
// 正常返回
List<BaseInfo> baseInfos = null;
JSONArray info = result.getJSONArray("business_list");
baseInfos = JSONHelper.toList(info, BaseInfo.class);
return baseInfos;
}
return null;
}
/**
* 上传图片
* @param fileName
* @param accountid
* @return
*/
public static String uploadImg(String newAccessToken, String filePath, String fileName) {
if (newAccessToken != null) {
String requestUrl = upload_img_shop_url.replace("ACCESS_TOKEN", newAccessToken);
byte[] fileByte;
try {
fileByte = fileData(filePath+fileName);
JSONObject result = WxstoreUtils.httpRequest2(requestUrl, "POST", fileByte);
if (result.getInteger("errcode") == 0) {
return result.getString("url");
}
return "";
} catch (IOException e) {
e.printStackTrace();
}
}
return "";
}
private static byte[] fileData(String filePath) throws IOException {
File file = new File(filePath);//存放照片的文件
InputStream fis = null;
byte[] imageByteArray = null;
fis = new FileInputStream(file);
imageByteArray= IOUtils.toByteArray(fis);
return imageByteArray;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxshop/model/ShopRtnInfo.java | src/main/java/org/jeewx/api/wxshop/model/ShopRtnInfo.java | package org.jeewx.api.wxshop.model;
public class ShopRtnInfo {
// 错误码
private String errcode;
// 错误信息
private String errmsg;
public String getErrcode() {
return errcode;
}
public void setErrcode(String errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxshop/model/ShopInfo.java | src/main/java/org/jeewx/api/wxshop/model/ShopInfo.java | package org.jeewx.api.wxshop.model;
public class ShopInfo {
// 错误码
private String errcode;
// 错误信息
private String errmsg;
// 门店信息
private Business business ;
public Business getBusiness() {
return business;
}
public void setBusiness(Business business) {
this.business = business;
}
public String getErrcode() {
return errcode;
}
public void setErrcode(String errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxshop/model/Business.java | src/main/java/org/jeewx/api/wxshop/model/Business.java | package org.jeewx.api.wxshop.model;
import java.util.List;
public class Business {
// 基本属性
private BaseInfo base_info;
public BaseInfo getBase_info() {
return base_info;
}
public void setBase_info(BaseInfo base_info) {
this.base_info = base_info;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxshop/model/PoiId.java | src/main/java/org/jeewx/api/wxshop/model/PoiId.java | package org.jeewx.api.wxshop.model;
public class PoiId {
//id
private String poi_id;
public String getPoi_id() {
return poi_id;
}
public void setPoi_id(String poi_id) {
this.poi_id = poi_id;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxshop/model/BusinessReq.java | src/main/java/org/jeewx/api/wxshop/model/BusinessReq.java | package org.jeewx.api.wxshop.model;
public class BusinessReq {
// 开始位置
private String begin;
// 返回数据条数
private String limit;
public String getBegin() {
return begin;
}
public void setBegin(String begin) {
this.begin = begin;
}
public String getLimit() {
return limit;
}
public void setLimit(String limit) {
this.limit = limit;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxshop/model/Photo.java | src/main/java/org/jeewx/api/wxshop/model/Photo.java | package org.jeewx.api.wxshop.model;
public class Photo {
//照片路径
private String photo_url;
public String getPhoto_url() {
return photo_url;
}
public void setPhoto_url(String photo_url) {
this.photo_url = photo_url;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxshop/model/BaseInfo.java | src/main/java/org/jeewx/api/wxshop/model/BaseInfo.java | package org.jeewx.api.wxshop.model;
import java.util.List;
public class BaseInfo {
// 门店名称
private String business_name;
// 分店名称
private String branch_name;
//门店所在的省份
private String province;
// 门店所在的城市
private String city;
// 门店所在地区
private String district;
// 门店所在的详细街道地址
private String address;
// 门店的电话
private String telephone;
// 门店的类型
private String categories;
// 坐标类型
private String offset_type;
// 门店所在地理位置的经度
private String longitude;
// 门店所在地理位置的纬度
private String latitude;
// 特色服务
private String special;
// 营业时间
private String open_time;
// 人均价格
private String avg_price;
// 商户自己的id
private String sid;
// 商户简介
private String introduction;
//推荐品
private String recommend;
//图片列表
private List<Photo> photo_list;
// 审核状态
private String available_state;
// 修改状态
private String update_status;
// 商户的id
private String poi_id;
public String getPoi_id() {
return poi_id;
}
public void setPoi_id(String poi_id) {
this.poi_id = poi_id;
}
public String getAvailable_state() {
return available_state;
}
public void setAvailable_state(String available_state) {
this.available_state = available_state;
}
public String getUpdate_status() {
return update_status;
}
public void setUpdate_status(String update_status) {
this.update_status = update_status;
}
public List<Photo> getPhoto_list() {
return photo_list;
}
public void setPhoto_list(List<Photo> photo_list) {
this.photo_list = photo_list;
}
public String getBusiness_name() {
return business_name;
}
public void setBusiness_name(String business_name) {
this.business_name = business_name;
}
public String getBranch_name() {
return branch_name;
}
public void setBranch_name(String branch_name) {
this.branch_name = branch_name;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getCategories() {
return categories;
}
public void setCategories(String categories) {
this.categories = categories;
}
public String getOffset_type() {
return offset_type;
}
public void setOffset_type(String offset_type) {
this.offset_type = offset_type;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getSpecial() {
return special;
}
public void setSpecial(String special) {
this.special = special;
}
public String getOpen_time() {
return open_time;
}
public void setOpen_time(String open_time) {
this.open_time = open_time;
}
public String getAvg_price() {
return avg_price;
}
public void setAvg_price(String avg_price) {
this.avg_price = avg_price;
}
public String getSid() {
return sid;
}
public void setSid(String sid) {
this.sid = sid;
}
public String getIntroduction() {
return introduction;
}
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
public String getRecommend() {
return recommend;
}
public void setRecommend(String recommend) {
this.recommend = recommend;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/AuthorizerSetOptionRet.java | src/main/java/org/jeewx/api/third/AuthorizerSetOptionRet.java | package org.jeewx.api.third;
/**
* 设置选项返回结果
* 成功返回 errcode":0,"errmsg":"ok"
*/
public class AuthorizerSetOptionRet {
private Integer errcode;// 错误码
private String errmsg;// 错误信息
public Integer getErrcode() {
return errcode;
}
public void setErrcode(Integer errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/AuthorizerOptionRet.java | src/main/java/org/jeewx/api/third/AuthorizerOptionRet.java | package org.jeewx.api.third;
/**
* 选项设置信息返回实体
*/
public class AuthorizerOptionRet {
//授权公众号appid
private String authorizer_appid;
//选项名
private String option_name;
//选项值
private String option_value;
public String getAuthorizer_appid() {
return authorizer_appid;
}
public void setAuthorizer_appid(String authorizer_appid) {
this.authorizer_appid = authorizer_appid;
}
public String getOption_name() {
return option_name;
}
public void setOption_name(String option_name) {
this.option_name = option_name;
}
public String getOption_value() {
return option_value;
}
public void setOption_value(String option_value) {
this.option_value = option_value;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/AuthorizerOption.java | src/main/java/org/jeewx/api/third/AuthorizerOption.java | package org.jeewx.api.third;
/**
* 获取选项设置信息参数实体
*/
public class AuthorizerOption {
//第三方平台appid
private String component_appid;
//授权公众号appid
private String authorizer_appid;
//选项名称
private String option_name;
public String getComponent_appid() {
return component_appid;
}
public void setComponent_appid(String component_appid) {
this.component_appid = component_appid;
}
public String getAuthorizer_appid() {
return authorizer_appid;
}
public void setAuthorizer_appid(String authorizer_appid) {
this.authorizer_appid = authorizer_appid;
}
public String getOption_name() {
return option_name;
}
public void setOption_name(String option_name) {
this.option_name = option_name;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/AuthorizerSetOption.java | src/main/java/org/jeewx/api/third/AuthorizerSetOption.java | package org.jeewx.api.third;
/**
* 设置选项信息参数实体
*/
public class AuthorizerSetOption {
//第三方平台appid
private String component_appid;
//授权公众号appid
private String authorizer_appid;
//选项名称
private String option_name;
//设置的选项值
private String option_value;
public String getComponent_appid() {
return component_appid;
}
public void setComponent_appid(String component_appid) {
this.component_appid = component_appid;
}
public String getAuthorizer_appid() {
return authorizer_appid;
}
public void setAuthorizer_appid(String authorizer_appid) {
this.authorizer_appid = authorizer_appid;
}
public String getOption_name() {
return option_name;
}
public void setOption_name(String option_name) {
this.option_name = option_name;
}
public String getOption_value() {
return option_value;
}
public void setOption_value(String option_value) {
this.option_value = option_value;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/JwThirdAPI.java | src/main/java/org/jeewx/api/third/JwThirdAPI.java | package org.jeewx.api.third;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.jeewx.api.core.common.WxstoreUtils;
import org.jeewx.api.core.exception.WexinReqException;
import org.jeewx.api.third.model.*;
import org.jeewx.api.wxstore.order.model.OrderInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
/**
* 微信--token信息
*
* @author lizr
*
*/
public class JwThirdAPI {
private static Logger logger = LoggerFactory.getLogger(JwThirdAPI.class);
//获取预授权码
private static String api_create_preauthcode_url = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=COMPONENT_ACCESS_TOKEN";
private static String api_component_token_url = "https://api.weixin.qq.com/cgi-bin/component/api_component_token";
private static String get_access_token_bycode_url = "https://api.weixin.qq.com/sns/oauth2/component/access_token?appid=APPID&code=CODE&grant_type=authorization_code&component_appid=COMPONENT_APPID&component_access_token=COMPONENT_ACCESS_TOKEN";
private static String api_query_auth_url = "https://api.weixin.qq.com/cgi-bin/component/api_query_auth?component_access_token=xxxx";
//客服接口地址
public static String send_message_url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN";
//4、获取(刷新)授权公众号的令牌
private static String api_authorizer_token_url = "https://api.weixin.qq.com/cgi-bin/component/api_authorizer_token?component_access_token=COMPONENT_ACCESS_TOKEN";
//5、获取授权方的账户信息
private static String api_get_authorizer_info_url = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_info?component_access_token=COMPONENT_ACCESS_TOKEN";
//6、获取授权方的选项设置信息
private static String api_get_authorizer_option_url = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_option?component_access_token=COMPONENT_ACCESS_TOKEN";
//7、设置授权方的选项信息
private static String api_set_authorizer_option_url = "https://api.weixin.qq.com/cgi-bin/component/api_set_authorizer_option?component_access_token=COMPONENT_ACCESS_TOKEN";
/**
* 1、获取第三方平台access_token
* @param appid
* @param appscret
* @return kY9Y9rfdcr8AEtYZ9gPaRUjIAuJBvXO5ZOnbv2PYFxox__uSUQcqOnaGYN1xc4N1rI7NDCaPm_0ysFYjRVnPwCJHE7v7uF_l1hI6qi6QBsA
* @throws WexinReqException
*/
public static String getAccessToken(ApiComponentToken apiComponentToken) throws WexinReqException{
String component_access_token = "";
String requestUrl = api_component_token_url;
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(apiComponentToken));
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
if (result.containsKey("errcode")) {
logger.error("获取第三方平台access_token!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
throw new WexinReqException("获取第三方平台access_token!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
} else {
component_access_token = result.getString("component_access_token");
}
return component_access_token;
}
/**
* 2、获取预授权码
* @param appid
* @param appscret
* @return kY9Y9rfdcr8AEtYZ9gPaRUjIAuJBvXO5ZOnbv2PYFxox__uSUQcqOnaGYN1xc4N1rI7NDCaPm_0ysFYjRVnPwCJHE7v7uF_l1hI6qi6QBsA
* @throws WexinReqException
*/
public static String getPreAuthCode(String component_appid, String component_access_token) throws WexinReqException{
String pre_auth_code = "";
String requestUrl = api_create_preauthcode_url.replace("COMPONENT_ACCESS_TOKEN", component_access_token);
GetPreAuthCodeParam getPreAuthCodeParam = new GetPreAuthCodeParam();
getPreAuthCodeParam.setComponent_appid(component_appid);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(getPreAuthCodeParam));
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
if (result.containsKey("errcode")) {
logger.error("获取权限令牌信息!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
throw new WexinReqException("获取权限令牌信息!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
} else {
pre_auth_code = result.getString("pre_auth_code");
}
return pre_auth_code;
}
/**
* 3、使用授权码换取公众号的授权信息
* @param appid
* @param appscret
* @return kY9Y9rfdcr8AEtYZ9gPaRUjIAuJBvXO5ZOnbv2PYFxox__uSUQcqOnaGYN1xc4N1rI7NDCaPm_0ysFYjRVnPwCJHE7v7uF_l1hI6qi6QBsA
* @throws WexinReqException
*/
public static JSONObject getApiQueryAuthInfo(String component_appid,String authorization_code,String component_access_token) throws WexinReqException{
String requestUrl = api_query_auth_url.replace("xxxx", component_access_token);
Map<String,String> mp = new HashMap<String,String>();
mp.put("component_appid", component_appid);
mp.put("authorization_code", authorization_code);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(mp));
System.out.println("-------------------3、使用授权码换取公众号的授权信息---requestUrl------------------------"+requestUrl);
JSONObject result = WxstoreUtils.httpRequest(requestUrl,"POST", obj.toString());
if (result.containsKey("errcode")) {
logger.error("获取第三方平台access_token!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
throw new WexinReqException("获取第三方平台access_token!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
}
return result;
}
/**
* 4、获取(刷新)授权公众号的令牌
* @param apiAuthorizerToken
* @param component_access_token
*/
public static ApiAuthorizerTokenRet apiAuthorizerToken(ApiAuthorizerToken apiAuthorizerToken,String component_access_token) throws WexinReqException{
String requestUrl = api_authorizer_token_url.replace("COMPONENT_ACCESS_TOKEN", component_access_token);
JSONObject param = JSONObject.parseObject(JSON.toJSONString(apiAuthorizerToken));
JSONObject result = WxstoreUtils.httpRequest(requestUrl,"POST", param.toString());
ApiAuthorizerTokenRet apiAuthorizerTokenRet = (ApiAuthorizerTokenRet)JSONObject.toJavaObject(result, ApiAuthorizerTokenRet.class);
return apiAuthorizerTokenRet;
}
/**
* 5、获取授权方的账户信息
*/
public static ApiGetAuthorizerRet apiGetAuthorizerInfo(ApiGetAuthorizer apiGetAuthorizer,String component_access_token) throws WexinReqException{
String requestUrl = api_get_authorizer_info_url.replace("COMPONENT_ACCESS_TOKEN", component_access_token);
JSONObject param = JSONObject.parseObject(JSON.toJSONString(apiGetAuthorizer));
JSONObject result = WxstoreUtils.httpRequest(requestUrl,"POST", param.toString());
ApiGetAuthorizerRet apiGetAuthorizerRet = (ApiGetAuthorizerRet)JSONObject.toJavaObject(result, ApiGetAuthorizerRet.class);
return apiGetAuthorizerRet;
}
/**
* 6、获取授权方的选项设置信息
*/
public static AuthorizerOptionRet apiGetAuthorizerOption(AuthorizerOption authorizerOption,String component_access_token) throws WexinReqException{
String requestUrl = api_get_authorizer_option_url.replace("COMPONENT_ACCESS_TOKEN", component_access_token);
JSONObject param = JSONObject.parseObject(JSON.toJSONString(authorizerOption));
JSONObject result = WxstoreUtils.httpRequest(requestUrl,"POST", param.toString());
AuthorizerOptionRet authorizerOptionRet = (AuthorizerOptionRet)JSONObject.toJavaObject(result, AuthorizerOptionRet.class);
return authorizerOptionRet;
}
/**
* 7、设置授权方的选项信息
*/
public static AuthorizerSetOptionRet apiSetAuthorizerOption(AuthorizerSetOption authorizerSetOption,String component_access_token) throws WexinReqException{
String requestUrl = api_set_authorizer_option_url.replace("COMPONENT_ACCESS_TOKEN", component_access_token);
JSONObject param = JSONObject.parseObject(JSON.toJSONString(authorizerSetOption));
JSONObject result = WxstoreUtils.httpRequest(requestUrl,"POST", param.toString());
AuthorizerSetOptionRet authorizerSetOptionRet = (AuthorizerSetOptionRet)JSONObject.toJavaObject(result, AuthorizerSetOptionRet.class);
return authorizerSetOptionRet;
}
/**
* 微信主动推送给第三方服务器
* 8、推送component_verify_ticket协议
* 9、推送取消授权通知
*/
/**
* 获取第三方平台access_token
* @param appid
* @param appscret
* @return kY9Y9rfdcr8AEtYZ9gPaRUjIAuJBvXO5ZOnbv2PYFxox__uSUQcqOnaGYN1xc4N1rI7NDCaPm_0ysFYjRVnPwCJHE7v7uF_l1hI6qi6QBsA
* @throws WexinReqException
*/
public static ReOpenAccessToken getAccessTokenByCode(String appid,String code,String grant_type,String component_appid,String component_access_token) throws WexinReqException{
String requestUrl = get_access_token_bycode_url.replace("COMPONENT_APPID", component_appid).replace("COMPONENT_ACCESS_TOKEN", component_access_token).replace("authorization_code", grant_type).replace("CODE", code).replace("APPID", appid);
JSONObject result = WxstoreUtils.httpRequest(requestUrl,"GET", null);
ReOpenAccessToken reOpenAccessToken = JSONObject.toJavaObject(result, ReOpenAccessToken.class);
if (result.containsKey("errcode")) {
logger.error("获取第三方平台access_token!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
throw new WexinReqException("获取第三方平台access_token!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
}
return reOpenAccessToken;
}
/**
* 发送客服消息
* @param obj
* @param ACCESS_TOKEN
* @return
*/
public static String sendMessage(Map<String,Object> obj,String ACCESS_TOKEN){
JSONObject json = JSONObject.parseObject(JSON.toJSONString(obj));
System.out.println("--------发送客服消息---------json-----"+json.toString());
// 调用接口获取access_token
String url = send_message_url.replace("ACCESS_TOKEN",ACCESS_TOKEN);
JSONObject jsonObject = WxstoreUtils.httpRequest(url, "POST", json.toString());
return jsonObject.toString();
}
public static void main(String[] args){
try {
//String s = JwThirdAPI.getPreAuthCode("wx5412820bba6f6bd6","unisk");
ApiComponentToken apiComponentToken = new ApiComponentToken();
//apiComponentToken.setComponent_appid("wx5412820bba6f6bd6");
apiComponentToken.setComponent_appid("wx056ae5bc88c95c55");
apiComponentToken.setComponent_appsecret("0c79e1fa963cd80cc0be99b20a18faeb");
apiComponentToken.setComponent_verify_ticket(null);
String s = JwThirdAPI.getAccessToken(apiComponentToken);
System.out.println(s);
} catch (WexinReqException e) {
e.printStackTrace();
}
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/model/ApiComponentToken.java | src/main/java/org/jeewx/api/third/model/ApiComponentToken.java | package org.jeewx.api.third.model;
public class ApiComponentToken {
private String component_appid;
private String component_appsecret;
private String component_verify_ticket;
public String getComponent_appid() {
return component_appid;
}
public void setComponent_appid(String component_appid) {
this.component_appid = component_appid;
}
public String getComponent_appsecret() {
return component_appsecret;
}
public void setComponent_appsecret(String component_appsecret) {
this.component_appsecret = component_appsecret;
}
public String getComponent_verify_ticket() {
return component_verify_ticket;
}
public void setComponent_verify_ticket(String component_verify_ticket) {
this.component_verify_ticket = component_verify_ticket;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/model/ApiAuthorizerToken.java | src/main/java/org/jeewx/api/third/model/ApiAuthorizerToken.java | package org.jeewx.api.third.model;
/**
* 获取(刷新)授权公众号的令牌 参数
*/
public class ApiAuthorizerToken {
//第三方平台appid
private String component_appid;
//授权方appid
private String authorizer_appid;
//授权方的刷新令牌
private String authorizer_refresh_token;
public String getComponent_appid() {
return component_appid;
}
public void setComponent_appid(String component_appid) {
this.component_appid = component_appid;
}
public String getAuthorizer_appid() {
return authorizer_appid;
}
public void setAuthorizer_appid(String authorizer_appid) {
this.authorizer_appid = authorizer_appid;
}
public String getAuthorizer_refresh_token() {
return authorizer_refresh_token;
}
public void setAuthorizer_refresh_token(String authorizer_refresh_token) {
this.authorizer_refresh_token = authorizer_refresh_token;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/model/ApiGetAuthorizerRetAuthorizerSType.java | src/main/java/org/jeewx/api/third/model/ApiGetAuthorizerRetAuthorizerSType.java | package org.jeewx.api.third.model;
/**
* 授权方公众号类型,0代表订阅号,1代表由历史老帐号升级后的订阅号,2代表服务号
*/
public class ApiGetAuthorizerRetAuthorizerSType {
private Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/model/ApiAuthorizerTokenRet.java | src/main/java/org/jeewx/api/third/model/ApiAuthorizerTokenRet.java | package org.jeewx.api.third.model;
/**
* (刷新)授权公众号的令牌返回数据
*/
public class ApiAuthorizerTokenRet {
//授权方令牌
private String authorizer_access_token;
//有效期,为2小时 7200
private Integer expires_in;
//刷新令牌
private String authorizer_refresh_token;
public String getAuthorizer_access_token() {
return authorizer_access_token;
}
public void setAuthorizer_access_token(String authorizer_access_token) {
this.authorizer_access_token = authorizer_access_token;
}
public Integer getExpires_in() {
return expires_in;
}
public void setExpires_in(Integer expires_in) {
this.expires_in = expires_in;
}
public String getAuthorizer_refresh_token() {
return authorizer_refresh_token;
}
public void setAuthorizer_refresh_token(String authorizer_refresh_token) {
this.authorizer_refresh_token = authorizer_refresh_token;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/model/ApiGetAuthorizerRetAuthortionFunc.java | src/main/java/org/jeewx/api/third/model/ApiGetAuthorizerRetAuthortionFunc.java | package org.jeewx.api.third.model;
public class ApiGetAuthorizerRetAuthortionFunc {
private ApiGetAuthorizerRetAuthortionFuncCate funcscope_category;
public ApiGetAuthorizerRetAuthortionFuncCate getFuncscope_category() {
return funcscope_category;
}
public void setFuncscope_category(
ApiGetAuthorizerRetAuthortionFuncCate funcscope_category) {
this.funcscope_category = funcscope_category;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/model/ApiGetAuthorizerRetAuthortionFuncCate.java | src/main/java/org/jeewx/api/third/model/ApiGetAuthorizerRetAuthortionFuncCate.java | package org.jeewx.api.third.model;
public class ApiGetAuthorizerRetAuthortionFuncCate {
private Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/model/ApiGetAuthorizerRetAuthortion.java | src/main/java/org/jeewx/api/third/model/ApiGetAuthorizerRetAuthortion.java | package org.jeewx.api.third.model;
import java.util.List;
/**
* 授权第三方相关信息
*/
public class ApiGetAuthorizerRetAuthortion {
//授权方appid
private String appid;
//公众号授权给开发者的权限集列表(请注意,当出现用户已经将消息与菜单权限集授权给了某个第三方,再授权给另一个第三方时,由于该权限集是互斥的,后一个第三方的授权将去除此权限集,开发者可以在返回的func_info信息中验证这一点,避免信息遗漏),1到13分别代表
private List<ApiGetAuthorizerRetAuthortionFunc> func_info;
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid;
}
public List<ApiGetAuthorizerRetAuthortionFunc> getFunc_info() {
return func_info;
}
public void setFunc_info(List<ApiGetAuthorizerRetAuthortionFunc> func_info) {
this.func_info = func_info;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/model/ReturnApiQueryAuthInfo.java | src/main/java/org/jeewx/api/third/model/ReturnApiQueryAuthInfo.java | package org.jeewx.api.third.model;
import java.util.List;
public class ReturnApiQueryAuthInfo {
private String authorization_info;
private String authorizer_appid;
private String authorizer_access_token;
private String expires_in;
private String authorizer_refresh_token;
private FuncInfo func_info;
public String getAuthorization_info() {
return authorization_info;
}
public void setAuthorization_info(String authorization_info) {
this.authorization_info = authorization_info;
}
public String getAuthorizer_appid() {
return authorizer_appid;
}
public void setAuthorizer_appid(String authorizer_appid) {
this.authorizer_appid = authorizer_appid;
}
public String getAuthorizer_access_token() {
return authorizer_access_token;
}
public void setAuthorizer_access_token(String authorizer_access_token) {
this.authorizer_access_token = authorizer_access_token;
}
public String getExpires_in() {
return expires_in;
}
public void setExpires_in(String expires_in) {
this.expires_in = expires_in;
}
public String getAuthorizer_refresh_token() {
return authorizer_refresh_token;
}
public void setAuthorizer_refresh_token(String authorizer_refresh_token) {
this.authorizer_refresh_token = authorizer_refresh_token;
}
public FuncInfo getFunc_info() {
return func_info;
}
public void setFunc_info(FuncInfo func_info) {
this.func_info = func_info;
}
}
class FuncInfo{
private List<funcscope_category> ls;
public List<funcscope_category> getLs() {
return ls;
}
public void setLs(List<funcscope_category> ls) {
this.ls = ls;
}
}
class funcscope_category{
private String id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
} | java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/model/ApiGetAuthorizerRet.java | src/main/java/org/jeewx/api/third/model/ApiGetAuthorizerRet.java | package org.jeewx.api.third.model;
/**
* 授权方的账户信息 实体
* @author machaolin
*/
public class ApiGetAuthorizerRet {
//授权方的账户信息
private ApiGetAuthorizerRetAuthorizer authorizer_info;
//二维码地址
private String qrcode_url;
//授权第三方相关信息
private ApiGetAuthorizerRetAuthortion authorization_info;
public ApiGetAuthorizerRetAuthorizer getAuthorizer_info() {
return authorizer_info;
}
public void setAuthorizer_info(ApiGetAuthorizerRetAuthorizer authorizer_info) {
this.authorizer_info = authorizer_info;
}
public String getQrcode_url() {
return qrcode_url;
}
public void setQrcode_url(String qrcode_url) {
this.qrcode_url = qrcode_url;
}
public ApiGetAuthorizerRetAuthortion getAuthorization_info() {
return authorization_info;
}
public void setAuthorization_info(
ApiGetAuthorizerRetAuthortion authorization_info) {
this.authorization_info = authorization_info;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/model/ApiGetAuthorizerRetAuthorizerVType.java | src/main/java/org/jeewx/api/third/model/ApiGetAuthorizerRetAuthorizerVType.java | package org.jeewx.api.third.model;
/**
* 授权方认证类型,-1代表未认证,0代表微信认证,1代表新浪微博认证,2代表腾讯微博认证,3代表已资质认证通过但还未通过名称认证,4代表已资质认证通过、还未通过名称认证,但通过了新浪微博认证,5代表已资质认证通过、还未通过名称认证,但通过了腾讯微博认证
*/
public class ApiGetAuthorizerRetAuthorizerVType {
private Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/model/ApiGetAuthorizerRetAuthorizer.java | src/main/java/org/jeewx/api/third/model/ApiGetAuthorizerRetAuthorizer.java | package org.jeewx.api.third.model;
/**
* 授权方的账户信息实体
*/
public class ApiGetAuthorizerRetAuthorizer {
//昵称
private String nick_name ;
//头像
private String head_img;
//授权方公众号类型,0代表订阅号,1代表由历史老帐号升级后的订阅号,2代表服务号
private ApiGetAuthorizerRetAuthorizerSType service_type_info;
//授权方认证类型,-1代表未认证,0代表微信认证,1代表新浪微博认证,2代表腾讯微博认证,3代表已资质认证通过但还未通过名称认证,4代表已资质认证通过、还未通过名称认证,但通过了新浪微博认证,5代表已资质认证通过、还未通过名称认证,但通过了腾讯微博认证
private ApiGetAuthorizerRetAuthorizerVType verify_type_info;
//授权方公众号的原始ID
private String user_name;
//授权方公众号所设置的微信号,可能为空
private String alias;
public String getNick_name() {
return nick_name;
}
public void setNick_name(String nick_name) {
this.nick_name = nick_name;
}
public String getHead_img() {
return head_img;
}
public void setHead_img(String head_img) {
this.head_img = head_img;
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public ApiGetAuthorizerRetAuthorizerSType getService_type_info() {
return service_type_info;
}
public void setService_type_info(
ApiGetAuthorizerRetAuthorizerSType service_type_info) {
this.service_type_info = service_type_info;
}
public ApiGetAuthorizerRetAuthorizerVType getVerify_type_info() {
return verify_type_info;
}
public void setVerify_type_info(
ApiGetAuthorizerRetAuthorizerVType verify_type_info) {
this.verify_type_info = verify_type_info;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/model/ApiGetAuthorizer.java | src/main/java/org/jeewx/api/third/model/ApiGetAuthorizer.java | package org.jeewx.api.third.model;
/**
* 获取授权方的账户信息 参数实体
*
*/
public class ApiGetAuthorizer {
//第三方平台appid
private String component_appid;
//授权方appid
private String authorizer_appid;
public String getComponent_appid() {
return component_appid;
}
public void setComponent_appid(String component_appid) {
this.component_appid = component_appid;
}
public String getAuthorizer_appid() {
return authorizer_appid;
}
public void setAuthorizer_appid(String authorizer_appid) {
this.authorizer_appid = authorizer_appid;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/model/GetPreAuthCodeParam.java | src/main/java/org/jeewx/api/third/model/GetPreAuthCodeParam.java | package org.jeewx.api.third.model;
import org.jeewx.api.core.req.model.WeixinReqParam;
/**
* 获取预授权码
* @author zhangdaihao
*
*/
public class GetPreAuthCodeParam extends WeixinReqParam{
private String component_appid;
public String getComponent_appid() {
return component_appid;
}
public void setComponent_appid(String component_appid) {
this.component_appid = component_appid;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/third/model/ReOpenAccessToken.java | src/main/java/org/jeewx/api/third/model/ReOpenAccessToken.java | package org.jeewx.api.third.model;
public class ReOpenAccessToken {
/**
* access_token 接口调用凭证
* expires_in access_token接口调用凭证超时时间,单位(秒)
* refresh_token 用户刷新access_token
* openid 授权用户唯一标识
* scope 用户授权的作用域,使用逗号(,)分隔
*/
private String access_token;
private String expires_in;
private String refresh_token;
private String openid;
private String scope;
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public String getExpires_in() {
return expires_in;
}
public void setExpires_in(String expires_in) {
this.expires_in = expires_in;
}
public String getRefresh_token() {
return refresh_token;
}
public void setRefresh_token(String refresh_token) {
this.refresh_token = refresh_token;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxuser/Test.java | src/main/java/org/jeewx/api/wxuser/Test.java | package org.jeewx.api.wxuser;
import org.jeewx.api.core.exception.WexinReqException;
import org.jeewx.api.wxbase.wxtoken.JwTokenAPI;
import org.jeewx.api.wxuser.user.JwUserAPI;
public class Test {
public static void main(String[] args) {
try {
String s = JwTokenAPI.getAccessToken("wxa842e07813a1380a","80a457401915ccbc10da0971fa6d404a");
System.out.println(JwUserAPI.getWxuser(s, "oGCDRjvr9L1NoqxbyXLReCVYVyV0").getCity());
} catch (WexinReqException e) {
e.printStackTrace();
}
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxuser/user/JwUserAPI.java | src/main/java/org/jeewx/api/wxuser/user/JwUserAPI.java | package org.jeewx.api.wxuser.user;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.jeewx.api.core.common.WxstoreUtils;
import org.jeewx.api.core.exception.WexinReqException;
import org.jeewx.api.core.req.WeiXinReqService;
import org.jeewx.api.core.req.model.user.UserInfoListGet;
import org.jeewx.api.wxuser.user.model.Wxuser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
/**
* 微信--用户
*
* @author lizr
*
*/
public class JwUserAPI {
private static Logger logger = LoggerFactory.getLogger(JwUserAPI.class);
//获取用户基本信息(包括UnionID机制)
private static String GET_USER_URL = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";
/**
* 根据user_openid 获取关注用户的基本信息
*
* @param shelf_id
* @return
* @throws WexinReqException
*/
public static Wxuser getWxuser(String accesstoken,String user_openid) throws WexinReqException {
if (accesstoken != null) {
String requestUrl = GET_USER_URL.replace("ACCESS_TOKEN", accesstoken).replace("OPENID", user_openid);
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", null);
logger.info(result.toString());
// 正常返回
Wxuser wxuser = null;
Object error = result.get("errcode");
wxuser = (Wxuser) JSONObject.toJavaObject(result, Wxuser.class);
return wxuser;
}
return null;
}
/**
* 获取所有关注用户信息信息
*
* @return
* @throws WexinReqException
*/
public static List<Wxuser> getAllWxuser(String accesstoken,String next_openid) throws WexinReqException {
if (accesstoken != null) {
UserInfoListGet userInfoListGet = new UserInfoListGet();
userInfoListGet.setAccess_token(accesstoken);
userInfoListGet.setNext_openid(next_openid);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(userInfoListGet);
Object error = result.get("errcode");
List<Wxuser> lstUser = null;
Wxuser mxuser = null;
int total = result.getInteger("total");
int count = result.getInteger("count");
String strNextOpenId = result.getString("next_openid");
JSONObject data = result.getJSONObject("data");
lstUser = new ArrayList<Wxuser>(total);
if (count > 0) {
JSONArray lstOpenid = data.getJSONArray("openid");
int iSize = lstOpenid.size();
for (int i = 0; i < iSize; i++) {
String openId = lstOpenid.getString(i);
mxuser = getWxuser(accesstoken, openId);
lstUser.add(mxuser);
}
if (strNextOpenId != null) {
lstUser.addAll(getAllWxuser(accesstoken, strNextOpenId));
}
}
return lstUser;
}
return null;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxuser/user/model/Wxuser.java | src/main/java/org/jeewx/api/wxuser/user/model/Wxuser.java | package org.jeewx.api.wxuser.user.model;
/**
* @Title: Entity
* @Description: 微信服务号关注用户union信息
* @author onlineGenerator
* @date 2015-01-25 19:28:24
* @version V1.0
*
*/
public class Wxuser {
/**用户是否订阅*/
private java.lang.Integer subscribe;
/**用户的标识*/
private java.lang.String openid;
/**用户的昵称*/
private java.lang.String nickname;
/**性别*/
private java.lang.String sex;
/**用户所在城市*/
private java.lang.String city;
/**用户所在国家*/
private java.lang.String country;
/**用户所在省份*/
private java.lang.String province;
/**用户的语言zh_CN*/
private java.lang.String language;
/**用户头像*/
private java.lang.String headimgurl;
/**用户关注时间*/
private java.lang.String subscribe_time;
/**用户粉丝唯一ID*/
private java.lang.String unionid;
/**用户被打上的标签ID列表*/
private String[] tagid_list;
/**粉丝备注*/
private String remark;
/**用户所在的分组ID(兼容旧的用户分组接口)*/
private Integer groupid;
public Integer getGroupid() {
return groupid;
}
public void setGroupid(Integer groupid) {
this.groupid = groupid;
}
public String[] getTagid_list() {
return tagid_list;
}
public void setTagid_list(String[] tagid_list) {
this.tagid_list = tagid_list;
}
public java.lang.Integer getSubscribe() {
return subscribe;
}
public void setSubscribe(java.lang.Integer subscribe) {
this.subscribe = subscribe;
}
public java.lang.String getOpenid() {
return openid;
}
public void setOpenid(java.lang.String openid) {
this.openid = openid;
}
public java.lang.String getNickname() {
return nickname;
}
public void setNickname(java.lang.String nickname) {
this.nickname = nickname;
}
public java.lang.String getSex() {
return sex;
}
public void setSex(java.lang.String sex) {
this.sex = sex;
}
public java.lang.String getCity() {
return city;
}
public void setCity(java.lang.String city) {
this.city = city;
}
public java.lang.String getCountry() {
return country;
}
public void setCountry(java.lang.String country) {
this.country = country;
}
public java.lang.String getProvince() {
return province;
}
public void setProvince(java.lang.String province) {
this.province = province;
}
public java.lang.String getLanguage() {
return language;
}
public void setLanguage(java.lang.String language) {
this.language = language;
}
public java.lang.String getHeadimgurl() {
return headimgurl;
}
public void setHeadimgurl(java.lang.String headimgurl) {
this.headimgurl = headimgurl;
}
public java.lang.String getSubscribe_time() {
return subscribe_time;
}
public void setSubscribe_time(java.lang.String subscribe_time) {
this.subscribe_time = subscribe_time;
}
public java.lang.String getUnionid() {
return unionid;
}
public void setUnionid(java.lang.String unionid) {
this.unionid = unionid;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxuser/group/JwGroupAPI.java | src/main/java/org/jeewx/api/wxuser/group/JwGroupAPI.java | package org.jeewx.api.wxuser.group;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.jeewx.api.core.exception.WexinReqException;
import org.jeewx.api.core.req.WeiXinReqService;
import org.jeewx.api.core.req.model.user.*;
import org.jeewx.api.core.util.WeiXinConstant;
import org.jeewx.api.wxbase.wxtoken.JwTokenAPI;
import java.util.ArrayList;
import java.util.List;
/**
* 微信--用户
*
* @author lizr
*
*/
public class JwGroupAPI {
//测试使用
private static String TOKEN = "GHFs1OHxNiwi9cKT_oUr53enRhSStZ7QpAOjoheRWKvJFR9JtPzEkO5KnepHOT7CnDzWghTjpMyEKsWy4IGiHxv-VS9f2BN7tF6sge-H8lo";
public static String RETURN_INFO_NAME = "groups";
/**
* 创建分组信息
* @param accesstoken
* @param groupName
* @return
* @throws WexinReqException
*/
public static GroupCreate createGroup(String accesstoken ,String groupName ) throws WexinReqException{
GroupCreate c = new GroupCreate();
c.setAccess_token(accesstoken);
Group g = new Group();
g.setName(groupName);
c.setGroup(g);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(c);
Object error = result.get(WeiXinConstant.RETURN_ERROR_INFO_CODE);
GroupCreate groupCreate = null;
groupCreate = (GroupCreate) JSONObject.toJavaObject(result, GroupCreate.class);
return groupCreate;
}
/**
* 获取所有的分组信息
* @param accesstoken
* @return
* @throws WexinReqException
*/
public static List<Group> getAllGroup(String accesstoken) throws WexinReqException{
GroupGet c = new GroupGet();
c.setAccess_token(accesstoken);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(c);
Object error = result.get(WeiXinConstant.RETURN_ERROR_INFO_CODE);
List<Group> lstGroup = null;
JSONArray infoArray = result.getJSONArray(RETURN_INFO_NAME);
lstGroup = new ArrayList<Group>(infoArray.size());
for(int i=0;i<infoArray.size();i++){
Group group = (Group)JSONObject.toJavaObject(infoArray.getJSONObject(i), Group.class);
if(!"未分组".equals(group.getName())){
lstGroup.add(group);
}
}
return lstGroup;
}
/**
* 获取用户分组id
* @param accesstoken
* @param openid
* @return
* @throws WexinReqException
*/
public static String getUserGroup(String accesstoken,String openid) throws WexinReqException{
GroupGetId g = new GroupGetId();
g.setAccess_token(accesstoken);
g.setOpenid(openid);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(g);
Object error = result.get(WeiXinConstant.RETURN_ERROR_INFO_CODE);
String groupId = "";
groupId = result.getString("groupid");
return groupId;
}
/**
* 更新分组 正常返回ok
* @param accesstoken
* @param groupId
* @param groupNewName
* @throws WexinReqException
*/
public static String updateGroup(String accesstoken,String groupId,String groupNewName) throws WexinReqException{
GroupUpdate groupUpdate = new GroupUpdate();
groupUpdate.setAccess_token(accesstoken);
Group g = new Group();
g.setId(groupId);
g.setName(groupNewName);
groupUpdate.setGroup(g);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(groupUpdate);
return result.getString("errmsg");
}
/**
* 修改用户分组
* @param accesstoken
* @param openid
* @param to_groupid
* @return
* @throws WexinReqException
*/
public static String groupMemberMove(String accesstoken,String openid,String to_groupid) throws WexinReqException{
GroupMembersUpdate u = new GroupMembersUpdate();
u.setAccess_token(accesstoken);
u.setOpenid(openid);;
u.setTo_groupid(to_groupid);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(u);
return result.getString("errmsg");
}
/**
* 批量更新用户分组
* @param accesstoken
* @param openid_list
* @param to_groupid
* @return
* @throws WexinReqException
*/
public static String batchGroupMemberMove(String accesstoken,List<String> openid_list,String to_groupid) throws WexinReqException{
BatchGroupMembersUpdate u = new BatchGroupMembersUpdate();
u.setAccess_token(accesstoken);
u.setOpenid_list(openid_list);
u.setTo_groupid(to_groupid);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(u);
return result.getString("errmsg");
}
/**
* 删除用户分组
* @param accesstoken 访问凭证
* @param deletegGroupid 删除的分组ID
*/
public static String groupDelete(String accesstoken,String deletegGroupid) throws WexinReqException{
//步骤一、api调用参数准备.
GroupDelete group = new GroupDelete();
Group g = new Group();
g.setId(deletegGroupid);
group.setAccess_token(accesstoken);
group.setGroup(g);
//步骤二、发起调用
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(group);
//步骤三、对返回结果进行处理.
//author machaolin by 20150715 for 很奇怪微信服务器没有按接口说明返回{errcode:xxx,errmsg:xxx},而是返回了{}。
if("{}".equals(result.toString().trim())){
return "ok";
}else {
return result.getString("errmsg");
}
}
public static void main(String[] args){
try {
getAccessToken();
//testCreateGroup();
//testUpdateGroup();
//testGetAllGroup();
//testGetUserGroup();
//testGroupMemberMove();
//testBatchGroupMemberMove();
//testGroupDelete();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* 获取tocken
*/
private static void getAccessToken(){
try {
System.out.println(TOKEN=JwTokenAPI.getAccessToken("wxd2b52b8f4bd5af7f","1b982dba2c3f853c3396babcdfa6cb1e"));
} catch (WexinReqException e) {
e.printStackTrace();
}
}
/**
* 1.0 创建分组
*/
private static void testCreateGroup(){
GroupCreate group;
try {
group = JwGroupAPI.createGroup(TOKEN, "分组2017");
System.out.println("创建的分组ID:"+group.getGroup().getId());
} catch (WexinReqException e) {
e.printStackTrace();
}
}
/**
* 2.0 更新分组名称
*/
private static void testUpdateGroup(){
String errmsg;
try {
errmsg = JwGroupAPI.updateGroup(TOKEN,"106","分组20172");
System.out.println("更新分组信息:"+errmsg);
} catch (WexinReqException e) {
e.printStackTrace();
}
}
/**
* 3.0 获取所有分组信息
*/
private static void testGetAllGroup(){
List<Group> groupList;
try {
groupList = JwGroupAPI.getAllGroup(TOKEN);
for(Group g : groupList){
System.out.println(g.getName());
}
//System.out.println("分组列表信息:"+groupList);
} catch (WexinReqException e) {
e.printStackTrace();
}
}
/**
* 4.0 获取用户所在分组
*/
private static void testGetUserGroup(){
String openid = "oSmm-vhtoFwRo0kaqIxVnw8INSFg";
try {
//JwUserAPI.getAllWxuser(TOKEN, "");
String groupid = JwGroupAPI.getUserGroup(TOKEN,openid);
System.out.println("该粉丝所在分组为:"+groupid);
} catch (WexinReqException e) {
e.printStackTrace();
}
}
/**
* 5.0 更改用户所在分组
*/
private static void testGroupMemberMove(){
String openid = "oSmm-vjkfKrkIw94VKciV5JSG8io";
try {
String groupid = JwGroupAPI.groupMemberMove(TOKEN,openid,"2");
System.out.println("该粉丝所在分组为:"+groupid);
} catch (WexinReqException e) {
e.printStackTrace();
}
}
/**
* 6.0 批量更改用户所在分组
*/
private static void testBatchGroupMemberMove(){
List<String> openidList = new ArrayList<String>();
String openid = "oSmm-vjkfKrkIw94VKciV5JSG8io";
try {
openidList.add(openid);
String groupid = JwGroupAPI.batchGroupMemberMove(TOKEN,openidList,"101");
System.out.println("该粉丝所在分组为:"+groupid);
} catch (WexinReqException e) {
e.printStackTrace();
}
}
/**
* 7.0 删除分组
*/
private static void testGroupDelete(){
try {
String errmsg = JwGroupAPI.groupDelete(TOKEN,"129");
System.out.println("删除分组:"+errmsg);
} catch (WexinReqException e) {
e.printStackTrace();
}
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxuser/tag/JwTagAPI.java | src/main/java/org/jeewx/api/wxuser/tag/JwTagAPI.java | package org.jeewx.api.wxuser.tag;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.jeewx.api.core.common.WxstoreUtils;
import org.jeewx.api.core.exception.WexinReqException;
import org.jeewx.api.core.util.WeiXinConstant;
import org.jeewx.api.wxuser.tag.model.WxTag;
import org.jeewx.api.wxuser.tag.model.WxTagUser;
import org.jeewx.api.wxuser.tag.model.WxTagUserList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class JwTagAPI {
private static Logger logger = LoggerFactory.getLogger(JwTagAPI.class);
//创建标签
private static String create_tag = "https://api.weixin.qq.com/cgi-bin/tags/create?access_token=ACCESS_TOKEN";
//获取创建的标签
private static String get_tag = "https://api.weixin.qq.com/cgi-bin/tags/get?access_token=ACCESS_TOKEN";
//编辑标签
private static String update_tag = "https://api.weixin.qq.com/cgi-bin/tags/update?access_token=ACCESS_TOKEN";
//删除标签
private static String delete_tag = "https://api.weixin.qq.com/cgi-bin/tags/delete?access_token=ACCESS_TOKEN";
//获取标签下粉丝列表
private static String get_tag_user = "https://api.weixin.qq.com/cgi-bin/user/tag/get?access_token=ACCESS_TOKEN";
//批量为用户打标签
private static String batchtagging = "https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging?access_token=ACCESS_TOKEN";
//批量为用户取消标签
private static String batchuntagging = "https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging?access_token=ACCESS_TOKEN";
//获取用户身上的标签列表
private static String getidlist= "https://api.weixin.qq.com/cgi-bin/tags/getidlist?access_token=ACCESS_TOKEN";
/**
* 创建标签
* @param accessToken
* @param tagName
* @return
* @throws WexinReqException
*/
public static JSONObject createTag(String accessToken, String tagName) throws WexinReqException{
JSONObject result = null;
if (accessToken != null) {
String requestUrl = create_tag.replace("ACCESS_TOKEN", accessToken);
Map<String,Object> map = new HashMap<String,Object>();
map.put("name", tagName);
JSONObject obj = new JSONObject();
obj.put("tag", map);
logger.info("创建标签方法执行前json参数---obj: "+obj.toString());
result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
logger.info("创建标签方法执行后json参数 : "+result.toString());
}
return result;
}
/**
* 获取标签
*/
public static List<WxTag> getTags(String accessToken){
List<WxTag> list = null;
if(accessToken != null){
String requestUrl = get_tag.replace("ACCESS_TOKEN", accessToken);
//logger.info("创建标签方法执行前json参数 obj: "+obj.toString());
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "GET", null);
Object error = result.get(WeiXinConstant.RETURN_ERROR_INFO_CODE);
if(error == null){
String tags = result.getString("tags");
JSONArray jsonArray = JSONArray.parseArray(tags);
list = jsonArray.toJavaList(WxTag.class);
return list;
}
logger.info("获取标签方法执行后json参数 : "+result.toString());
}
return list;
}
/**
* 编辑标签
*/
public static JSONObject updateTag(String accessToken,int id,String name){
JSONObject result = null;
if(accessToken != null){
String requestUrl = update_tag.replace("ACCESS_TOKEN", accessToken);
Map<String,Object> data = new HashMap<String,Object>();
data.put("id", id);
data.put("name", name);
JSONObject obj = new JSONObject();
obj.put("tag", data);
logger.info("编辑标签方法执行前json参数---obj: "+obj.toString());
result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
logger.info("编辑标签方法执行后json参数 : "+result.toString());
}
return result;
}
/**
* 删除标签
*/
public static JSONObject delete(String accessToken,String id){
JSONObject result = null;
if(accessToken != null){
String requestUrl = delete_tag.replace("ACCESS_TOKEN", accessToken);
Map<String,Object> data = new HashMap<String,Object>();
data.put("id", id);
JSONObject obj = new JSONObject();
obj.put("tag", data);
logger.info("删除标签方法执行前json参数---obj: "+obj.toString());
result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
logger.info("删除标签方法执行后json参数 : "+result.toString());
}
return result;
}
/**
* 获取标签下粉丝列表
*/
public static WxTagUser getTagUser(String accessToken,int tagid,String next_openid){
WxTagUser tagUser = null;
WxTagUserList users = null;
try {
if(accessToken != null){
String requestUrl = get_tag_user.replace("ACCESS_TOKEN", accessToken);
Map<String,Object> data = new HashMap<String,Object>();
data.put("tagid", tagid);
data.put("next_openid", next_openid);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(data));
logger.info("获取标签下粉丝列表方法执行前json参数---obj: "+obj.toString());
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "GET", obj.toString());
Integer error = (Integer) result.get(WeiXinConstant.RETURN_ERROR_INFO_CODE);
if(error == null){
/*Integer count = (Integer) obj.get("count");
String nextOpenid = obj.getString("next_openid");
Object dataStr = obj.get("data");
JSONObject dataJson = JSONObject.fromObject(dataStr);
JSONArray jsonArray = dataJson.getJSONArray("openid");
List<String> list = JSONArray.toList(jsonArray, String.class);
users.setOpenid(list);
tagUser.setCount(count);
tagUser.setData(users);
tagUser.setNext_openid(nextOpenid);*/
tagUser = (WxTagUser) JSONObject.toJavaObject(result, WxTagUser.class);
}
logger.info("获取标签下粉丝列表方法执行后json参数 : "+result.toString());
}
} catch (Exception e) {
e.printStackTrace();
}
return tagUser;
}
/**
* 批量为用户打标签
*/
public static JSONObject batchtagging(String accessToken,List<String> openid_list,int tagid){
JSONObject result = null;
if(accessToken != null){
String requestUrl = batchtagging.replace("ACCESS_TOKEN", accessToken);
Map<String,Object> data = new HashMap<String,Object>();
data.put("openid_list", openid_list);
data.put("tagid", tagid);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(data));
logger.info("批量为用户打标签 方法执行前json参数---obj: "+obj.toString());
result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
logger.info("批量为用户打标签 方法执行后json参数 : "+result.toString());
}
return result;
}
/**
* 批量为用户取消标签
*/
public static JSONObject batchuntagging(String accessToken,List<String> openid_list,int tagid){
JSONObject result = null;
if(accessToken != null){
String requestUrl = batchuntagging.replace("ACCESS_TOKEN", accessToken);
Map<String,Object> data = new HashMap<String,Object>();
data.put("openid_list", openid_list);
data.put("tagid", tagid);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(data));
logger.info("批量为用户取消标签 方法执行前json参数---obj: "+obj.toString());
result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
logger.info("批量为用户取消标签 方法执行后json参数 : "+result.toString());
}
return result;
}
/**
* 获取用户身上的标签列表
*/
public static List<Integer> getidlist(String accessToken,String openid){
List<Integer> list = null;
if(accessToken != null){
String requestUrl = getidlist.replace("ACCESS_TOKEN", accessToken);
Map<String,Object> data = new HashMap<String,Object>();
data.put("openid", openid);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(data));
logger.info("获取用户身上的标签列表 方法执行前json参数---obj: "+obj.toString());
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
Object error = result.get(WeiXinConstant.RETURN_ERROR_INFO_CODE);
if(error == null){
JSONArray jsonArray = result.getJSONArray("tagid_list");
list = jsonArray.toJavaList(Integer.class);
}
logger.info("获取用户身上的标签列表 方法执行后json参数 : "+result.toString());
}
return list;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxuser/tag/model/WxTagUser.java | src/main/java/org/jeewx/api/wxuser/tag/model/WxTagUser.java | package org.jeewx.api.wxuser.tag.model;
import java.util.ArrayList;
import java.util.List;
public class WxTagUser {
Integer count ;
String next_openid;
WxTagUserList data;
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public String getNext_openid() {
return next_openid;
}
public void setNext_openid(String next_openid) {
this.next_openid = next_openid;
}
public WxTagUserList getData() {
return data;
}
public void setData(WxTagUserList data) {
this.data = data;
}
@Override
public String toString() {
return "WxTagUser [count=" + count + ", next_openid=" + next_openid + ", data=" + data + "]";
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxuser/tag/model/WxTag.java | src/main/java/org/jeewx/api/wxuser/tag/model/WxTag.java | package org.jeewx.api.wxuser.tag.model;
import java.util.ArrayList;
import java.util.List;
public class WxTag {
Integer id;
String name;
int count;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
@Override
public String toString() {
return "WxTag [id=" + id + ", name=" + name + ", count=" + count + "]";
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxuser/tag/model/WxTagUserList.java | src/main/java/org/jeewx/api/wxuser/tag/model/WxTagUserList.java | package org.jeewx.api.wxuser.tag.model;
import java.util.ArrayList;
import java.util.List;
public class WxTagUserList {
List<String> openid = new ArrayList<String>();
public List<String> getOpenid() {
return openid;
}
public void setOpenid(List<String> openid) {
this.openid = openid;
}
@Override
public String toString() {
return "WxTagUserList [openid=" + openid + "]";
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxbase/wxserviceip/JwServiceIpAPI.java | src/main/java/org/jeewx/api/wxbase/wxserviceip/JwServiceIpAPI.java | package org.jeewx.api.wxbase.wxserviceip;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.jeewx.api.core.exception.WexinReqException;
import org.jeewx.api.core.req.WeiXinReqService;
import org.jeewx.api.core.req.model.ServiceIP;
import org.jeewx.api.core.util.WeiXinConstant;
import java.util.ArrayList;
import java.util.List;
/**
* 微信--token信息
*
* @author lizr
*
*/
public class JwServiceIpAPI {
/**
* 返回的信息名称
*/
public static String RETURN_INFO_NAME = "ip_list";
/**
* 获取服务的ip列表信息
* @param accessToke
* @return
* @throws WexinReqException
*/
public static List<String> getServiceIpList(String accessToke) throws WexinReqException{
ServiceIP param = new ServiceIP();
param.setAccess_token(accessToke);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(param);
Object error = result.get(WeiXinConstant.RETURN_ERROR_INFO_CODE);
List<String> lstServiceIp = null;
JSONArray infoArray = result.getJSONArray(RETURN_INFO_NAME);
lstServiceIp = new ArrayList<String>(infoArray.size());
for (int i = 0; i < infoArray.size(); i++) {
lstServiceIp.add(infoArray.getString(i));
}
return lstServiceIp;
}
public static void main(String[] args){
try {
List<String> s = JwServiceIpAPI.getServiceIpList("kY9Y9rfdcr8AEtYZ9gPaRUjIAuJBvXO5ZOnbv2PYFxox__uSUQcqOnaGYN1xc4N1rI7NDCaPm_0ysFYjRVnPwCJHE7v7uF_l1hI6qi6QBsA");
System.out.println(s);
} catch (WexinReqException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxbase/wxtoken/JwTokenAPI.java | src/main/java/org/jeewx/api/wxbase/wxtoken/JwTokenAPI.java | package org.jeewx.api.wxbase.wxtoken;
import com.alibaba.fastjson.JSONObject;
import org.jeewx.api.core.exception.WexinReqException;
import org.jeewx.api.core.req.WeiXinReqService;
import org.jeewx.api.core.req.model.AccessToken;
/**
* 微信--token信息
*
* @author lizr
*
*/
public class JwTokenAPI {
private static AccessToken atoken = null;
/**
* 获取权限令牌信息
* @param appid
* @param appscret
* @return kY9Y9rfdcr8AEtYZ9gPaRUjIAuJBvXO5ZOnbv2PYFxox__uSUQcqOnaGYN1xc4N1rI7NDCaPm_0ysFYjRVnPwCJHE7v7uF_l1hI6qi6QBsA
* @throws WexinReqException
*/
public static String getAccessToken(String appid, String appscret) throws WexinReqException{
String newAccessToken = "";
atoken = new AccessToken();
atoken.setAppid(appid);
atoken.setSecret(appscret);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(atoken);
// 正常返回
newAccessToken = result.getString("access_token");;
return newAccessToken;
}
public static void main(String[] args){
try {
String s = JwTokenAPI.getAccessToken("wx00737224cb9dbc7d","b9479ebdb58d1c6b6efd4171ebe718b5");
System.out.println(s);
} catch (WexinReqException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxbase/wxmedia/JwMediaAPI.java | src/main/java/org/jeewx/api/wxbase/wxmedia/JwMediaAPI.java | package org.jeewx.api.wxbase.wxmedia;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.internal.util.StringUtils;
import org.jeewx.api.core.common.WxstoreUtils;
import org.jeewx.api.core.exception.WexinReqException;
import org.jeewx.api.core.req.WeiXinReqService;
import org.jeewx.api.core.req.model.DownloadMedia;
import org.jeewx.api.core.req.model.UploadMedia;
import org.jeewx.api.core.util.WeiXinConstant;
import org.jeewx.api.core.util.WeiXinReqUtil;
import org.jeewx.api.wxbase.wxmedia.model.*;
import org.jeewx.api.wxsendmsg.JwSendMessageAPI;
import org.jeewx.api.wxsendmsg.model.WxArticle;
import org.jeewx.api.wxsendmsg.model.WxArticlesResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 微信--token信息
*
* @author lizr
*
*/
public class JwMediaAPI {
private static Logger logger = LoggerFactory.getLogger(JwMediaAPI.class);
// 新增永久图文素材
private static String material_add_news_url ="https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=ACCESS_TOKEN&type=TYPE";
// 新增其他类型永久素材
private static String material_add_material_url = "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=ACCESS_TOKEN";
// 获取永久素材
private static String material_get_material_url = "https://api.weixin.qq.com/cgi-bin/material/get_material?access_token=ACCESS_TOKEN";
// 获取素材总数
private static String material_get_materialcount_url = "https://api.weixin.qq.com/cgi-bin/material/get_materialcount?access_token=ACCESS_TOKEN";
// 修改永久图文素材
private static String material_update_news_url = "https://api.weixin.qq.com/cgi-bin/material/update_news?access_token=ACCESS_TOKEN";
// 获取素材列表
private static String material_batchget_material_url = "https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token=ACCESS_TOKEN";
//新增其他类型永久素材 图文素材上传专用
private static String add_material = "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=ACCESS_TOKEN&type=TYPE";
//删除永久图文素材
private static String material_del_news_url = "https://api.weixin.qq.com/cgi-bin/material/del_material?access_token=ACCESS_TOKEN";
/**
* 经测试该方法不可用
* @param accessToke
* @param type 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
* @param fileNamePath 上传的文件目录
* @return
* @throws WexinReqException
*/
@Deprecated
public static WxUpload uploadMedia(String accessToke,String type,String fileNamePath) throws WexinReqException{
UploadMedia uploadMedia = new UploadMedia();
uploadMedia.setAccess_token(accessToke);
uploadMedia.setFilePathName(fileNamePath);
uploadMedia.setType(type);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(uploadMedia);
Object error = result.get(WeiXinConstant.RETURN_ERROR_INFO_CODE);
WxUpload wxMedia = null;
wxMedia = (WxUpload) JSONObject.toJavaObject(result, WxUpload.class);
return wxMedia;
}
/**
* 下载多媒体
* @param accessToke
* @param media_id
* @param filePath
* @return
* @throws WexinReqException
*/
@Deprecated
public static WxDwonload downMedia(String accessToke,String media_id,String filePath) throws WexinReqException{
DownloadMedia downloadMedia = new DownloadMedia();
downloadMedia.setAccess_token(accessToke);
downloadMedia.setFilePath(filePath);
downloadMedia.setMedia_id(media_id);
JSONObject result = WeiXinReqService.getInstance().doWeinxinReqJson(downloadMedia);
Object error = result.get(WeiXinConstant.RETURN_ERROR_INFO_CODE);
WxDwonload wxMedia = null;
wxMedia = (WxDwonload) JSONObject.toJavaObject(result, WxDwonload.class);
return wxMedia;
}
public static void main(String[] args){
try {
/*WxUpload s = WeixinMediaService.uploadMedia(
"kY9Y9rfdcr8AEtYZ9gPaRUjIAuJBvXO5ZOnbv2PYFxox__uSUQcqOnaGYN1xc4N1rI7NDCaPm_0ysFYjRVnPwCJHE7v7uF_l1hI6qi6QBsA",
"image","C:/Users/sfli.sir/Desktop/temp/2457331_160355071353_2.jpg");*/
WxDwonload d = JwMediaAPI.downMedia(
"kY9Y9rfdcr8AEtYZ9gPaRUjIAuJBvXO5ZOnbv2PYFxox__uSUQcqOnaGYN1xc4N1rI7NDCaPm_0ysFYjRVnPwCJHE7v7uF_l1hI6qi6QBsA",
"wBSDL0sz3zqOSGEXG9kIht48V9W7pAQBK50rFKFx1dv6FXsVNROxcxLPMUa9L-yI",
"C:/Users/sfli.sir/Desktop/temp/");
System.out.println(d.getFileName());
} catch (WexinReqException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* 上传新增永久图文素材 (经测试,该方法不可用)
*
* @param accesstoken
* @param wxArticles
* 图文集合,数量不大于10
* @return WxArticlesResponse 上传图文消息素材返回结果
* @throws WexinReqException
*/
@Deprecated
public static WxArticlesResponse uploadArticlesByMaterial(String accesstoken, List<WxArticle> wxArticles) throws WexinReqException {
WxArticlesResponse wxArticlesResponse = null;
if (wxArticles.size() == 0) {
logger.error("没有上传的图文消息");
} else if (wxArticles.size() > 10) {
logger.error("图文消息最多为10个图文");
} else {
if (accesstoken != null) {
String requestUrl = material_add_news_url.replace("ACCESS_TOKEN", accesstoken);
for (WxArticle article : wxArticles) {
if (article.getFileName() != null && article.getFileName().length() > 0) {
try {
String mediaId = JwSendMessageAPI.getFileMediaId(accesstoken, article);
article.setThumb_media_id(mediaId);
} catch (Exception e) {
throw new WexinReqException(e);
}
}
}
WxArticlesRequest wxArticlesRequest = new WxArticlesRequest();
wxArticlesRequest.setArticles(wxArticles);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(wxArticlesRequest));
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
//System.out.println("微信返回的结果:" + result.toString());
if (result.containsKey("errcode")) {
logger.error("上传图文消息失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
throw new WexinReqException("上传图文消息失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
} else {
wxArticlesResponse = new WxArticlesResponse();
wxArticlesResponse.setMedia_id(result.getString("media_id"));
wxArticlesResponse.setType(result.getString("type"));
wxArticlesResponse.setCreated_at(new Date(result.getLong("created_at") * 1000));
}
}
}
return wxArticlesResponse;
}
/**
* 获取素材总数
*
* @param accesstoken
* @param accesstoken
*
* @return WxCountResponse 素材数目返回结果
* @throws WexinReqException
*/
public static WxCountResponse getMediaCount(String accesstoken) throws WexinReqException {
WxCountResponse wxCountResponse = null;
if (accesstoken != null) {
String requestUrl = material_get_materialcount_url.replace("ACCESS_TOKEN", accesstoken);
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST",null);
//System.out.println("微信返回的结果:" + result.toString());
if (result.containsKey("errcode")) {
logger.error("上传图文消息失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
throw new WexinReqException("上传图文消息失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
} else {
wxCountResponse = new WxCountResponse();
wxCountResponse.setImage_count(result.getString("image_count"));
wxCountResponse.setNews_count(result.getString("news_count"));
wxCountResponse.setVideo_count(result.getString("video_count"));
wxCountResponse.setVoice_count(result.getString("voice_count"));
}
}
return wxCountResponse;
}
/**
* 获取永久素材 (经测试,该方法调用接口返回时封装实体对象不可用)
*
* @param accesstoken
* @param wxArticles
* 图文集合,数量不大于10
* @return WxArticlesResponse 上传图文消息素材返回结果
* @throws WexinReqException
*/
@Deprecated
public static WxArticlesRespponseByMaterial getArticlesByMaterial(String accesstoken,String mediaId) throws WexinReqException {
WxArticlesRespponseByMaterial wxArticlesRespponseByMaterial = null;
if (accesstoken != null) {
String requestUrl = material_get_material_url.replace("ACCESS_TOKEN", accesstoken);
WxArticlesRequestByMaterial wxArticlesRequestByMaterial = new WxArticlesRequestByMaterial();
wxArticlesRequestByMaterial.setMediaId(mediaId);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(wxArticlesRespponseByMaterial));
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
//System.out.println("微信返回的结果:" + result.toString());
if (result.containsKey("errcode")) {
logger.error("获得消息失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
throw new WexinReqException("获得消息失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
} else {
wxArticlesRespponseByMaterial = (WxArticlesRespponseByMaterial)JSONObject.toJavaObject(result,WxArticlesRespponseByMaterial.class);
}
}
return wxArticlesRespponseByMaterial;
}
/**
* 删除永久素材 (经测试,该方法调用接口地址不对)
*
* @param accesstoken
* @param mediaId
* 图文集合,数量不大于10
* @return WxArticlesRespponseByMaterial 上传图文消息素材返回结果
* @throws WexinReqException
*/
@Deprecated
public static void deleteArticlesByMaterial(String accesstoken,String mediaId) throws WexinReqException {
if (accesstoken != null&& !StringUtils.isEmpty(mediaId)) {
String requestUrl = material_get_material_url.replace("ACCESS_TOKEN", accesstoken);
WxArticlesRequestByMaterial wxArticlesRequestByMaterial = new WxArticlesRequestByMaterial();
wxArticlesRequestByMaterial.setMediaId(mediaId);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(wxArticlesRequestByMaterial));
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
//System.out.println("微信返回的结果:" + result.toString());
if (result.containsKey("errcode")&&result.get("errcode")!="0") {
logger.error("删除消息失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
throw new WexinReqException("删除消息失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
}
}
}
/**
* 修改永久素材
*
* @param accesstoken
* @param wxUpdateArticle
* @throws WexinReqException
*/
@Deprecated
public static void updateArticlesByMaterial(String accesstoken,WxUpdateArticle wxUpdateArticle) throws WexinReqException {
if (accesstoken != null) {
String requestUrl = material_update_news_url.replace("ACCESS_TOKEN", accesstoken);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(wxUpdateArticle));
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
//System.out.println("微信返回的结果:" + result.toString());
if (result.containsKey("errcode")&&result.get("errcode")!="0") {
logger.error("消息失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
throw new WexinReqException("消息消息失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
}
}
}
/**
* 获取素材列表 (经测试,该方法调用接口后json数据转java对象报错)
*
* @param accesstoken,type,offset,count
* @param WxNews
* @throws WexinReqException
*/
@Deprecated
public static WxNews queryArticlesByMaterial(String accesstoken,String type,int offset,int count) throws WexinReqException {
WxNews wn = null;
if (accesstoken != null) {
String requestUrl = material_batchget_material_url.replace("ACCESS_TOKEN", accesstoken);
JSONObject obj = new JSONObject();
obj.put("type", type);
obj.put("offset", offset);
obj.put("count", count);
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
//System.out.println("微信返回的结果:" + result.toString());
if (result.containsKey("errcode")&&result.get("errcode")!="0") {
logger.error("消息失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
throw new WexinReqException("消息消息失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
} else{
wn = (WxNews) JSONObject.toJavaObject(result, WxNews.class);
}
}
return wn;
}
/**
* 新增永久图文素材 (经测试,该方法不可用)
* @param accesstoken
* @param wxArticles
* @return
* @throws WexinReqException
*/
@Deprecated
public static String getMediaIdByMaterial(String accesstoken, List<WxArticle> wxArticles) throws WexinReqException {
WxArticlesResponse response = uploadArticlesByMaterial(accesstoken, wxArticles);
if (response == null) {
throw new WexinReqException("获取图文的mediaId失败");
}
return response.getMedia_id();
}
/**
* 新增其他类型永久素材 (经测试,该方法不能上传永久图片素材)
*
* @param filePath
* @param fileName
* @param type
* 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
* @return
* @throws Exception
*/
@Deprecated
public static WxMediaForMaterialResponse uploadMediaFileByMaterial(String accesstoken, WxMediaForMaterial wx) throws WexinReqException {
WxMediaForMaterialResponse mediaResource = null;
if (accesstoken != null) {
String requestUrl = material_add_material_url.replace("ACCESS_TOKEN", accesstoken);
File file = new File(wx.getFilePath() + wx.getFileName());
String contentType = WeiXinReqUtil.getFileContentType(wx.getFileName().substring(wx.getFileName().lastIndexOf(".") + 1));
JSONObject result = WxstoreUtils.uploadMediaFile(requestUrl, file, contentType);
if("video"==wx.getType()){
WxDescriptionRequest wr = new WxDescriptionRequest();
wr.setDescription(wx.getWxDescription());
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(wr));
WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
}
//System.out.println("微信返回的结果:" + result.toString());
if (result.containsKey("errcode")) {
logger.error("上传媒体资源失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
} else {
// {"type":"TYPE","media_id":"MEDIA_ID","created_at":123456789}
mediaResource = new WxMediaForMaterialResponse();
if("thumb".equals(wx.getType())){
mediaResource.setMedia_id(result.getString("thumb_media_id"));
}else{
mediaResource.setMedia_id(result.getString("media_id"));
}
mediaResource.setUrl(result.getString("url"));
}
// return mediaResource;
}
return mediaResource;
}
/**
* 永久获取多媒体资源的mediaId
*
* @param accesstoken
* @param wxMedia
* @return
* @throws WexinReqException
*/
@Deprecated
public static String getMediaIdForMaterial(String accesstoken, WxMediaForMaterial wxMediaForMaterial) throws WexinReqException {
WxMediaForMaterialResponse response = uploadMediaFileByMaterial(accesstoken, wxMediaForMaterial);
if (response == null) {
throw new WexinReqException("获取多媒体资源的mediaId失败");
}
return response.getMedia_id();
}
//-- update-begin--Author:gengjiajia Date:2016-11-28 for:TASK #1583 【图文管理】重写管理永久素材的接口
/**
* 新增其他永久素材
* @param accesstoken
* @param wx
* @return
* @throws WexinReqException
*/
@Deprecated
public static WxMediaForMaterialResponse addMediaFileByMaterialNews(String accesstoken, String type,String filePath,String fileName) throws WexinReqException {
WxMediaForMaterialResponse mediaResource = null;
if (accesstoken != null) {
String requestUrl = add_material.replace("ACCESS_TOKEN", accesstoken);
String url = requestUrl.replace("TYPE", type);
File file = new File(filePath + fileName);
String contentType = WeiXinReqUtil.getFileContentType(fileName.substring(fileName.lastIndexOf(".") + 1));
JSONObject result = WxstoreUtils.uploadMediaFileNews(url, file, contentType);
if (result.containsKey("errcode")) {
logger.error("新增其他永久素材 失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
throw new WexinReqException(result.getString("errcode"));
} else {
logger.info("====新增其他永久素材 成功====result:"+result.toString());
mediaResource = new WxMediaForMaterialResponse();
if("thumb".equals(type)){
mediaResource.setMedia_id(result.getString("thumb_media_id"));
}else{
mediaResource.setMedia_id(result.getString("media_id"));
}
mediaResource.setUrl(result.getString("url"));
}
}
return mediaResource;
}
/**
* 上传新增素材
*
* @param accesstoken
* @param wxArticles
* 图文集合,数量不大于100000
* @return WxArticlesResponse 上传图文消息素材返回结果
* @throws WexinReqException
*/
public static WxArticlesResponse uploadArticlesByMaterialNews(String accesstoken, List<WxArticle> wxArticles,String type) throws WexinReqException {
WxArticlesResponse wxArticlesResponse = null;
if (wxArticles.size() == 0) {
logger.error("没有上传的图文消息");
} else {
if (accesstoken != null) {
String requestUrl = material_add_news_url.replace("ACCESS_TOKEN", accesstoken).replace("TYPE",type);
for (WxArticle wxArticle : wxArticles) {
try {
File media = new File(wxArticle.getFilePath());
String s = uploadPermanentMaterial(media, type, wxArticle.getTitle(), wxArticle.getContent(), requestUrl);
JSONObject jsonObject = JSONObject.parseObject(s);
if (jsonObject.containsKey("errcode")) {
logger.error("新增永久素材失败!errcode=" + jsonObject.getString("errcode") + ",errmsg = " + jsonObject.getString("errmsg"));
throw new WexinReqException(jsonObject.getString("errcode"));
} else {
logger.info("=====新增永久素材成功=====result:"+jsonObject.toString());
wxArticlesResponse = new WxArticlesResponse();
wxArticlesResponse.setMedia_id(jsonObject.getString("media_id"));
//只有图片才会存在路径
if("image".equals(type)){
wxArticlesResponse.setUrl(jsonObject.getString("url"));
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}
return wxArticlesResponse;
}
/**
* 修改永久素材 已下线
*
* @param accesstoken
* @param wxUpdateArticle
* @throws WexinReqException
*/
public static void updateArticlesByMaterialNews(String accesstoken,WxUpdateArticle wxUpdateArticle) throws WexinReqException {
if (accesstoken != null) {
String requestUrl = material_update_news_url.replace("ACCESS_TOKEN", accesstoken);
JSONObject obj = JSONObject.parseObject(JSON.toJSONString(wxUpdateArticle));
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
if (result.containsKey("errcode")&&result.getInteger("errcode")!=0) {
logger.error("修改永久素材失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
throw new WexinReqException(result.getString("errcode"));
}else{
logger.info("=====修改永久素材成功=====");
}
}
}
/**
* 获取永久素材
* 注意 新版本获取指定素材除了 video视频 其余图片、语音 返回的均为文件流。需要将url转成工作流来处理
* @param accesstoken
* @return WxArticlesResponse
* @throws WexinReqException
*/
public static WxNewsArticle getArticlesByMaterialNews(String accesstoken,String mediaId) throws WexinReqException {
WxNewsArticle wxNewsArticle = new WxNewsArticle();
if (accesstoken != null) {
String requestUrl = material_get_material_url.replace("ACCESS_TOKEN", accesstoken);
JSONObject obj = new JSONObject();
obj.put("media_id", mediaId);
String s = sendPost(requestUrl, obj.toJSONString());
if (s.contains("errcode")) {
JSONObject result = JSONObject.parseObject(s);
logger.error("获取永久素材 失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg"));
throw new WexinReqException(result.getString("errcode"));
} else {
logger.info("====获取永久素材成功====result:"+ s);
if(s.contains("title")){
JSONObject jsonObject = JSONObject.parseObject(s);
String title = jsonObject.getString("title");
String downUrl = jsonObject.getString("down_url");
String description = jsonObject.getString("description");
wxNewsArticle.setTitle(title);
wxNewsArticle.setUrl(downUrl);
wxNewsArticle.setContent(description);
}else{
wxNewsArticle.setUrl(s);
}
}
}
return wxNewsArticle;
}
/**
* 获取素材列表
*
* @param accesstoken,type,offset,count
* @param WxNews
* @throws WexinReqException
*/
public static WxNews queryArticlesByMaterialNews(String accesstoken,String type,int offset,int count) throws WexinReqException {
WxNews news = new WxNews();
if (accesstoken != null) {
String requestUrl = material_batchget_material_url.replace("ACCESS_TOKEN", accesstoken);
JSONObject obj = new JSONObject();
obj.put("type", type);
obj.put("offset", offset);
obj.put("count", count);
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
if (result.containsKey("errcode")&&result.getInteger("errcode")!=0) {
logger.error("=====获取素材列表失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg")+"=====");
throw new WexinReqException(result.getString("errcode"));
} else{
logger.info("=====获取素材列表成功!result:"+result.toString()+"=====");
JSONArray jsonArray = result.getJSONArray("item");
Object[] itemArr = jsonArray.toArray();
List<WxItem> wxItems = new ArrayList<WxItem>();
for (int i = 0; i < itemArr.length; i++) {
WxItem wxItem = new WxItem();
Object itemObj = itemArr[i];
JSONObject itemJson = JSONObject.parseObject(JSON.toJSONString(itemObj));
String mediaId = itemJson.getString("media_id");
Object newsItemObj = itemJson.get("content");
if(null != newsItemObj){
JSONObject newsItemJson = JSONObject.parseObject(JSON.toJSONString(newsItemObj));
JSONArray newsItemJsonArr = newsItemJson.getJSONArray("news_item");
List<WxNewsArticle> wxArticleList = newsItemJsonArr.toJavaList(WxNewsArticle.class);
wxItem.setContents(wxArticleList);
}
wxItem.setMedia_id(mediaId);
if(itemJson.containsKey("name")){
wxItem.setName("name");
}
wxItem.setUpdate_time(itemJson.getString("update_time"));
wxItems.add(wxItem);
}
news.setItems(wxItems);
}
}
return news;
}
/**
* 删除永久素材
*
* @param accesstoken
* @param mediaId
* 图文集合,数量不大于10
* @return WxArticlesRespponseByMaterial 上传图文消息素材返回结果
* @throws WexinReqException
*/
public static void deleteArticlesByMaterialNews(String accesstoken,String mediaId) throws WexinReqException {
if (accesstoken != null&&!StringUtils.isEmpty(mediaId)) {
String requestUrl = material_del_news_url.replace("ACCESS_TOKEN", accesstoken);
JSONObject obj = new JSONObject();
obj.put("media_id", mediaId);
JSONObject result = WxstoreUtils.httpRequest(requestUrl, "POST", obj.toString());
if (result.containsKey("errcode")&&result.getInteger("errcode")!=0) {
logger.error("=====删除永久素材失败!errcode=" + result.getString("errcode") + ",errmsg = " + result.getString("errmsg")+"======");
throw new WexinReqException(result.getString("errcode"));
}else{
logger.info("=====删除永久素材成功=====");
}
}
}
//-- update-end--Author:gengjiajia Date:2016-11-28 for:TASK #1583 【图文管理】重写管理永久素材的接口
/**
* 上传永久素材
* @param file
* @param type
* @param title type为video时需要,其他类型设null
* @param introduction type为video时需要,其他类型设null
* @return {"media_id":MEDIA_ID,"url":URL}
*/
public static String uploadPermanentMaterial(File file, String type, String title, String introduction, String url) {
String result = null;
try {
URL uploadURL = new URL(url);
HttpURLConnection conn = (HttpURLConnection) uploadURL.openConnection();
conn.setConnectTimeout(5000);
conn.setReadTimeout(30000);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setRequestMethod("POST");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("Cache-Control", "no-cache");
String boundary = "-----------------------------" + System.currentTimeMillis();
conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
OutputStream output = conn.getOutputStream();
output.write(("--" + boundary + "\r\n").getBytes());
output.write(String.format("Content-Disposition: form-data; name=\"media\"; filename=\"%s\"\r\n", file.getName()).getBytes());
output.write("Content-Type: video/mp4 \r\n\r\n".getBytes());
byte[] data = new byte[1024];
int len = 0;
FileInputStream input = new FileInputStream(file);
while ((len = input.read(data)) > -1) {
output.write(data, 0, len);
}
/*对类型为video的素材进行特殊处理*/
if ("video".equals(type)) {
output.write(("--" + boundary + "\r\n").getBytes());
output.write("Content-Disposition: form-data; name=\"description\";\r\n\r\n".getBytes());
output.write(String.format("{\"title\":\"%s\", \"introduction\":\"%s\"}", title, introduction).getBytes());
}
output.write(("\r\n--" + boundary + "--\r\n\r\n").getBytes());
output.flush();
output.close();
input.close();
InputStream resp = conn.getInputStream();
StringBuffer sb = new StringBuffer();
while ((len = resp.read(data)) > -1)
sb.append(new String(data, 0, len, "utf-8"));
resp.close();
result = sb.toString();
} catch (IOException e) {
logger.error(e.getMessage(),e);
e.printStackTrace();
}
return result;
}
/**
* 发送post请求 用于获取素材
* @param url
* @param param
*/
public static String sendPost(String url, String param) {
PrintWriter out = null;
BufferedReader in = null;
String result = "";
try {
URL realUrl = new URL(url);
URLConnection conn = realUrl.openConnection();
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
conn.setDoOutput(true);
conn.setDoInput(true);
out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(), "UTF-8"));
out.print(param);
out.flush();
String line;
for(in = new BufferedReader(new InputStreamReader(conn.getInputStream())); (line = in.readLine()) != null; result = result + line) {
}
} catch (Exception var16) {
System.out.println("发送 POST 请求出现异常!" + var16);
var16.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (IOException var15) {
var15.printStackTrace();
}
}
logger.info("result:{}"+result);
return result;
}
} | java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxDwonload.java | src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxDwonload.java | package org.jeewx.api.wxbase.wxmedia.model;
/**
* 微信多媒体文件
* @author sfli.sir
*
*/
public class WxDwonload {
private String filepath;
private String fileName;
public String getFilepath() {
return filepath;
}
public void setFilepath(String filepath) {
this.filepath = filepath;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxDescriptionRequest.java | src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxDescriptionRequest.java | package org.jeewx.api.wxbase.wxmedia.model;
/**
* 上传图文消息素材
* @author lihongxuan
*
*/
public class WxDescriptionRequest {
WxDescription description = new WxDescription();
public WxDescription getDescription() {
return description;
}
public void setDescription(WxDescription description) {
this.description = description;
}
@Override
public String toString() {
return "WxDescriptionRequest [description=" + description + "]";
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxMediaForMaterialResponse.java | src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxMediaForMaterialResponse.java | package org.jeewx.api.wxbase.wxmedia.model;
import java.util.Date;
/**
* 上传到微信的媒体资源文件bean
*
* @author lihongxuan
*
*/
public class WxMediaForMaterialResponse {
/** 新增的图片素材的图片URL */
private String url;
/** 媒体资源ID */
private String media_id;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getMedia_id() {
return media_id;
}
public void setMedia_id(String media_id) {
this.media_id = media_id;
}
@Override
public String toString() {
return "WxMediaResponse [url=" + url + ", media_id=" + media_id + "]";
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxArticlesRequest.java | src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxArticlesRequest.java | package org.jeewx.api.wxbase.wxmedia.model;
import java.util.ArrayList;
import java.util.List;
import org.jeewx.api.wxsendmsg.model.WxArticle;
/**
* 上传图文消息素材
* @author LIAIJUN
*
*/
public class WxArticlesRequest {
List<WxArticle> articles = new ArrayList<WxArticle>();
public List<WxArticle> getArticles() {
return articles;
}
public void setArticles(List<WxArticle> articles) {
this.articles = articles;
}
@Override
public String toString() {
return "WxArticlesRequest [articles=" + articles + "]";
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxNewsArticle.java | src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxNewsArticle.java | package org.jeewx.api.wxbase.wxmedia.model;
/**
* 图文消息
* @author LIAIJUN
*
*/
public class WxNewsArticle {
/** 图文消息缩略图的media_id */
private String thumb_media_id;
/** 图文消息的作者 */
private String author;
/** 图文消息的标题 */
private String title;
/** 在图文消息页面点击“阅读原文”后的页面 */
private String content_source_url;
/** 图文消息页面的内容,支持HTML标签 */
private String content;
/** 图文消息的描述 */
private String digest;
/** 是否显示封面,1为显示,0为不显示 */
private String show_cover_pic;
/** 图片url*/
private String thumb_url;
/**url*/
private String url;
private String fileName;
private String filePath;
public String getThumb_media_id() {
return thumb_media_id;
}
public void setThumb_media_id(String thumb_media_id) {
this.thumb_media_id = thumb_media_id;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent_source_url() {
return content_source_url;
}
public void setContent_source_url(String content_source_url) {
this.content_source_url = content_source_url;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getDigest() {
return digest;
}
public void setDigest(String digest) {
this.digest = digest;
}
public String getShow_cover_pic() {
return show_cover_pic;
}
public void setShow_cover_pic(String show_cover_pic) {
this.show_cover_pic = show_cover_pic;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getThumb_url() {
return thumb_url;
}
public void setThumb_url(String thumb_url) {
this.thumb_url = thumb_url;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("WxArticle [thumb_media_id=");
builder.append(thumb_media_id);
builder.append(", author=");
builder.append(author);
builder.append(", title=");
builder.append(title);
builder.append(", content_source_url=");
builder.append(content_source_url);
builder.append(", content=");
builder.append(content);
builder.append(", digest=");
builder.append(digest);
builder.append(", show_cover_pic=");
builder.append(show_cover_pic);
builder.append(", thumb_url=");
builder.append(thumb_url);
builder.append(", url=");
builder.append(url);
builder.append(", fileName=");
builder.append(fileName);
builder.append(", filePath=");
builder.append(filePath);
builder.append("]");
return builder.toString();
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxItem.java | src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxItem.java | package org.jeewx.api.wxbase.wxmedia.model;
import java.util.List;
/**
* 图文消息图文消息
* @author lihongxuan
*
*/
public class WxItem {
/** 媒体id */
private String media_id;
/** 图文消息的作者 */
//-- update-begin--Author:gengjiajia Date:2016-11-28 for:TASK #1583 【图文管理】
//微信接口返回的可能会是多个,使用list接收
//private WxArticle content;
private List<WxNewsArticle> contents;
//-- update-end--Author:gengjiajia Date:2016-11-28 for:TASK #1583 【图文管理】
/** 文件名称 */
private String name;
/** 这篇图文消息素材的最后更新时间 */
private String update_time;
/** 图文页的URL,或者,当获取的列表是图片素材列表时,该字段是图片的URL */
private String url;
public String getMedia_id() {
return media_id;
}
public void setMedia_id(String media_id) {
this.media_id = media_id;
}
/*public WxArticle getContent() {
return content;
}
public void setContent(WxArticle content) {
this.content = content;
}*/
public List<WxNewsArticle> getContents() {
return contents;
}
public void setContents(List<WxNewsArticle> contents) {
this.contents = contents;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUpdate_time() {
return update_time;
}
public void setUpdate_time(String update_time) {
this.update_time = update_time;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("WxItem [media_id=");
builder.append(media_id);
builder.append(", contents=");
builder.append(contents);
builder.append(", name=");
builder.append(name);
builder.append(", update_time=");
builder.append(update_time);
builder.append(", url=");
builder.append(url);
builder.append("]");
return builder.toString();
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxCountResponse.java | src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxCountResponse.java | package org.jeewx.api.wxbase.wxmedia.model;
/**
* 获取素材总数
*
* @author lihongxuan
*
*/
public class WxCountResponse {
/** 语音总数量 */
private String voice_count;
/** 视频总数量 */
private String video_count;
/** 图片总数量*/
private String image_count;
/** 图文总数量*/
private String news_count;
public String getVoice_count() {
return voice_count;
}
public void setVoice_count(String voice_count) {
this.voice_count = voice_count;
}
public String getVideo_count() {
return video_count;
}
public void setVideo_count(String video_count) {
this.video_count = video_count;
}
public String getImage_count() {
return image_count;
}
public void setImage_count(String image_count) {
this.image_count = image_count;
}
public String getNews_count() {
return news_count;
}
public void setNews_count(String news_count) {
this.news_count = news_count;
}
@Override
public String toString() {
return "WxCountResponse [voice_count=" + voice_count + ", video_count=" + video_count + ", image_count=" + image_count +", news_count=" + news_count + "]";
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxMediaForMaterial.java | src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxMediaForMaterial.java | package org.jeewx.api.wxbase.wxmedia.model;
/**
* 多媒体资源文件
* @author lihongxuan
*
*/
public class WxMediaForMaterial {
private String fileName;
private String filePath;
private String type;
private WxDescription wxDescription;
public WxDescription getWxDescription() {
return wxDescription;
}
public void setWxDescription(WxDescription wxDescription) {
this.wxDescription = wxDescription;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
return "WxMedia [fileName=" + fileName + ", filePath=" + filePath + ", type=" + type + "]";
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxArticlesRequestByMaterial.java | src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxArticlesRequestByMaterial.java | package org.jeewx.api.wxbase.wxmedia.model;
import java.util.ArrayList;
import java.util.List;
/**
* 上传图文消息素材id
* @author lihongxuan
*
*/
public class WxArticlesRequestByMaterial {
private String mediaId;
public String getMediaId() {
return mediaId;
}
public void setMediaId(String mediaId) {
this.mediaId = mediaId;
}
@Override
public String toString() {
return "WxArticlesRequestByMaterial [mediaId=" + mediaId + "]";
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxNews.java | src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxNews.java | package org.jeewx.api.wxbase.wxmedia.model;
import java.util.List;
/**
* 图文消息图文消息
* @author lihongxuan
*
*/
public class WxNews {
/** 媒体id */
private String total_count;
/** 图文消息的作者 */
//-- update-begin--Author:gengjiajia Date:2016-11-28 for:TASK #1583 【图文管理】
//微信接口返回的结果会是多个,使用list接收
//private WxItem item;
private List<WxItem> items;
/** 文件名称 */
private String item_count;
public String getTotal_count() {
return total_count;
}
public void setTotal_count(String total_count) {
this.total_count = total_count;
}
/*public WxItem getItem() {
return item;
}
public void setItem(WxItem item) {
this.item = item;
}*/
public List<WxItem> getItems() {
return items;
}
public void setItems(List<WxItem> items) {
this.items = items;
}
public String getItem_count() {
return item_count;
}
public void setItem_count(String item_count) {
this.item_count = item_count;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("WxNews [total_count=");
builder.append(total_count);
builder.append(", items=");
builder.append(items);
builder.append(", item_count=");
builder.append(item_count);
builder.append("]");
return builder.toString();
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
jeecgboot/weixin4j | https://github.com/jeecgboot/weixin4j/blob/9a0a503cc99e24c77de671890fae15ee3235669f/src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxArticlesRespponseByMaterial.java | src/main/java/org/jeewx/api/wxbase/wxmedia/model/WxArticlesRespponseByMaterial.java | package org.jeewx.api.wxbase.wxmedia.model;
import java.util.ArrayList;
import java.util.List;
import org.jeewx.api.wxsendmsg.model.WxArticle;
/**
* 获得媒体信息
* @author lihongxuan
*
*/
public class WxArticlesRespponseByMaterial {
List<WxArticle> news_item = new ArrayList<WxArticle>();
public List<WxArticle> getNews_item() {
return news_item;
}
public void setNews_item(List<WxArticle> news_item) {
this.news_item = news_item;
}
@Override
public String toString() {
return "WxArticlesRequest [news_item=" + news_item + "]";
}
}
| java | Apache-2.0 | 9a0a503cc99e24c77de671890fae15ee3235669f | 2026-01-05T02:41:50.789942Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.