|
|
|
@@ -8,9 +8,13 @@ import cn.binarywang.wx.miniapp.bean.template.WxMaTemplateListResult; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.WxAppinfo; |
|
|
|
import com.iformall.domain.po.WxAuthorizerInfo; |
|
|
|
import com.iformall.domain.po.WxTemplateMsg; |
|
|
|
import com.iformall.enums.EnumWxAuthorizationStatus; |
|
|
|
import com.iformall.service.WxAppinfoService; |
|
|
|
import com.iformall.service.WxAuthorizerInfoService; |
|
|
|
import com.iformall.service.WxTemplateMsgService; |
|
|
|
import com.iformall.service.wechat.FmOpenService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
@@ -39,6 +43,12 @@ public class WechatWeappMsgTemplateController { |
|
|
|
@Autowired |
|
|
|
private WxAuthorizerInfoService authorizerInfoService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxAppinfoService appinfoService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxTemplateMsgService templateMsgService; |
|
|
|
|
|
|
|
@ApiOperation("获取小程序模板库标题列表") |
|
|
|
@GetMapping("getTmpLibList") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@@ -123,6 +133,22 @@ public class WechatWeappMsgTemplateController { |
|
|
|
@ApiOperation("删除帐号下的某个模板") |
|
|
|
@PostMapping("delTemplate") |
|
|
|
public ResultData delTemplate(@RequestParam(value = "appId") String appId, @RequestParam(value = "templateId") String templateId) { |
|
|
|
// check app |
|
|
|
WxAppinfo appinfo = appinfoService.getByAppId(appId); |
|
|
|
if(appinfo == null) { |
|
|
|
String msg = "此appId未纳入管理,请联系管理员"; |
|
|
|
logger.error(msg); |
|
|
|
return new ResultData(Result.ERROR, msg); |
|
|
|
} |
|
|
|
WxTemplateMsg msgQ = new WxTemplateMsg(); |
|
|
|
msgQ.setTemplateId(templateId); |
|
|
|
msgQ.setTenantId(appinfo.getTenantId()); |
|
|
|
WxTemplateMsg msg = templateMsgService.getByObj(msgQ); |
|
|
|
if(msg != null) { |
|
|
|
String msgStr = "此模板正被使用,请不要删除"; |
|
|
|
logger.error(msgStr); |
|
|
|
return new ResultData(Result.ERROR, msgStr); |
|
|
|
} |
|
|
|
try { |
|
|
|
WxMaService maService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); |
|
|
|
maService.getTemplateService().delTemplate(templateId); |
|
|
|
|