Просмотр исходного кода

1.修改Network增加网络状态监测。

Pen Li 8 лет назад
Родитель
Сommit
f09c125d49

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 1
RedAnt ERP Mobile/common/NetworkUtils.h

@@ -21,5 +21,5 @@ typedef void(^progressHandler)(double progress);
 +(NSDictionary*)err_log:(NSString*) up_params result:(NSString*)result module:(NSString*) module code:(int) code;
 
 
-+ (void)upload:(NSString *)filePath Params:(NSDictionary *)params ToHost:(NSString *)url Result:(resultHandler)r Progress:(progressHandler)p DecryptHandler:(id(^)(NSString *result))decrypt;
++ (NSURLSessionTask *)upload:(NSString *)filePath Params:(NSDictionary *)params ToHost:(NSString *)url Result:(resultHandler)r Progress:(progressHandler)p DecryptHandler:(id(^)(NSString *result))decrypt;
 @end

+ 2 - 1
RedAnt ERP Mobile/common/NetworkUtils.m

@@ -279,7 +279,7 @@ repeat:
     NSMutableDictionary* jsobj = [@{@"result":@"2"} mutableCopy];
     return jsobj;
 }
-+ (void)upload:(NSString *)filePath  Params:(NSDictionary *)params ToHost:(NSString *)urlString Result:(resultHandler)r Progress:(progressHandler)p DecryptHandler:(id (^)(NSString *))decrypt {
++ (NSURLSessionTask *)upload:(NSString *)filePath  Params:(NSDictionary *)params ToHost:(NSString *)urlString Result:(resultHandler)r Progress:(progressHandler)p DecryptHandler:(id (^)(NSString *))decrypt {
     
     
     NSString *fileName = [filePath lastPathComponent];
@@ -368,6 +368,7 @@ repeat:
     
     [dataTask resume];
     
+    return dataTask;
 }
 
 

+ 83 - 83
RedAnt ERP Mobile/iSales-NPD/config.h

@@ -38,140 +38,140 @@
 #define LOCAL_URL_CUSTOMER_INFO_EDITOR @"customer_info_template"
 #define LOCAL_URL_CUSTOMER_INFO_EDIT @"customer_info_template_edit"
 
-//http://12.196.120.217
+//http://192.168.0.133:8080/site
 //http://192.168.0.133:8080/site
 #ifdef test_server
 
 //------------------- chen server-----------------------
-#define  URL_UPDATE_AUTH  @"http://12.196.120.217/isales/login.htm"
-#define  URL_LOGOUT  @"http://12.196.120.217/isales/loginOut.htm"
-#define  URL_RETRIEVE_PASS  @"http://12.196.120.217/isales/forgotPassword.htm"
+#define  URL_UPDATE_AUTH  @"http://192.168.0.133:8080/site/isales/login.htm"
+#define  URL_LOGOUT  @"http://192.168.0.133:8080/site/isales/loginOut.htm"
+#define  URL_RETRIEVE_PASS  @"http://192.168.0.133:8080/site/isales/forgotPassword.htm"
 
-#define  URL_REQUEST_CATMENU  @"http://12.196.120.217/isales/menu.htm"
-#define  URL_LOAD_HOME  @"http://12.196.120.217/isales/homePage.htm"
-#define  URL_CATEGORY @"http://12.196.120.217/isales/distinctCategory.htm"
-#define  URL_SEARCH  @"http://12.196.120.217/isales/search.htm"
-#define  URL_ITEM_SEARCH  @"http://12.196.120.217/isales/itemSearch.htm"
-#define  URL_CATEGORY_LOADMORE  @"http://12.196.120.217/isales/categoryMore.htm"
-#define  URL_CUSTOMER_ADV_SEARCH @"http://12.196.120.217/isales/getContactAdvance.htm"
+#define  URL_REQUEST_CATMENU  @"http://192.168.0.133:8080/site/isales/menu.htm"
+#define  URL_LOAD_HOME  @"http://192.168.0.133:8080/site/isales/homePage.htm"
+#define  URL_CATEGORY @"http://192.168.0.133:8080/site/isales/distinctCategory.htm"
+#define  URL_SEARCH  @"http://192.168.0.133:8080/site/isales/search.htm"
+#define  URL_ITEM_SEARCH  @"http://192.168.0.133:8080/site/isales/itemSearch.htm"
+#define  URL_CATEGORY_LOADMORE  @"http://192.168.0.133:8080/site/isales/categoryMore.htm"
+#define  URL_CUSTOMER_ADV_SEARCH @"http://192.168.0.133:8080/site/isales/getContactAdvance.htm"
 
 
-#define  URL_ORDER_LIST  @"http://12.196.120.217/isales/orderList.htm"
-#define  URL_ORDER_DETAIL  @"http://12.196.120.217/isales/orderDetail.htm"
-#define URL_COMMIT_ORDER @"http://12.196.120.217/isales/createOrder.htm"
-#define URL_COPY_ORDER @"http://12.196.120.217/isales/copyOrder.htm"
-#define URL_SIGN_ORDER @"http://12.196.120.217/isales/updateOrderSign.htm"
-#define URL_SAVE_ORDER @"http://12.196.120.217/isales/saveOrder.htm"
-#define URL_UPDATE_ORDERCUSTOMER @"http://12.196.120.217/isales/updateOrderCustomerInfo.htm"
-#define  URL_NEW_ORDER  @"http://12.196.120.217/isales/createNewOrder.htm"
-#define  URL_OPEN_ORDER  @"http://12.196.120.217/isales/openOrder.htm"
-#define  URL_RELEASE_ORDER  @"http://12.196.120.217/isales/closeOrder.htm"
-#define  URL_DELETE_ORDER  @"http://12.196.120.217/isales/deleteOrder.htm"
-#define  URL_CANCEL_ORDER  @"http://12.196.120.217/isales/cancelOrder.htm"
+#define  URL_ORDER_LIST  @"http://192.168.0.133:8080/site/isales/orderList.htm"
+#define  URL_ORDER_DETAIL  @"http://192.168.0.133:8080/site/isales/orderDetail.htm"
+#define URL_COMMIT_ORDER @"http://192.168.0.133:8080/site/isales/createOrder.htm"
+#define URL_COPY_ORDER @"http://192.168.0.133:8080/site/isales/copyOrder.htm"
+#define URL_SIGN_ORDER @"http://192.168.0.133:8080/site/isales/updateOrderSign.htm"
+#define URL_SAVE_ORDER @"http://192.168.0.133:8080/site/isales/saveOrder.htm"
+#define URL_UPDATE_ORDERCUSTOMER @"http://192.168.0.133:8080/site/isales/updateOrderCustomerInfo.htm"
+#define  URL_NEW_ORDER  @"http://192.168.0.133:8080/site/isales/createNewOrder.htm"
+#define  URL_OPEN_ORDER  @"http://192.168.0.133:8080/site/isales/openOrder.htm"
+#define  URL_RELEASE_ORDER  @"http://192.168.0.133:8080/site/isales/closeOrder.htm"
+#define  URL_DELETE_ORDER  @"http://192.168.0.133:8080/site/isales/deleteOrder.htm"
+#define  URL_CANCEL_ORDER  @"http://192.168.0.133:8080/site/isales/cancelOrder.htm"
 
 
-#define  URL_CART_SET_PRICE  @"http://12.196.120.217/isales/setPrice.htm"
-#define  URL_CART_ITEM_NOTES  @"http://12.196.120.217/isales/setItemNotes.htm"
-#define  URL_CART_GENERAL_NOTES  @"http://12.196.120.217/isales/updateGeneralNote.htm"
+#define  URL_CART_SET_PRICE  @"http://192.168.0.133:8080/site/isales/setPrice.htm"
+#define  URL_CART_ITEM_NOTES  @"http://192.168.0.133:8080/site/isales/setItemNotes.htm"
+#define  URL_CART_GENERAL_NOTES  @"http://192.168.0.133:8080/site/isales/updateGeneralNote.htm"
 
-#define  URL_CART_INCRESEMENT  @"http://12.196.120.217/isales/increment.htm"
-#define  URL_CART  @"http://12.196.120.217/isales/cartDtail.htm"
-#define  URL_CARTDELIVERY  @"http://12.196.120.217/isales/cartDelivery.htm"
-#define  URL_ADD_TO_CART  @"http://12.196.120.217/isales/addToCart.htm"
-#define  URL_CART_REMOVE  @"http://12.196.120.217/isales/deleteToCart.htm"
-#define  URL_CART_CHECK  @"http://12.196.120.217/isales/checkCartItem.htm"
-#define  URL_CART2WISH  @"http://12.196.120.217/isales/cartRemoveToWishlist.htm"
-#define  URL_WISH2CART  @"http://12.196.120.217/isales/wishlistRemoveToCart.htm"
+#define  URL_CART_INCRESEMENT  @"http://192.168.0.133:8080/site/isales/increment.htm"
+#define  URL_CART  @"http://192.168.0.133:8080/site/isales/cartDtail.htm"
+#define  URL_CARTDELIVERY  @"http://192.168.0.133:8080/site/isales/cartDelivery.htm"
+#define  URL_ADD_TO_CART  @"http://192.168.0.133:8080/site/isales/addToCart.htm"
+#define  URL_CART_REMOVE  @"http://192.168.0.133:8080/site/isales/deleteToCart.htm"
+#define  URL_CART_CHECK  @"http://192.168.0.133:8080/site/isales/checkCartItem.htm"
+#define  URL_CART2WISH  @"http://192.168.0.133:8080/site/isales/cartRemoveToWishlist.htm"
+#define  URL_WISH2CART  @"http://192.168.0.133:8080/site/isales/wishlistRemoveToCart.htm"
 
 
 
 
-#define  URL_CATEGORYADDALL  @"http://12.196.120.217/isales/categoryAddAllTo.htm"
-#define  URL_SEARCHADDALL  @"http://12.196.120.217/isales/searchAddAllTo.htm"
-#define  URL_ITEMSEARCHADDALL @"http://12.196.120.217/isales/itemSearchAddAllTo.htm"
+#define  URL_CATEGORYADDALL  @"http://192.168.0.133:8080/site/isales/categoryAddAllTo.htm"
+#define  URL_SEARCHADDALL  @"http://192.168.0.133:8080/site/isales/searchAddAllTo.htm"
+#define  URL_ITEMSEARCHADDALL @"http://192.168.0.133:8080/site/isales/itemSearchAddAllTo.htm"
 
 
-#define  URL_ITEM_DETAIL  @"http://12.196.120.217/isales/modelDetail.htm"
+#define  URL_ITEM_DETAIL  @"http://192.168.0.133:8080/site/isales/modelDetail.htm"
 
-#define  URL_ADD_TO_WATCHLIST  @"http://12.196.120.217/isales/addToWishList.htm"
-#define  URL_WATCHLIST  @"http://12.196.120.217/isales/wishList.htm"
-#define  URL_WATCHLIST_REMOVE  @"http://12.196.120.217/isales/deleteToWishList.htm"
+#define  URL_ADD_TO_WATCHLIST  @"http://192.168.0.133:8080/site/isales/addToWishList.htm"
+#define  URL_WATCHLIST  @"http://192.168.0.133:8080/site/isales/wishList.htm"
+#define  URL_WATCHLIST_REMOVE  @"http://192.168.0.133:8080/site/isales/deleteToWishList.htm"
 
 
 
-#define  URL_ADD_TO_PORTFOLIO @"http://12.196.120.217/isales/addToPortfolio.htm"
-#define  URL_PORTFOLIO_REMOVE  @"http://12.196.120.217/isales/deleteToPortfolio.htm"
-#define  URL_PORTFOLIOLIST_REMOVE  @"http://12.196.120.217/isales/deleteTearSheetPdf.htm"
-#define  URL_PORTFOLIO  @"http://12.196.120.217/isales/portfolios.htm"
-#define  URL_PORTFOLIO_SET_PRICE  @"http://12.196.120.217/isales/setTearSheetPrice.htm"
-#define  URL_DM_PARAMS @"http://12.196.120.217/isales/selectTearSheetParam.htm"
-#define  URL_REQUEST_DM @"http://12.196.120.217/isales/getTearSheetPdf.htm"
-#define  URL_SAVE_DM_DIRECT @"http://12.196.120.217/isales/getTearSheetPdf.htm"
-#define  URL_SAVE_DM @"http://12.196.120.217/isales/saveTearSheetPdf.htm"
-#define  URL_DM_LIST @"http://12.196.120.217/isales/tearSheetPdfList.htm"
-//#define  URL_DM_SET_QTY @"http://12.196.120.217/isales/setTearSheetAvailableQty.htm"
-#define  URL_REQUEST_MODEL_QTY @"http://12.196.120.217/isales/getTearSheetAvailableQty.htm"
+#define  URL_ADD_TO_PORTFOLIO @"http://192.168.0.133:8080/site/isales/addToPortfolio.htm"
+#define  URL_PORTFOLIO_REMOVE  @"http://192.168.0.133:8080/site/isales/deleteToPortfolio.htm"
+#define  URL_PORTFOLIOLIST_REMOVE  @"http://192.168.0.133:8080/site/isales/deleteTearSheetPdf.htm"
+#define  URL_PORTFOLIO  @"http://192.168.0.133:8080/site/isales/portfolios.htm"
+#define  URL_PORTFOLIO_SET_PRICE  @"http://192.168.0.133:8080/site/isales/setTearSheetPrice.htm"
+#define  URL_DM_PARAMS @"http://192.168.0.133:8080/site/isales/selectTearSheetParam.htm"
+#define  URL_REQUEST_DM @"http://192.168.0.133:8080/site/isales/getTearSheetPdf.htm"
+#define  URL_SAVE_DM_DIRECT @"http://192.168.0.133:8080/site/isales/getTearSheetPdf.htm"
+#define  URL_SAVE_DM @"http://192.168.0.133:8080/site/isales/saveTearSheetPdf.htm"
+#define  URL_DM_LIST @"http://192.168.0.133:8080/site/isales/tearSheetPdfList.htm"
+//#define  URL_DM_SET_QTY @"http://192.168.0.133:8080/site/isales/setTearSheetAvailableQty.htm"
+#define  URL_REQUEST_MODEL_QTY @"http://192.168.0.133:8080/site/isales/getTearSheetAvailableQty.htm"
 
-#define  URL_CONTACT_LIST  @"http://12.196.120.217/isales/getAllContact.htm"
-#define  URL_SHIPTO_LIST  @"http://12.196.120.217/isales/getShipToContact.htm"
+#define  URL_CONTACT_LIST  @"http://192.168.0.133:8080/site/isales/getAllContact.htm"
+#define  URL_SHIPTO_LIST  @"http://192.168.0.133:8080/site/isales/getShipToContact.htm"
 
-#define  URL_ADDRESS_EDOTOR  @"http://12.196.120.217/isales/getAddAddress.htm"
-#define  URL_ADDRESS_SAVE  @"http://12.196.120.217/isales/saveAddress.htm"
+#define  URL_ADDRESS_EDOTOR  @"http://192.168.0.133:8080/site/isales/getAddAddress.htm"
+#define  URL_ADDRESS_SAVE  @"http://192.168.0.133:8080/site/isales/saveAddress.htm"
 
 
-#define  URL_CREDITCARD_EDOTOR  @"http://12.196.120.217/isales/creditCard.htm"
-#define  URL_CREDITCARD_SAVE  @"http://12.196.120.217/isales/saveAddress.htm"
+#define  URL_CREDITCARD_EDOTOR  @"http://192.168.0.133:8080/site/isales/creditCard.htm"
+#define  URL_CREDITCARD_SAVE  @"http://192.168.0.133:8080/site/isales/saveAddress.htm"
 
 
 
-#define  URL_CUSTOMER_INFO  @"http://12.196.120.217/isales/getCustomerInfoByContact.htm"
-#define  URL_CUSTOMER_PENDINGORDER  @"http://12.196.120.217/isales/hasPendingOrderByContact.htm"
-#define  URL_NEW_CUSTOMER  @"http://12.196.120.217/isales/getAddCustomer.htm"
-#define  URL_EDIT_CUSTOMER  @"http://12.196.120.217/isales/getUpdateCustomerInfoByContact.htm"
-#define  URL_CUSTOMER_SAVE  @"http://12.196.120.217/isales/saveCustomer.htm"
-#define  URL_CUSTOMER_UPDATE  @"http://12.196.120.217/isales/updateCustomer.htm"
-#define  URL_UPDATE_CUSTOMER_BCARD  @"http://12.196.120.217/isales/updateCustomerBusiCard.htm"
+#define  URL_CUSTOMER_INFO  @"http://192.168.0.133:8080/site/isales/getCustomerInfoByContact.htm"
+#define  URL_CUSTOMER_PENDINGORDER  @"http://192.168.0.133:8080/site/isales/hasPendingOrderByContact.htm"
+#define  URL_NEW_CUSTOMER  @"http://192.168.0.133:8080/site/isales/getAddCustomer.htm"
+#define  URL_EDIT_CUSTOMER  @"http://192.168.0.133:8080/site/isales/getUpdateCustomerInfoByContact.htm"
+#define  URL_CUSTOMER_SAVE  @"http://192.168.0.133:8080/site/isales/saveCustomer.htm"
+#define  URL_CUSTOMER_UPDATE  @"http://192.168.0.133:8080/site/isales/updateCustomer.htm"
+#define  URL_UPDATE_CUSTOMER_BCARD  @"http://192.168.0.133:8080/site/isales/updateCustomerBusiCard.htm"
 
 
 
 
 
 
-#define  URL_ERR_LOG  @"http://12.196.120.217/isales/er_log.htm"
+#define  URL_ERR_LOG  @"http://192.168.0.133:8080/site/isales/er_log.htm"
 
-#define  URL_UPLOAD_IMG  @"http://12.196.120.217/isales/uploadImg.htm"
+#define  URL_UPLOAD_IMG  @"http://192.168.0.133:8080/site/isales/uploadImg.htm"
 
 
-#define  URL_NPD_POLICY  @"http://12.196.120.217/isales/generalPolicy.htm"
+#define  URL_NPD_POLICY  @"http://192.168.0.133:8080/site/isales/generalPolicy.htm"
 
 
-#define  URL_CHECK_OFFLINE  @"http://12.196.120.217/offline/initDatas.htm"
-#define  URL_UPLOAD_OFFLINE  @"http://12.196.120.217/offline/uploadOfflineData.htm"
+#define  URL_CHECK_OFFLINE  @"http://192.168.0.133:8080/site/offline/initDatas.htm"
+#define  URL_UPLOAD_OFFLINE  @"http://192.168.0.133:8080/site/offline/uploadOfflineData.htm"
 
 
-#define  URL_DOWNLOAD_OFFLINE  @"http://12.196.120.217/offline/downloadDatas.htm"
-#define  URL_FINISH_DOWNLOAD_OFFLINE  @"http://12.196.120.217/offline/confirmVersion.htm"
+#define  URL_DOWNLOAD_OFFLINE  @"http://192.168.0.133:8080/site/offline/downloadDatas.htm"
+#define  URL_FINISH_DOWNLOAD_OFFLINE  @"http://192.168.0.133:8080/site/offline/confirmVersion.htm"
 
 
-#define  URL_GET_RESULT  @"http://12.196.120.217/offline/getResultBySerial.htm"
+#define  URL_GET_RESULT  @"http://192.168.0.133:8080/site/offline/getResultBySerial.htm"
 
-#define URL_SET_PRICE_TYPE @"http://12.196.120.217/isales/setSeePriceType.htm"
+#define URL_SET_PRICE_TYPE @"http://192.168.0.133:8080/site/isales/setSeePriceType.htm"
 
-#define URL_GET_CIVEN_PRICE @"http://12.196.120.217/isales/getSeeGivenPrice.htm"
+#define URL_GET_CIVEN_PRICE @"http://192.168.0.133:8080/site/isales/getSeeGivenPrice.htm"
 
-#define URL_SET_GIVEN_PRICE @"http://12.196.120.217/isales/setSeeGivenPrice.htm"
+#define URL_SET_GIVEN_PRICE @"http://192.168.0.133:8080/site/isales/setSeeGivenPrice.htm"
 
-#define URL_SET_MERGE_ORDER @"http://12.196.120.217/isales/mergeOrder.htm"
+#define URL_SET_MERGE_ORDER @"http://192.168.0.133:8080/site/isales/mergeOrder.htm"
 
-#define URL_REQUEST_LOGIN @"http://12.196.120.217/isales/requestLogin.htm"
+#define URL_REQUEST_LOGIN @"http://192.168.0.133:8080/site/isales/requestLogin.htm"
 
-#define URL_EMAIL_CART @"http://12.196.120.217/isales/sendCartEmail.htm"
+#define URL_EMAIL_CART @"http://192.168.0.133:8080/site/isales/sendCartEmail.htm"
 
-#define URL_NOTIFY_ME @"http://12.196.120.217/isales/notifyMeEmail.htm"
+#define URL_NOTIFY_ME @"http://192.168.0.133:8080/site/isales/notifyMeEmail.htm"
 
-#define URL_EMAIL_WISHLIST @"http://12.196.120.217/isales/sendWishListEmail.htm"
+#define URL_EMAIL_WISHLIST @"http://192.168.0.133:8080/site/isales/sendWishListEmail.htm"
 
-#define URL_BLOG @"http://12.196.120.217/blog"
+#define URL_BLOG @"http://192.168.0.133:8080/site/blog"
 
 #else