This commit is contained in:
life
2015-04-12 23:28:54 +08:00
parent f78349822c
commit c567103193
34 changed files with 1970 additions and 251 deletions

18
src/node_modules/file.js generated vendored
View File

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