mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-02 20:02:37 +08:00
✨ #1213 增加部分微信卡券接口
This commit is contained in:
parent
2d0cb1a2a2
commit
3512930237
@ -632,7 +632,17 @@ public enum WxMpErrorMsgEnum {
|
||||
/**
|
||||
* 查询起始值 begin 不合法.
|
||||
*/
|
||||
CODE_9001036(9001036, "查询起始值 begin 不合法");
|
||||
CODE_9001036(9001036, "查询起始值 begin 不合法"),
|
||||
|
||||
/**
|
||||
* 设置的 speed 参数不在0到4的范围内
|
||||
*/
|
||||
CODE_45083(45083, "设置的 speed 参数不在0到4的范围内"),
|
||||
|
||||
/**
|
||||
* 没有设置 speed 参数
|
||||
*/
|
||||
CODE_45084(45084, "没有设置 speed 参数");
|
||||
|
||||
private int code;
|
||||
private String msg;
|
||||
|
@ -4,6 +4,8 @@ import me.chanjar.weixin.common.bean.WxCardApiSignature;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.mp.bean.card.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 卡券相关接口.
|
||||
*
|
||||
@ -207,4 +209,78 @@ public interface WxMpCardService {
|
||||
*/
|
||||
WxMpCardDeleteResult deleteCard(String cardId) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* 导入自定义code(仅对自定义code商户)
|
||||
*
|
||||
* @param cardId 卡券id
|
||||
* @param codeList 需导入微信卡券后台的自定义code,上限为100个。
|
||||
*/
|
||||
WxMpCardCodeDepositResult cardCodeDeposit(String cardId, List<String> codeList) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 查询导入code数目接口
|
||||
*
|
||||
* @param cardId 卡券id
|
||||
*/
|
||||
WxMpCardCodeDepositCountResult cardCodeDepositCount(String cardId) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* 核查code接口
|
||||
*
|
||||
* @param cardId 卡券id
|
||||
* @param codeList 已经微信卡券后台的自定义code,上限为100个
|
||||
*/
|
||||
WxMpCardCodeCheckcodeResult cardCodeCheckcode(String cardId, List<String> codeList) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 图文消息群发卡券获取内嵌html
|
||||
*
|
||||
* @param cardId 卡券id
|
||||
*/
|
||||
WxMpCardMpnewsGethtmlResult cardMpnewsGethtml(String cardId) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* 修改库存接口
|
||||
* https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Managing_Coupons_Vouchers_and_Cards.html#5
|
||||
*
|
||||
* @param cardId 卡券ID
|
||||
* @param changeValue 库存变更值,负值为减少库存
|
||||
*/
|
||||
void cardModifyStock(String cardId, Integer changeValue) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* 更改Code接口
|
||||
* https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Managing_Coupons_Vouchers_and_Cards.html#6
|
||||
*
|
||||
* @param cardId 卡券ID
|
||||
* @param oldCode 需变更的Code码
|
||||
* @param newCode 变更后的有效Code码
|
||||
*/
|
||||
void cardCodeUpdate(String cardId, String oldCode, String newCode) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 设置买单接口
|
||||
* https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Create_a_Coupon_Voucher_or_Card.html#12
|
||||
*
|
||||
* @param cardId 卡券ID
|
||||
* @param isOpen 是否开启买单功能,填true/false
|
||||
*/
|
||||
void cardPaycellSet(String cardId, Boolean isOpen) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 设置自助核销
|
||||
* https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Create_a_Coupon_Voucher_or_Card.html#14
|
||||
*
|
||||
* @param cardId 卡券ID
|
||||
* @param isOpen 是否开启自助核销功能
|
||||
* @param needVerifyCod 用户核销时是否需要输入验证码, 填true/false, 默认为false
|
||||
* @param needRemarkAmount 用户核销时是否需要备注核销金额, 填true/false, 默认为false
|
||||
*/
|
||||
void cardSelfConsumeCellSet(String cardId, Boolean isOpen,
|
||||
Boolean needVerifyCod, Boolean needRemarkAmount) throws WxErrorException;
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,9 @@ package me.chanjar.weixin.mp.api;
|
||||
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.mp.bean.*;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassGetResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassSpeedGetResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult;
|
||||
|
||||
/**
|
||||
@ -92,4 +94,36 @@ public interface WxMpMassMessageService {
|
||||
*/
|
||||
void delete(Long msgId, Integer articleIndex) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* 获取群发速度
|
||||
* https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Batch_Sends_and_Originality_Checks.html#9
|
||||
*/
|
||||
WxMpMassSpeedGetResult messageMassSpeedGet() throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* 设置群发速度
|
||||
* https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Batch_Sends_and_Originality_Checks.html#9
|
||||
*
|
||||
* @param speed 群发速度的级别,是一个0到4的整数,数字越大表示群发速度越慢。
|
||||
* speed realspeed
|
||||
* 0 80w/分钟
|
||||
* 1 60w/分钟
|
||||
* 2 45w/分钟
|
||||
* 3 30w/分钟
|
||||
* 4 10w/分钟
|
||||
*/
|
||||
void messageMassSpeedSet(Integer speed) throws WxErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* 查询群发消息发送状态【订阅号与服务号认证后均可用】
|
||||
* https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Batch_Sends_and_Originality_Checks.html#%E6%9F%A5%E8%AF%A2%E7%BE%A4%E5%8F%91%E6%B6%88%E6%81%AF%E5%8F%91%E9%80%81%E7%8A%B6%E6%80%81%E3%80%90%E8%AE%A2%E9%98%85%E5%8F%B7%E4%B8%8E%E6%9C%8D%E5%8A%A1%E5%8F%B7%E8%AE%A4%E8%AF%81%E5%90%8E%E5%9D%87%E5%8F%AF%E7%94%A8%E3%80%91
|
||||
*
|
||||
* @param msgId 群发消息后返回的消息id
|
||||
* @return 消息发送后的状态,SEND_SUCCESS表示发送成功,SENDING表示发送中,SEND_FAIL表示发送失败,DELETE表示已删除
|
||||
*/
|
||||
WxMpMassGetResult messageMassGet(Long msgId) throws WxErrorException;
|
||||
|
||||
}
|
||||
|
@ -9,9 +9,11 @@ import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.RandomUtils;
|
||||
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
import me.chanjar.weixin.mp.api.WxMpCardService;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.card.*;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpResult;
|
||||
import me.chanjar.weixin.mp.enums.TicketType;
|
||||
import me.chanjar.weixin.mp.enums.WxMpApiUrl;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
@ -19,6 +21,7 @@ import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
||||
/**
|
||||
@ -241,12 +244,117 @@ public class WxMpCardServiceImpl implements WxMpCardService {
|
||||
|
||||
@Override
|
||||
public WxMpCardDeleteResult deleteCard(String cardId) throws WxErrorException {
|
||||
if (StringUtils.isEmpty(cardId)) {
|
||||
throw new WxErrorException(WxError.builder().errorCode(41012).errorMsg("cardId不能为空").build());
|
||||
}
|
||||
checkCardId(cardId);
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("card_id", cardId);
|
||||
String response = this.wxMpService.post(WxMpApiUrl.Card.CARD_DELETE, param.toString());
|
||||
return WxMpCardDeleteResult.fromJson(response);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WxMpCardCodeDepositResult cardCodeDeposit(String cardId, List<String> codeList) throws WxErrorException {
|
||||
checkCardId(cardId);
|
||||
if (codeList.size() == 0 || codeList.size() > 100) {
|
||||
throw new WxErrorException(WxError.builder().errorCode(40109).errorMsg("code数量为0或者code数量超过100个").build());
|
||||
}
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("card_id", cardId);
|
||||
param.add("code",
|
||||
WxGsonBuilder.create().toJsonTree(codeList, new TypeToken<List<String>>() {
|
||||
}.getType()).getAsJsonArray());
|
||||
String response = this.wxMpService.post(WxMpApiUrl.Card.CARD_CODE_DEPOSIT, param.toString());
|
||||
return WxMpCardCodeDepositResult.fromJson(response);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WxMpCardCodeDepositCountResult cardCodeDepositCount(String cardId) throws WxErrorException {
|
||||
checkCardId(cardId);
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("card_id", cardId);
|
||||
String response = this.wxMpService.post(WxMpApiUrl.Card.CARD_CODE_DEPOSIT_COUNT, param.toString());
|
||||
return WxMpCardCodeDepositCountResult.fromJson(response);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WxMpCardCodeCheckcodeResult cardCodeCheckcode(String cardId, List<String> codeList) throws WxErrorException {
|
||||
checkCardId(cardId);
|
||||
if (codeList.size() == 0 || codeList.size() > 100) {
|
||||
throw new WxErrorException(WxError.builder().errorCode(40109).errorMsg("code数量为0或者code数量超过100个").build());
|
||||
}
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("card_id", cardId);
|
||||
param.add("code",
|
||||
WxGsonBuilder.create().toJsonTree(codeList, new TypeToken<List<String>>() {
|
||||
}.getType()).getAsJsonArray());
|
||||
String response = this.wxMpService.post(WxMpApiUrl.Card.CARD_CODE_CHECKCODE, param.toString());
|
||||
return WxMpCardCodeCheckcodeResult.fromJson(response);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WxMpCardMpnewsGethtmlResult cardMpnewsGethtml(String cardId) throws WxErrorException {
|
||||
checkCardId(cardId);
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("card_id", cardId);
|
||||
String response = this.wxMpService.post(WxMpApiUrl.Card.CARD_MPNEWS_GETHTML, param.toString());
|
||||
return WxMpCardMpnewsGethtmlResult.fromJson(response);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void cardModifyStock(String cardId, Integer changeValue) throws WxErrorException {
|
||||
checkCardId(cardId);
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("card_id", cardId);
|
||||
if (changeValue > 0) {
|
||||
param.addProperty("increase_stock_value", changeValue);
|
||||
} else {
|
||||
param.addProperty("reduce_stock_value", Math.abs(changeValue));
|
||||
}
|
||||
this.wxMpService.post(WxMpApiUrl.Card.CARD_MODIFY_STOCK, param.toString());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void cardCodeUpdate(String cardId, String oldCode, String newCode) throws WxErrorException {
|
||||
checkCardId(cardId);
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("card_id", cardId);
|
||||
param.addProperty("code", oldCode);
|
||||
param.addProperty("new_code", newCode);
|
||||
this.wxMpService.post(WxMpApiUrl.Card.CARD_CODE_UPDATE, param.toString());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void cardPaycellSet(String cardId, Boolean isOpen) throws WxErrorException {
|
||||
checkCardId(cardId);
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("card_id", cardId);
|
||||
param.addProperty("is_open", isOpen);
|
||||
this.wxMpService.post(WxMpApiUrl.Card.CARD_PAYCELL_SET, param.toString());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void cardSelfConsumeCellSet(String cardId, Boolean isOpen,
|
||||
Boolean needVerifyCod, Boolean needRemarkAmount) throws WxErrorException {
|
||||
checkCardId(cardId);
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("card_id", cardId);
|
||||
param.addProperty("is_open", isOpen);
|
||||
param.addProperty("need_verify_cod", needVerifyCod);
|
||||
param.addProperty("need_remark_amount", needRemarkAmount);
|
||||
this.wxMpService.post(WxMpApiUrl.Card.CARD_SELF_CONSUME_CELL_SET, param.toString());
|
||||
}
|
||||
|
||||
|
||||
private void checkCardId(String cardId) throws WxErrorException {
|
||||
if (StringUtils.isEmpty(cardId)) {
|
||||
throw new WxErrorException(WxError.builder().errorCode(41012).errorMsg("cardId不能为空").build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,9 @@ import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpMassMessageService;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.*;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassGetResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassSpeedGetResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult;
|
||||
import me.chanjar.weixin.mp.enums.WxMpApiUrl;
|
||||
|
||||
@ -64,4 +66,29 @@ public class WxMpMassMessageServiceImpl implements WxMpMassMessageService {
|
||||
this.wxMpService.post(MassMessage.MESSAGE_MASS_DELETE_URL, jsonObject.toString());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WxMpMassSpeedGetResult messageMassSpeedGet() throws WxErrorException {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
String response = this.wxMpService.post(MassMessage.MESSAGE_MASS_SPEED_GET_URL, jsonObject.toString());
|
||||
return WxMpMassSpeedGetResult.fromJson(response);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void messageMassSpeedSet(Integer speed) throws WxErrorException {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("speed", speed);
|
||||
this.wxMpService.post(MassMessage.MESSAGE_MASS_SPEED_SET_URL, jsonObject.toString());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WxMpMassGetResult messageMassGet(Long msgId) throws WxErrorException {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("msg_id", msgId);
|
||||
String response = this.wxMpService.post(MassMessage.MESSAGE_MASS_GET_URL, jsonObject.toString());
|
||||
return WxMpMassGetResult.fromJson(response);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
package me.chanjar.weixin.mp.bean.card;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpResult;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class WxMpCardCodeCheckcodeResult extends WxMpResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5128692403997016750L;
|
||||
|
||||
/**
|
||||
* 已经成功存入的code数目
|
||||
*/
|
||||
@SerializedName("exist_code")
|
||||
private List<String> existCode;
|
||||
|
||||
@SerializedName("not_exist_code")
|
||||
private List<String> notExistCode;
|
||||
|
||||
|
||||
public static WxMpCardCodeCheckcodeResult fromJson(String json) {
|
||||
return WxMpGsonBuilder.create().fromJson(json, WxMpCardCodeCheckcodeResult.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return WxMpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
package me.chanjar.weixin.mp.bean.card;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpResult;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@Data
|
||||
public class WxMpCardCodeDepositCountResult extends WxMpResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6707587956061215868L;
|
||||
|
||||
/**
|
||||
* 已经成功存入的code数目
|
||||
*/
|
||||
@SerializedName("count")
|
||||
private Integer count;
|
||||
|
||||
|
||||
public static WxMpCardCodeDepositCountResult fromJson(String json) {
|
||||
return WxMpGsonBuilder.create().fromJson(json, WxMpCardCodeDepositCountResult.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return WxMpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
package me.chanjar.weixin.mp.bean.card;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpResult;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@Data
|
||||
public class WxMpCardCodeDepositResult extends WxMpResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2955588617765355420L;
|
||||
|
||||
/**
|
||||
* 成功个数
|
||||
*/
|
||||
@SerializedName("succ_code")
|
||||
private Integer succCode;
|
||||
|
||||
/**
|
||||
* 重复导入的code会自动被过滤
|
||||
*/
|
||||
@SerializedName("duplicate_code")
|
||||
private Integer duplicateCode;
|
||||
|
||||
/**
|
||||
* 失败个数
|
||||
*/
|
||||
@SerializedName("fail_code")
|
||||
private Integer failCode;
|
||||
|
||||
|
||||
public static WxMpCardCodeDepositResult fromJson(String json) {
|
||||
return WxMpGsonBuilder.create().fromJson(json, WxMpCardCodeDepositResult.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return WxMpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
package me.chanjar.weixin.mp.bean.card;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpResult;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class WxMpCardMpnewsGethtmlResult extends WxMpResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6435268886823478711L;
|
||||
|
||||
/**
|
||||
* 返回一段html代码,可以直接嵌入到图文消息的正文里。即可以把这段代码嵌入到 上传图文消息素材接口 中的content字段里
|
||||
*/
|
||||
@SerializedName("content")
|
||||
private String content;
|
||||
|
||||
public static WxMpCardMpnewsGethtmlResult fromJson(String json) {
|
||||
return WxMpGsonBuilder.create().fromJson(json, WxMpCardMpnewsGethtmlResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return WxMpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
package me.chanjar.weixin.mp.bean.result;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 查询群发消息发送状态【订阅号与服务号认证后均可用】
|
||||
* https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Batch_Sends_and_Originality_Checks.html#%E6%9F%A5%E8%AF%A2%E7%BE%A4%E5%8F%91%E6%B6%88%E6%81%AF%E5%8F%91%E9%80%81%E7%8A%B6%E6%80%81%E3%80%90%E8%AE%A2%E9%98%85%E5%8F%B7%E4%B8%8E%E6%9C%8D%E5%8A%A1%E5%8F%B7%E8%AE%A4%E8%AF%81%E5%90%8E%E5%9D%87%E5%8F%AF%E7%94%A8%E3%80%91
|
||||
*/
|
||||
@Data
|
||||
public class WxMpMassGetResult extends WxMpResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2909694117357278557L;
|
||||
|
||||
@SerializedName("msg_id")
|
||||
private Long msgId;
|
||||
|
||||
@SerializedName("msg_status")
|
||||
private String msgstatus;
|
||||
|
||||
public static WxMpMassGetResult fromJson(String json) {
|
||||
return WxMpGsonBuilder.create().fromJson(json, WxMpMassGetResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return WxMpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package me.chanjar.weixin.mp.bean.result;
|
||||
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 获取群发速度
|
||||
* https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Batch_Sends_and_Originality_Checks.html#9
|
||||
* speed realspeed
|
||||
* 0 80w/分钟
|
||||
* 1 60w/分钟
|
||||
* 2 45w/分钟
|
||||
* 3 30w/分钟
|
||||
* 4 10w/分钟
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
public class WxMpMassSpeedGetResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6478157575168068334L;
|
||||
|
||||
private Integer speed;
|
||||
|
||||
private Integer realspeed;
|
||||
|
||||
public static WxMpMassSpeedGetResult fromJson(String json) {
|
||||
return WxMpGsonBuilder.create().fromJson(json, WxMpMassSpeedGetResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return WxMpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package me.chanjar.weixin.mp.bean.result;
|
||||
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 基础的微信公众号平台请求结果.
|
||||
*/
|
||||
@Data
|
||||
public class WxMpResult implements Serializable {
|
||||
private static final long serialVersionUID = 2101652152604850904L;
|
||||
protected String errcode;
|
||||
protected String errmsg;
|
||||
|
||||
/**
|
||||
* 请求是否成功.
|
||||
*/
|
||||
public boolean isSuccess() {
|
||||
return StringUtils.equalsIgnoreCase(errcode, "0");
|
||||
}
|
||||
|
||||
public static WxMpResult fromJson(String json) {
|
||||
return WxGsonBuilder.create().fromJson(json, WxMpResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return WxGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -506,7 +506,48 @@ public interface WxMpApiUrl {
|
||||
/**
|
||||
* 卡券删除.
|
||||
*/
|
||||
CARD_DELETE(API_DEFAULT_HOST_URL, "/card/delete");
|
||||
CARD_DELETE(API_DEFAULT_HOST_URL, "/card/delete"),
|
||||
|
||||
/**
|
||||
* 导入code接口.
|
||||
*/
|
||||
CARD_CODE_DEPOSIT(API_DEFAULT_HOST_URL, "/card/code/deposit"),
|
||||
|
||||
/**
|
||||
* 查询导入code数目接口
|
||||
*/
|
||||
CARD_CODE_DEPOSIT_COUNT(API_DEFAULT_HOST_URL, "/card/code/getdepositcount"),
|
||||
|
||||
/**
|
||||
* 核查code接口
|
||||
*/
|
||||
CARD_CODE_CHECKCODE(API_DEFAULT_HOST_URL, "/card/code/checkcode"),
|
||||
|
||||
/**
|
||||
* 图文消息群发卡券
|
||||
*/
|
||||
CARD_MPNEWS_GETHTML(API_DEFAULT_HOST_URL, "/card/mpnews/gethtml"),
|
||||
|
||||
/**
|
||||
* 修改库存接口
|
||||
*/
|
||||
CARD_MODIFY_STOCK(API_DEFAULT_HOST_URL, "/card/modifystock"),
|
||||
|
||||
/**
|
||||
* 更改Code接口
|
||||
*/
|
||||
CARD_CODE_UPDATE(API_DEFAULT_HOST_URL, "/card/code/update"),
|
||||
|
||||
/**
|
||||
* 设置买单接口
|
||||
*/
|
||||
CARD_PAYCELL_SET(API_DEFAULT_HOST_URL, "/card/paycell/set"),
|
||||
|
||||
/**
|
||||
* 设置自助核销接口
|
||||
*/
|
||||
CARD_SELF_CONSUME_CELL_SET(API_DEFAULT_HOST_URL, "/card/selfconsumecell/set"),
|
||||
;
|
||||
|
||||
private String prefix;
|
||||
private String path;
|
||||
@ -694,7 +735,25 @@ public interface WxMpApiUrl {
|
||||
/**
|
||||
* 删除群发接口.
|
||||
*/
|
||||
MESSAGE_MASS_DELETE_URL(API_DEFAULT_HOST_URL, "/cgi-bin/message/mass/delete");
|
||||
MESSAGE_MASS_DELETE_URL(API_DEFAULT_HOST_URL, "/cgi-bin/message/mass/delete"),
|
||||
|
||||
|
||||
/**
|
||||
* 获取群发速度.
|
||||
*/
|
||||
MESSAGE_MASS_SPEED_GET_URL(API_DEFAULT_HOST_URL, "/cgi-bin/message/mass/speed/get"),
|
||||
|
||||
|
||||
/**
|
||||
* 设置群发速度.
|
||||
*/
|
||||
MESSAGE_MASS_SPEED_SET_URL(API_DEFAULT_HOST_URL, "/cgi-bin/message/mass/speed/set"),
|
||||
|
||||
|
||||
/**
|
||||
* 查询群发消息发送状态【订阅号与服务号认证后均可用】
|
||||
*/
|
||||
MESSAGE_MASS_GET_URL(API_DEFAULT_HOST_URL, "/cgi-bin/message/mass/get");
|
||||
|
||||
private String prefix;
|
||||
private String path;
|
||||
|
Loading…
Reference in New Issue
Block a user