|
@@ -9,6 +9,7 @@ import com.kym.common.R;
|
|
|
import com.kym.service.MpRelationService;
|
|
import com.kym.service.MpRelationService;
|
|
|
import com.kym.service.wechat.WeixinMPService;
|
|
import com.kym.service.wechat.WeixinMPService;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
|
|
+import me.chanjar.weixin.mp.api.WxMpService;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
@@ -29,10 +30,13 @@ public class WeixinMPController {
|
|
|
|
|
|
|
|
private final WeixinMPService weixinMPService;
|
|
private final WeixinMPService weixinMPService;
|
|
|
private final MpRelationService mpRelationService;
|
|
private final MpRelationService mpRelationService;
|
|
|
|
|
+ private final WxMpService wxMpService;
|
|
|
|
|
|
|
|
- public WeixinMPController(WeixinMPService weixinMPService, MpRelationService mpRelationService) {
|
|
|
|
|
|
|
+ public WeixinMPController(WeixinMPService weixinMPService, MpRelationService mpRelationService,
|
|
|
|
|
+ WxMpService wxMpService) {
|
|
|
this.weixinMPService = weixinMPService;
|
|
this.weixinMPService = weixinMPService;
|
|
|
this.mpRelationService = mpRelationService;
|
|
this.mpRelationService = mpRelationService;
|
|
|
|
|
+ this.wxMpService = wxMpService;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -73,6 +77,22 @@ public class WeixinMPController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 导出当前公众号自定义菜单结构(调试用)
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping(value = "/exportMenu")
|
|
|
|
|
+ @SaIgnore
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public R<?> exportMenu() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ String menuJson = wxMpService.getMenuService().menuGet();
|
|
|
|
|
+ return R.success(menuJson);
|
|
|
|
|
+ } catch (WxErrorException e) {
|
|
|
|
|
+ log.error("导出菜单失败", e);
|
|
|
|
|
+ return R.failed(-1, "导出失败: " + e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 手动同步公众号关注用户(一次性触发)
|
|
* 手动同步公众号关注用户(一次性触发)
|
|
|
*/
|
|
*/
|