Эх сурвалжийг харах

移动 NetworkUtils 工具类的位置,同时修改RA Image 和 eSign const.h 文件,增加宏定义,纠正引用错误问题。

Ray Zhang 8 жил өмнө
parent
commit
77d2c6608f

BIN
Ants Contract/AntsContract.xcworkspace/xcuserdata/Ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 6 - 6
Ants Contract/Granite Expo eSign/Granite Expo eSign.xcodeproj/project.pbxproj

@@ -36,7 +36,6 @@
 		7128C2C71E1250FC00FF635B /* PDFUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 7128C2BD1E1250FC00FF635B /* PDFUtils.m */; };
 		7128C2C81E1250FC00FF635B /* TextUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 7128C2BF1E1250FC00FF635B /* TextUtils.m */; };
 		7128C2C91E1250FC00FF635B /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 7128C2C11E1250FC00FF635B /* Reachability.m */; };
-		7128C2CA1E1250FC00FF635B /* NetworkUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 7128C2C31E1250FC00FF635B /* NetworkUtils.m */; };
 		7128C2CB1E1250FC00FF635B /* RAUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 7128C2C51E1250FC00FF635B /* RAUtils.m */; };
 		7128C2D81E12510900FF635B /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 7128C2CE1E12510900FF635B /* ioapi.c */; };
 		7128C2D91E12510900FF635B /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = 7128C2D01E12510900FF635B /* mztools.c */; };
@@ -76,6 +75,7 @@
 		71CDA0901F75EE400079F8E6 /* DocumentTemplateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71CDA08F1F75EE400079F8E6 /* DocumentTemplateViewController.m */; };
 		71CDA0931F75EEBF0079F8E6 /* TemplateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71CDA0921F75EEBF0079F8E6 /* TemplateViewController.m */; };
 		71D5734F1F723260008179ED /* GEIC - Home Improvement Contract 2017 Desktop.json in Resources */ = {isa = PBXBuildFile; fileRef = 71D5734E1F723260008179ED /* GEIC - Home Improvement Contract 2017 Desktop.json */; };
+		71E9F6B91F8B48720052C78E /* NetworkUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 71E9F6B71F8B48720052C78E /* NetworkUtils.m */; };
 		71F8D0341EC057A2002003DB /* RANetworkTaskDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 71F8D0331EC057A2002003DB /* RANetworkTaskDelegate.m */; };
 /* End PBXBuildFile section */
 
@@ -134,8 +134,6 @@
 		7128C2BF1E1250FC00FF635B /* TextUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TextUtils.m; path = "../../../RedAnt ERP Mobile/common/TextUtils.m"; sourceTree = "<group>"; };
 		7128C2C01E1250FC00FF635B /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Reachability.h; path = "../../../RedAnt ERP Mobile/common/Reachability.h"; sourceTree = "<group>"; };
 		7128C2C11E1250FC00FF635B /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Reachability.m; path = "../../../RedAnt ERP Mobile/common/Reachability.m"; sourceTree = "<group>"; };
-		7128C2C21E1250FC00FF635B /* NetworkUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkUtils.h; path = "../../../RedAnt ERP Mobile/common/NetworkUtils.h"; sourceTree = "<group>"; };
-		7128C2C31E1250FC00FF635B /* NetworkUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NetworkUtils.m; path = "../../../RedAnt ERP Mobile/common/NetworkUtils.m"; sourceTree = "<group>"; };
 		7128C2C41E1250FC00FF635B /* RAUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAUtils.h; path = "../../../RedAnt ERP Mobile/common/RAUtils.h"; sourceTree = "<group>"; };
 		7128C2C51E1250FC00FF635B /* RAUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAUtils.m; path = "../../../RedAnt ERP Mobile/common/RAUtils.m"; sourceTree = "<group>"; };
 		7128C2CD1E12510900FF635B /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = crypt.h; path = "../../../RedAnt ERP Mobile/common/zip/minizip/crypt.h"; sourceTree = "<group>"; };
@@ -210,6 +208,8 @@
 		71CDA0911F75EEBF0079F8E6 /* TemplateViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateViewController.h; sourceTree = "<group>"; };
 		71CDA0921F75EEBF0079F8E6 /* TemplateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TemplateViewController.m; sourceTree = "<group>"; };
 		71D5734E1F723260008179ED /* GEIC - Home Improvement Contract 2017 Desktop.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "GEIC - Home Improvement Contract 2017 Desktop.json"; sourceTree = "<group>"; };
+		71E9F6B71F8B48720052C78E /* NetworkUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = NetworkUtils.m; path = ../../../common/NetworkUtils.m; sourceTree = "<group>"; };
+		71E9F6B81F8B48720052C78E /* NetworkUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = NetworkUtils.h; path = ../../../common/NetworkUtils.h; sourceTree = "<group>"; };
 		71F8D0321EC057A2002003DB /* RANetworkTaskDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RANetworkTaskDelegate.h; path = ../../../common/upload/RANetworkTaskDelegate.h; sourceTree = "<group>"; };
 		71F8D0331EC057A2002003DB /* RANetworkTaskDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RANetworkTaskDelegate.m; path = ../../../common/upload/RANetworkTaskDelegate.m; sourceTree = "<group>"; };
 /* End PBXFileReference section */
@@ -272,6 +272,8 @@
 				7128C24F1E124F4500FF635B /* Info.plist */,
 				71F8D0321EC057A2002003DB /* RANetworkTaskDelegate.h */,
 				71F8D0331EC057A2002003DB /* RANetworkTaskDelegate.m */,
