|
|
|
@@ -6,6 +6,10 @@ import com.google.gson.GsonBuilder; |
|
|
|
import com.google.gson.reflect.TypeToken; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.WxWeappCodeStatus; |
|
|
|
import com.iformall.enums.EnumWeappAuditStatus; |
|
|
|
import com.iformall.enums.EnumWeappReleaseStatus; |
|
|
|
import com.iformall.service.WxWeappCodeStatusService; |
|
|
|
import com.iformall.service.wechat.WxOpenService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
@@ -42,6 +46,9 @@ public class WechatWeappCodeController { |
|
|
|
@Autowired |
|
|
|
private WxOpenService openService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxWeappCodeStatusService weappCodeStatusService; |
|
|
|
|
|
|
|
@ApiOperation(value = "为授权的小程序帐号上传小程序代码", notes = "extInfo参考https://mp.weixin.qq.com/debug/wxadoc/dev/framework/config.html") |
|
|
|
@PostMapping("/codeCommit") |
|
|
|
public ResultData codeCommit(Long templateId, String userVersion, String userDesc, String extInfoStr) { |
|
|
|
@@ -130,6 +137,15 @@ public class WechatWeappCodeController { |
|
|
|
WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); |
|
|
|
WxOpenMaSubmitAuditResult openRet = openMaService.submitAudit(subMessage); |
|
|
|
logger.info(openRet.toString()); |
|
|
|
WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId); |
|
|
|
if(codeStatus != null) { |
|
|
|
if(openRet.isSuccess()) { |
|
|
|
codeStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); |
|
|
|
} else { |
|
|
|
codeStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); |
|
|
|
} |
|
|
|
weappCodeStatusService.updateAuditStatus(codeStatus); |
|
|
|
} |
|
|
|
return new ResultData(openRet); |
|
|
|
} catch (WxErrorException e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
@@ -144,6 +160,16 @@ public class WechatWeappCodeController { |
|
|
|
WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); |
|
|
|
WxOpenMaQueryAuditResult openRet = openMaService.getAuditStatus(Long.valueOf(auditidStr)); |
|
|
|
logger.info(openRet.toString()); |
|
|
|
WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId); |
|
|
|
if(codeStatus != null) { |
|
|
|
if(openRet.getStatus().equals(0)) { |
|
|
|
codeStatus.setAuditStatus(EnumWeappAuditStatus.SUCCESS.getCode()); |
|
|
|
} else { |
|
|
|
codeStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); |
|
|
|
codeStatus.setAuditErrCode(Integer.valueOf(openRet.getErrcode())); |
|
|
|
} |
|
|
|
weappCodeStatusService.updateAuditStatus(codeStatus); |
|
|
|
} |
|
|
|
return new ResultData(openRet); |
|
|
|
} catch (WxErrorException e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
@@ -158,6 +184,16 @@ public class WechatWeappCodeController { |
|
|
|
WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); |
|
|
|
WxOpenMaQueryAuditResult openRet = openMaService.getLatestAuditStatus(); |
|
|
|
logger.info(openRet.toString()); |
|
|
|
WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId); |
|
|
|
if(codeStatus != null) { |
|
|
|
if(openRet.getStatus().equals(0)) { |
|
|
|
codeStatus.setAuditStatus(EnumWeappAuditStatus.SUCCESS.getCode()); |
|
|
|
} else { |
|
|
|
codeStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); |
|
|
|
codeStatus.setAuditErrCode(Integer.valueOf(openRet.getErrcode())); |
|
|
|
} |
|
|
|
weappCodeStatusService.updateAuditStatus(codeStatus); |
|
|
|
} |
|
|
|
return new ResultData(openRet); |
|
|
|
} catch (WxErrorException e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
@@ -172,6 +208,16 @@ public class WechatWeappCodeController { |
|
|
|
WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); |
|
|
|
WxOpenResult openRet = openMaService.releaesAudited(); |
|
|
|
logger.info(openRet.toString()); |
|
|
|
WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId); |
|
|
|
if(codeStatus != null) { |
|
|
|
if(openRet.getErrcode().equals('0')) { |
|
|
|
codeStatus.setReleaseStatus(EnumWeappReleaseStatus.SUCCESS.getCode()); |
|
|
|
} else { |
|
|
|
codeStatus.setReleaseStatus(EnumWeappReleaseStatus.FAIL.getCode()); |
|
|
|
codeStatus.setReleaseErrCode(Integer.valueOf(openRet.getErrcode())); |
|
|
|
} |
|
|
|
weappCodeStatusService.updateReleaseStatus(codeStatus); |
|
|
|
} |
|
|
|
return new ResultData(openRet); |
|
|
|
} catch (WxErrorException e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
@@ -186,7 +232,13 @@ public class WechatWeappCodeController { |
|
|
|
WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); |
|
|
|
WxOpenResult openRet = openMaService.revertCodeReleaes(); |
|
|
|
logger.info(openRet.toString()); |
|
|
|
return new ResultData(openRet); |
|
|
|
if(openRet.isSuccess()) { |
|
|
|
WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(appId); |
|
|
|
if(codeStatus != null) { |
|
|
|
codeStatus.setReleaseStatus(EnumWeappReleaseStatus.BACK.getCode()); |
|
|
|
weappCodeStatusService.updateReleaseStatus(codeStatus); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (WxErrorException e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
} |
|
|
|
|