Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.jetbrains.annotations.Nullable;

import java.util.Objects;

/**
* 模版消息行业枚举.
Expand Down Expand Up @@ -195,15 +198,19 @@ public enum WxMpTemplateIndustryEnum {
*
* @param firstClass 主行业名称
* @param secondClass 副行业名称
* @return .
* @return 如果找不到, 返回null
*/
@Nullable
public static WxMpTemplateIndustryEnum findByClass(String firstClass, String secondClass) {
for (WxMpTemplateIndustryEnum industryEnum : WxMpTemplateIndustryEnum.values()) {
if (industryEnum.firstClass.equals(firstClass) && industryEnum.secondClass.contains(secondClass)) {
return industryEnum;
}
}

if (Objects.equals(firstClass, "其他") && Objects.equals(secondClass, "其他")) {
//微信返回的其他行业实际上为"其他",而非"其它",此处兼容处理
return OTHER;
}
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaAuditMediaUploadResult;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.bean.ma.WxMaOpenCommitExtInfo;
import me.chanjar.weixin.open.bean.ma.WxMaScheme;
import me.chanjar.weixin.open.bean.message.WxOpenMaSubmitAuditMessage;
import me.chanjar.weixin.open.bean.result.*;
Expand Down Expand Up @@ -379,14 +378,18 @@ WxOpenMaDomainResult modifyDomain(String action, List<String> requestDomains, Li
/**
* 1、为授权的小程序帐号上传小程序代码
*
* @param templateId 代码模板ID
* @param userVersion 用户定义版本
* @param userDesc 用户定义版本描述
* @param extInfo 第三方自定义的配置
* @param templateId 代码模板ID
* @param userVersion 用户定义版本
* @param userDesc 用户定义版本描述
* @param extJsonObject 为了方便第三方平台的开发者引入 extAppid 的开发调试工作,引入ext.json配置文件概念,该参数则是用于控制ext.json配置文件的内容。
* 如果是普通模板可以使用 WxMaOpenCommitExtInfo 类构造参数,
* 如果是标准模板可支持的参数为:{"extAppid":'', "ext": {}, "window": {}} 所以可以使用 WxMaOpenCommitStandardExt 构造参数
* @return the wx open result
* @throws WxErrorException the wx error exception
* @see me.chanjar.weixin.open.bean.ma.WxMaOpenCommitStandardExt
* @see me.chanjar.weixin.open.bean.ma.WxMaOpenCommitExtInfo
*/
WxOpenResult codeCommit(Long templateId, String userVersion, String userDesc, WxMaOpenCommitExtInfo extInfo) throws WxErrorException;
WxOpenResult codeCommit(Long templateId, String userVersion, String userDesc, Object extJsonObject) throws WxErrorException;

/**
* 获取体验小程序的体验二维码
Expand Down Expand Up @@ -617,6 +620,7 @@ WxOpenMaDomainResult modifyDomain(String action, List<String> requestDomains, Li

/**
* 为小程序开通小商店组件
*
* @return
*/
WxOpenResult registerShopComponent() throws WxErrorException;
Expand All @@ -630,6 +634,7 @@ WxOpenMaDomainResult modifyDomain(String action, List<String> requestDomains, Li

/**
* 小程序审核 提审素材上传接口
*
* @return
*/
WxMaAuditMediaUploadResult uploadMedia(File file) throws WxErrorException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import me.chanjar.weixin.open.api.WxOpenComponentService;
import me.chanjar.weixin.open.api.WxOpenMaBasicService;
import me.chanjar.weixin.open.api.WxOpenMaService;
import me.chanjar.weixin.open.bean.ma.WxMaOpenCommitExtInfo;
import me.chanjar.weixin.open.bean.ma.WxMaQrcodeParam;
import me.chanjar.weixin.open.bean.ma.WxMaScheme;
import me.chanjar.weixin.open.bean.message.WxOpenMaSubmitAuditMessage;
Expand Down Expand Up @@ -185,13 +184,13 @@ public WxOpenResult updateShowWxaItem(Integer flag, String mpAppId) throws WxErr
}

@Override
public WxOpenResult codeCommit(Long templateId, String userVersion, String userDesc, WxMaOpenCommitExtInfo extInfo) throws WxErrorException {
public WxOpenResult codeCommit(Long templateId, String userVersion, String userDesc, Object extJsonObject) throws WxErrorException {
JsonObject params = new JsonObject();
params.addProperty("template_id", templateId);
params.addProperty("user_version", userVersion);
params.addProperty("user_desc", userDesc);
//注意:ext_json必须是字符串类型
params.addProperty("ext_json", GSON.toJson(extInfo));
params.addProperty("ext_json", GSON.toJson(extJsonObject));
String response = post(API_CODE_COMMIT, GSON.toJson(params));
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import java.io.Serializable;

/**
* 小程序代码模板
*
* @author <a href="https://github.com/charmingoh">Charming</a>
* @since 2018-04-26 17:10
*/
Expand Down Expand Up @@ -37,7 +39,7 @@ public class WxOpenMaCodeTemplate implements Serializable {
* 模板类型 0对应普通模板,1对应标准模板
*/
@SerializedName(value = "templateType", alternate = "template_type")
private Integer template_type;
private Integer templateType;

/**
* 开发者上传草稿时间 / 被添加为模版的时间
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,29 @@
* https://developers.weixin.qq.com/miniprogram/dev/devtools/ext.html#%E5%B0%8F%E7%A8%8B%E5%BA%8F%E6%A8%A1%E6%9D%BF%E5%BC%80%E5%8F%91
* </p>
*
* <p>
* ext_json补充说明
* 文档地址:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/code/commit.html
* 为了便于第三方平台使用同一个小程序模板为不同的小程序提供服务,第三方可以将自定义信息放置在 ext_json 中,在模板小程序中,可以使用 wx.getExtConfigSync 接口获取自定义信息,从而区分不同的小程序。详见:小程序模板开发
* ext_json 中的参数可选,参数详见小程序配置;但是,如果是模板id为标准模板库的模板id,则ext_json可支持的参数为:{"extAppid":'', "ext": {}, "window": {}}
* ext_json 中有限支持 pages,支持配置模板页面的子集(ext_json 中不可新增页面)。
* ext_json 中有限支持 subPackages,支持配置模板分包及其页面的子集(ext_json 中配置的分包必须已声明于模板中,且不可新增分包页面)。
* ext_json支持plugins配置,该配置会覆盖模板中的app.json中的plugins配置。关于plugin的使用详情请参考使用插件。
* 如果代码中已经有配置,则配置的合并规则为:
* ext整体替换
* pages整体替换
* extPages中找到对应页面,同级覆盖page.json
* window同级覆盖
* extAppid直接加到app.json
* networkTimeout同级覆盖
* customOpen整体替换
* tabbar同级覆盖
* functionPages整体替换
* subPackages整体替换
* navigateToMiniProgaramAppIdList:整体替换
* plugins整体替换
* </p>
*
* @author yqx
* @date 2018/9/13
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package me.chanjar.weixin.open.bean.ma;

import com.google.gson.annotations.SerializedName;
import lombok.Data;

import java.io.Serializable;
import java.util.Map;

/**
* 微信第三方平台上传代码到小程序代码标准模板时的参数
* ext_json补充说明
* 文档地址:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/code/commit.html
* 为了便于第三方平台使用同一个小程序模板为不同的小程序提供服务,第三方可以将自定义信息放置在 ext_json 中,在模板小程序中,可以使用 wx.getExtConfigSync 接口获取自定义信息,从而区分不同的小程序。详见:小程序模板开发
* ext_json 中的参数可选,参数详见小程序配置;但是,如果是模板id为标准模板库的模板id,则ext_json可支持的参数为:{"extAppid":'', "ext": {}, "window": {}}
* ext_json 中有限支持 pages,支持配置模板页面的子集(ext_json 中不可新增页面)。
* ext_json 中有限支持 subPackages,支持配置模板分包及其页面的子集(ext_json 中配置的分包必须已声明于模板中,且不可新增分包页面)。
* ext_json支持plugins配置,该配置会覆盖模板中的app.json中的plugins配置。关于plugin的使用详情请参考使用插件。
* 如果代码中已经有配置,则配置的合并规则为:
* ext整体替换
* pages整体替换
* extPages中找到对应页面,同级覆盖page.json
* window同级覆盖
* extAppid直接加到app.json
* networkTimeout同级覆盖
* customOpen整体替换
* tabbar同级覆盖
* functionPages整体替换
* subPackages整体替换
* navigateToMiniProgaramAppIdList:整体替换
* plugins整体替换
* </p>
*
* @author <a href="https://www.sacoc.cn">广州跨界</a>
* @since 2021/08/12
*/
@Data
public class WxMaOpenCommitStandardExt implements Serializable {

private static final long serialVersionUID = 4595618023108631477L;

/**
* 授权小程序Appid,可填入商户小程序AppID,以区分不同商户
*/
@SerializedName("create_time")
private String extAppId;

/**
* 开发自定义的数据字段
*/
private Map<String, Object> ext;

/**
* 授权小程序Appid,可填入商户小程序AppID,以区分不同商户
*/
private Map<String, Object> window;
}