Browse Source

1.图片按实际排序

huangxiaodong 1 day ago
parent
commit
9f653af95f

+ 4 - 4
创维盒子/code/AppDelegate/PrefixHeader.pch

@@ -108,8 +108,8 @@ isBangsScreen; \
 //弃用 #define shareService   @"http://testprivacy.phone.armclouding.com:1801/h5/#/pages/fileSharing/index?productType=Private-X&token="
 
 //创维盒子 测试地址 正在使用
-#define CloudService   @"http://testprivacy.phone.androidscloud.com:1801"
-#define shareService   @"http://testprivacy.phone.androidscloud.com:1801/h5/#/pages/fileSharing/index?productType=Private-X&token="
+//#define CloudService   @"http://testprivacy.phone.androidscloud.com:1801"
+//#define shareService   @"http://testprivacy.phone.androidscloud.com:1801/h5/#/pages/fileSharing/index?productType=Private-X&token="
 
 //预生产环境
 //#define CloudService   @"http://testprivacy.phone.androidscloud.com:10900"
@@ -120,8 +120,8 @@ isBangsScreen; \
 //弃用 #define shareService   @"http://hiboxde.armclouding.com:7780/h5/#/pages/fileSharing/index?productType=Private-X&token="
 
 //生产环境 1.4.3 开始使用
-//#define CloudService   @"http://hiboxde.androidscloud.com:7780"
-//#define shareService   @"http://hiboxde.androidscloud.com:7780/h5/#/pages/fileSharing/index?productType=Private-X&token="
+#define CloudService   @"http://hiboxde.androidscloud.com:7780"
+#define shareService   @"http://hiboxde.androidscloud.com:7780/h5/#/pages/fileSharing/index?productType=Private-X&token="
 
 
 #define AESCODEKEEYY @"fvO8gAfNSr1tbdQe"

+ 1 - 0
创维盒子/code/Class/Set/uploadFile/model/uploadFileDataModel.h

@@ -30,6 +30,7 @@ typedef enum{
 @interface uploadFileDataModel : JSONModel
 //目前上传用到的字段有
 @property (nonatomic, strong) PHAsset *asset;
+@property (nonatomic, copy) NSString *assetTimerStr;//拍照或者视频时间
 @property (nonatomic, copy) NSString *localIdentifier;
 @property (nonatomic, copy)  NSString *filename;//image or video
 @property (nonatomic, copy)  NSString *videoFirstImageName;

+ 1 - 0
创维盒子/code/Class/Set/uploadFile/uploadFileManager/uploadFileManager.m

@@ -140,6 +140,7 @@ static uploadFileManager * cur_uploadFileShareInstance = nil;
     for (TZAssetModel * model in indexPathsForSelectedItems) {
         uploadFileDataModel * curModel = [uploadFileDataModel new];
         curModel.asset = model.asset;
+        curModel.assetTimerStr = [iTools convertToBeijingTimeString:curModel.asset.creationDate];
         curModel.localIdentifier = model.asset.localIdentifier;
         
         BOOL isRepeatingTasksType = NO;

+ 2 - 0
创维盒子/code/Class/Set/uploadFile/uploadFileView/uploadFileRecordCell.m

@@ -242,6 +242,7 @@
                     PHFetchResult *fetchResult = [PHAsset fetchAssetsWithLocalIdentifiers:@[curLocalIdentifier] options:nil];
                     PHAsset *asset = fetchResult.firstObject;
                     curUploadFileDataModel.asset = asset;
+                    curUploadFileDataModel.assetTimerStr = [iTools convertToBeijingTimeString:curUploadFileDataModel.asset.creationDate];
                 }
                 
                 if(!curUploadFileDataModel.asset){
@@ -283,6 +284,7 @@
                     PHFetchResult *fetchResult = [PHAsset fetchAssetsWithLocalIdentifiers:@[curLocalIdentifier] options:nil];
                     PHAsset *asset = fetchResult.firstObject;
                     curUploadFileDataModel.asset = asset;
+                    curUploadFileDataModel.assetTimerStr = [iTools convertToBeijingTimeString:curUploadFileDataModel.asset.creationDate];
                 }
                 
                 PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];

+ 7 - 0
创维盒子/code/Helpers/iTools.h

@@ -195,6 +195,13 @@ NS_ASSUME_NONNULL_BEGIN
 
 //获取文件大小
 + (unsigned long long)getFileSize:(NSString *)filePath;
+
+/**
+ * 将 NSDate 转换为北京时间字符串
+ * @param date 要转换的 NSDate 对象
+ * @return 北京时间字符串
+ */
++ (NSString *)convertToBeijingTimeString:(NSDate *)date;
 @end
 
 NS_ASSUME_NONNULL_END

+ 29 - 0
创维盒子/code/Helpers/iTools.m

@@ -1480,4 +1480,33 @@ static const char encodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopq
         return 0;
     }
 }
+
+/**
+ * 将 NSDate 转换为北京时间字符串
+ * @param date 要转换的 NSDate 对象
+ * @return 北京时间字符串
+ */
++ (NSString *)convertToBeijingTimeString:(NSDate *)date {
+    if (!date) {
+        return nil;
+    }
+    
+    NSString * format = @"yyyy:MM:dd HH:mm:ss";
+    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
+    
+    // 1. 设置时区为北京时间
+    NSTimeZone *beijingTimeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];
+    formatter.timeZone = beijingTimeZone;
+    
+    // 2. 设置地区为中国(影响星期、月份等本地化显示)
+    NSLocale *chinaLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
+    formatter.locale = chinaLocale;
+    
+    // 3. 设置日期格式
+    formatter.dateFormat = format;
+    
+    // 4. 格式转换
+    return [formatter stringFromDate:date];
+}
+
 @end

