1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- //
- // RYBaseVM.h
- // Asteria
- //
- // Created by 王猛 on 2023/12/25.
- //
- #import <Foundation/Foundation.h>
- typedef NS_ENUM(NSUInteger,ReqNetType){
- GetReqNetType ,
- PostReqNetType ,
- FormDataPostReqNetType ,
- PutReqNetType ,
- DeleteReqNetType
- } ;
- NS_ASSUME_NONNULL_BEGIN
- @protocol RY_baseVMprotocol <NSObject>
- ///获取网络请求的回调
- -(void)ry_respnsData:(nullable id)data
- parseAry:(nullable NSMutableArray *)arry
- sucess:(BOOL)sucessOrFail
- mark:(NSString *)mark
- reqNetType:(ReqNetType)reqNetType;
- ///batch 多个 网络请求同步的代理
- ///同步时发出了a、b、c 3个网络请求,我们希望在a、b、c 3个网络请求都结束的时候获得一个通知
- //-(void)pro_batchResponAry:(NSArray <UCMHttpRequestResponse *>*)responseAry success:(BOOL)success modelData:(NSMutableArray *_Nullable)modelAry;
- @end
- @interface RYBaseVM : NSObject
- @property (nonatomic, weak) id <RY_baseVMprotocol> delegate;
- + (instancetype)setupVMclass:(Class)VMclass;
- - (instancetype)initDelegate:(id<RY_baseVMprotocol>)delegte;
- -(void)ry_requestPostApi:(NSString *)mark param:(NSDictionary *)param;
- -(void)ry_formDataRequestPostApi:(NSString *)mark param:(NSDictionary *)param;
- -(void)ry_requestGetApi:(NSString *)mark param:(NSDictionary *)param;
- -(void)ry_requestPutApi:(NSString *)mark param:(NSString *)paramStr;
- -(void)ry_requestDeleteApi:(NSString *)mark paramStr:(NSString *)paramStr;
-
- //重写的方法 解析之后再传给 VC
- -(void)ry_respnsSucessWithPath:(NSString *)mark data:(id)data reqNetType:(ReqNetType)reqNetType;
- -(void)ry_reponsFaildWithPath:(NSString *)mark code:(NSString *)code msg:(NSString *)msg reqNetType:(ReqNetType)reqNetType;
- - (void)ry_VMconfigDelegateData:(id)data
- parseAry:(NSMutableArray *)ary
- success:(BOOL)success
- mark:(NSString *)mark
- reqNetType:(ReqNetType)reqNetType;
- @end
- NS_ASSUME_NONNULL_END
|