Skip to content

Commit 6958142

Browse files
silloybinarywang
authored andcommitted
#1199 开放平台模块增加部分第三方平台代小程序实现业务的接口(包括查询服务商的当月提审限额和加急次数,加急审核申请)
* 🎨 统一异常输出 * ✨ 增加代小程序实现业务接口
1 parent fdaefcb commit 6958142

File tree

5 files changed

+262
-4
lines changed

5 files changed

+262
-4
lines changed

weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxMaErrorMsgEnum.java

Lines changed: 174 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,180 @@ public enum WxMaErrorMsgEnum {
271271
/**
272272
* 订单无效.
273273
*/
274-
CODE_89300(89300, "订单无效");
274+
CODE_89300(89300, "订单无效"),
275+
276+
/**
277+
* 代小程序实现业务的错误码,部分和小程序业务一致
278+
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Mini_Programs/Intro.html
279+
*/
280+
CODE_85060(85060, "无效的taskid"),
281+
282+
CODE_85027(85027, "身份证绑定管理员名额达到上限"),
283+
284+
CODE_85061(85061, "手机号绑定管理员名额达到上限"),
285+
286+
CODE_85026(85026, "微信号绑定管理员名额达到上限"),
287+
288+
CODE_85063(85063, "身份证黑名单"),
289+
290+
CODE_85062(85062, "手机号黑名单"),
291+
292+
CODE_85016(85016, "域名数量超过限制"),
293+
294+
CODE_85017(85017, "没有新增域名,请确认小程序已经添加了域名或该域名是否没有在第三方平台添加"),
295+
296+
CODE_85018(85018, "域名没有在第三方平台设置"),
297+
298+
CODE_89019(89019, "业务域名无更改,无需重复设置"),
299+
300+
CODE_89020(89020, "尚未设置小程序业务域名,请先在第三方平台中设置小程序业务域名后在调用本接口"),
301+
302+
CODE_89021(89021, "请求保存的域名不是第三方平台中已设置的小程序业务域名或子域名"),
303+
304+
CODE_89029(89029, "业务域名数量超过限制"),
305+
306+
CODE_89231(89231, "个人小程序不支持调用 setwebviewdomain 接口"),
307+
308+
CODE_91001(91001, "不是公众号快速创建的小程序"),
309+
310+
CODE_91002(91002, "小程序发布后不可改名"),
311+
312+
CODE_91003(91003, "改名状态不合法"),
313+
314+
CODE_91004(91004, "昵称不合法"),
315+
316+
CODE_91005(91005, "昵称 15 天主体保护"),
317+
318+
CODE_91006(91006, "昵称命中微信号"),
319+
320+
CODE_91007(91007, "昵称已被占用"),
321+
322+
CODE_91008(91008, "昵称命中 7 天侵权保护期"),
323+
324+
CODE_91009(91009, "需要提交材料"),
325+
326+
CODE_91010(91010, "其他错误"),
327+
328+
CODE_91011(91011, "查不到昵称修改审核单信息"),
329+
330+
CODE_91012(91012, "其他错误"),
331+
332+
CODE_91013(91013, "占用名字过多"),
333+
334+
CODE_91014(91014, "+号规则 同一类型关联名主体不一致"),
335+
336+
CODE_91015(91015, "原始名不同类型主体不一致"),
337+
338+
CODE_91016(91016, "名称占用者 ≥2"),
339+
340+
CODE_91017(91017, "+号规则 不同类型关联名主体不一致"),
341+
342+
CODE_40097(40097, "参数错误"),
343+
344+
CODE_41006(41006, "media_id 不能为空"),
345+
346+
CODE_46001(46001, "media_id 不存在"),
347+
348+
CODE_40009(40009, "图片尺寸太大"),
349+
350+
CODE_53202(53202, "本月头像修改次数已用完"),
351+
352+
CODE_53200(53200, "本月功能介绍修改次数已用完"),
353+
354+
CODE_53201(53201, "功能介绍内容命中黑名单关键字"),
355+
356+
CODE_85083(85083, "搜索标记位被封禁,无法修改"),
357+
358+
CODE_85084(85084, "非法的 status 值,只能填 0 或者 1"),
359+
360+
CODE_85013(85013, "无效的自定义配置"),
361+
362+
CODE_85014(85014, "无效的模版编号"),
363+
364+
CODE_85043(85043, "模版错误"),
365+
366+
CODE_85044(85044, "代码包超过大小限制"),
367+
368+
CODE_85045(85045, "ext_json 有不存在的路径"),
369+
370+
CODE_85046(85046, "tabBar 中缺少 path"),
371+
372+
CODE_85047(85047, "pages 字段为空"),
373+
374+
CODE_85048(85048, "ext_json 解析失败"),
375+
376+
CODE_80082(80082, "没有权限使用该插件"),
377+
378+
CODE_80067(80067, "找不到使用的插件"),
379+
380+
CODE_80066(80066, "非法的插件版本"),
381+
382+
CODE_86000(86000, "不是由第三方代小程序进行调用"),
383+
384+
CODE_86001(86001, "不存在第三方的已经提交的代码"),
385+
386+
CODE_85006(85006, "标签格式错误"),
387+
388+
CODE_85007(85007, "页面路径错误"),
389+
390+
CODE_85008(85008, "类目填写错误"),
391+
392+
CODE_85009(85009, "已经有正在审核的版本"),
393+
394+
CODE_85010(85010, "item_list 有项目为空"),
395+
396+
CODE_85011(85011, "标题填写错误"),
397+
398+
CODE_85023(85023, "审核列表填写的项目数不在 1-5 以内"),
399+
400+
CODE_85077(85077, "小程序类目信息失效(类目中含有官方下架的类目,请重新选择类目)"),
401+
402+
CODE_86002(86002, "小程序还未设置昵称、头像、简介。请先设置完后再重新提交"),
403+
404+
CODE_85085(85085, "近 7 天提交审核的小程序数量过多,请耐心等待审核完毕后再次提交"),
405+
406+
CODE_85086(85086, "提交代码审核之前需提前上传代码"),
407+
408+
CODE_85087(85087, "小程序已使用 api navigateToMiniProgram,请声明跳转 appid 列表后再次提交"),
409+
410+
CODE_85012(85012, "无效的审核 id"),
411+
412+
CODE_87013(87013, "撤回次数达到上限(每天一次,每个月 10 次)"),
413+
414+
CODE_85019(85019, "没有审核版本"),
415+
416+
CODE_85020(85020, "审核状态未满足发布"),
417+
418+
CODE_87011(87011, "现网已经在灰度发布,不能进行版本回退"),
419+
420+
CODE_87012(87012, "该版本不能回退,可能的原因:1:无上一个线上版用于回退 2:此版本为已回退版本,不能回退 3:此版本为回退功能上线之前的版本,不能回退"),
421+
422+
CODE_85079(85079, "小程序没有线上版本,不能进行灰度"),
423+
424+
CODE_85080(85080, "小程序提交的审核未审核通过"),
425+
426+
CODE_85081(85081, "无效的发布比例"),
427+
428+
CODE_85082(85082, "当前的发布比例需要比之前设置的高"),
429+
430+
CODE_85021(85021, "状态不可变"),
431+
432+
CODE_85022(85022, "action 非法"),
433+
434+
CODE_89401(89401, "系统不稳定,请稍后再试,如多次失败请通过社区反馈"),
435+
436+
CODE_89402(89402, "该审核单不在待审核队列,请检查是否已提交审核或已审完"),
437+
438+
CODE_89403(89403, "本单属于平台不支持加急种类,请等待正常审核流程"),
439+
440+
CODE_89404(89404, "本单已加速成功,请勿重复提交"),
441+
442+
CODE_89405(89405, "本月加急额度不足,请提升提审质量以获取更多额度"),
443+
444+
CODE_85064(85064, "找不到模版/草稿"),
445+
446+
CODE_85065(85065, "模版库已满"),
447+
;
275448

276449
private int code;
277450
private String msg;

weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/SimplePostRequestExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static RequestExecutor<String, String> create(RequestHttp requestHttp) {
3636
case OK_HTTP:
3737
return new OkHttpSimplePostRequestExecutor(requestHttp);
3838
default:
39-
return null;
39+
throw new IllegalArgumentException("非法请求参数");
4040
}
4141
}
4242

weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,17 @@ public interface WxOpenMaService extends WxMaService {
196196
String API_GET_GRAY_RELEASE_PLAN = "https://api.weixin.qq.com/wxa/getgrayreleaseplan";
197197

198198

199+
/**
200+
* 查询服务商的当月提审限额和加急次数(Quota)
201+
*/
202+
String API_QUERY_QUOTA = "https://api.weixin.qq.com/wxa/queryquota";
203+
204+
/**
205+
* 加急审核申请
206+
*/
207+
String API_SPEED_AUDIT = "https://api.weixin.qq.com/wxa/speedupaudit";
208+
209+
199210
/**
200211
* 获得小程序的域名配置信息
201212
*/
@@ -397,4 +408,17 @@ public interface WxOpenMaService extends WxMaService {
397408
*/
398409
WxOpenMaGrayReleasePlanResult getgrayreleaseplan() throws WxErrorException;
399410

411+
412+
/**
413+
* 查询服务商的当月提审限额和加急次数(Quota)
414+
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Mini_Programs/code/query_quota.html
415+
*/
416+
WxOpenMaQueryQuotaResult queryQuota() throws WxErrorException;
417+
418+
/**
419+
* 加急审核申请
420+
* 有加急次数的第三方可以通过该接口,对已经提审的小程序进行加急操作,加急后的小程序预计2-12小时内审完。
421+
*/
422+
Boolean speedAudit(Long auditid) throws WxErrorException;
423+
400424
}

weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ public WxOpenResult changeWxaSearchStatus(Integer status) throws WxErrorExceptio
228228
*/
229229
@Override
230230
public WxOpenMaSearchStatusResult getWxaSearchStatus() throws WxErrorException {
231-
JsonObject paramJson = new JsonObject();
232-
String response = post(API_GET_WXA_SEARCH_STATUS, GSON.toJson(paramJson));
231+
String response = get(API_GET_WXA_SEARCH_STATUS, null);
233232
return WxMaGsonBuilder.create().fromJson(response, WxOpenMaSearchStatusResult.class);
234233
}
235234

@@ -523,6 +522,32 @@ public WxOpenMaGrayReleasePlanResult getgrayreleaseplan() throws WxErrorExceptio
523522
}
524523

