2018-01-30-最近状态

关于工作

  • 1. 在工作上不要拖后腿

私人生活

  1. 冬天家里的水管爆了,三个房间全部被淹了
  2. 平板、手机、猫(wifi)全部报废
  3. 在生活上不要生病
  4. 学会好好照顾自己
  5. 五年前的事过去了
  6. 现在要学会生活
  7. 学会坚持
# 我很害怕给别人带来麻烦

# 我不想从别人口中得知自己不成熟、不够优秀、或者很烦和这种人做喷狗之类的话

# 我不愿意让自己变得一无是处,不喜欢自己被否定

# 所以,我只能默默的改变,如果现在给一些人带来了一些不必要的麻烦

# 请不要生气,我会改正的
2018/1/30 posted in  生活总结

2018-01-30-收藏功能

收藏

  • 项目要求要在首页的视频右下角添加一个收藏的功能
  • 思路:
    • 1. 进入一个界面先要进行判断是否有收藏,所以进行第一次网络请求
    • 2. 判断成功后,在进行第二次事件,用户点击了收藏按钮所做的动作,例如收藏成功、取消收藏
NSString *getiscollect = [QWHttpUrls getiscollectUrl];
NSMutableDictionary *params = [[NSMutableDictionary alloc]init];
[params setValue:[QWAccountModel sharedModel].uid forKey:@"uid"];
[params setValue:@"3" forKey:@"collect_type"];
[params setValue:self.gameID forKey:@"collect_id"];
[QWHttpTool postmanager:getiscollect params:params success:^(id  _Nonnull manager, id  _Nonnull json) {
    QWLog(@"显示collectstatus===%@",json[@"status"]);
    QWLog(@"显示collectURLdata===%@",json[@"data"]);
    if ([json[@"status"] isEqualToString:@"1"]) {
        [self.collectBtn setImage:[UIImage imageNamed:[NSString stringWithFormat:@"已收藏"]] forState:UIControlStateNormal];
//            Isselected = 2;
    }else{
        [self.collectBtn setImage:[UIImage imageNamed:[NSString stringWithFormat:@"收藏"]] forState:UIControlStateNormal];
//            Isselected = 1;
    }
} failure:^(NSError * _Nonnull error) {
    
}];
- (void)btnClick{
    self.collectBtn.selected = !self.collectBtn.selected;
    
    if (Isselected==1) {
        if (self.collectBtn.selected) {
            NSString *collectURL = [QWHttpUrls CollectUrlWithOp:1 withcollect_type:3 Withcollect_id:_movieStr];
            NSMutableDictionary *params = [[NSMutableDictionary alloc]init];
            [params setValue:[QWAccountModel sharedModel].uid forKey:@"uid"];
            [QWHttpTool postmanager:collectURL params:params success:^(id  _Nonnull manager, id  _Nonnull json) {
                QWLog(@"collect结果===%@",json[@"msg"]);
                [QWShowMessage showMessage:[NSString stringWithFormat:@"%@",json[@"msg"]]];
                [self.collectBtn setImage:[UIImage imageNamed:[NSString stringWithFormat:@"已收藏"]] forState:UIControlStateSelected];
            } failure:^(NSError * _Nonnull error) {
                
            }];
        }else{
            NSString *collectURL = [QWHttpUrls CollectUrlWithOp:2 withcollect_type:3 Withcollect_id:_movieStr];
            NSMutableDictionary *params = [[NSMutableDictionary alloc]init];
            [params setValue:[QWAccountModel sharedModel].uid forKey:@"uid"];
            [QWHttpTool postmanager:collectURL params:params success:^(id  _Nonnull manager, id  _Nonnull json) {
                QWLog(@"collect结果===%@",json[@"msg"]);
                [QWShowMessage showMessage:[NSString stringWithFormat:@"%@",json[@"msg"]]];
                [self.collectBtn setImage:[UIImage imageNamed:[NSString stringWithFormat:@"收藏"]] forState:UIControlStateSelected];
            } failure:^(NSError * _Nonnull error) {
                
            }];
            
        }
        
    }else{
        if (self.collectBtn.selected) {
            
            NSString *collectURL = [QWHttpUrls CollectUrlWithOp:2 withcollect_type:3 Withcollect_id:_movieStr];
            NSMutableDictionary *params = [[NSMutableDictionary alloc]init];
            [params setValue:[QWAccountModel sharedModel].uid forKey:@"uid"];
            [QWHttpTool postmanager:collectURL params:params success:^(id  _Nonnull manager, id  _Nonnull json) {
                QWLog(@"collect结果===%@",json[@"msg"]);
                [QWShowMessage showMessage:[NSString stringWithFormat:@"%@",json[@"msg"]]];
                [self.collectBtn setImage:[UIImage imageNamed:[NSString stringWithFormat:@"收藏"]] forState:UIControlStateSelected];
            } failure:^(NSError * _Nonnull error) {
                
            }];
        }else{
            NSString *collectURL = [QWHttpUrls CollectUrlWithOp:1 withcollect_type:3 Withcollect_id:_movieStr];
            NSMutableDictionary *params = [[NSMutableDictionary alloc]init];
            [params setValue:[QWAccountModel sharedModel].uid forKey:@"uid"];
            [QWHttpTool postmanager:collectURL params:params success:^(id  _Nonnull manager, id  _Nonnull json) {
                QWLog(@"collect结果===%@",json[@"msg"]);
                [QWShowMessage showMessage:[NSString stringWithFormat:@"%@",json[@"msg"]]];
                [self.collectBtn setImage:[UIImage imageNamed:[NSString stringWithFormat:@"已收藏"]] forState:UIControlStateSelected];
            } failure:^(NSError * _Nonnull error) {
                
            }];
            
        }
        
    }
}
2018/1/30 posted in  工作总结

