Skip to content

Commit

Permalink
fix qiniu
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhutu committed Feb 26, 2016
1 parent e257919 commit 3a981fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions server/util/qiniu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand All @@ -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;
});
Expand All @@ -57,21 +57,21 @@ 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;
});
};
//复制文件
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;
})
};
Expand Down

0 comments on commit 3a981fa

Please sign in to comment.