定义 多个条件判断 组合 为一个判断条件 的方法
来源:互联网 发布:金螳螂家装 知乎 编辑:程序博客网 时间:2024/05/29 15:11
#import <Foundation/Foundation.h>
//通知类型前台电商放在后面比较少
// active * k + type * j + flag * i 来定义枚举后面的都是前面的一个量级所以即时加起来也永远不可能 >后面的一个量级 (尽量类型多的放在前面这样会使得总体的数小一点,计算机指令上计算效率高)
/*
下一量级大于前面的每组最大的和保证了每个类型下的不符合状态下的不会错乱
即:及时有多个0也不会出现已经定义的
如 orderType = 0 applicationState最大是3也不可能会出现其他状态只有3的类型
----------------------------------------------------------
分段 1~n * m , m1 = (n0+1)*m0 (计算方式)
**************** *********** ************************
applicationState 1~3 * 1 ,
orderType 1~2 * 4 , 4 = (3+1)*1
OrderStatus 1~3 * 12 , 12 = (2+1) * 4
----------------------------------------------------------
----------------------------------
applicationState:
active --- 1
Inactive --- 2
Background --- 3
----------------------------------
orderType:
Takeout --- 1
Business --- 2
----------------------------------
OrderStatus:
refund --- 1 // 申请退款
receive --- 2 // 接单
otherStatus --- 3 // 其他状态通知
----------------------------------
*/
//----------------用来计算通知类型的基本元素--------------------------
//分段
#define App_State_Active_NT 1
#define App_State_Inactive_NT 2
#define App_State_Background_NT 3
#define OrderType_TakeOut_NT 1
#define OrderType_Business_NT 2
#define OrderStatus_Refund_NT 1
#define OrderStatus_Receive_NT 2
#define OrderStatus_Other_NT 3
//分段对应的基数
#define App_State_Base 1
#define OrderType_Base 4
#define OrderStatus_Base 12
//----------------判断需要用的通知类型-------------------------------
#define Active_T_Refund_NT 17 // 1*1 + 1* 4 + 1 * 12;前台外卖退款
#define Active_T_Rceive_NT 29 // 1*1 + 1* 4 + 2 * 12;前台外卖接单
#define Active_T_OtherStatus_NT 41 // 1*1 + 1* 4 + 3 * 12;前台外卖状态变化
#define Inactive_T_Refund_NT 18 // 2*1 + 1* 4 + 1 * 12;点击通知外卖退款
#define Inactive_T_Rceive_NT 30 // 2*1 + 1* 4 + 2 * 12;点击通知外卖接单
#define Inactive_T_OtherStatus_NT 42 // 2*1 + 1* 4 + 3 * 12;点击通知外卖状态变化
#define Background_T_Refund_NT 19 // 3*1 + 1* 4 + 1 * 12;后台外卖退款
#define Background_T_Rceive_NT 31 // 3*1 + 1* 4 + 2 * 12;后台外卖接单
#define Background_T_OtherStatus_NT 43 // 3*1 + 1* 4 + 3 * 12;后台外卖状态变化
#define Active_B_Refund_NT 21 // 1*1 + 2* 4 + 1 * 12;前台电商退款
#define Active_B_Rceive_NT 33 // 1*1 + 2* 4 + 2 * 12;前台电商接单
#define Active_B_OtherStatus_NT 45 // 1*1 + 2* 4 + 3 * 12;前台电商状态变化
#define Inactive_B_Refund_NT 22 // 2*1 + 2* 4 + 1 * 12;点击通知电商退款
#define Inactive_B_Rceive_NT 34 // 2*1 + 2* 4 + 2 * 12;点击通知电商接单
#define Inactive_B_OtherStatus_NT 46 // 2*1 + 2* 4 + 3 * 12;点击通知电商状态变化
#define Background_B_Refund_NT 23 // 3*1 + 2* 4 + 1 * 12;后台电商退款
#define Background_B_Rceive_NT 35 // 3*1 + 2* 4 + 2 * 12;后台电商接单
#define Background_B_OtherStatus_NT 47 // 3*1 + 2* 4 + 3 * 12;后台电商状态变化
@interface NotiTypeCustom : NSObject
+(NSInteger)getNotiTypeUserInfo:(NSDictionary *)userInfo applicationState:(UIApplicationState)applicationState;
+(NSInteger)getOrderStatusType:(NSDictionary *)userInfo;
+(NSInteger)getOrderType:(NSDictionary *)userInfo;
+(NSInteger)getAppState:(UIApplicationState)applicationState;
@end
- 定义 多个条件判断 组合 为一个判断条件 的方法
- 多个条件判断语句实现方法
- javascript多个判断条件的改写
- 多个条件判断二进制的简化
- Boolean值判断2个条件之后选择一个条件
- switch 以string为条件 做判断的方法
- MyBatis 判断条件为等于的问题
- MyBatis 判断条件为等于的问题
- MyBatis 判断条件为等于的问题
- MyBatis 判断条件为等于的问题
- MyBatis 判断条件为等于的问题
- sturts2标签判断多个条件
- 一个if 判断条件的常见错误
- NSScanner:一个陌生的条件判断利器
- 排序需要多个判断条件的解决方法
- jstl 多个判断条件正确的写法
- c#的条件判断
- linux的条件判断
- PAT_乙级 1040 有几个PAT
- 浮动IP(FLOAT IP)
- 知识库--Lifecycle (44)
- Fiddler抓包教程
- 伟东山视频自学笔记——uboot-的start.S详细注解及分析
- 定义 多个条件判断 组合 为一个判断条件 的方法
- Forge Acision即时通讯学习
- 第十五周项目四 验证算法——直接插入排序
- Qt开发之HTTP
- 数组中只出现一次的数字
- 伟东山视频自学笔记——uboot命令分析+实现_________精华————————
- form表单提交和ajax表单提交
- Git工作流指南
- mysql 外键约束