From d852bafe55aeafe5218d09933910a3b75a9b397a Mon Sep 17 00:00:00 2001 From: lipengjava <lipbb@qq.com> Date: Fri, 19 May 2017 18:24:31 +0800 Subject: [PATCH] upload media --- src/media_upload_foreign.js | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+), 0 deletions(-) create mode 100644 src/media_upload_foreign.js diff --git a/src/media_upload_foreign.js b/src/media_upload_foreign.js new file mode 100644 index 0000000..64ce5df --- /dev/null +++ b/src/media_upload_foreign.js @@ -0,0 +1,60 @@ +/** + * @api {post} /DocSharing/mediaUploadForeign 26.上传伴音文件 + * @apiName mediaUploadForeign + * @apiGroup doc + * @apiVersion 1.6.0 + * @apiDescription 上传伴音文件。<br/> + * 只允许 mp3 文件。<br/> + * 需要用到22接口中得到的文档服务器地址。 + * + * @apiParam {String} siteId 站点标识 + * @apiParam {Long} timestamp 时间戳 + * @apiParam {String} authId MD5(key+siteId+timestamp), 其中 key 为与系统约定的加密 key + * @apiParam {String} createUserName 上传者名字 + * @apiParam {String} createUserID 上传者 id + * + * @apiParamExample {form-data} 请求示例 + <html> + <body> + 上传文件程序应用示例 + <form action="mediaUploadForeign" method="post" enctype="multipart/form-data"> + 请选择要上传的文件<input type="file" name="upfile" size="50"> + siteID:<input type="text" name="siteID" size="50" value="admin"> + timestamp:<input type="text" name="timestamp" size="50" value="1442286924284"> + authId:<input type="text" name="authId" size="50" value="68e150f469667a9972b7f82bc6ec0877"> + createUserName:<input type="text" name="createUserName" size="50" value="admin"> + createUserID:<input type="text" name="createUserID" size="50" value="402880f44fa5bcac014fa5dff5330001"> + <input type="submit" value="提交"> + </form> + </body> + </html> + * + * @apiSuccess {Array} docList + * @apiSuccess {Object} docList.doc + * @apiSuccess {int} docList.doc.errorCode + * 0:成功 <br/> + * 1:siteId 错误 <br/> + * 2:站点未到生效日期 <br/> + * 3:站点过期 <br/> + * 4:authId 错误 <br/> + * 5:authId 不能重复使用 <br/> + * 6:timestamp 超时 <br/> + * 7:上传格式不正确 <br/> + * @apiSuccess {String} docList.doc.mediaId id + * @apiSuccess {String} docList.doc.filepath 绝对路径 + * @apiSuccess {String} docList.doc.relativeLocation 相对路径 + * @apiSuccess {String} docList.doc.filetype 文件类型 + * @apiSuccess {String} docList.doc.fileName 文件名称 + * + * @apiSuccessExample {xml} 返回示例 + <?xml version=“1.0” encoding="UTF-8"?> + <result> + <errorCode>0</errorCode> + <mediaId>402880f84ff3bf77014ff3c0bcdb0002</mediaId> + <filepath>http://127.0.0.1:8080/DocSharing/data/0/20151009-104200/0eb9a0c3781f5017c866127067a7e968.mp3</filepath> + <relativeLocation>/DocSharing/data/0/20151009-104200/0eb9a0c3781f5017c866127067a7e968.mp3</relativeLocation> + <filetype>mp3</filetype> + <fileName>凤凰传奇 - 我和草原有个约定.mp3</fileName> + </result> + * + */ -- libgit2 0.24.0