Skip to content

Commit

Permalink
update to v1.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhutu committed Jul 11, 2016
1 parent 859388f commit c58f4f3
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 24 deletions.
8 changes: 8 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### [查看Releases](https://github.com/jackhutu/jackblog-api-koa/releases)

1.1.7 / 2016-07-11
==================

* 修复七牛错误
* 更新依赖包及相关代码

1.1.6 / 2016-05-07
==================

Expand Down
Empty file added logs/development-error.log.0
Empty file.
Empty file added logs/development-error.log.1
Empty file.
4 changes: 4 additions & 0 deletions logs/test-error.log.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":20915,"level":50,"msg":"登录密码错误 { username: '[email protected]' }","time":"2016-07-10T09:33:37.721Z","v":0}
{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":20915,"level":50,"msg":"登录用户名错误 { username: '[email protected]' }","time":"2016-07-10T09:33:37.731Z","v":0}
{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":20915,"level":50,"msg":"未验证用户登录 { username: '[email protected]' }","time":"2016-07-10T09:33:37.810Z","v":0}
{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":20915,"level":50,"msg":"被阻止登录 { username: '[email protected]' }","time":"2016-07-10T09:33:37.880Z","v":0}
4 changes: 4 additions & 0 deletions logs/test-error.log.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":50988,"level":50,"msg":"登录密码错误 { username: '[email protected]' }","time":"2016-05-07T13:20:27.385Z","v":0}
{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":50988,"level":50,"msg":"登录用户名错误 { username: '[email protected]' }","time":"2016-05-07T13:20:27.395Z","v":0}
{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":50988,"level":50,"msg":"未验证用户登录 { username: '[email protected]' }","time":"2016-05-07T13:20:27.477Z","v":0}
{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":50988,"level":50,"msg":"被阻止登录 { username: '[email protected]' }","time":"2016-05-07T13:20:27.556Z","v":0}
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jackblog-api-koa",
"version": "1.1.6",
"version": "1.1.7",
"description": "jackblog API koa版",
"main": "server/app.js",
"scripts": {
Expand All @@ -23,29 +23,29 @@
},
"homepage": "https://github.com/jackhutu/jackblog-api-koa#readme",
"dependencies": {
"bluebird": "^3.3.5",
"bluebird": "^3.4.1",
"bunyan": "^1.8.1",
"ccap": "^0.6.4",
"ccap": "^0.6.10",
"co": "^4.6.0",
"debug": "^2.2.0",
"ioredis": "^1.15.1",
"ioredis": "^2.2.0",
"koa": "^1.2.0",
"koa-bodyparser": "^2.0.1",
"koa-bodyparser": "^2.2.0",
"koa-compose": "^2.4.0",
"koa-compress": "^1.0.9",
"koa-cors": "0.0.16",
"koa-generic-session": "^1.10.2",
"koa-generic-session": "^1.11.1",
"koa-json": "^1.1.3",
"koa-jwt": "^1.2.0",
"koa-logger": "^1.3.0",
"koa-multer": "0.0.2",
"koa-passport": "^1.3.1",
"koa-redis": "^2.0.1",
"koa-redis": "^2.1.1",
"koa-response-time": "^1.0.2",
"koa-router": "^5.3.0",
"lodash": "^4.11.2",
"markdown-it": "^6.0.1",
"mongoose": "^4.4.15",
"lodash": "^4.13.1",
"markdown-it": "^7.0.0",
"mongoose": "^4.5.3",
"passport-github": "^1.1.0",
"passport-local": "^1.0.0",
"passport-qq": "0.0.3",
Expand All @@ -57,12 +57,12 @@
"gulp": "^3.9.1",
"gulp-coveralls": "^0.1.4",
"gulp-env": "^0.4.0",
"gulp-istanbul": "^0.10.4",
"gulp-istanbul": "^1.0.0",
"gulp-mocha": "^2.2.0",
"gulp-nodemon": "^2.0.6",
"gulp-nodemon": "^2.1.0",
"gulp-sequence": "^0.4.5",
"gulp-util": "^3.0.7",
"should": "^8.3.1",
"should": "^9.0.2",
"sinon": "^1.17.4",
"supertest": "^1.2.0"
}
Expand Down
8 changes: 4 additions & 4 deletions server/api/article/article.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,23 +267,23 @@ exports.getPrenext = function *(next) {
//获取首页图片
exports.getIndexImage = function *() {
//从redis中获取
const imagesCount = yield redis.llen('indexImages')
const imagesCount = yield redis.llen('indexImages');
if(!imagesCount || imagesCount < 1){
this.status = 200;
this.body = {success:true,img:config.defaultIndexImage};
try{
if(config.qiniu.app_key !== '' && config.qiniu.app_secret !== ''){
const result = yield qiniuHelper.list('blog/index','',30)
const result = yield qiniuHelper.list('blog/index','',30);
result.items.map(function (item) {
redis.lpush('indexImages',config.qiniu.domain + item.key + '-600x1500q80');
})
}
}catch(err){
redis.del('indexImages')
redis.del('indexImages');
}
return;
}else{
const images = yield redis.lrange('indexImages', 0, 30)
const images = yield redis.lrange('indexImages', 0, 30);
const index = _.random(images.length - 1);
this.status = 200;
return this.body = {success:true,img:images[index]};
Expand Down
3 changes: 3 additions & 0 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fs.readdirSync(modelsPath).forEach(function (file) {
require(modelsPath + '/' + file);
}
});
//mongoose promise 风格
mongoose.Promise = require('bluebird');
//mongoose.Promise = global.Promise;

// 初始化数据
if(config.seedDB && config.env === 'development') {
Expand Down
14 changes: 7 additions & 7 deletions server/util/qiniu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ qiniu.conf.SECRET_KEY = config.qiniu.app_secret;
var client = new qiniu.rs.Client();

//对一般操作进行promise封装
var uploadFile = Promise.promisify(qiniu.io.putFile, qiniu.io);
var uploadFile = Promise.promisify(qiniu.io.putFile);
var moveFile = Promise.promisify(client.move, client);
var copyFile = Promise.promisify(client.copy, client);
var removeFile = Promise.promisify(client.remove, client);
var statFile = Promise.promisify(client.stat, client);
var fetchFile = Promise.promisify(client.fetch, client);
var allList = Promise.promisify(qiniu.rsf.listPrefix, qiniu.ref);
var allList = Promise.promisify(qiniu.rsf.listPrefix);

exports.uploadFile = uploadFile;
exports.moveFile = moveFile;
Expand Down Expand Up @@ -79,11 +79,11 @@ exports.remove = function(key){
列出所有资源,
prefix 想要查询的资源前缀缺省值为空字符串,limit 限制条数缺省值为1000
marker 上一次列举返回的位置标记,作为本次列举的起点信息。缺省值为空字符串
delimiter 指定目录分隔符,列出所有公共前缀(模拟列出目录效果)。默认值为空字符串。
*/
exports.list = function(prefix, marker, limit){
return this.allList(bucket, prefix, marker, limit).then(function(result){
exports.list = function(prefix, marker, limit, delimiter){
var delimiter = delimiter || ''
return this.allList(bucket, prefix, marker, limit, delimiter).then(function(result){
return result;
})
};


};

0 comments on commit c58f4f3

Please sign in to comment.