+				71E9F6B81F8B48720052C78E /* NetworkUtils.h */,
+				71E9F6B71F8B48720052C78E /* NetworkUtils.m */,
 				7128C3361E12540F00FF635B /* ACNetwork.h */,
 				7128C3371E12540F00FF635B /* ACNetwork.m */,
 				7128C3381E12540F00FF635B /* AppDelegate.h */,
@@ -401,8 +403,6 @@
 				7128C2BF1E1250FC00FF635B /* TextUtils.m */,
 				7128C2C01E1250FC00FF635B /* Reachability.h */,
 				7128C2C11E1250FC00FF635B /* Reachability.m */,
-				7128C2C21E1250FC00FF635B /* NetworkUtils.h */,
-				7128C2C31E1250FC00FF635B /* NetworkUtils.m */,
 				7128C2C41E1250FC00FF635B /* RAUtils.h */,
 				7128C2C51E1250FC00FF635B /* RAUtils.m */,
 			);
@@ -562,6 +562,7 @@
 				7128C2E71E12511B00FF635B /* AESCrypt.m in Sources */,
 				713B97B31F79E649002B86BF /* RAPDFPage.m in Sources */,
 				71F8D0341EC057A2002003DB /* RANetworkTaskDelegate.m in Sources */,
+				71E9F6B91F8B48720052C78E /* NetworkUtils.m in Sources */,
 				7115D4271E13B70C00EF4E4C /* DocumentListViewController.m in Sources */,
 				7128C33A1E12540F00FF635B /* ACNetwork.m in Sources */,
 				7128C2B71E1250CA00FF635B /* RectDrawable.m in Sources */,
@@ -569,7 +570,6 @@
 				7128C2D91E12510900FF635B /* mztools.c in Sources */,
 				714A9AEF1E9CADA100371995 /* PendingDocumentsTableViewCell.m in Sources */,
 				7128C2EB1E12511B00FF635B /* NSString+Base64.m in Sources */,
-				7128C2CA1E1250FC00FF635B /* NetworkUtils.m in Sources */,
 				7128C2B31E1250CA00FF635B /* BasicDrawable.m in Sources */,
 				7128C2C71E1250FC00FF635B /* PDFUtils.m in Sources */,
 				717243441E1CCCEC00800678 /* CustomIOSAlertView.m in Sources */,

+ 44 - 0
Ants Contract/Granite Expo eSign/Granite Expo eSign/const.h

@@ -29,8 +29,16 @@
 //#define UIColorFromRGBA(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF000000) >> 32))/255.0 green:((float)((rgbValue & 0xFF0000) >> 16))/255.0 blue:((float)((rgbValue & 0xFF00) >> 8))/255.0 alpha:((float)(rgbValue & 0xFF))/255.0]
 
 
+#define AP_USER_NOT_EXIST                 0
+#define AP_USER_NOT_AUTH                 1
+#define AP_USER_AUTH                     2
 
 
+#define AP_SESSION_EXPIRED                 4
+
+#define AP_MESSAGE_NEW                 5
+#define AP_MESSAGE_NONE                     6
+
 
 #define TV_BG 0xccffff
 
@@ -44,4 +52,40 @@
 #define JSON_TIMEOUT 30
 
 
+#define RESULT_FALSE 0
+#define RESULT_TRUE         2
+#define RESULT_NO_EMAIL_ADDRESS      3
+#define RESULT_NET_SERVER_ERR         -1
+#define RESULT_NET_ERROR             -3
+#define RESULT_NET_NOTAVAILABLE          -4
+#define RESULT_ERROR                 -5
+#define RESULT_LOCALFILE_ERROR             -7
+#define RESULT_USERAUTH_ERROR             -9
+#define RESULT_UPDATE_USERAUTH_ERROR     -11
+#define RESULT_SESSION_EXPIRED              -13
+#define RESULT_VER_LOW                   -15
+#define RESULT_BACKEND_CRASH                   -20
+#define RESULT_RESPONSE_ERROR                   -30
+#define RESULT_TIMEOUT                   99
+
+#define RESULT_LOGIN_DEVICE                   -18
+
+#define RESULT_NO_MODEL                   8
+
+
+
+
+#define MSG_NET_NOTAVAILABLE @"No available network, please check your network setting."
+#define MSG_NET_ERROR @"Net Error. Cannot connect to server for now. Please retry later."
+#define MSG_USERAUTH_ERROR @"Username or password is incorrect.Please check."
+#define MSG_VER_LOW @"Current App version is out of date, please update to the latest version."
+#define MSG_ERROR @"Connection failed with Server, please email your IT Admin."//@"Some error occured on server."
+#define MSG_SUCCESS @"Success."
+#define MSG_LOGIN_DEVICE @"You are currently signed in on another device. Please check."
+#define MSG_TIMEOUT @"Request timeout."
+
+#define MSG_OFFLINE_SUBMIT @"Offline order will be submitted when you login online mode and sync with server."
+#define TITLE_OFFLINE_SUBMIT @"Offline Submit"
+
+
 #endif /* const_h */

BIN
Apex Mobile/Apex Mobile.xcodeproj/project.xcworkspace/xcuserdata/Ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 6 - 6
RA Image/RA Image.xcodeproj/project.pbxproj

