标签:
常用的时间唯一脚本:
Action() { int id, scid; char *vuser_group,strid[5]; char proposalNo[1024]; int i; char OrderId[20]; srand(time(NULL)); //特别注意:加上这句,每次取不同的随机值 i=rand()%10; // lr_save_datetime("%Y%m%d%H%M%S", DATE_NOW,"now"); lr_save_datetime("%m%d%H%M%S", DATE_NOW,"now"); sprintf(OrderId,"%s%d",lr_eval_string("{now}"),i); lr_output_message("订单号为:%s",OrderId); web_save_timestamp_param("tStamp", LAST); // lr_output_message("%s",lr_eval_string("{tStamp}")); lr_whoami(&id, &vuser_group, &scid); lr_message( "Group: %s, vuser id: %d, scenario id %d", vuser_group, id, scid); //将整数转化为字符串 itoa(id,strid,10); //获得当前的时间戳 web_save_timestamp_param("tStamp",LAST); strcpy(proposalNo,lr_eval_string("{tStamp}")); strcat(proposalNo,strid); return 0; }
标签:
原文地址:http://www.cnblogs.com/qmfsun/p/4864575.html