写作模式, sync问题

This commit is contained in:
life
2015-03-08 01:52:30 +08:00
parent 4a48b11a10
commit 49bec63ded
20 changed files with 522 additions and 7318 deletions

12
node_modules/file.js generated vendored
View File

@@ -258,16 +258,16 @@ var File = {
// 访问api, 得到图片
function getImageFromApi() {
log('从远程得到图片 ' + fileId);
console.log('fetch servers image ' + fileId);
Api.getImage(fileId, function(fileLocalPath, filename) {
if(fileLocalPath) {
log('图片保存到本地成功');
console.log('save image to local');
// 保存到本地数据库中
me.addImageForce(fileId, fileLocalPath, function(doc) {
if(doc) {
log('保存到本地数据库成功');
console.log('save image to local success');
} else {
log('保存到数据库失败');
console.log('save image to local error');
}
callback(fileLocalPath);
// return me.retImage(fileLocalPath, res);
@@ -275,7 +275,7 @@ var File = {
} else {
// 远程取不到图片, 是没有网络? 还是远程真的没有了
// TODO
log('取不远程的图片' + fileId);
console.log("cann't get server's image" + fileId);
callback(false);
// return me.e404(res);
}
@@ -285,7 +285,7 @@ var File = {
// has表示本地数据库有记录
me.getImageLocalPath(fileId, function(has, fileLocalPath) {
// 本地有
log('re img')
console.log('re img')
console.log(fileLocalPath);
// console.log(fs.exists(fileLocalPath));
if(has && fileLocalPath) {