@@ -35,7 +35,6 @@
 		42E1B1041EB1CCB200EEF27C /* login.json in Resources */ = {isa = PBXBuildFile; fileRef = 42E1B1031EB1CCB200EEF27C /* login.json */; };
 		42E1B1081EB1D9B100EEF27C /* LoginSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42E1B1071EB1D9B100EEF27C /* LoginSettingViewController.m */; };
 		71114A9D1EB1BCB400D2200C /* LoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71114A9C1EB1BCB400D2200C /* LoginViewController.m */; };
-		71114AA01EB1C3DE00D2200C /* NetworkUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 71114A9F1EB1C3DE00D2200C /* NetworkUtils.m */; };
 		71114AA31EB1C40900D2200C /* RAINetwork.m in Sources */ = {isa = PBXBuildFile; fileRef = 71114AA21EB1C40900D2200C /* RAINetwork.m */; };
 		71114AA61EB1C50D00D2200C /* RAUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 71114AA51EB1C50D00D2200C /* RAUtils.m */; };
 		71114AB21EB1C5C800D2200C /* AESCrypt.m in Sources */ = {isa = PBXBuildFile; fileRef = 71114AAA1EB1C5C800D2200C /* AESCrypt.m */; };
@@ -68,6 +67,7 @@
 		71DCDC441EAF234E00BA045A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 71DCDC431EAF234E00BA045A /* Assets.xcassets */; };
 		71DCDC471EAF234E00BA045A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71DCDC451EAF234E00BA045A /* LaunchScreen.storyboard */; };
 		71DCDC501EAF353000BA045A /* modelist.json in Resources */ = {isa = PBXBuildFile; fileRef = 71DCDC4F1EAF353000BA045A /* modelist.json */; };
+		71E9F6B31F8B46380052C78E /* NetworkUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 71E9F6B11F8B46380052C78E /* NetworkUtils.m */; };
 		71F8D1CE1EC955BF002003DB /* UIView+Toast.m in Sources */ = {isa = PBXBuildFile; fileRef = 71F8D1CD1EC955BF002003DB /* UIView+Toast.m */; };
 /* End PBXBuildFile section */
 
