调用nutzwx的add_material方法,代码如下:
if (err != null && err.getAdaptorErr() != null) {
return NutMap.NEW().addv("code", 1).addv("msg", "文件不合法");
} else if (tf == null) {
return Result.error("空文件");
} else {
WxApi2 wxApi2 = wxConfigService.getWxApi2(wxid);
log.debug("file::::"+tf.getFile().getAbsolutePath());
WxResp resp = wxApi2.add_material("video", tf.getFile());
log.debug(resp);
if (resp.errcode() != 0) {
return Result.error(resp.errmsg());
}
return Result.success("上传成功", resp.get("media_id"));
}
错误日志:
```
2020-08-21 00:16:03,237 cn.wizzer.app.web.modules.controllers.platform.wx.WxReplyNewsController.uploadMedia(WxReplyNewsController.java:144) DEBUG - file::::C:\Users\Administrator\nutzwk\upload\tmp\00\00\00\00\00\00\00\00.mp4
2020-08-21 00:16:03,253 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) DEBUG - select access_token,access_token_expires,access_token_lastat from wx_config where id=?
| 1 |
|----------------------------------|
| ee3907ae917b4bfc9f9164de37a24074 |
For example:> "select access_token,access_token_expires,access_token_lastat from wx_config where id='ee3907ae917b4bfc9f9164de37a24074'"
2020-08-21 00:16:03,253 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) DEBUG - select access_token,access_token_expires,access_token_lastat from wx_config where id=?
| 1 |
|----------------------------------|
| ee3907ae917b4bfc9f9164de37a24074 |
For example:> "select access_token,access_token_expires,access_token_lastat from wx_config where id='ee3907ae917b4bfc9f9164de37a24074'"
2020-08-21 00:16:15,331 cn.wizzer.app.web.modules.controllers.platform.wx.WxReplyNewsController.uploadMedia(WxReplyNewsController.java:146) DEBUG - {errcode=41005, errmsg=media data missing hint: [gPHxuA0175d234] rid: 5f3ea1cf-693662cf-0ffbbc1a}
```