2018-01-25-低级错误

在 ContenView 上添加 button 不显示

    self.collectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.collectBtn.frame = CGRectMake(screen_width-(screen_width-40), CGRectGetMaxY(_videoImage.frame)+left, 40, 40);
//    self.collectBtn.backgroundColor = [UIColor redColor];
    [self.collectBtn setBackgroundImage:[UIImage imageNamed:@"star-highlighted"] forState:UIControlStateNormal];
    [self.collectBtn setBackgroundImage:[UIImage imageNamed:@"star-highlighted-template"] forState:UIControlStateHighlighted];
    [self.collectBtn addTarget:self action:@selector(collectBtnClick) forControlEvents:UIControlEventTouchUpInside];
    
    [self.contentView addSubview:self.collectBtn];

这里的美工给的图片不是我之前的公司的美工,他们的命名方式很奇怪

  • 默认的格式:star-template
  • 高亮的格式:star-highlighted-template

一般的美工都是这么明名的

  • 默认的格式:star-template
  • 高亮的格式:star-template-highlighted

再加上我最近状态不佳,就直接写成以上的样子,最后什么都没显示

总结:不管是在哪上班摸清楚他们的行为方式
2018/1/25 posted in  工作总结

2018-01-22 Jeklly 搭建博客

Read more   2018/1/24 posted in  工作总结

2018-01-23 - hexo 博客搭建

支付问题

  • 微信支付

Hexo 搭建博客