+ 8 - 0
创维盒子/code/NAS/nasBackupsManager/nasMixBackupsManager.m

@@ -280,6 +280,7 @@
                     PHFetchResult *fetchResult = [PHAsset fetchAssetsWithLocalIdentifiers:@[curLocalIdentifier] options:nil];
                     PHAsset *asset = fetchResult.firstObject;
                     operation.fileModel.asset = asset;
+                    operation.fileModel.assetTimerStr = [iTools convertToBeijingTimeString:asset.creationDate];
                 }
                 
                 PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];
@@ -336,6 +337,7 @@
                 PHFetchResult *fetchResult = [PHAsset fetchAssetsWithLocalIdentifiers:@[curLocalIdentifier] options:nil];
                 PHAsset *asset = fetchResult.firstObject;
                 operation.fileModel.asset = asset;
+                operation.fileModel.assetTimerStr = [iTools convertToBeijingTimeString:asset.creationDate];
             }
             
 
@@ -623,6 +625,12 @@
      */
     [request setValue:[NSString stringWithFormat:@"multipart/form-data; charset=utf-8; boundary=%@", Kboundary3] forHTTPHeaderField:@"Content-Type"];
     
+    NSString *creationDate = dataModel.assetTimerStr;
+    if (creationDate && params
+        && [params isKindOfClass:[NSMutableDictionary class]]) {
+        [params setValue:creationDate forKey:@"fileTime"];
+    }
+    
     /// body
     NSMutableData *boydData = [NSMutableData data];
     // 2.1 边界符号(开始边界)

+ 11 - 2
创维盒子/code/NAS/nasUploadManager/nasMixUploadManager.m

@@ -373,6 +373,7 @@
                     PHFetchResult *fetchResult = [PHAsset fetchAssetsWithLocalIdentifiers:@[curLocalIdentifier] options:nil];
                     PHAsset *asset = fetchResult.firstObject;
                     operation.fileModel.asset = asset;
+                    operation.fileModel.assetTimerStr = [iTools convertToBeijingTimeString:asset.creationDate];
                 }
                 
                 PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];
@@ -435,6 +436,7 @@
                 PHFetchResult *fetchResult = [PHAsset fetchAssetsWithLocalIdentifiers:@[curLocalIdentifier] options:nil];
                 PHAsset *asset = fetchResult.firstObject;
                 operation.fileModel.asset = asset;
+                operation.fileModel.assetTimerStr = [iTools convertToBeijingTimeString:asset.creationDate];
             }
             
 
@@ -756,6 +758,12 @@
      */
     [request setValue:[NSString stringWithFormat:@"multipart/form-data; charset=utf-8; boundary=%@", Kboundary2] forHTTPHeaderField:@"Content-Type"];
     
+    NSString *creationDate = dataModel.assetTimerStr;
+    if (creationDate && params
+        && [params isKindOfClass:[NSMutableDictionary class]]) {
+        [params setValue:creationDate forKey:@"fileTime"];
+    }
+    
     /// body
     NSMutableData *boydData = [NSMutableData data];
     // 2.1 边界符号(开始边界)
@@ -794,7 +802,7 @@
     
     
     NSString *serverFileName = dataModel.filename;  //name
-
+    //NSString *creationDate = dataModel.assetTimerStr;
     
     // filename已命名文件;  name相当于一个key, 这个名字和服务器保持一致
     /*
@@ -802,7 +810,8 @@
      */
     //2.3 拼接数据(创建一个字符串来拼装)
     NSMutableString *string = [NSMutableString new];
-    [string appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\" ", @"file", serverFileName];
+    [string appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"; ", @"file", serverFileName];
+    //[string appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"; fileTime=\"%@\" ", @"file", serverFileName,creationDate];
     //[string appendFormat:@"%@", KNewLine];
     [string appendFormat:@"\r\n"];
     [string appendFormat:@"Content-Type:%@", serverContentTypes];

+ 1 - 0
创维盒子/code/NAS/nasUploadManager/nasUploadFileManager.m

@@ -125,6 +125,7 @@
     for (TZAssetModel * model in indexPathsForSelectedItems) {
         uploadFileDataModel * curModel = [uploadFileDataModel new];
         curModel.asset = model.asset;
+        curModel.assetTimerStr = [iTools convertToBeijingTimeString:model.asset.creationDate];
         curModel.localIdentifier = model.asset.localIdentifier;
         
         BOOL isRepeatingTasksType = NO;

+ 6 - 0
创维盒子/code/NAS/nasUploadManager/nasUploadManager.m

@@ -90,6 +90,12 @@
      */
     [request setValue:[NSString stringWithFormat:@"multipart/form-data; charset=utf-8; boundary=%@", Kboundary] forHTTPHeaderField:@"Content-Type"];
     
+    NSString *creationDate = dataModel.assetTimerStr;
+    if (creationDate && params
+        && [params isKindOfClass:[NSMutableDictionary class]]) {
+        [params setValue:creationDate forKey:@"fileTime"];
+    }
+    
     /// body
     NSMutableData *boydData = [NSMutableData data];
     // 2.1 边界符号(开始边界)