@@ -124,8 +124,6 @@
 		42E1B1071EB1D9B100EEF27C /* LoginSettingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginSettingViewController.m; sourceTree = "<group>"; };
 		71114A9B1EB1BCB400D2200C /* LoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginViewController.h; sourceTree = "<group>"; };
 		71114A9C1EB1BCB400D2200C /* LoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginViewController.m; sourceTree = "<group>"; };
-		71114A9E1EB1C3DE00D2200C /* NetworkUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkUtils.h; path = "../../RedAnt ERP Mobile/common/NetworkUtils.h"; sourceTree = "<group>"; };
-		71114A9F1EB1C3DE00D2200C /* NetworkUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NetworkUtils.m; path = "../../RedAnt ERP Mobile/common/NetworkUtils.m"; sourceTree = "<group>"; };
 		71114AA11EB1C40900D2200C /* RAINetwork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAINetwork.h; sourceTree = "<group>"; };
 		71114AA21EB1C40900D2200C /* RAINetwork.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAINetwork.m; sourceTree = "<group>"; };
 		71114AA41EB1C50D00D2200C /* RAUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAUtils.h; path = "../../RedAnt ERP Mobile/common/RAUtils.h"; sourceTree = "<group>"; };
@@ -187,6 +185,8 @@
 		71DCDC461EAF234E00BA045A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
 		71DCDC481EAF234E00BA045A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		71DCDC4F1EAF353000BA045A /* modelist.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = modelist.json; sourceTree = "<group>"; };
+		71E9F6B11F8B46380052C78E /* NetworkUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = NetworkUtils.m; path = ../../common/NetworkUtils.m; sourceTree = "<group>"; };
+		71E9F6B21F8B46380052C78E /* NetworkUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = NetworkUtils.h; path = ../../common/NetworkUtils.h; sourceTree = "<group>"; };
 		71F8D1CC1EC955BF002003DB /* UIView+Toast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIView+Toast.h"; path = "../../common/customUI/UIView+Toast.h"; sourceTree = "<group>"; };
 		71F8D1CD1EC955BF002003DB /* UIView+Toast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIView+Toast.m"; path = "../../common/customUI/UIView+Toast.m"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
@@ -365,8 +365,8 @@
 		42E1B10D1EB1E91D00EEF27C /* Network */ = {
 			isa = PBXGroup;
 			children = (
-				71114A9E1EB1C3DE00D2200C /* NetworkUtils.h */,
-				71114A9F1EB1C3DE00D2200C /* NetworkUtils.m */,
+				71E9F6B21F8B46380052C78E /* NetworkUtils.h */,
+				71E9F6B11F8B46380052C78E /* NetworkUtils.m */,
 				71114AA11EB1C40900D2200C /* RAINetwork.h */,
 				71114AA21EB1C40900D2200C /* RAINetwork.m */,
 				42F2B9FE1EC041A200AEEA34 /* upload */,
@@ -643,8 +643,8 @@
 				42E1B1081EB1D9B100EEF27C /* LoginSettingViewController.m in Sources */,
 				71F8D1CE1EC955BF002003DB /* UIView+Toast.m in Sources */,
 				71114AC81EB1C73B00D2200C /* unzip.c in Sources */,
-				71114AA01EB1C3DE00D2200C /* NetworkUtils.m in Sources */,
 				71114AEF1EB2DEF900D2200C /* MenuViewController.m in Sources */,
+				71E9F6B31F8B46380052C78E /* NetworkUtils.m in Sources */,
 				71114AA31EB1C40900D2200C /* RAINetwork.m in Sources */,
 				71114AC91EB1C73B00D2200C /* zip.c in Sources */,
 				428566D81EF122360041208A /* PhotoPreviewCell.m in Sources */,

BIN
RA Image/RA Image.xcodeproj/project.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 45 - 0
RA Image/RA Image/const.h

@@ -19,11 +19,18 @@
 #ifdef DEBUG
 //     #define DebugLog( s, ... ) fprintf(stderr,"%s\n",[[NSString stringWithFormat:s, ##__VA_ARGS__] UTF8String])//
 #define DebugLog( s, ... ) fprintf(stderr, "<%p %s:(%d)> %s \n", self, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent]UTF8String], __LINE__, [[NSString stringWithFormat:(s), ##__VA_ARGS__]UTF8String] )
+
+#define blockDebugLog( s, ... ) fprintf(stderr, "<%p %s:(%d)> %s \n",weakself, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent]UTF8String], __LINE__, [[NSString stringWithFormat:(s), ##__VA_ARGS__]UTF8String] )
+
 #else
 #define DebugLog( s, ... )
+
+#define blockDebugLog( s, ... )
 #endif
 #else
 #define DebugLog( s, ... )
+
+#define blockDebugLog( s, ... )
 #endif
 
 
@@ -45,4 +52,42 @@
 //#define JSON_TIMEOUT 30
 
 
+
+#define RESULT_FALSE 0
+#define RESULT_TRUE         2
+#define RESULT_NO_EMAIL_ADDRESS      3
+#define RESULT_NET_SERVER_ERR         -1
+#define RESULT_NET_ERROR             -3
+#define RESULT_NET_NOTAVAILABLE          -4
+#define RESULT_ERROR                 -5
+#define RESULT_LOCALFILE_ERROR             -7
+#define RESULT_USERAUTH_ERROR             -9
+#define RESULT_UPDATE_USERAUTH_ERROR     -11
+#define RESULT_SESSION_EXPIRED              -13
+#define RESULT_VER_LOW                   -15
+#define RESULT_BACKEND_CRASH                   -20
+#define RESULT_RESPONSE_ERROR                   -30
+#define RESULT_TIMEOUT                   99
+
+#define RESULT_LOGIN_DEVICE                   -18
+
+#define RESULT_NO_MODEL                   8
+
+
+#define JSON_TIMEOUT 60
+
+
+#define MSG_NET_NOTAVAILABLE @"No available network, please check your network setting."
+#define MSG_NET_ERROR @"Net Error. Cannot connect to server for now. Please retry later."
+#define MSG_USERAUTH_ERROR @"Username or password is incorrect.Please check."
+#define MSG_VER_LOW @"Current App version is out of date, please update to the latest version."
+#define MSG_ERROR @"Connection failed with Server, please email your IT Admin."//@"Some error occured on server."
+#define MSG_SUCCESS @"Success."
+#define MSG_LOGIN_DEVICE @"You are currently signed in on another device. Please check."
+#define MSG_TIMEOUT @"Request timeout."
+
+#define MSG_OFFLINE_SUBMIT @"Offline order will be submitted when you login online mode and sync with server."
+#define TITLE_OFFLINE_SUBMIT @"Offline Submit"
+
+
 #endif /* const_h */

+ 1 - 1
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -522,7 +522,7 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/category/CategoryViewController.m"
-            timestampString = "528441914.822481"
+            timestampString = "528455566.180151"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "170"

+ 6 - 0
RedAnt ERP Mobile/iSales-HOMER.xcodeproj/project.pbxproj

@@ -270,6 +270,7 @@
 		71DF74971C57614C00F2789C /* PhotoStackView.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74921C57614C00F2789C /* PhotoStackView.m */; };
 		71DF74981C57614C00F2789C /* PhotoStackViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74941C57614C00F2789C /* PhotoStackViewController.m */; };
 		71E3634A1F46963200CFAF19 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71E363481F46963100CFAF19 /* Main.storyboard */; };
+		71E9F6B61F8B46830052C78E /* NetworkUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 71E9F6B41F8B46820052C78E /* NetworkUtils.m */; };
 		71FFBBE91C60894900D91DC2 /* iSalesDB.m in Sources */ = {isa = PBXBuildFile; fileRef = 71FFBBE61C60894900D91DC2 /* iSalesDB.m */; };
 		71FFBBEA1C60894900D91DC2 /* iSalesNetwork.m in Sources */ = {isa = PBXBuildFile; fileRef = 71FFBBE81C60894900D91DC2 /* iSalesNetwork.m */; };
 		A31E80CF7BEA220BD1CC4B97 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C694180C757B34E24180D628 /* libPods.a */; };