525524

525+
/**
526+
* 查询服务商的当月提审限额和加急次数(Quota)
527+
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Mini_Programs/code/query_quota.html
528+
*/
529+
@Override
530+
public WxOpenMaQueryQuotaResult queryQuota() throws WxErrorException {
531+
String response = get(API_QUERY_QUOTA, null);
532+
return WxMaGsonBuilder.create().fromJson(response, WxOpenMaQueryQuotaResult.class);
533+
}
534+
535+
536+
537+
/**
538+
* 加急审核申请
539+
* 有加急次数的第三方可以通过该接口,对已经提审的小程序进行加急操作,加急后的小程序预计2-12小时内审完。
540+
*/
541+
@Override
542+
public Boolean speedAudit(Long auditid) throws WxErrorException {
543+
JsonObject params = new JsonObject();
544+
params.addProperty("auditid", auditid);
545+
String response = post(API_SPEED_AUDIT, GSON.toJson(params));
546+
WxOpenResult result = WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
547+
return result.isSuccess();
548+
}
549+
550+
526551
/**
527552
* 将字符串对象转化为GsonArray对象
528553
*
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package me.chanjar.weixin.open.bean.result;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import lombok.EqualsAndHashCode;
6+
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
7+
8+
/**
9+
* 微信开放平台小程序当前分阶段发布详情
10+
*/
11+
@Data
12+
@EqualsAndHashCode(callSuper = true)
13+
public class WxOpenMaQueryQuotaResult extends WxOpenResult {
14+
15+
private static final long serialVersionUID = 5915265985261653007L;
16+
17+
@SerializedName("rest")
18+
private Integer rest;
19+
20+
@SerializedName("limit")
21+
private Integer limit;
22+
23+
@SerializedName("speedup_rest")
24+
private Integer speedupRest;
25+
26+
@SerializedName("speedup_limit")
27+
private Integer speedupLimit;
28+
29+
30+
@Override
31+
public String toString() {
32+
return WxOpenGsonBuilder.create().toJson(this);
33+
}
34+
35+
36+
}

0 commit comments

Comments
 (0)