From 3a981fa9d5a11c2808ab8db71b36c0f910210fd7 Mon Sep 17 00:00:00 2001 From: Jack Hu Date: Fri, 26 Feb 2016 22:52:52 +0800 Subject: [PATCH] fix qiniu --- package.json | 6 +++--- server/util/qiniu/index.js | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 44e0325..968265c 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/jackhutu/jackblog-api-koa#readme", "dependencies": { - "bluebird": "^3.1.1", + "bluebird": "^3.3.3", "bunyan": "^1.5.1", "ccap": "^0.6.4", "co": "^4.6.0", @@ -50,8 +50,8 @@ "passport-local": "^1.0.0", "passport-qq": "0.0.3", "passport-weibo": "^0.1.2", - "qiniu": "^6.1.9", - "pm2": "^0.15.7" + "pm2": "^0.15.7", + "qiniu": "^6.1.9" }, "devDependencies": { "del": "^2.2.0", diff --git a/server/util/qiniu/index.js b/server/util/qiniu/index.js index f5be405..3c3d501 100644 --- a/server/util/qiniu/index.js +++ b/server/util/qiniu/index.js @@ -37,7 +37,7 @@ var bucket = config.qiniu.bucket; exports.bucket = bucket; //将网络图片上传到七牛服务器 exports.fetch = function (url,key) { - return this.fetchFile(url,bucket,key).spread(function (result,response) { + return this.fetchFile(url,bucket,key).then(function (result) { result.url = config.qiniu.domain + result.key; return result; }); @@ -47,7 +47,7 @@ exports.fetch = function (url,key) { exports.upload = function (path,key) { var extra = new qiniu.io.PutExtra(); var uptoken = getUptoken(config.qiniu.bucket); - return this.uploadFile(uptoken, key, path, extra).spread(function(result,response){ + return this.uploadFile(uptoken, key, path, extra).then(function(result){ result.url = config.qiniu.domain + result.key; return result; }); @@ -57,7 +57,7 @@ exports.upload = function (path,key) { exports.move = function(keySrc,keyDest){ var bucketSrc,bucketDest; bucketSrc = bucketDest = bucket; - return this.moveFile(bucketSrc, keySrc, bucketDest, keyDest).spread(function (result,response) { + return this.moveFile(bucketSrc, keySrc, bucketDest, keyDest).then(function (result) { return result; }); }; @@ -65,13 +65,13 @@ exports.move = function(keySrc,keyDest){ exports.copy = function(keySrc,keyDest){ var bucketSrc,bucketDest; bucketSrc = bucketDest = bucket; - return this.copyFile(bucketSrc, keySrc, bucketDest, keyDest).spread(function (result,response) { + return this.copyFile(bucketSrc, keySrc, bucketDest, keyDest).then(function (result) { return result; }); }; exports.remove = function(key){ - return this.removeFile(bucket,key).spread(function (result,response) { + return this.removeFile(bucket,key).then(function (result) { return result; }) };