#pragma mark - 订单号(随机生成)
- (NSString *)orderId
{
NSDate * today = [NSDate date];
//转换时间格式
NSDateFormatter * df = [[NSDateFormatter alloc]init];//格式化
[df setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString * s1 = [df stringFromDate:today];
NSDate * date = [df dateFromString:s1];
//转换时间格式
NSDateFormatter * df2 = [[NSDateFormatter alloc]init];//格式化
[df2 setDateFormat:@"yyyyMMddHHmmssfffffff"];
[df2 setLocale:[[NSLocale alloc]initWithLocaleIdentifier:@"zh_CN"]];
NSString *string = [[NSString alloc]init];
for (int i = 0; i < 14; i++) {
int number = arc4random() % 10;
NSString *tempString = [NSString stringWithFormat:@"%d", number];
string = [string stringByAppendingString:tempString];
}
// NSLog(@"%@",[[df2 stringFromDate:date] stringByAppendingString:string]);
NSString * ordid = [[df2 stringFromDate:date] stringByAppendingString:string];
return ordid;
}