@@ -758,6 +759,8 @@
 		71DF74931C57614C00F2789C /* PhotoStackViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PhotoStackViewController.h; path = common/photoStack/PhotoStackViewController.h; sourceTree = SOURCE_ROOT; };
 		71DF74941C57614C00F2789C /* PhotoStackViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PhotoStackViewController.m; path = common/photoStack/PhotoStackViewController.m; sourceTree = SOURCE_ROOT; };
 		71E363491F46963200CFAF19 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = "iSales-NPD/Base.lproj/Main.storyboard"; sourceTree = SOURCE_ROOT; };
+		71E9F6B41F8B46820052C78E /* NetworkUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = NetworkUtils.m; path = ../../common/NetworkUtils.m; sourceTree = "<group>"; };
+		71E9F6B51F8B46830052C78E /* NetworkUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = NetworkUtils.h; path = ../../common/NetworkUtils.h; sourceTree = "<group>"; };
 		71FFBBE51C60894900D91DC2 /* iSalesDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iSalesDB.h; path = common/data_provider/iSalesDB.h; sourceTree = SOURCE_ROOT; };
 		71FFBBE61C60894900D91DC2 /* iSalesDB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = iSalesDB.m; path = common/data_provider/iSalesDB.m; sourceTree = SOURCE_ROOT; };
 		71FFBBE71C60894900D91DC2 /* iSalesNetwork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iSalesNetwork.h; path = common/data_provider/iSalesNetwork.h; sourceTree = SOURCE_ROOT; };
@@ -1406,6 +1409,8 @@
 				42BF67CB1E5179970081F90A /* ERPUtils.m */,
 				71FFBBE51C60894900D91DC2 /* iSalesDB.h */,
 				71FFBBE61C60894900D91DC2 /* iSalesDB.m */,
+				71E9F6B51F8B46830052C78E /* NetworkUtils.h */,
+				71E9F6B41F8B46820052C78E /* NetworkUtils.m */,
 				71FFBBE71C60894900D91DC2 /* iSalesNetwork.h */,
 				71FFBBE81C60894900D91DC2 /* iSalesNetwork.m */,
 				71BF06F91D2F3CAC00981938 /* OLDataProvider.h */,
@@ -2141,6 +2146,7 @@
 				7162A5811C5872EF00AB630E /* HomeTableViewCellBanner.m in Sources */,
 				7162A5E61C58781000AB630E /* iSalesNavigationController.m in Sources */,
 				7141DD631C5747CE00F7DF59 /* NSString+Base64.m in Sources */,
+				71E9F6B61F8B46830052C78E /* NetworkUtils.m in Sources */,
 				7162A5C41C5873BB00AB630E /* ItemSearchViewController.m in Sources */,
 				7162A5481C58719D00AB630E /* RATreeView+TableViewDataSource.m in Sources */,
 				42D3A4A31EFA6D36007A54C1 /* PhotoPreviewCell.m in Sources */,

+ 2 - 2
RedAnt ERP Mobile/iSales-HOMER/iSales-HOMER-Info.plist

@@ -17,11 +17,11 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.90</string>
+	<string>1.92</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>170901</string>
+	<string>170930</string>
 	<key>ITSAppUsesNonExemptEncryption</key>
 	<false/>
 	<key>LSRequiresIPhoneOS</key>

+ 13 - 1
RedAnt Mobile/RedAnt Mobile.xcodeproj/project.pbxproj

