Skip to content

Commit

Permalink
fix qiniu helper
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhutu committed Feb 25, 2016
1 parent 8f69696 commit e257919
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 25 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
[coveralls-url]: https://coveralls.io/github/jackhutu/jackblog-api-koa?branch=master

## 简介
Jackblog 是使用 Node.js MongoDB 开发的个人博客系统,前后端分离,仿简书模板.此为服务端koa版.
Jackblog 是使用 Node.js + MongoDB + 其它客户端框架, 开发的个人博客系统,前后端分离,仿简书模板.此为服务端koa版.
服务端有:
[express版](https://github.com/jackhutu/jackblog-api-es5)
[koa版](https://github.com/jackhutu/jackblog-api-koa)
[express版](https://github.com/jackhutu/jackblog-api-express)
[koa版](https://github.com/jackhutu/jackblog-api-koa)
客户端有:
[angular1.x版](https://github.com/jackhutu/jackblog-angular1)
[react redux 版](https://github.com/jackhutu/jackblog-react-redux)
[vue 版](https://github.com/jackhutu/jackblog-vue)
移动端有:
[react native 版](https://github.com/jackhutu/jackblog-react-native-redux)

Expand Down
6 changes: 6 additions & 0 deletions logs/development-error.log.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":49622,"level":50,"msg":"hello","time":"2016-01-27T04:48:19.454Z","v":0}
{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":49795,"level":50,"msg":"hello","time":"2016-01-27T04:51:58.809Z","v":0}
{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":49881,"level":50,"msg":"hello","time":"2016-01-27T04:53:22.933Z","v":0}
{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":50542,"level":50,"登录用户名错误!":{"username":"[email protected]"},"msg":"","time":"2016-01-27T05:06:59.382Z","v":0}
{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":50630,"level":50,"msg":"","username":"[email protected]","time":"2016-01-27T05:08:53.900Z","v":0}
{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":50722,"level":50,"msg":"登录用户名错误 { username: '[email protected]' }","time":"2016-01-27T05:10:39.517Z","v":0}
13 changes: 4 additions & 9 deletions server/api/article/article.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,10 @@ exports.getIndexImage = function *() {
if(!config.indexImages || config.indexImages.length < 1){
this.status = 200;
this.body = {success:true,img:config.defaultIndexImage};
qiniuHelper.list('blog/index','',10).then(function(result){
return Promise.map(result.items,function (item) {
return config.qiniu.domain + item.key + '-600x1500q80';
})
}).then(function (images) {
config.indexImages = images;
}).catch(function (err) {
config.indexImages = [];
});
const result = yield qiniuHelper.list('blog/index','',10)
config.indexImages = result.items.map(function (item) {
return config.qiniu.domain + item.key + '-600x1500q80';
})
return;
}else{
const images = config.indexImages;
Expand Down
12 changes: 1 addition & 11 deletions server/auth/auth.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function hasRole(roleRequired) {
* 生成token
*/
function signToken(id) {
return jwt.sign({ _id: id }, config.session.secrets, { expiresIn: '7d' });
return jwt.sign({ _id: id }, config.session.secrets, { expiresIn: '1y' });
}

/**
Expand All @@ -80,16 +80,6 @@ function snsPassport() {
yield next;
}
])
// .use(authToken(false))
// .use(function( req, res, next) {
// req.session.passport = {
// redirectUrl: req.query.redirectUrl || '/'
// }
// if(req.user){
// req.session.passport.userId = req.user._id;
// }
// next();
// });
}

exports.isAuthenticated = isAuthenticated;
Expand Down
2 changes: 1 addition & 1 deletion server/auth/local/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function checkCaptcha() {
}
}
if(error_msg){
this.status = 400;
this.status = 422;
return this.body = {error_msg:error_msg}
}
yield next;
Expand Down
2 changes: 1 addition & 1 deletion server/util/qiniu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ prefix 想要查询的资源前缀缺省值为空字符串,limit 限制条数缺
marker 上一次列举返回的位置标记,作为本次列举的起点信息。缺省值为空字符串
*/
exports.list = function(prefix, marker, limit){
return this.allList(bucket, prefix, marker, limit).spread(function(result,response){
return this.allList(bucket, prefix, marker, limit).then(function(result){
return result;
})
};
Expand Down

0 comments on commit e257919

Please sign in to comment.