1.优化断电重启文件丢失(服务器已上报),重新下载图片

This commit is contained in:
2025-11-26 19:59:22 +08:00
parent 3311bda502
commit 7df8c91156
2 changed files with 9 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.text.TextUtils;
import com.android.SharePreUtils;
import com.android.database.DaoManager;
import com.android.database.lib.AdsInfoBean;
import com.android.database.lib.AppBean;
@@ -593,6 +594,11 @@ public class AppManager {
favNaviBean = new FavNaviBean(index, adsInfoBean.getLocalFilePath(), adsInfoBean.getInfo(), null);
}else {//考虑下载好图片重启后变回 -tmp文件的情况
File tempFile=new File(adsInfoBean.getLocalFilePath()+"-tmp");
//对已上报的图片文件 系统丢失文件情况 重新下载
if(!tempFile.exists()&& SharePreUtils.filterByKeyValue(String.valueOf(adsInfoBean.getAdResourceId()),String.valueOf(0))){
LogUtils.loge("sys lost file which has upload,redownload it but not notify");
ADManager.getInstance().hasDownloadButLostFile(adsInfoBean,adsInfoBean.getAdUri(),0,adsInfoBean.getAdSize());
}
if(tempFile.exists()&&tempFile.length()==adsInfoBean.getAdSize()){
tempFile.renameTo(file);
tempFile.delete();