20day-、UI综合练习(网易彩票)---主要代码和对应的业务分析

来源:互联网 发布:windows性能测试工具 编辑:程序博客网 时间:2024/05/18 14:21

网易彩票业务

1、彩票资讯、中奖排行、个人中奖
2、主要内容
购彩业务模式:代理商机制、资金流
购彩流程:
采种:双色球
3、代理商机制

1)代理商机制的产生原因让用户的购买投注被国家认可,也是出票合法化出票门槛高小公司作为子代理商跟代理商(和有关机构签订协议的企业)打交道2)代理商的工作对上与政府部门协调,对下管理子代理商为每个子代理商分配唯一的标识和密码3)子代理商可以做的事情使用唯一的标识和密码登录代理商的管理系统,查询跟自身相关的所有信息核实彩票销量数据的准确性、出票数、成功率

4、资金流
1)用户 – 子代理商

*注册账号,成为子代理商的用户*充值(充值入口:支付宝、网银、手机充值卡等),需要付手续费手续费低于3%:由子代理商支付 手续费高于3%:由用户支付*选号购彩核实信息(彩种、资金)保存投注(保存到数据库) 资金冻结(并非扣款)*购彩成功清除冻结资金 扣除账号余额

2)子代理商 – 代理商

*预存部分资金要比预期销量多资金预警*批量提交购彩请求收集一段时间内的购彩投注(1~10分钟内)打包发送请求核实资金冻结资金*出票成功代理商发信息给子代理商清除冻结资金扣除子代理商账户余额

3)代理商 – 省级出票平台

*预存资金*出票成功扣除代理商的账户余额出票平台发信息给代理商

5、中奖
这里写图片描述

6、盈利

出票平台:3%代理商:%4子代理商:8%

代码段

一、主框架

1、UITabBarController 导航控制器,切换子控制器

[self setSelectedIndex:index];

2、IOS6、IOS7的运行时、编译时兼容
自定义按钮的标题宽度、高度

3、导航控制器的view的伸缩控制

//    self.edgesForExtendedLayout//@property(nonatomic,assign) UIRectEdge edgesForExtendedLayout NS_AVAILABLE_IOS(7_0); // Defaults to UIRectEdgeAll    /* typedef NS_OPTIONS(NSUInteger, UIRectEdge) {     UIRectEdgeNone   = 0,     UIRectEdgeTop    = 1 << 0,     UIRectEdgeLeft   = 1 << 1,     UIRectEdgeBottom = 1 << 2,     UIRectEdgeRight  = 1 << 3,     UIRectEdgeAll    = UIRectEdgeTop | UIRectEdgeLeft | UIRectEdgeBottom | UIRectEdgeRight     } NS_ENUM_AVAILABLE_IOS(7_0);// | 并运算     */

4、产品推荐-使用 UICollectionViewController(可以UITableViewController 进行比较学习)

5、json 字符串的解析

6、UIDatePicker的使用

7、偏好设置的工具方法

9、#pragma mark - UIWebView 加载网页

#pragma mark - UIWebView 加载网页- (void) loadRequestHtml{    UIWebView *view = (UIWebView*)self.view;    NSURL *url = [[NSBundle mainBundle] URLForResource:self.htmlModel.html withExtension:nil];    NSURLRequest *request = [NSURLRequest requestWithURL:url];    [view loadRequest:request];}

10.#pragma mark - UIWebViewDelegate 执行js 根据ID跳转到对应的标题

10.#pragma mark - UIWebViewDelegate 执行js 根据ID跳转到对应的标题- (void)webViewDidFinishLoad:(UIWebView *)webView{    if (self.htmlModel.ID.length) {        NSString *jsCode = [NSString stringWithFormat:@"window.location.href='#%@';",self.htmlModel.ID];//self.htmlModel.ID html 的ID属性的值        [(UIWebView*)self.view stringByEvaluatingJavaScriptFromString:jsCode];    }}

11、宏的定义

#define ILColor(r,g,b) ([UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0])    [self.tableView setBackgroundColor:ILColor(244, 243, 241)];

12、应用跳转

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{    //获取模型    HLProductModel *model = self.products[indexPath.item];    NSString *urlStr = [NSString stringWithFormat:@"%@://%@",model.customUrl,model.ID];    NSURL *url = [NSURL URLWithString:urlStr];    UIApplication *app = [UIApplication sharedApplication];    if (![app canOpenURL:url]) {//2016-04-30 17:39:03.355 HisunLottery[932:417803] -canOpenURL: failed for URL: "newsapp://com.netease.news" - error: "This app is not allowed to query for scheme newsapp"        url =[NSURL URLWithString:model.url];//跳转到appstore的URL    }    [app openURL:url];}

13、block 使用的注意事项

14、http://dev.umeng.com/social/ios/quick-integration 利用友盟分享s d k,进行新浪分享

1)导入SystemConfiguration.framework2)AppDelegate.m- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 方法添加appKey:    [UMSocialData setAppKey:@"57249011e0f55a7e6e000cec"];3)添加实现代码//新浪分享    [sinaItem setOptionBlock:^{[UMSocialSnsService presentSnsIconSheetView:share                                             appKey:nil                                          shareText:@"你要分享的文字---kevin"                                         shareImage:[UIImage imageNamed:@"about_logo"]                                    shareToSnsNames:[NSArray arrayWithObjects:UMShareToSina,UMShareToWechatSession,UMShareToQQ,nil]                                           delegate:share];    }];
阅读全文
0 0
原创粉丝点击