| @@ -5,14 +5,12 @@ import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.service.wechat.WxOpenService; | import com.iformall.service.wechat.WxOpenService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | |||||
| import me.chanjar.weixin.common.error.WxErrorException; | import me.chanjar.weixin.common.error.WxErrorException; | ||||
| import me.chanjar.weixin.open.api.WxOpenMaService; | import me.chanjar.weixin.open.api.WxOpenMaService; | ||||
| import me.chanjar.weixin.open.bean.ma.WxMaOpenCommitExtInfo; | import me.chanjar.weixin.open.bean.ma.WxMaOpenCommitExtInfo; | ||||
| import me.chanjar.weixin.open.bean.message.WxOpenMaSubmitAuditMessage; | import me.chanjar.weixin.open.bean.message.WxOpenMaSubmitAuditMessage; | ||||
| import me.chanjar.weixin.open.bean.result.WxOpenMaCategoryListResult; | |||||
| import me.chanjar.weixin.open.bean.result.WxOpenMaPageListResult; | |||||
| import me.chanjar.weixin.open.bean.result.WxOpenMaSubmitAuditResult; | |||||
| import me.chanjar.weixin.open.bean.result.WxOpenResult; | |||||
| import me.chanjar.weixin.open.bean.result.*; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -41,6 +39,7 @@ public class WechatWeappCodeController { | |||||
| @Autowired | @Autowired | ||||
| private WxOpenService openService; | private WxOpenService openService; | ||||
| @ApiOperation(value = "为授权的小程序帐号上传小程序代码", notes = "extInfo参考https://mp.weixin.qq.com/debug/wxadoc/dev/framework/config.html") | |||||
| @PostMapping("/codeCommit") | @PostMapping("/codeCommit") | ||||
| public ResultData codeCommit(Long templateId, String userVersion, String userDesc, String extInfoStr) { | public ResultData codeCommit(Long templateId, String userVersion, String userDesc, String extInfoStr) { | ||||
| try { | try { | ||||
| @@ -55,6 +54,7 @@ public class WechatWeappCodeController { | |||||
| return new ResultData(Result.ERROR); | return new ResultData(Result.ERROR); | ||||
| } | } | ||||
| @ApiOperation("获取体验小程序的体验二维码") | |||||
| @GetMapping("/getQrcode") | @GetMapping("/getQrcode") | ||||
| public void getQrcode(String appId, String pagePath, Map<String, String> params, HttpServletResponse response, HttpServletRequest req) { | public void getQrcode(String appId, String pagePath, Map<String, String> params, HttpServletResponse response, HttpServletRequest req) { | ||||
| try { | try { | ||||
| @@ -89,6 +89,7 @@ public class WechatWeappCodeController { | |||||
| } | } | ||||
| } | } | ||||
| @ApiOperation("获取授权小程序帐号已设置的类目") | |||||
| @GetMapping("/getCategory") | @GetMapping("/getCategory") | ||||
| public ResultData getCategory(String appId) { | public ResultData getCategory(String appId) { | ||||
| try { | try { | ||||
| @@ -102,6 +103,7 @@ public class WechatWeappCodeController { | |||||
| return new ResultData(Result.ERROR); | return new ResultData(Result.ERROR); | ||||
| } | } | ||||
| @ApiOperation("获取小程序的第三方提交代码的页面配置") | |||||
| @GetMapping("/getPage") | @GetMapping("/getPage") | ||||
| public ResultData getPage(String appId) { | public ResultData getPage(String appId) { | ||||
| try { | try { | ||||
| @@ -115,6 +117,7 @@ public class WechatWeappCodeController { | |||||
| return new ResultData(Result.ERROR); | return new ResultData(Result.ERROR); | ||||
| } | } | ||||
| @ApiOperation("将第三方提交的代码包提交审核") | |||||
| @PostMapping("/submitAudit") | @PostMapping("/submitAudit") | ||||
| public ResultData submitAudit(String appId, String subMesgStr) { | public ResultData submitAudit(String appId, String subMesgStr) { | ||||
| try { | try { | ||||
| @@ -128,4 +131,101 @@ public class WechatWeappCodeController { | |||||
| } | } | ||||
| return new ResultData(Result.ERROR); | return new ResultData(Result.ERROR); | ||||
| } | } | ||||
| @ApiOperation("查询某个指定版本的审核状态") | |||||
| @PostMapping("/getAuditstatus") | |||||
| public ResultData getAuditstatus(String appId, String auditidStr) { | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| WxOpenMaQueryAuditResult openRet = openMaService.getAuditStatus(Long.valueOf(auditidStr)); | |||||
| logger.info(openRet.toString()); | |||||
| return new ResultData(openRet); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| return new ResultData(Result.ERROR); | |||||
| } | |||||
| @ApiOperation("查询最新一次提交的审核状态") | |||||
| @GetMapping("/getLatestAuditstatus") | |||||
| public ResultData get_latest_auditstatus(String appId) { | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| WxOpenMaQueryAuditResult openRet = openMaService.getLatestAuditStatus(); | |||||
| logger.info(openRet.toString()); | |||||
| return new ResultData(openRet); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| return new ResultData(Result.ERROR); | |||||
| } | |||||
| @ApiOperation("发布已通过审核的小程序") | |||||
| @PostMapping("/releaesAudited") | |||||
| public ResultData releaesAudited(String appId) { | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| WxOpenResult openRet = openMaService.releaesAudited(); | |||||
| logger.info(openRet.toString()); | |||||
| return new ResultData(openRet); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| return new ResultData(Result.ERROR); | |||||
| } | |||||
| @ApiOperation("小程序版本回退") | |||||
| @GetMapping("/revertCodeRelease") | |||||
| public ResultData revertCodeRelease(String appId) { | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| WxOpenResult openRet = openMaService.revertCodeReleaes(); | |||||
| logger.info(openRet.toString()); | |||||
| return new ResultData(openRet); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| return new ResultData(Result.ERROR); | |||||
| } | |||||
| @ApiOperation("查询当前设置的最低基础库版本及各版本用户占比") | |||||
| @GetMapping("/getSupportVersion") | |||||
| public ResultData getSupportVersion(String appId) { | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| String openRet = openMaService.getSupportVersion(); | |||||
| logger.info(openRet.toString()); | |||||
| return new ResultData(openRet); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| return new ResultData(Result.ERROR); | |||||
| } | |||||
| @ApiOperation("设置最低基础库版本") | |||||
| @GetMapping("/setSupportVersion") | |||||
| public ResultData setSupportVersion(String appId, String version) { | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| String openRet = openMaService.setSupportVersion(version); | |||||
| logger.info(openRet.toString()); | |||||
| return new ResultData(openRet); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| return new ResultData(Result.ERROR); | |||||
| } | |||||
| @ApiOperation(value = "小程序审核撤回", notes = "单个帐号每天审核撤回次数最多不超过1次,一个月不超过10次。") | |||||
| @GetMapping("/undoCodeAudit") | |||||
| public ResultData undoCodeAudit(String appId) { | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| openMaService.undoCodeAudit(); | |||||
| return new ResultData(); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| return new ResultData(Result.ERROR); | |||||
| } | |||||
| } | } | ||||