骑行保存数据改成同步
This commit is contained in:
1 parent
f3f17c1256
commit
d4fa2bbb69
6 files changed
+38
-29
No files matched your search
@@ -119,13 +119,13 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
|
||||
public RouteResultParam selectParam { get; set; }
|
||||
|
||||
public void SaveWithLocalRecordAysnc(CyclingModel cyclingModel, RouteResultParam selectParam, string imageName,string recordId,string path)
|
||||
public int SaveWithLocalRecordAysnc(CyclingModel cyclingModel, RouteResultParam selectParam, string imageName,string recordId,string path)
|
||||
{
|
||||
Saved = true;
|
||||
Dictionary<MapInterruptRecord, List<string>> recordData = new Dictionary<MapInterruptRecord, List<string>>();
|
||||
if (RiderDatas.Count <= 0)
|
||||
{
|
||||
return ;
|
||||
return -1;
|
||||
}
|
||||
string newFileName = Guid.NewGuid().ToString();
|
||||
int FTP = Helper.GetFtp();
|
||||
@@ -230,37 +230,43 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
Debug.Log(ex.Message);
|
||||
}
|
||||
recordData.Add(interruptRecord, files);
|
||||
SaveDataAysnc(recordData, path);
|
||||
return SaveDataAysnc(recordData, path);
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存数据
|
||||
/// </summary>
|
||||
/// <param name="base64Image"></param>
|
||||
/// <returns></returns>
|
||||
public void SaveDataAysnc(Dictionary<MapInterruptRecord, List<string>> data,string path)
|
||||
public int SaveDataAysnc(Dictionary<MapInterruptRecord, List<string>> data,string path)
|
||||
{
|
||||
if (data != null && data.Count > 0)
|
||||
{
|
||||
//var path = Helper.GetDataDir("MapWorkoutRecords");
|
||||
Task.Run(() => {
|
||||
//Task.Run(() => {
|
||||
try
|
||||
{
|
||||
var record = data.FirstOrDefault();
|
||||
MapInterruptRecordApi service = new MapInterruptRecordApi();
|
||||
var result = service.Add(record.Key, record.Value);
|
||||
|
||||
//删除文件
|
||||
try
|
||||
|
||||
if (result.result)
|
||||
{
|
||||
if (result.result && Directory.Exists(path))
|
||||
//删除文件
|
||||
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
Helper.DelectDir(path);
|
||||
}
|
||||
//});
|
||||
return result.data.RankingId;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Log(e.Message);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Log(e.Message);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user