Commit ed113f9c authored by 神楽坂玲奈's avatar 神楽坂玲奈

fix

parent a1bbd10c
{ {
"name": "mycard-mobile", "name": "mycard-mobile",
"version": "1.0.15", "version": "1.0.17",
"license": "UNLISENCED", "license": "UNLISENCED",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
......
...@@ -66,12 +66,19 @@ export class StorageService { ...@@ -66,12 +66,19 @@ export class StorageService {
if (local_time) { if (local_time) {
// 远端有,本地有 // 远端有,本地有
if (local_time > remote_time) { if (remote_time > local_time) {
// 远端有,本地有,远端>本地,下载 // 远端有,本地有,远端>本地,下载
await this.download(local_path, remote_path, index_path, remote_time); await this.download(local_path, remote_path, index_path, remote_time);
} else if (local_time < remote_time) { } else if (remote_time < local_time) {
// 远端有,本地有,远端<本地,上传 // 远端有,本地有,远端<本地,上传
await this.upload(local_path, remote_path, index_path); await this.upload(local_path, remote_path, index_path);
} else {
// 远端有,本地有,远端=本地,更新记录
const time = local_time.toString();
if (localStorage.getItem(index_path) !== time) {
console.log('更新记录', index_path, time);
localStorage.setItem(index_path, time);
}
} }
} else { } else {
// 远端有,本地无 // 远端有,本地无
...@@ -103,6 +110,8 @@ export class StorageService { ...@@ -103,6 +110,8 @@ export class StorageService {
} }
} }
// fixme: 如果远端和本地同时没有,但是 localStorage 里有,要删除
// console.log('sync', 'done'); // console.log('sync', 'done');
this.working = false; this.working = false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment