Commit 04ee37bb04f11b58e3eb43ac686365aea1880859

Authored by zhangxiaowen
1 parent ae36c1b9

no message

CNLiveMineModule.podspec
... ... @@ -83,6 +83,12 @@ TODO: 网家家-我的模块.
83 83 # 基类
84 84 s.dependency 'CNLiveCommonClass'
85 85  
  86 + # IM
  87 + s.dependency 'CNLiveIMBaseSDK'
  88 +
  89 + # 类别
  90 + s.dependency 'CNLiveCategory'
  91 +
86 92 # 用户信息本地化
87 93 s.dependency 'CNLiveUserManagement'
88 94  
... ... @@ -98,11 +104,8 @@ TODO: 网家家-我的模块.
98 104 # 设置模块
99 105 s.dependency 'CNLiveSettingModule'
100 106  
101   - #IM
102   - s.dependency 'CNLiveIMBaseSDK'
103   -
104   - #类别
105   - s.dependency 'CNLiveCategory'
  107 + # 我的收藏模块
  108 + s.dependency 'CNLiveCollectionModule'
106 109  
107 110 s.static_framework = true
108 111  
... ...
CNLiveMineModule/Classes/Controller/CNLiveMineController.m
... ... @@ -22,6 +22,7 @@
22 22 #import "CNLiveMineCell.h"
23 23 #import "CNLiveMineModel.h"
24 24 #import "CNLiveUserInfoController.h"
  25 +#import "CNLiveMineRequest.h"
25 26  
26 27 @interface CNLiveMineController()<UITableViewDelegate, UITableViewDataSource, CNLiveMineHeaderViewDelegate, CNLiveMineCellDelegate>
27 28 @property (nonatomic, strong) UITableView *tableView;
... ... @@ -60,7 +61,8 @@ static const CGFloat timeValue = 1.5;
60 61 @"image":@"mine_refund"
61 62 }
62 63 ]
63   - },
  64 +
  65 + },
64 66 @{
65 67 @"name":@"常用工具",
66 68 @"style":@"2",
... ... @@ -94,7 +96,8 @@ static const CGFloat timeValue = 1.5;
94 96 @"image":@"mine_tool_map"
95 97 }
96 98 ]
97   - },
  99 +
  100 + },
98 101 @{
99 102 @"name":@"购买的商品",
100 103 @"pic":@"mine_buy_commodity",
... ... @@ -105,7 +108,8 @@ static const CGFloat timeValue = 1.5;
105 108 @"image":@"mine_e-ticket"
106 109 }
107 110 ]
108   - },
  111 +
  112 + },
109 113 @{
110 114 @"name":@"大众体育",
111 115 @"pic":@"mine_china_sport",
... ... @@ -119,11 +123,12 @@ static const CGFloat timeValue = 1.5;
119 123 @"image":@"mine_record"
120 124 }
121 125 ]
122   - }
  126 +
  127 + }
123 128 ];
124 129 for(NSDictionary *dic in data){
125 130 CNLiveMineModel *model = [CNLiveMineModel mj_objectWithKeyValues:dic];
126   -// [model editModel:NO];
  131 + [model editModel:NO];
127 132 [self.data addObject:model];
128 133 }
129 134 [self.tableView reloadData];
... ... @@ -223,35 +228,27 @@ static const CGFloat timeValue = 1.5;
223 228 }
224 229 }
225 230  
  231 +// 请求签到赚积分
226 232 - (void)requestSignIn{
227   - NSDictionary *params = @{@"sid":CNUserShareModel.uid};
228   - [CNLiveNetworking setAllowRequestDefaultArgument:YES];
229   - [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIntegralSignInUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
230   -
  233 + [CNLiveMineRequest signIn:^(BOOL isSuccess, NSDictionary * _Nonnull data, NSError * _Nonnull error) {
231 234 if (error.code == -1001 || error.code == -1009) {
232 235 [QMUITips showError:@"网络连接已断开" inView:self.view hideAfterDelay:timeValue];
233 236 return ;
234 237 }
235   - if (!error) {
236   - if(responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSDictionary class]]){
237   - id<CNLiveIntegralServiceProtocol> service = [[BeeHive shareInstance] createService:@protocol(CNLiveIntegralServiceProtocol)];
238   - NSDictionary *dic = responseObject[@"data"];
239   - NSInteger status = [dic[@"status"] integerValue];
240   - if (status == 1) {
241   - [service showGoldWhereaboutsViewWithDic:dic];
242   -
243   - }else{
244   - [service showSignInViewWithDic:dic];
245   - }
246   -
  238 + if (isSuccess) {
  239 + id<CNLiveIntegralServiceProtocol> service = [[BeeHive shareInstance] createService:@protocol(CNLiveIntegralServiceProtocol)];
  240 + NSInteger status = [data[@"status"] integerValue];
  241 + if (status == 1) {
  242 + [service showGoldWhereaboutsViewWithDic:data];
  243 + }else{
  244 + [service showSignInViewWithDic:data];
247 245 }
248 246  
249 247 }else{
250 248 [QMUITips showError:@"签到失败" inView:self.view hideAfterDelay:timeValue];
251   - return ;
252 249  
253 250 }
254   -
  251 + self.headerView.interactionEnabled = YES;
255 252 }];
256 253 }
257 254  
... ...
CNLiveMineModule/Classes/Model/CNLiveMineModel.h
... ... @@ -36,6 +36,7 @@ typedef NS_ENUM(NSInteger, CNLiveMineCellType) {
36 36 @property (nonatomic, assign) CGFloat height;
37 37 @property (nonatomic, assign) CGFloat margin;
38 38  
  39 +// 是否显示路径工具
39 40 - (void)editModel:(BOOL)showMapTool;
40 41  
41 42 @end
... ...
CNLiveMineModule/Classes/Model/CNLiveMineRequest.h 0 → 100644
  1 +//
  2 +// CNLiveMineRequest.h
  3 +// CNLiveMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +typedef void(^CancelCollectionBlock)(BOOL isSuccess, NSDictionary *data, NSError *error);
  13 +
  14 +@interface CNLiveMineRequest : NSObject
  15 +
  16 ++ (void)signIn:(CancelCollectionBlock)block;
  17 +
  18 +@end
  19 +
  20 +NS_ASSUME_NONNULL_END
... ...
CNLiveMineModule/Classes/Model/CNLiveMineRequest.m 0 → 100644
  1 +//
  2 +// CNLiveMineRequest.m
  3 +// CNLiveMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveMineRequest.h"
  10 +#import "CNLiveCategory.h"
  11 +#import "CNLiveNetworking.h"
  12 +#import "CNLiveEnvironment.h"
  13 +#import "CNUserInfoManager.h"
  14 +
  15 +#import "CNLiveCollectionModel.h"
  16 +
  17 +@implementation CNLiveMineRequest
  18 +
  19 ++ (void)signIn:(CancelCollectionBlock)block {
  20 + NSDictionary *params = @{@"sid":CNUserShareModel.uid};
  21 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  22 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIntegralSignInUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  23 + if (responseObject && [responseObject isKindOfClass:[NSDictionary class]] && responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSDictionary class]]) {
  24 + NSString *errorCode = [NSString stringWithFormat:@"%@", responseObject[@"errorCode"]];
  25 + NSDictionary *data = responseObject[@"data"];
  26 + block?block([errorCode isEqualToString:@"0"], data, error):@"";
  27 + }else{
  28 + block?block(NO, @{}, error):@"";
  29 +
  30 + }
  31 +
  32 + }];
  33 +}
  34 +
  35 +
  36 +@end
