Authored by huangyCode

新增上传接口

@@ -9,6 +9,7 @@ const router = express.Router(); // eslint-disable-line @@ -9,6 +9,7 @@ const router = express.Router(); // eslint-disable-line
9 const multipartMiddleware = multipart(); 9 const multipartMiddleware = multipart();
10 10
11 router.post('/xianyu/upload/idcard', multipartMiddleware, upload.uploadIdCard); 11 router.post('/xianyu/upload/idcard', multipartMiddleware, upload.uploadIdCard);
  12 +router.post('/xianyu/upload/im', multipartMiddleware, upload.uploadIdIm);
12 13
13 router.get('/xianyu/passport/login/taobao', passport.login.taobaoLogin); 14 router.get('/xianyu/passport/login/taobao', passport.login.taobaoLogin);
14 router.get('/xianyu/passport/callback/taobao', passport.login.taobaoCallback); 15 router.get('/xianyu/passport/callback/taobao', passport.login.taobaoCallback);
@@ -71,6 +71,15 @@ const uploadIdCard = (req, res, next) => { @@ -71,6 +71,15 @@ const uploadIdCard = (req, res, next) => {
71 }).then(res.json).catch(next); 71 }).then(res.json).catch(next);
72 } 72 }
73 73
  74 +const uploadIdIm = (req, res, next) => {
  75 + upload({
  76 + files: req.files && req.files.file || [],
  77 + type: 'image',
  78 + bucket: 'imserver'
  79 + }).then(res.json).catch(next);
  80 +}
  81 +
74 module.exports = { 82 module.exports = {
75 - uploadIdCard 83 + uploadIdCard,
  84 + uploadIdIm
76 }; 85 };