mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-05 17:38:05 +08:00
🆕 #2613【企业微信】增加管理商品图册的相关接口
This commit is contained in:
parent
1030115751
commit
8831056a5f
@ -1,17 +1,16 @@
|
||||
package me.chanjar.weixin.cp.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import lombok.NonNull;
|
||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
import me.chanjar.weixin.cp.bean.external.*;
|
||||
import me.chanjar.weixin.cp.bean.external.contact.*;
|
||||
import me.chanjar.weixin.cp.bean.oa.WxCpApprovalInfoQueryFilter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -977,7 +976,8 @@ public interface WxCpExternalContactService {
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/update_intercept_rule?access_token=ACCESS_TOKEN
|
||||
* <pre>
|
||||
*/
|
||||
WxCpInterceptRuleResultResp updateInterceptRule(WxCpInterceptRuleResp ruleResp) throws WxErrorException;
|
||||
WxCpInterceptRuleResultResp updateInterceptRule(WxCpInterceptRuleResp ruleResp) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 删除敏感词规则
|
||||
@ -987,6 +987,42 @@ public interface WxCpExternalContactService {
|
||||
* <pre>
|
||||
* @param rule_id 规则id
|
||||
*/
|
||||
WxCpBaseResp delInterceptRule(String rule_id) throws WxErrorException;
|
||||
WxCpBaseResp delInterceptRule(String rule_id) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 创建商品图册
|
||||
* 企业和第三方应用可以通过此接口增加商品
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:<a href="https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_product_album?access_token=ACCESS_TOKEN">https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_product_album?access_token=ACCESS_TOKEN</a>
|
||||
* 文档地址:<a href="https://developer.work.weixin.qq.com/document/path/95096#%E5%88%9B%E5%BB%BA%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C">https://developer.work.weixin.qq.com/document/path/95096#%E5%88%9B%E5%BB%BA%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C</a>
|
||||
* <pre>
|
||||
* @param wxCpProductAlbumInfo 商品图册信息
|
||||
* @return 商品id
|
||||
*/
|
||||
String addProductAlbum(WxCpProductAlbumInfo wxCpProductAlbumInfo) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 编辑商品图册
|
||||
* 企业和第三方应用可以通过此接口修改商品信息
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:<a href="https://qyapi.weixin.qq.com/cgi-bin/externalcontact/update_product_album?access_token=ACCESS_TOKEN">https://qyapi.weixin.qq.com/cgi-bin/externalcontact/update_product_album?access_token=ACCESS_TOKEN</a>
|
||||
* 文档地址:<a href="https://developer.work.weixin.qq.com/document/path/95096#%E7%BC%96%E8%BE%91%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C">https://developer.work.weixin.qq.com/document/path/95096#%E7%BC%96%E8%BE%91%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C</a>
|
||||
* <pre>
|
||||
* @param wxCpProductAlbumInfo 商品图册信息
|
||||
*/
|
||||
void updateProductAlbum(WxCpProductAlbumInfo wxCpProductAlbumInfo) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 删除商品图册
|
||||
* 企业和第三方应用可以通过此接口删除商品信息
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:<a href="https://qyapi.weixin.qq.com/cgi-bin/externalcontact/delete_product_album?access_token=ACCESS_TOKEN">https://qyapi.weixin.qq.com/cgi-bin/externalcontact/delete_product_album?access_token=ACCESS_TOKEN</a>
|
||||
* 文档地址:<a href="https://developer.work.weixin.qq.com/document/path/95096#%E5%88%A0%E9%99%A4%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C">https://developer.work.weixin.qq.com/document/path/95096#%E5%88%A0%E9%99%A4%E5%95%86%E5%93%81%E5%9B%BE%E5%86%8C</a>
|
||||
* <pre>
|
||||
* @param productId 商品id
|
||||
*/
|
||||
void deleteProductAlbum(String productId) throws WxErrorException;
|
||||
}
|
||||
|
@ -2,12 +2,6 @@ package me.chanjar.weixin.cp.api.impl;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.UUID;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||
@ -27,9 +21,13 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.ExternalContact.*;
|
||||
|
||||
@ -857,10 +855,32 @@ public class WxCpExternalContactServiceImpl implements WxCpExternalContactServic
|
||||
@Override
|
||||
public WxCpBaseResp delInterceptRule(String rule_id) throws WxErrorException {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("rule_id",rule_id);
|
||||
jsonObject.addProperty("rule_id", rule_id);
|
||||
return WxCpBaseResp
|
||||
.fromJson(this.mainService.post(this.mainService.getWxCpConfigStorage().getApiUrl(DEL_INTERCEPT_RULE), jsonObject));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addProductAlbum(WxCpProductAlbumInfo wxCpProductAlbumInfo) throws WxErrorException {
|
||||
String url = this.mainService.getWxCpConfigStorage().getApiUrl(ADD_PRODUCT_ALBUM);
|
||||
String responseContent = this.mainService.post(url, wxCpProductAlbumInfo.toJson());
|
||||
JsonObject tmpJson = GsonParser.parse(responseContent);
|
||||
return tmpJson.get("product_id").getAsString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProductAlbum(WxCpProductAlbumInfo wxCpProductAlbumInfo) throws WxErrorException {
|
||||
String url = this.mainService.getWxCpConfigStorage().getApiUrl(UPDATE_PRODUCT_ALBUM);
|
||||
this.mainService.post(url, wxCpProductAlbumInfo.toJson());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProductAlbum(String productId) throws WxErrorException {
|
||||
JsonObject o = new JsonObject();
|
||||
o.addProperty("product_id", productId);
|
||||
String url = this.mainService.getWxCpConfigStorage().getApiUrl(DELETE_PRODUCT_ALBUM);
|
||||
this.mainService.post(url, o.toString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -50,4 +50,8 @@ public class WxCpProductAlbumInfo implements Serializable {
|
||||
return WxCpGsonBuilder.create().fromJson(json, WxCpProductAlbumInfo.class);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -273,8 +273,12 @@ public interface WxCpApiPathConsts {
|
||||
String GET_GROUP_MSG_LIST_V2 = "/cgi-bin/externalcontact/get_groupmsg_list_v2";
|
||||
String GET_GROUP_MSG_RESULT = "/cgi-bin/externalcontact/get_group_msg_result";
|
||||
|
||||
|
||||
String GET_PRODUCT_ALBUM = "/cgi-bin/externalcontact/get_product_album";
|
||||
String GET_PRODUCT_ALBUM_LIST = "/cgi-bin/externalcontact/get_product_album_list";
|
||||
String ADD_PRODUCT_ALBUM = "/cgi-bin/externalcontact/add_product_album";
|
||||
String UPDATE_PRODUCT_ALBUM = "/cgi-bin/externalcontact/update_product_album";
|
||||
String DELETE_PRODUCT_ALBUM = "/cgi-bin/externalcontact/delete_product_album";
|
||||
|
||||
String GROUP_WELCOME_TEMPLATE_ADD = "/cgi-bin/externalcontact/group_welcome_template/add";
|
||||
String GROUP_WELCOME_TEMPLATE_EDIT = "/cgi-bin/externalcontact/group_welcome_template/edit";
|
||||
|
Loading…
Reference in New Issue
Block a user