... ...
CNLiveMineModule/Classes/View/CNLiveMineHeaderView.h
... ... @@ -25,6 +25,8 @@ typedef NS_ENUM(NSInteger, CNLiveMineHeaderViewType) {
25 25 @end
26 26 @interface CNLiveMineHeaderView : UIView
27 27 @property (nonatomic, weak) id<CNLiveMineHeaderViewDelegate> delegate;
  28 +@property (nonatomic, assign) BOOL interactionEnabled;
  29 +
28 30 - (void)layoutSubviews;
29 31  
30 32 @end
... ...
CNLiveMineModule/Classes/View/CNLiveMineHeaderView.m
... ... @@ -298,14 +298,24 @@ static const NSInteger margin = 20;
298 298 }
299 299  
300 300 }
  301 +
  302 +- (void)setInteractionEnabled:(BOOL)interactionEnabled{
  303 + _interactionEnabled = interactionEnabled;
  304 + _sign.userInteractionEnabled = interactionEnabled;
  305 + _witness.userInteractionEnabled = interactionEnabled;
  306 +
  307 +}
  308 +
301 309 - (void)signDidClicked:(UIButton *)btn{
302 310 if (self.delegate && [self.delegate respondsToSelector:@selector(headerView:pushToController:)]) {
  311 + btn.userInteractionEnabled = NO;
303 312 [self.delegate headerView:self pushToController:CNLiveMineHeaderViewTypeSign];
304 313 }
305 314 }
306 315  
307 316 - (void)witnessDidClicked:(UIButton *)btn{
308 317 if (self.delegate && [self.delegate respondsToSelector:@selector(headerView:pushToController:)]) {
  318 + btn.userInteractionEnabled = NO;
309 319 [self.delegate headerView:self pushToController:CNLiveMineHeaderViewTypeWintess];
310 320 }
311 321 }
... ...
Example/CNLiveMineModule.xcodeproj/project.pbxproj
... ... @@ -345,6 +345,7 @@
345 345 "${BUILT_PRODUCTS_DIR}/CNLiveCacheManagerKit/CNLiveCacheManagerKit.framework",
346 346 "${BUILT_PRODUCTS_DIR}/CNLiveCategory/CNLiveCategory.framework",
347 347 "${BUILT_PRODUCTS_DIR}/CNLiveChooseCountry/CNLiveChooseCountry.framework",
  348 + "${BUILT_PRODUCTS_DIR}/CNLiveCollectionModule/CNLiveCollectionModule.framework",
348 349 "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework",
349 350 "${BUILT_PRODUCTS_DIR}/CNLiveCommonClass/CNLiveCommonClass.framework",
350 351 "${BUILT_PRODUCTS_DIR}/CNLiveCustomUI/CNLiveCustomUI.framework",
... ... @@ -392,6 +393,7 @@
392 393 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCacheManagerKit.framework",
393 394 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCategory.framework",
394 395 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveChooseCountry.framework",
  396 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCollectionModule.framework",
395 397 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework",
396 398 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonClass.framework",
397 399 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomUI.framework",
... ...
Example/CNLiveMineModule/CNLIVEAppDelegate.m
... ... @@ -19,7 +19,7 @@
19 19 {
20 20 // Override point for customization after application launch.
21 21 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
22   - [CNLiveEnvironmentManager setEnvironment:CNLiveProductionAppStore];
  22 + [CNLiveEnvironmentManager setEnvironment:CNLiveDebugAppStore];
23 23 [CNLiveUserSystemCenter setAppId:AppId appKey:APPKey appSecret:AppSecret isTestEnvironment:TestEnvironment];
24 24 if ([CNUserShareManager isLogin]) {
25 25 [CNLiveUserSystemCenter setUserId:CNUserShareModel.uid];
... ...