Commit d18fb7bf10a77c8d477fff4fc5968b7249a1a4af

Authored by yanglingyu
1 parent 6f7fd7ac

收藏中英文分离修改

CNLiveScioLive/AppDelegate.m
@@ -39,8 +39,7 @@ @@ -39,8 +39,7 @@
39 39
40 [[BaiduMobStat defaultStat] startWithAppId:uBaiduMobStat]; 40 [[BaiduMobStat defaultStat] startWithAppId:uBaiduMobStat];
41 41
42 - //收藏  
43 - [[DBAction sharedDBAction] createTable]; 42 +
44 43
45 //分享 44 //分享
46 [MobClick startWithAppkey:uMengKey reportPolicy:BATCH channelId:nil]; 45 [MobClick startWithAppkey:uMengKey reportPolicy:BATCH channelId:nil];
@@ -51,6 +50,9 @@ @@ -51,6 +50,9 @@
51 //语言 50 //语言
52 [self setApplicationLanguage]; 51 [self setApplicationLanguage];
53 52
  53 + //收藏
  54 + [[DBAction sharedDBAction] createTable:@"en"];
  55 + [[DBAction sharedDBAction] createTable:@"zh"];
54 //版本更新 56 //版本更新
55 [self checkAppUpdate]; 57 [self checkAppUpdate];
56 58
@@ -101,9 +103,11 @@ @@ -101,9 +103,11 @@
101 //获取系统语言 103 //获取系统语言
102 if (IS_CHINESE) { 104 if (IS_CHINESE) {
103 self.lan =@"zh-Hans"; 105 self.lan =@"zh-Hans";
  106 + [User_Defaults setObject:@"zh-Hans" forKey:Language_Local];
104 [IQKeyboardManager sharedManager].toolbarDoneBarButtonItemText = @"完成"; 107 [IQKeyboardManager sharedManager].toolbarDoneBarButtonItemText = @"完成";
105 }else{ 108 }else{
106 self.lan =@"en"; 109 self.lan =@"en";
  110 + [User_Defaults setObject:@"en" forKey:Language_Local];
107 [IQKeyboardManager sharedManager].toolbarDoneBarButtonItemText = @"Done"; 111 [IQKeyboardManager sharedManager].toolbarDoneBarButtonItemText = @"Done";
108 } 112 }
109 } 113 }
CNLiveScioLive/Pages/Home/新闻详情/Controller/ArticleDetailViewController.m
@@ -216,9 +216,9 @@ @@ -216,9 +216,9 @@
216 { 216 {
217 NSDictionary *dic = [weakSelf.model toDictionary]; 217 NSDictionary *dic = [weakSelf.model toDictionary];
218 TableData *notice = [[TableData alloc] initWithJSONDictionary:dic]; 218 TableData *notice = [[TableData alloc] initWithJSONDictionary:dic];
219 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 219 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
220 if (!isIn) { 220 if (!isIn) {
221 - BOOL isInsert = [[DBAction sharedDBAction] insertTable:notice]; 221 + BOOL isInsert = [[DBAction sharedDBAction] insertTable:[User_Defaults objectForKey:Language_Local] notice:notice];
222 if (isInsert) { 222 if (isInsert) {
223 [AlertViewTool showHUDAddedToView:weakSelf.view text:CustomStr(@"CollectSuccess")]; 223 [AlertViewTool showHUDAddedToView:weakSelf.view text:CustomStr(@"CollectSuccess")];
224 [weakSelf.detailsView.btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 224 [weakSelf.detailsView.btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
@@ -226,7 +226,7 @@ @@ -226,7 +226,7 @@
226 } 226 }
227 227
228 } else { 228 } else {
229 - BOOL isDelete = [[DBAction sharedDBAction] deleteTable:notice]; 229 + BOOL isDelete = [[DBAction sharedDBAction] deleteTable:[User_Defaults objectForKey:Language_Local] notice:notice];
230 if (isDelete) { 230 if (isDelete) {
231 [AlertViewTool showHUDAddedToView:weakSelf.view text:CustomStr(@"CancelCollect")]; 231 [AlertViewTool showHUDAddedToView:weakSelf.view text:CustomStr(@"CancelCollect")];
232 [weakSelf.detailsView.btn setImage:[UIImage imageNamed:@"cnlive_isfavorite"] forState:UIControlStateNormal]; 232 [weakSelf.detailsView.btn setImage:[UIImage imageNamed:@"cnlive_isfavorite"] forState:UIControlStateNormal];
CNLiveScioLive/Pages/Home/新闻详情/Controller/VideoDetailViewController.m
@@ -227,9 +227,9 @@ static NSString *newsLeftPicTableViewCell = @"CNLiveNewsLeftPicTableViewCell"; @@ -227,9 +227,9 @@ static NSString *newsLeftPicTableViewCell = @"CNLiveNewsLeftPicTableViewCell";
227 { 227 {
228 NSDictionary *dic = [weakSelf.model toDictionary]; 228 NSDictionary *dic = [weakSelf.model toDictionary];
229 TableData *notice = [[TableData alloc] initWithJSONDictionary:dic]; 229 TableData *notice = [[TableData alloc] initWithJSONDictionary:dic];
230 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 230 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
231 if (!isIn) { 231 if (!isIn) {
232 - BOOL isInsert = [[DBAction sharedDBAction] insertTable:notice]; 232 + BOOL isInsert = [[DBAction sharedDBAction] insertTable:[User_Defaults objectForKey:Language_Local] notice:notice];
233 if (isInsert) { 233 if (isInsert) {
234 [AlertViewTool showHUDAddedToView:weakSelf.view text:CustomStr(@"CollectSuccess")]; 234 [AlertViewTool showHUDAddedToView:weakSelf.view text:CustomStr(@"CollectSuccess")];
235 [weakSelf.detailsView.btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 235 [weakSelf.detailsView.btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
@@ -237,7 +237,7 @@ static NSString *newsLeftPicTableViewCell = @"CNLiveNewsLeftPicTableViewCell"; @@ -237,7 +237,7 @@ static NSString *newsLeftPicTableViewCell = @"CNLiveNewsLeftPicTableViewCell";
237 } 237 }
238 238
239 } else { 239 } else {
240 - BOOL isDelete = [[DBAction sharedDBAction] deleteTable:notice]; 240 + BOOL isDelete = [[DBAction sharedDBAction] deleteTable:[User_Defaults objectForKey:Language_Local] notice:notice];
241 if (isDelete) { 241 if (isDelete) {
242 [AlertViewTool showHUDAddedToView:weakSelf.view text:CustomStr(@"CancelCollect")]; 242 [AlertViewTool showHUDAddedToView:weakSelf.view text:CustomStr(@"CancelCollect")];
243 [weakSelf.detailsView.btn setImage:[UIImage imageNamed:@"cnlive_isfavorite"] forState:UIControlStateNormal]; 243 [weakSelf.detailsView.btn setImage:[UIImage imageNamed:@"cnlive_isfavorite"] forState:UIControlStateNormal];
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldArticleDetailViewController.m
@@ -203,7 +203,7 @@ @@ -203,7 +203,7 @@
203 203
204 UIButton *isFavoriteButton = [UIButton buttonWithType:UIButtonTypeCustom]; 204 UIButton *isFavoriteButton = [UIButton buttonWithType:UIButtonTypeCustom];
205 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary]; 205 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary];
206 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 206 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
207 if (isIn) { 207 if (isIn) {
208 [isFavoriteButton setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 208 [isFavoriteButton setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
209 } else { 209 } else {
@@ -270,17 +270,17 @@ @@ -270,17 +270,17 @@
270 } 270 }
271 } else if (20000 == btn.tag) { 271 } else if (20000 == btn.tag) {
272 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary]; 272 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary];
273 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 273 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
274 274
275 if (!isIn) { 275 if (!isIn) {
276 - BOOL isInsert = [[DBAction sharedDBAction] insertTable:notice]; 276 + BOOL isInsert = [[DBAction sharedDBAction] insertTable:[User_Defaults objectForKey:Language_Local] notice:notice];
277 if (isInsert) { 277 if (isInsert) {
278 [AlertViewTool showHUDAddedToView:self.view text:CustomStr(@"CollectSuccess")]; 278 [AlertViewTool showHUDAddedToView:self.view text:CustomStr(@"CollectSuccess")];
279 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 279 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
280 280
281 } 281 }
282 } else { 282 } else {
283 - BOOL isDelete = [[DBAction sharedDBAction] deleteTable:notice]; 283 + BOOL isDelete = [[DBAction sharedDBAction] deleteTable:[User_Defaults objectForKey:Language_Local] notice:notice];
284 if (isDelete) { 284 if (isDelete) {
285 [AlertViewTool showHUDAddedToView:self.view text:CustomStr(@"CancelCollect")]; 285 [AlertViewTool showHUDAddedToView:self.view text:CustomStr(@"CancelCollect")];
286 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorite"] forState:UIControlStateNormal]; 286 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorite"] forState:UIControlStateNormal];
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldVideoDetailViewController.m
@@ -104,7 +104,7 @@ @@ -104,7 +104,7 @@
104 104
105 UIButton *isFavoriteButton = [UIButton buttonWithType:UIButtonTypeCustom]; 105 UIButton *isFavoriteButton = [UIButton buttonWithType:UIButtonTypeCustom];
106 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary]; 106 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary];
107 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 107 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
108 if (isIn) { 108 if (isIn) {
109 [isFavoriteButton setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 109 [isFavoriteButton setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
110 } else { 110 } else {
@@ -142,7 +142,7 @@ @@ -142,7 +142,7 @@
142 [_webView loadHTMLString:[self setHTMLString] baseURL:nil]; 142 [_webView loadHTMLString:[self setHTMLString] baseURL:nil];
143 } else if (20000 == btn.tag) { 143 } else if (20000 == btn.tag) {
144 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary]; 144 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary];
145 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 145 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
146 146
147 NSMutableDictionary *author = [NSMutableDictionary dictionaryWithContentsOfFile:FavouriteAuthors_PATH]; 147 NSMutableDictionary *author = [NSMutableDictionary dictionaryWithContentsOfFile:FavouriteAuthors_PATH];
148 if (!author) { 148 if (!author) {
@@ -150,7 +150,7 @@ @@ -150,7 +150,7 @@
150 } 150 }
151 151
152 if (!isIn) { 152 if (!isIn) {
153 - BOOL isInsert = [[DBAction sharedDBAction] insertTable:notice]; 153 + BOOL isInsert = [[DBAction sharedDBAction] insertTable:[User_Defaults objectForKey:Language_Local] notice:notice];
154 [author setObject:self.authorName forKey:notice.pageUrl]; 154 [author setObject:self.authorName forKey:notice.pageUrl];
155 [author writeToFile:FavouriteAuthors_PATH atomically:YES]; 155 [author writeToFile:FavouriteAuthors_PATH atomically:YES];
156 if (isInsert) { 156 if (isInsert) {
@@ -158,7 +158,7 @@ @@ -158,7 +158,7 @@
158 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 158 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
159 } 159 }
160 } else { 160 } else {
161 - BOOL isDelete = [[DBAction sharedDBAction] deleteTable:notice]; 161 + BOOL isDelete = [[DBAction sharedDBAction] deleteTable:[User_Defaults objectForKey:Language_Local] notice:notice];
162 [author removeObjectForKey:notice.pageUrl]; 162 [author removeObjectForKey:notice.pageUrl];
163 [author writeToFile:FavouriteAuthors_PATH atomically:YES]; 163 [author writeToFile:FavouriteAuthors_PATH atomically:YES];
164 if (isDelete) { 164 if (isDelete) {
CNLiveScioLive/Pages/Home/新闻详情/OldController/SCIOSpecialViewController.m
@@ -77,7 +77,7 @@ @@ -77,7 +77,7 @@
77 77
78 UIButton *isFavoriteButton = [UIButton buttonWithType:UIButtonTypeCustom]; 78 UIButton *isFavoriteButton = [UIButton buttonWithType:UIButtonTypeCustom];
79 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary]; 79 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary];
80 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 80 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
81 if (isIn) { 81 if (isIn) {
82 [isFavoriteButton setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 82 [isFavoriteButton setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
83 } else { 83 } else {
@@ -107,15 +107,15 @@ @@ -107,15 +107,15 @@
107 UIButton *btn = (UIButton *)sender; 107 UIButton *btn = (UIButton *)sender;
108 if (20000 == btn.tag) { 108 if (20000 == btn.tag) {
109 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary]; 109 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary];
110 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 110 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
111 if (!isIn) { 111 if (!isIn) {
112 - BOOL isInsert = [[DBAction sharedDBAction] insertTable:notice]; 112 + BOOL isInsert = [[DBAction sharedDBAction] insertTable:[User_Defaults objectForKey:Language_Local] notice:notice];
113 if (isInsert) { 113 if (isInsert) {
114 [AlertViewTool showHUDAddedToView:self.view text:CustomStr(@"CollectSuccess")]; 114 [AlertViewTool showHUDAddedToView:self.view text:CustomStr(@"CollectSuccess")];
115 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 115 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
116 } 116 }
117 } else { 117 } else {
118 - BOOL isDelete = [[DBAction sharedDBAction] deleteTable:notice]; 118 + BOOL isDelete = [[DBAction sharedDBAction] deleteTable:[User_Defaults objectForKey:Language_Local] notice:notice];
119 if (isDelete) { 119 if (isDelete) {
120 [AlertViewTool showHUDAddedToView:self.view text:CustomStr(@"CancelCollect")]; 120 [AlertViewTool showHUDAddedToView:self.view text:CustomStr(@"CancelCollect")];
121 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorite"] forState:UIControlStateNormal]; 121 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorite"] forState:UIControlStateNormal];
CNLiveScioLive/Pages/Home/新闻详情/View/CNLiveNewsDetailsView.m
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 if(i == 1){ 49 if(i == 1){
50 self.btn = btn; 50 self.btn = btn;
51 TableData *notice = [[TableData alloc] initWithJSONDictionary:self.dic]; 51 TableData *notice = [[TableData alloc] initWithJSONDictionary:self.dic];
52 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 52 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
53 if (isIn) { 53 if (isIn) {
54 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 54 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
55 } else { 55 } else {
CNLiveScioLive/Pages/Live/Controller/TopNoticeViewController.m
@@ -156,7 +156,7 @@ @@ -156,7 +156,7 @@
156 UIButton *isFavoriteButton = [UIButton buttonWithType:UIButtonTypeCustom]; 156 UIButton *isFavoriteButton = [UIButton buttonWithType:UIButtonTypeCustom];
157 isFavoriteButton.tag = 20000; 157 isFavoriteButton.tag = 20000;
158 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary[@"programs"][0]]; 158 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary[@"programs"][0]];
159 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 159 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
160 if (isIn) { 160 if (isIn) {
161 [isFavoriteButton setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 161 [isFavoriteButton setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
162 } else { 162 } else {
@@ -200,15 +200,15 @@ @@ -200,15 +200,15 @@
200 } 200 }
201 } else if (20000 == btn.tag) { 201 } else if (20000 == btn.tag) {
202 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary[@"programs"][0]]; 202 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary[@"programs"][0]];
203 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 203 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
204 if (!isIn) { 204 if (!isIn) {
205 - BOOL isInsert = [[DBAction sharedDBAction] insertTable:notice]; 205 + BOOL isInsert = [[DBAction sharedDBAction] insertTable:[User_Defaults objectForKey:Language_Local] notice:notice];
206 if (isInsert) { 206 if (isInsert) {
207 [AlertViewTool showHUDViewText:CustomStr(@"CollectSuccess")]; 207 [AlertViewTool showHUDViewText:CustomStr(@"CollectSuccess")];
208 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 208 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
209 } 209 }
210 } else { 210 } else {
211 - BOOL isDelete = [[DBAction sharedDBAction] deleteTable:notice]; 211 + BOOL isDelete = [[DBAction sharedDBAction] deleteTable:[User_Defaults objectForKey:Language_Local] notice:notice];
212 if (isDelete) { 212 if (isDelete) {
213 [AlertViewTool showHUDViewText:CustomStr(@"CancelCollect")]; 213 [AlertViewTool showHUDViewText:CustomStr(@"CancelCollect")];
214 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorite"] forState:UIControlStateNormal]; 214 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorite"] forState:UIControlStateNormal];
CNLiveScioLive/Pages/Live/Controller/VideoPlayBackViewController.m
@@ -113,7 +113,7 @@ @@ -113,7 +113,7 @@
113 113
114 UIButton *isFavoriteButton = [UIButton buttonWithType:UIButtonTypeCustom]; 114 UIButton *isFavoriteButton = [UIButton buttonWithType:UIButtonTypeCustom];
115 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary]; 115 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary];
116 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 116 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
117 if (isIn) { 117 if (isIn) {
118 [isFavoriteButton setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 118 [isFavoriteButton setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
119 } else { 119 } else {
@@ -151,15 +151,15 @@ @@ -151,15 +151,15 @@
151 [_webView loadHTMLString:[self setHTMLString] baseURL:nil]; 151 [_webView loadHTMLString:[self setHTMLString] baseURL:nil];
152 } else if (20000 == btn.tag) { 152 } else if (20000 == btn.tag) {
153 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary]; 153 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary];
154 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 154 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
155 if (!isIn) { 155 if (!isIn) {
156 - BOOL isInsert = [[DBAction sharedDBAction] insertTable:notice]; 156 + BOOL isInsert = [[DBAction sharedDBAction] insertTable:[User_Defaults objectForKey:Language_Local] notice:notice];
157 if (isInsert) { 157 if (isInsert) {
158 [AlertViewTool showHUDViewText:CustomStr(@"CollectSuccess")]; 158 [AlertViewTool showHUDViewText:CustomStr(@"CollectSuccess")];
159 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 159 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
160 } 160 }
161 } else { 161 } else {
162 - BOOL isDelete = [[DBAction sharedDBAction] deleteTable:notice]; 162 + BOOL isDelete = [[DBAction sharedDBAction] deleteTable:[User_Defaults objectForKey:Language_Local] notice:notice];
163 if (isDelete) { 163 if (isDelete) {
164 [AlertViewTool showHUDViewText:CustomStr(@"CancelCollect")]; 164 [AlertViewTool showHUDViewText:CustomStr(@"CancelCollect")];
165 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorite"] forState:UIControlStateNormal]; 165 [btn setImage:[UIImage imageNamed:@"cnlive_isfavorite"] forState:UIControlStateNormal];
CNLiveScioLive/Pages/My/我的收藏/Controller/CNLiveMyCollectionViewController.m
@@ -26,7 +26,7 @@ static NSString *myAnnouncementsTableViewCell = @"CNMyAnnouncementsTableViewCell @@ -26,7 +26,7 @@ static NSString *myAnnouncementsTableViewCell = @"CNMyAnnouncementsTableViewCell
26 #pragma mark - Data 26 #pragma mark - Data
27 - (void)viewWillAppear:(BOOL)animated{ 27 - (void)viewWillAppear:(BOOL)animated{
28 [super viewWillAppear:animated]; 28 [super viewWillAppear:animated];
29 - self.data = [[DBAction sharedDBAction] queryTable]; 29 + self.data = [[DBAction sharedDBAction] queryTable:[User_Defaults objectForKey:Language_Local]];
30 self.errorLabel.hidden = self.data.count != 0; 30 self.errorLabel.hidden = self.data.count != 0;
31 [self.tableView reloadData]; 31 [self.tableView reloadData];
32 32
CNLiveScioLive/Pages/Newsound/OldController/VoiceViewController.m
@@ -403,7 +403,7 @@ static const NSInteger margin = 34; @@ -403,7 +403,7 @@ static const NSInteger margin = 34;
403 403
404 // 判断收藏按钮状态 404 // 判断收藏按钮状态
405 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary]; 405 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary];
406 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 406 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
407 if (isIn) { 407 if (isIn) {
408 [favoriteBtn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 408 [favoriteBtn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
409 } else { 409 } else {
@@ -849,7 +849,7 @@ static const NSInteger margin = 34; @@ -849,7 +849,7 @@ static const NSInteger margin = 34;
849 } 849 }
850 // 判断收藏按钮状态 850 // 判断收藏按钮状态
851 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary]; 851 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary];
852 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 852 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
853 if (isIn) { 853 if (isIn) {
854 [favoriteBtn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 854 [favoriteBtn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
855 } else { 855 } else {
@@ -1070,14 +1070,14 @@ static const NSInteger margin = 34; @@ -1070,14 +1070,14 @@ static const NSInteger margin = 34;
1070 1070
1071 - (void)favoriteBtnClicked:(id)sender { 1071 - (void)favoriteBtnClicked:(id)sender {
1072 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary]; 1072 TableData *notice = [[TableData alloc] initWithJSONDictionary:_dictionary];
1073 - BOOL isIn = [[DBAction sharedDBAction] isInTable:notice]; 1073 + BOOL isIn = [[DBAction sharedDBAction] isInTable:[User_Defaults objectForKey:Language_Local] notice:notice];
1074 NSMutableDictionary *author = [NSMutableDictionary dictionaryWithContentsOfFile:FavouriteAuthors_PATH]; 1074 NSMutableDictionary *author = [NSMutableDictionary dictionaryWithContentsOfFile:FavouriteAuthors_PATH];
1075 if (!author) { 1075 if (!author) {
1076 author = [NSMutableDictionary dictionary]; 1076 author = [NSMutableDictionary dictionary];
1077 } 1077 }
1078 1078
1079 if (!isIn) { 1079 if (!isIn) {
1080 - BOOL isInsert = [[DBAction sharedDBAction] insertTable:notice]; 1080 + BOOL isInsert = [[DBAction sharedDBAction] insertTable:[User_Defaults objectForKey:Language_Local] notice:notice];
1081 [author setObject:_dictionary[@"author"] forKey:notice.pageUrl]; 1081 [author setObject:_dictionary[@"author"] forKey:notice.pageUrl];
1082 [author writeToFile:FavouriteAuthors_PATH atomically:YES]; 1082 [author writeToFile:FavouriteAuthors_PATH atomically:YES];
1083 if (isInsert) { 1083 if (isInsert) {
@@ -1085,7 +1085,7 @@ static const NSInteger margin = 34; @@ -1085,7 +1085,7 @@ static const NSInteger margin = 34;
1085 [favoriteBtn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal]; 1085 [favoriteBtn setImage:[UIImage imageNamed:@"cnlive_isfavorited"] forState:UIControlStateNormal];
1086 } 1086 }
1087 } else { 1087 } else {
1088 - BOOL isDelete = [[DBAction sharedDBAction] deleteTable:notice]; 1088 + BOOL isDelete = [[DBAction sharedDBAction] deleteTable:[User_Defaults objectForKey:Language_Local] notice:notice];
1089 [author removeObjectForKey:notice.pageUrl]; 1089 [author removeObjectForKey:notice.pageUrl];
1090 [author writeToFile:FavouriteAuthors_PATH atomically:YES]; 1090 [author writeToFile:FavouriteAuthors_PATH atomically:YES];
1091 if (isDelete) { 1091 if (isDelete) {
CNLiveScioLive/Pages/Tools/DBAction/DBAction.h
@@ -18,9 +18,9 @@ @@ -18,9 +18,9 @@
18 - (NSMutableArray *)queryNoticeTable; 18 - (NSMutableArray *)queryNoticeTable;
19 19
20 20
21 -- (void)createTable;  
22 -- (BOOL)isInTable:(TableData*)notice;  
23 -- (BOOL)insertTable: (TableData*)notice;  
24 -- (BOOL)deleteTable: (TableData*)notice;  
25 -- (NSMutableArray *)queryTable; 21 +- (void)createTable:(NSString *)tableName;
  22 +- (BOOL)isInTable:(NSString *)tableName notice:(TableData*)notice;
  23 +- (BOOL)insertTable:(NSString *)tableName notice:(TableData*)notice;
  24 +- (BOOL)deleteTable:(NSString *)tableName notice:(TableData*)notice;
  25 +- (NSMutableArray *)queryTable:(NSString *)tableName;
26 @end 26 @end
CNLiveScioLive/Pages/Tools/DBAction/DBAction.m
@@ -124,16 +124,18 @@ static DBAction *instance = nil; @@ -124,16 +124,18 @@ static DBAction *instance = nil;
124 return list; 124 return list;
125 } 125 }
126 126
127 -- (void)createTable{ 127 +- (void)createTable:(NSString *)tableName{
128 if ([db open]) { 128 if ([db open]) {
129 - NSString * sql = @"CREATE TABLE DATATABLE (cmsColumnName varchar, cmsColumnId varchar, cmsContentId int, createDate varchar, desc varchar, gxbArticleId int, gxbVideoId int, img varchar, pageUrl varchar, picType varchar, playType varchar, publishDate varchar, subTitle varchar, title varchar, type varchar, uploadVideoUrl varchar, videoUrl varchar, vipFlag int, uuid varchar)"; 129 + tableName = [tableName substringToIndex:2];
  130 + NSString * sql = [NSString stringWithFormat:@"CREATE TABLE %@DATATABLE (cmsColumnName varchar, cmsColumnId varchar, cmsContentId int, createDate varchar, desc varchar, gxbArticleId int, gxbVideoId int, img varchar, pageUrl varchar, picType varchar, playType varchar, publishDate varchar, subTitle varchar, title varchar, type varchar, uploadVideoUrl varchar, videoUrl varchar, vipFlag int, uuid varchar)",tableName.uppercaseString];
130 BOOL res = [db executeUpdate:sql]; 131 BOOL res = [db executeUpdate:sql];
131 if (!res) { 132 if (!res) {
132 NSLog(@"建表失败"); 133 NSLog(@"建表失败");
133 - NSString *sql1 = [NSString stringWithFormat:@"ALTER TABLE %@ ADD %@ VARCHAR",@"DATATABLE",@"playType"]; 134 +
  135 + NSString *sql1 = [NSString stringWithFormat:@"ALTER TABLE %@DATATABLE ADD %@ VARCHAR",tableName,@"playType"];
134 BOOL result1 = [db executeUpdate:sql1]; 136 BOOL result1 = [db executeUpdate:sql1];
135 137
136 - NSString *sql2 = [NSString stringWithFormat:@"ALTER TABLE %@ ADD %@ VARCHAR",@"DATATABLE",@"uuid"]; 138 + NSString *sql2 = [NSString stringWithFormat:@"ALTER TABLE %@DATATABLE ADD %@ VARCHAR",tableName,@"uuid"];
137 BOOL result2 = [db executeUpdate:sql2]; 139 BOOL result2 = [db executeUpdate:sql2];
138 140
139 } else { 141 } else {
@@ -145,9 +147,10 @@ static DBAction *instance = nil; @@ -145,9 +147,10 @@ static DBAction *instance = nil;
145 } 147 }
146 } 148 }
147 149
148 -- (BOOL)isInTable:(TableData*)notice{ 150 +- (BOOL)isInTable:(NSString *)tableName notice:(TableData*)notice{
149 if ([db open]) { 151 if ([db open]) {
150 - NSString * check = [NSString stringWithFormat:@"SELECT * FROM DATATABLE where cmsContentId = %d",notice.cmsContentId]; 152 + tableName = [tableName substringToIndex:2];
  153 + NSString * check = [NSString stringWithFormat:@"SELECT * FROM %@DATATABLE where cmsContentId = %d",tableName.uppercaseString,notice.cmsContentId];
151 FMResultSet * re = [db executeQuery:check]; 154 FMResultSet * re = [db executeQuery:check];
152 while ([re next]) { 155 while ([re next]) {
153 return YES; 156 return YES;
@@ -157,13 +160,14 @@ static DBAction *instance = nil; @@ -157,13 +160,14 @@ static DBAction *instance = nil;
157 return NO; 160 return NO;
158 } 161 }
159 162
160 -- (BOOL)insertTable:(TableData*)notice{ 163 +- (BOOL)insertTable:(NSString *)tableName notice:(TableData*)notice{
161 if ([db open]) { 164 if ([db open]) {
162 - NSString * check = [NSString stringWithFormat:@"SELECT * FROM DATATABLE where cmsContentId = %d",notice.cmsContentId]; 165 + tableName = [tableName substringToIndex:2];
  166 + NSString * check = [NSString stringWithFormat:@"SELECT * FROM %@DATATABLE where cmsContentId = %d",tableName.uppercaseString,notice.cmsContentId];
163 FMResultSet * re = [db executeQuery:check]; 167 FMResultSet * re = [db executeQuery:check];
164 if (![re next]) { 168 if (![re next]) {
165 NSString *desc = [notice.desc stringByReplacingOccurrencesOfString:@"'" withString:@"''"]; 169 NSString *desc = [notice.desc stringByReplacingOccurrencesOfString:@"'" withString:@"''"];
166 - NSString * sql = [NSString stringWithFormat:@"INSERT INTO DATATABLE (cmsColumnName, cmsColumnId, cmsContentId, createDate, desc, gxbArticleId, gxbVideoId, img, pageUrl, picType, playType, publishDate, subTitle, title, type, uploadVideoUrl, videoUrl, vipFlag, uuid) values('%@','%@','%d', '%@','%@','%d','%d', '%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%d', '%@')", notice.cmsColumnName, notice.cmsColumnId, notice.cmsContentId, notice.createDate, desc, notice.gxbArticleId, notice.gxbVideoId, notice.img, notice.pageUrl, notice.picType, notice.playType, notice.publishDate, notice.subTitle, notice.title, notice.type, notice.uploadVideoUrl, notice.videoUrl, notice.vipFlag, notice.uuid?notice.uuid:@""]; 170 + NSString * sql = [NSString stringWithFormat:@"INSERT INTO %@DATATABLE (cmsColumnName, cmsColumnId, cmsContentId, createDate, desc, gxbArticleId, gxbVideoId, img, pageUrl, picType, playType, publishDate, subTitle, title, type, uploadVideoUrl, videoUrl, vipFlag, uuid) values('%@','%@','%d', '%@','%@','%d','%d', '%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%d', '%@')",tableName.uppercaseString, notice.cmsColumnName, notice.cmsColumnId, notice.cmsContentId, notice.createDate, desc, notice.gxbArticleId, notice.gxbVideoId, notice.img, notice.pageUrl, notice.picType, notice.playType, notice.publishDate, notice.subTitle, notice.title, notice.type, notice.uploadVideoUrl, notice.videoUrl, notice.vipFlag, notice.uuid?notice.uuid:@""];
167 BOOL res = [db executeUpdate:sql]; 171 BOOL res = [db executeUpdate:sql];
168 if (!res) { 172 if (!res) {
169 return NO; 173 return NO;
@@ -176,9 +180,10 @@ static DBAction *instance = nil; @@ -176,9 +180,10 @@ static DBAction *instance = nil;
176 return NO; 180 return NO;
177 } 181 }
178 182
179 -- (BOOL)deleteTable:(TableData*)notice{ 183 +- (BOOL)deleteTable:(NSString *)tableName notice:(TableData*)notice{
180 if ([db open]) { 184 if ([db open]) {
181 - NSString * sql = [NSString stringWithFormat:@"DELETE FROM DATATABLE where cmsContentId = %d",notice.cmsContentId]; 185 + tableName = [tableName substringToIndex:2];
  186 + NSString * sql = [NSString stringWithFormat:@"DELETE FROM %@DATATABLE where cmsContentId = %d",tableName.uppercaseString,notice.cmsContentId];
182 BOOL res = [db executeUpdate:sql]; 187 BOOL res = [db executeUpdate:sql];
183 if (!res) { 188 if (!res) {
184 return NO; 189 return NO;
@@ -190,10 +195,11 @@ static DBAction *instance = nil; @@ -190,10 +195,11 @@ static DBAction *instance = nil;
190 return NO; 195 return NO;
191 } 196 }
192 197
193 -- (NSMutableArray *)queryTable{ 198 +- (NSMutableArray *)queryTable:(NSString *)tableName{
194 NSMutableArray *list = [[NSMutableArray alloc] init]; 199 NSMutableArray *list = [[NSMutableArray alloc] init];
195 if ([db open]) { 200 if ([db open]) {
196 - NSString * sql = @"SELECT * FROM DATATABLE"; 201 + tableName = [tableName substringToIndex:2];
  202 + NSString *sql = [NSString stringWithFormat:@"SELECT * FROM %@DATATABLE",tableName.uppercaseString];
197 FMResultSet * rs = [db executeQuery:sql]; 203 FMResultSet * rs = [db executeQuery:sql];
198 while ([rs next]) { 204 while ([rs next]) {
199 TableData * notice = [[TableData alloc] init]; 205 TableData * notice = [[TableData alloc] init];