11package com .wechat .ferry .controller ;
22
3+ import com .alibaba .fastjson2 .JSONObject ;
34import java .util .List ;
45
56import org .springframework .beans .factory .annotation .Autowired ;
1415import com .wechat .ferry .entity .vo .request .WxPpWcfDatabaseSqlReq ;
1516import com .wechat .ferry .entity .vo .request .WxPpWcfDatabaseTableReq ;
1617import com .wechat .ferry .entity .vo .request .WxPpWcfDeleteGroupMemberReq ;
18+ import com .wechat .ferry .entity .vo .request .WxPpWcfDownloadAttachReq ;
1719import com .wechat .ferry .entity .vo .request .WxPpWcfGroupMemberReq ;
1820import com .wechat .ferry .entity .vo .request .WxPpWcfInviteGroupMemberReq ;
1921import com .wechat .ferry .entity .vo .request .WxPpWcfPassFriendApplyReq ;
4143import com .wechat .ferry .entity .vo .response .WxPpWcfSendXmlMsgResp ;
4244import com .wechat .ferry .enums .ResponseCodeEnum ;
4345import com .wechat .ferry .service .WeChatDllService ;
46+ import com .wechat .ferry .utils .PathUtils ;
4447
4548import io .swagger .annotations .Api ;
4649import io .swagger .annotations .ApiOperation ;
4750import lombok .extern .slf4j .Slf4j ;
51+ import org .springframework .util .StringUtils ;
4852
4953/**
5054 * 控制层-微信DLL处理
@@ -182,7 +186,6 @@ public TResponse<WxPpWcfSendPatOnePatMsgResp> patOnePat(@Validated @RequestBody
182186 // public TResponse<Object> queryVoiceMsg() {
183187 // return TResponse.ok(ResponseCodeEnum.SUCCESS, list);
184188 // }
185-
186189 @ ApiOperation (value = "撤回消息" , notes = "revokeMsg" )
187190 @ PostMapping (value = "/revokeMsg" )
188191 public TResponse <Object > revokeMsg (@ Validated @ RequestBody WxPpWcfRevokeMsgReq request ) {
@@ -207,7 +210,6 @@ public TResponse<Object> revokeMsg(@Validated @RequestBody WxPpWcfRevokeMsgReq r
207210 // return TResponse.ok(ResponseCodeEnum.SUCCESS, list);
208211 // }
209212 //
210-
211213 @ ApiOperation (value = "通过好友申请" , notes = "passFriendApply" )
212214 @ PostMapping (value = "/passFriendApply" )
213215 public TResponse <Object > passFriendApply (@ Validated @ RequestBody WxPpWcfPassFriendApplyReq request ) {
@@ -257,16 +259,67 @@ public TResponse<Object> receiveTransfer(@Validated @RequestBody WxPpWcfReceiveT
257259 return TResponse .ok (ResponseCodeEnum .SUCCESS );
258260 }
259261
260- // @ApiOperation(value = "下载图片、视频、文件", notes = "queryMsgTypeList")
261- // @PostMapping(value = "/list/msgType")
262- // public TResponse<Object> queryMsgTypeList() {
263- // return TResponse.ok(ResponseCodeEnum.SUCCESS, list);
264- // }
265- //
266- // @ApiOperation(value = "解密图片", notes = "queryMsgTypeList")
267- // @PostMapping(value = "/list/msgType")
268- // public TResponse<Object> queryMsgTypeList() {
269- // return TResponse.ok(ResponseCodeEnum.SUCCESS, list);
270- // }
262+ /**
263+ * 下载视频 add by wmz 2025-05-01
264+ *
265+ * @param request
266+ * @return
267+ * @throws Exception
268+ */
269+ @ ApiOperation (value = "下载视频" , notes = "download_video" )
270+ @ PostMapping (value = "/download/video" )
271+ public TResponse <Object > downloadVideo (@ Validated @ RequestBody WxPpWcfDownloadAttachReq request ) throws Exception {
272+ String path = weChatDllService .downloadVideo (request );
273+ if (path != null ) {
274+ JSONObject pathJson = new JSONObject ();
275+ pathJson .put ("path" , path );
276+ return TResponse .ok (ResponseCodeEnum .SUCCESS , pathJson );
277+ }
278+ return TResponse .ok (ResponseCodeEnum .FAILED );
279+ }
280+
281+ /**
282+ * 下载图片 add by wmz 2025-05-02
283+ *
284+ * @param request
285+ * @return
286+ * @throws Exception
287+ */
288+ @ ApiOperation (value = "下载图片" , notes = "download_picture" )
289+ @ PostMapping (value = "/download/picture" )
290+ public TResponse <Object > downloadPicture (@ Validated @ RequestBody WxPpWcfDownloadAttachReq request ) throws Exception {
291+ //check parameter
292+ String dir = request .getDir ();
293+ if (!StringUtils .hasText (dir )) {
294+ log .info ("需要指定图片的路径dir" );
295+ return TResponse .fail ("需要指定图片的路径dir" );
296+ }
297+ boolean res = PathUtils .createDir (dir );
298+ if (!res ) {
299+ return TResponse .fail ("图片路径创建失败" + dir );
300+ }
301+
302+ String path = weChatDllService .downloadPicture (request );
303+ if (path != null ) {
304+ JSONObject pathJson = new JSONObject ();
305+ pathJson .put ("path" , path );
306+ return TResponse .ok (ResponseCodeEnum .SUCCESS , pathJson );
307+ }
308+ return TResponse .ok (ResponseCodeEnum .FAILED );
309+ }
310+
311+ /**
312+ * 暂未实现 add by mz 2025-05-01
313+ *
314+ * @param request
315+ * @return
316+ * @throws Exception
317+ */
318+ @ ApiOperation (value = "登陆二维码" , notes = "loginQR" )
319+ @ PostMapping (value = "/loginQR" )
320+ public TResponse <Object > loginQR (@ Validated @ RequestBody WxPpWcfDownloadAttachReq request ) throws Exception {
321+ String path = weChatDllService .loginQR ();
322+ return TResponse .ok (ResponseCodeEnum .SUCCESS , path );
323+ }
271324
272325}
0 commit comments