配置环境

  • 安装 Node(必须

    • 作用:用来生成静态页面的 到 Node.js 官网下载相应平台的最新版本,一路安装即可。
  • 安装Git(必须

    • 作用:把本地的 hexo 内容提交到 github 上去. 安装 Xcode 就自带有 Git,我就不多说了。
  • 申请GitHub(必须

    • 作用:是用来做博客的远程创库、域名、服务器之类的,怎么与本地 hexo 建立连接等下讲。 github 账号我也不再啰嗦了,没有的话直接申请就行了,跟一般的注册账号差不多,SSH Keys,看你自己了,可以不配制,不配置的话以后每次对自己的博客有改动提交的时候就要手动输入账号密码,配置了就不需要了,怎么配置我就不多说了,网上有很多教程。
Read more   2018/1/23 posted in  工作总结

2018-01-22 - SDK 相关

  • 接入 初始化
  • YourAppToken 是后台创建的 iOS 端只需要调用就行

SDK 开发

在SDK开发中,一般会需要经过几个流程,

# 开发SDK
# 测试SDK
# 把SDK交付给使用人员

这些东西看似步骤多,过程繁琐,而且每修改一次SDK就需要重复一次上述的过程,增加了一些不必要的操作。

当然,如果我们在SDK设计之初就有一个好的项目架构,就可以极大简化开发流程,提高开发效率.

pushToViewControllerWhenClickPushMessageWith - 这个是极光推送的方法

#pragma mark -- 程序点击推送消息进入的方法
// iOS 10 Support
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler {
    // Required
    NSDictionary * userInfo = response.notification.request.content.userInfo;
    if([response.notification.request.triggerisKindOfClass:[UNPushNotificationTriggerclass]]) {
        [JPUSHServicehandleRemoteNotification:userInfo];
        
         [selfpushToViewControllerWhenClickPushMessageWith:userInfo]; //跳转页面
    }
    completionHandler();  // 系统要求执行这个方法
}

#pragma mark -- 程序跳转方法
-(void)pushToViewControllerWhenClickPushMessageWith:(NSDictionary*)msgDic{
    
    //将字段存入本地,因为要在你要跳转的页面用它来判断
   NSUserDefaults*pushJudge = [NSUserDefaultsstandardUserDefaults];
  //  [pushJudge setObject:@"push"forKey:@"push"];
//判断后台传送的标示(用于跳转哪一个页面的判断)
    if ([[msgDicobjectForKey:@"type"]isEqualToString:@"active"]){
//得到根部控制器
        TabBarController *hxl=(TabBarController *)self.window.rootViewController;
//得到控制器中的导航栏
        UINavigationController *nav=hxl.selectedViewController;
//得到导航栏对应的控制器
        UIViewController  *controller=(UIViewController *)nav.visibleViewController;
//进行跳转页面
        TSProductDetailViewController *pro=[[TSProductDetailViewControlleralloc]init];
        
         pro.detailid=[[msgDicobjectForKey:@"id"]integerValue];        
        [controller.navigationControllerpushViewController:pro animated:YES];
      
    }elseif ([[msgDicobjectForKey:@"type"]isEqualToString:@"dynamics"]){
        TabBarController *hxl=(TabBarController *)self.window.rootViewController;
        hxl.selectedIndex=2;
    }
}

#pragma mark iOS 10 前台收到通知(远程推送和本地通知)
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler {
    NSDictionary * userInfo = notification.request.content.userInfo;
    if([notification.request.triggerisKindOfClass:[UNPushNotificationTriggerclass]]) {
        /// iOS10处理远程推送
        [JPUSHServicehandleRemoteNotification:userInfo];
        /// 前台收到推送的时候转成本地通知 ===========================
        [self popAlert:userInfo];
        
    }else{
        /// iOS10处理本地通知添加到通知栏 ==============================
        completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
        
        
    }
    // 需要执行这个方法,选择是否提醒用户,有Badge、Sound、Alert三种类型可以选择设置
}

//在前台的时候 我这里就直接弹出提示框
-(void)popAlert:(NSDictionary *)pushMessageDic{
    NSLog(@"%@",pushMessageDic);
    NSString *title;
    if([[pushMessageDicobjectForKey:@"type"]isEqualToString:@"active"])
    {
     title=@"您有新的活动推送";
        [JCAlertViewshowTwoButtonsWithTitle:titleMessage:             [[pushMessageDicobjectForKey:@"aps"]objectForKey:@"alert"]ButtonType:JCAlertViewButtonTypeCancelButtonTitle:@"取消"Click:^{
            
        } ButtonType:JCAlertViewButtonTypeDefaultButtonTitle:@"查看"Click:^{
            [selfpushToViewControllerWhenClickPushMessageWith:pushMessageDic];
            
        }];
    }elseif([[pushMessageDic objectForKey:@"type"]isEqualToString:@"dynamics"]){
        title=@"您有新的评论消息";
        [JCAlertViewshowOneButtonWithTitle:titleMessage:[[pushMessageDicobjectForKey:@"aps"]objectForKey:@"alert"]ButtonType:JCAlertViewButtonTypeCancelButtonTitle:@"取消"Click:^{
            
        }];
      
    }
    
   
}


测试数据

  • 后台给了个接口
    • 传进 IDFA 用来收集用户注册激活数据

1-
2 -

3 -

4 -

架构

2018/1/22 posted in  工作总结