@@ -535,7 +535,7 @@
 		71F3A9951F5F8E22001036C8 /* Project object */ = {
 			isa = PBXProject;
 			attributes = {
-				LastUpgradeCheck = 0830;
+				LastUpgradeCheck = 0900;
 				ORGANIZATIONNAME = Ray;
 				TargetAttributes = {
 					71F3A99C1F5F8E22001036C8 = {
@@ -687,7 +687,9 @@
 				CLANG_CXX_LIBRARY = "libc++";
 				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
 				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_COMMA = YES;
 				CLANG_WARN_CONSTANT_CONVERSION = YES;
 				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
 				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
@@ -695,7 +697,11 @@
 				CLANG_WARN_ENUM_CONVERSION = YES;
 				CLANG_WARN_INFINITE_RECURSION = YES;
 				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
 				CLANG_WARN_SUSPICIOUS_MOVE = YES;
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -735,7 +741,9 @@
 				CLANG_CXX_LIBRARY = "libc++";
 				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
 				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_COMMA = YES;
 				CLANG_WARN_CONSTANT_CONVERSION = YES;
 				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
 				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
@@ -743,7 +751,11 @@
 				CLANG_WARN_ENUM_CONVERSION = YES;
 				CLANG_WARN_INFINITE_RECURSION = YES;
 				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
 				CLANG_WARN_SUSPICIOUS_MOVE = YES;
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;

BIN
RedAnt Mobile/RedAnt Mobile.xcodeproj/project.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 3 - 1
RedAnt Mobile/RedAnt Mobile.xcodeproj/xcuserdata/ray.xcuserdatad/xcschemes/RedAnt Mobile.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0830"
+   LastUpgradeVersion = "0900"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
       buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      language = ""
       shouldUseLaunchSchemeArgsEnv = "YES">
       <Testables>
       </Testables>
@@ -45,6 +46,7 @@
       buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      language = ""
       launchStyle = "0"
       useCustomWorkingDirectory = "NO"
       ignoresPersistentStateOnLaunch = "NO"

+ 25 - 0
common/NetworkUtils.h

@@ -0,0 +1,25 @@
+//
+//  NetworkUtils.h
+//  AntsContract
+//
+//  Created by Ray on 12/26/16.
+//  Copyright © 2016 United Software Applications, Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "const.h"
+typedef NSMutableDictionary*(^resultBlock)(NSMutableDictionary* result);
+typedef NSMutableDictionary*(^decryptBlock)(NSMutableDictionary* result);
+
+
+typedef void(^resultHandler)(NSMutableDictionary *result);
+typedef void(^progressHandler)(NSURLSessionTask *task,double progress);
+
+@interface NetworkUtils : NSObject
++(bool) IsNetworkAvailable;
++(NSData*)get_json : (NSString*) url parameters:(NSMutableDictionary *) params file:(NSString*)file_path err_recorder:(NSString* )recorder_url result_handler:(resultBlock)resultBlock decrypt_handler:(decryptBlock)decryptBlock;
++(NSDictionary*)err_log:(NSString*) up_params result:(NSString*)result module:(NSString*) module code:(int) code;
+
+
++ (NSURLSessionTask *)upload:(NSString *)filePath Params:(NSDictionary *)params ToHost:(NSString *)url Result:(resultHandler)r Progress:(progressHandler)p DecryptHandler:(id(^)(NSString *result))decrypt;
+@end

+ 391 - 0
common/NetworkUtils.m

@@ -0,0 +1,391 @@
+//
+//  NetworkUtils.m
+//  AntsContract
+//
+//  Created by Ray on 12/26/16.
+//  Copyright © 2016 United Software Applications, Inc. All rights reserved.
+//
+
+#import "NetworkUtils.h"
+#import "RAUtils.h"
+#import "Reachability.h"
+#import "RANetworkTaskDelegate.h"
+
+#define BOUNDARY @"AaB03x"
+
+@implementation NetworkUtils
+
+
+//+(NSDictionary*) error_dict:(NSError*)error
+//{
+//    if(error==nil)
+//        return nil;
+//    NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
+//    [ret setValue:[NSString stringWithFormat:@"%d",error.code] forKey:@"error_code"];
+//    [ret setValue:error.domain forKey:@"err_domain"];
+//    [ret setValue:[error localizedDescription] forKey:@"err_message"];
+//    // [ret setObject:error.userInfo forKey:@"user_info"];
+//    return ret;
+//}
+
++(bool) IsNetworkAvailable
+{
+    
+    if (([Reachability reachabilityForInternetConnection].currentReachabilityStatus == NotReachable) &&
+        ([Reachability reachabilityForLocalWiFi].currentReachabilityStatus == NotReachable))
+        return false;
+    return true;
+}
+
++(NSData*)get_json : (NSString*) url parameters:(NSMutableDictionary *) params file:(NSString*)file_path err_recorder:(NSString* )recorder_url result_handler:(resultBlock)resultBlock decrypt_handler:(decryptBlock)decryptBlock
+{
+    int retry = 0;
+    
+
+    
+    
+repeat:
+    {
+        
+        //    return [self fake_json:url];
+        
+        //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+        //分界线的标识符
+        NSString *TWITTERFON_FORM_BOUNDARY = @"AaB03x";
+        //根据url初始化request
+        NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]
+                                                               cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
+                                                           timeoutInterval:JSON_TIMEOUT];
+        //分界线 --AaB03x
+        NSString *MPboundary=[[NSString alloc]initWithFormat:@"--%@",TWITTERFON_FORM_BOUNDARY];
+        //结束符 AaB03x--
+        NSString *endMPboundary=[[NSString alloc]initWithFormat:@"%@--",MPboundary];
+        //要上传的图片
+        //    UIImage *image=[params objectForKey:@"pic"];
+        //得到图片的data
+            NSData* data = [NSData dataWithContentsOfFile:file_path];
+        //http body的字符串
+        NSMutableString *body=[[NSMutableString alloc]init];
+        
+        //    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+        //     [params setValue:@"handset_login" forKey:@"action"];
+        //    [headers setValue:[NSString stringWithFormat:@"%d",dataLength] forKey:@"Content-Length"];
+        
+        //    [params setValue:appDelegate.sessionid forKey:@"sessionid"];
+        //   [params setValue:password forKey:@"password"];
+        //    [params setValue:[NSString stringWithFormat:@"%d",ver]  forKey:@"auth_ver"];
+        
+        
+        
+        //    [headers setValue:headQuerlString forKey:@"param"];
+        
+        //参数的集合的所有key的集合
+        NSArray *keys= [params allKeys];
+        DebugLog(@"================parms==================");
+        //遍历keys
+        for(int i=0;i<[keys count];i++)
+        {
+            //得到当前key
+            NSString *key=[keys objectAtIndex:i];
+            //如果key不是pic,说明value是字符类型,比如name:Boris
+            if(![key isEqualToString:@"pic"])
+            {
+                //添加分界线,换行
+                [body appendFormat:@"%@\r\n",MPboundary];
+                //添加字段名称,换2行
+                [body appendFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n",key];
+                //添加字段的值
+                [body appendFormat:@"%@\r\n",[params objectForKey:key]];
+                DebugLog(@"parameter: key=%@   value=%@",key,[params objectForKey:key]);
+            }
+        }
+        DebugLog(@"================parms==================");
+        ////添加分界线,换行
+        [body appendFormat:@"%@\r\n",MPboundary];
+        //声明pic字段,文件名为boris.png
+        
+        NSString * file_format=[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"upfile\"; filename=\"%@\"\r\n", [file_path lastPathComponent]];
+
+        
+        
+        [body appendFormat:@"%@", file_format];
+        //声明上传文件的格式
+        [body appendFormat:@"Content-Type: application/zip\r\n\r\n"];
+        
+        //声明结束符:--AaB03x--
+        NSString *end=[[NSString alloc]initWithFormat:@"\r\n%@",endMPboundary];
+        //声明myRequestData,用来放入http body
+        NSMutableData *myRequestData=[NSMutableData data];
+        //将body字符串转化为UTF8格式的二进制
+        [myRequestData appendData:[body dataUsingEncoding:NSUTF8StringEncoding]];
+        //将image的data加入
+            [myRequestData appendData:data];
+        //加入结束符--AaB03x--
+        [myRequestData appendData:[end dataUsingEncoding:NSUTF8StringEncoding]];
+        
+        //设置HTTPHeader中Content-Type的值
+        NSString *content=[[NSString alloc]initWithFormat:@"multipart/form-data; boundary=%@",TWITTERFON_FORM_BOUNDARY];
+        //设置HTTPHeader
+        [request setValue:content forHTTPHeaderField:@"Content-Type"];
+        
+        // 关闭keep alive
+        [request setValue:@"close" forHTTPHeaderField:@"Connection"];
+        //设置Content-Length
+        [request setValue:[NSString stringWithFormat:@"%lu", (unsigned long)[myRequestData length]] forHTTPHeaderField:@"Content-Length"];
+        //设置http body
+        [request setHTTPBody:myRequestData];
+        //http method
+        [request setHTTPMethod:@"POST"];
+        
+        
+        NSHTTPURLResponse* urlResponse = nil;
+        
+        NSError *error = nil;
+        
+        NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];
+        
+        
+        DebugLog(@"url: %@",url);
+        
+        DebugLog(@"response: %@",[NSHTTPURLResponse localizedStringForStatusCode:urlResponse.statusCode]);
+        
+        if (responseData==nil) {
+            
+            //            DebugLog(@"response error:%@", [error localizedDescription]);
+            
+            
+            NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
+            //#define RESULT_FALSE 0
+            //#define RESULT_TRUE		 2
+            //#define RESULT_NET_ERROR			 -3
+            //#define RESULT_NET_NOTAVAILABLE		  -4
+            //#define RESULT_ERROR				 -5
+            //#define RESULT_LOCALFILE_ERROR			 -7
+            //#define RESULT_USERAUTH_ERROR			 -9
+            //#define RESULT_UPDATE_USERAUTH_ERROR	 -11
+            //#define RESULT_SESSION_EXPIRED			  -13
+            //#define RESULT_VER_LOW
+            
+            //     NSString * moreinfo = error.description ;
+            
+            NSString* err_msg = [error localizedDescription];
+            
+            
+            //-----------------retry 3 times for error code -1005------------------------
+            if(error.code==-1005&&retry<3)
+            {
+                retry++;
+                goto repeat;
+                
+            }
+            //-----------------end retry 3 times for error code -1005------------------------
+            
+            NSDictionary* error_json = [RAUtils error_dict:error];
+            [ret setObject:error_json forKey:@"err_obj"];
+            NSString* resp_msg= nil;
+            
+            if(err_msg.length==0)
+            {
+                err_msg =[NSHTTPURLResponse localizedStringForStatusCode:urlResponse.statusCode];
+                resp_msg = err_msg;
+            }
+            [ret setValue:[NSString stringWithFormat:@"%d",RESULT_NET_ERROR] forKey:@"result"];
+            [ret setValue:err_msg forKey:@"err_msg"];
+            [ret setValue:resp_msg forKey:@"resp_msg"];
+            [ret setValue:[NSString stringWithFormat:@"%ld",(long)urlResponse.statusCode] forKey:@"resp_code"];
+            
+            
+            NSData *jsonData = [NSJSONSerialization dataWithJSONObject:ret
+                                                               options:0
+                                                                 error:nil];
+            if(![url isEqualToString:recorder_url])
+            {
+                [self err_log:[RAUtils base64en:[RAUtils dict2string:params]] result:[RAUtils base64en:[RAUtils dict2string:ret]] module:url code:RESULT_NET_ERROR];
+            }
+            return jsonData;
+            
+        }
+        else
+        {
+          //  NSString* err_msg = [error localizedDescription];
+            NSMutableString *str = [[NSMutableString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
+            
+            DebugLog(@"data string: %@",str);
+            NSError *error1 = nil;
+            
+            NSMutableDictionary* jsobj = [[NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error1] mutableCopy];
+            
+            if(jsobj==nil)// 服务器返回不是json
+            {
+                
+                jsobj=[[NSMutableDictionary alloc] init];
+                [jsobj setValue:@"1" forKey:@"result"];
+                
+            }
+            if([jsobj[@"encrypt"] boolValue]==true)
+            {
+                jsobj = decryptBlock(jsobj);
+            }
+            jsobj = resultBlock(jsobj);
+                    int result=[[jsobj valueForKey:@"result"] intValue];
+            if(![url isEqualToString:recorder_url]&&/*![url isEqualToString:URL_DOWNLOAD_OFFLINE]&&*/result!=2&&result!=99)
+            {
+                [self err_log:[RAUtils base64en:[RAUtils dict2string:params]] result:[RAUtils base64en:str] module:url code:result];
+            }
+            NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsobj
+                                                               options:0
+                                                                 error:nil];
+            return jsonData;
+            
+        }
+        return responseData;
+    }
+}
+
++(NSDictionary*)err_log:(NSString*) up_params result:(NSString*)result module:(NSString*) module code:(int) code//device:(NSString*) device
+{
+    //    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+    //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    //    if(appDelegate.user!=nil)
+    //        [params setValue:appDelegate.user forKey:@"user"];
+    //
+    //    [params setValue:up_params forKey:@"upparam"];
+    //
+    //    [params setValue:[NSNumber numberWithInt:code ] forKey:@"code"];
+    //
+    //    [params setValue:result forKey:@"result"];
+    //    [params setValue:module forKey:@"interfac"];
+    //
+    //    [params setValue:[RAUtils base64en:[RAUtils dict2string: [RAUtils device_info]]] forKey:@"device"];
+    //
+    //
+    //    //     [params setValue:module forKey:@"module"];
+    //
+    //    //  [[UIDevice currentDevice]  name];
+    //
+    //    //    if(appDelegate.offline_mode)
+    //    //    {
+    //    //        return [OLDataProvider offline_notimpl];
+    //    //    }
+    //    if(![self IsNetworkAvailable])
+    //        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+    //
+    //    NSData* json=[self get_json:URL_ERR_LOG parameters:params];
+    //    if(json==nil)
+    //        return nil;
+    //    NSError *error=nil;
+    //    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+    //    return jsobj;
+    NSMutableDictionary* jsobj = [@{@"result":@"2"} mutableCopy];
+    return jsobj;
+}
++ (NSURLSessionTask *)upload:(NSString *)filePath  Params:(NSDictionary *)params ToHost:(NSString *)urlString Result:(resultHandler)r Progress:(progressHandler)p DecryptHandler:(id (^)(NSString *))decrypt {
+    
+    
+    NSString *fileName = [filePath lastPathComponent];
+    
+    NSMutableData *dataM = [NSMutableData data];
+    
+    NSMutableString *stringM = [NSMutableString string];
+    
+    
+    DebugLog(@"================parms==================");
+
+    
+    
+    for (NSString *key in params) {
+        
+        [stringM appendString:[NSString stringWithFormat:@"--%@\r\n",BOUNDARY]];
+        [stringM appendFormat:@"Content-Type: text/plain; charset=UTF-8\r\n"];
+        [stringM appendFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n",key];
+        [stringM appendFormat:@"%@\r\n",[params objectForKey:key]];
+        
+        
+        DebugLog(@"parameter: key=%@   value=%@",key,[params objectForKey:key]);
+    }
+    DebugLog(@"================parms==================");
+    [stringM appendString:[NSString stringWithFormat:@"--%@\r\n",BOUNDARY]];
+    
+    [stringM appendFormat:@"Content-Disposition: form-data; name=\"upfile\"; filename=%@\r\n",fileName];
+    [stringM appendString:@"Content-Type: application/mac-binary\r\n"];
+    [stringM appendString:@"\r\n"];
+    
+    NSData *stringM_data = [stringM dataUsingEncoding:NSUTF8StringEncoding];
+    [dataM appendData:stringM_data];
+    
+    NSData *file_data = [NSData dataWithContentsOfFile:filePath];
+    [dataM appendData:file_data];
+    
+    NSString *end = [NSString stringWithFormat:@"\r\n--%@--",BOUNDARY];
+    [dataM appendData:[end dataUsingEncoding:NSUTF8StringEncoding]];
+    
+    // Data
+    NSData *data = dataM;
+    
+    
+    // 可变请求
+    NSURL *url = [NSURL URLWithString:urlString];
+    NSMutableURLRequest *requestM = [NSMutableURLRequest requestWithURL:url
+                                                            cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:JSON_TIMEOUT];
+    // line note
+    requestM.HTTPMethod = @"POST";
+    
+    // request header
+    [requestM addValue:@"close" forHTTPHeaderField:@"Connection"];
+    
+    [requestM addValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@",BOUNDARY] forHTTPHeaderField:@"Content-Type"];
+    
+    [requestM addValue:[NSString stringWithFormat:@"%lu", (unsigned long)[data length]] forHTTPHeaderField:@"Content-Length"];
+    
+    // request body
+    requestM.HTTPBody = data;
+    
+    
+    
+    NSURLSession *urlSession = [self standSession];
+    
+    if (urlSession.delegate) {
+        if ([urlSession.delegate isKindOfClass:[RANetworkTaskDelegate class]]) {
+            
+            RANetworkTaskDelegate *delegate = (RANetworkTaskDelegate *)urlSession.delegate;
+            
+            if (p) {
+                delegate.p = p;
+            }
+            
+            if (r) {
+                delegate.r = r;
+            }
+            
+            if (decrypt) {
+                delegate.decryptHandler = decrypt;
+            }
+            
+        }
+    }
+    
+    NSURLSessionDataTask *dataTask = [urlSession uploadTaskWithRequest:requestM fromData:data];
+    
+    [dataTask resume];
+    
+    return dataTask;
+}
+
+
+
+
++ (NSURLSession *)standSession {
+    NSURLSession *session = nil;
+    
+    RANetworkTaskDelegate *delegate = [RANetworkTaskDelegate sharedInstance];
+    
+    NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
+    config.timeoutIntervalForRequest = JSON_TIMEOUT;
+    
+    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
+    
+    session = [NSURLSession sessionWithConfiguration:config delegate:delegate delegateQueue:queue];
+    
+    return session;
+}
+@end

+ 1 - 1
common/upload/RAUploadOperation.h

@@ -16,6 +16,6 @@ typedef NS_ENUM(NSInteger, TaskStatus) {
 };
 @interface RAUploadOperation : NSOperation
 - (instancetype)initWithTaskinfo:(NSMutableDictionary*)taskinfo retry:(int) maxRetry;
-@property (nonatomic , copy) void (^updateUI)();
+@property (nonatomic , copy) void (^updateUI)(void);
 //@property (nonatomic , copy) void (^operationFinish)(NSMutableDictionary* taskinfo);
 @end