number随时间随机递增每天 不同 php(原创)
<?php namespace Controller; class IndexController{ public function getAutoRegUserName(){ $sql="SELECT UserId as Id FROM LoginInfo ORDER BY UserId DESC LIMIT 1;"; $rs = \MI_Mysql::query($sql); //var_dump($rs); if($rs!==false&&$rs[0]['Id']){ $result=array('code'=>0,'msg'=>'success','data'=>'appreg'.$rs[0]['Id']); }else{ $result['code']=2001; $result['msg']='数据库异常'; } return $result; } public function getIncreaseNumAsk(){ $baseArr=array(3127,2297,2328,1843,1294,14,851,3871,3913,2665,1051,795,371,2622,4000,2712,3482,2185,655,3311,1441,2228,2356,3007,3760,180,3942,2164,1738,2814,1388,864,1110,3717,2708,2405,3731,3560,2276,3643,2224,3327,438,2595,1948,437,1306,1430,2623,1962,740,63,189,3096,3071,3949,3277,3012,2112,1015,1826,3501,1880,2937,3218,587,1341,2949,146,3618,2591,2370,2944,3030,965,892,3467,2271,2322,2090,232,3063,2153,422,2159,1223,370,1436,235,2483,2451,2061,1984,330,998,1201,918,2339,149,1064,1956,2741,3435,900,1770,399,1793,1237,2670,114,3327,2903,3178,1480,3326,1337,2704,3696,2773,2939,2179,1224,1000,162,1555,1998,1363,2473,337,1513,3538,2294,253,2972,3194,2024,3371,987,3262,2041,1102,2588,944,279,68,269,1617,2772,3966,389,1711,2144,1614,2711,2306,3169,709,3670,1642,1046,1182,1179,3341,1436,151,2535,3460,3522,3522,2721,1563,623,1309,2507,903,1378,2776,2520,149,2741,2909,1860,885,523,571,3192,3693,1280,2861,1334,2327,43,2514,1667,1479,2665,201,939,2187,3724,3660,3750,346,969,2256,1249,2347,1032,3769,2497,3774,2678,356,658,3201,928,3850,2893,2209,2711,227,535,2754,2742,2203,232,1406,2405,1171,3594,2128,831,3343,2474,1801,1599,3724,148,2631,3492,2645,2404,2170,3002,3063,1370,3930,2913,263,2138,1623,491,2674,376,3233,876,609,639,3281,1781,232,1409,2613,3576,3884,413,1174,3607,562,3805,3099,3207,2209,1268,2208,1271,2638,2137,183,2902,275,1807,3394,2949,2184,2626,3825,2794,3266,3106,575,3498,515,3188,3073,398,3602,247,4,163,51,3103,3370,2260,370,1578,3532,3009,3715,3716,1911,3990,1522,1304,2939,3707,3931,2764,2500,3196,1870,3075,2694,2385,2263,1767,2783,1864,2014,2788,2028,2066,1890,1398,325,2261,2976,3858,1270,2691,3573,3182,2681,1095,486,1619,801,416,383,3302,3612,2253,2376,2306,637,639,72,3420,2504,2087,2207,531,152,97,1930,478); $miniArr=array(10,4,18,4,6,16,3,9,10,15,7,6,11,0,11,6,16,2,15,11,14,1,1,14,15,0,5,0,0,6,18,10,11,17,15,17,15,18,7,7,14,15,13,6,16,6,13,13,8,9,5,4,11,7,0,7,7,5,8,7,12,7,18,4,6,14,3,3,13,11,10,8,7,4,15,5,10,10,18,0,0,5,5,11,13,5,0,2,10,8,10,3,16,9,8,4,5,11,7,0,3,17,9,10,3,5,15,13,15,15,14,16,2,0,9,15,5,9,17,16,17,8,1,14,18,9,18,5,1,7,5,4,5,14,15,8,1,12,3,16,9,17,14,11,18,4,8,4,13,7,2,12,16,3,7,15,12,7,2,14,14,7,18,1,2,15,9,3,9,12,1,18,11,15,11,10,1,0,15,14,8,17,8,5,2,15,2,14,4,4,10,18,11,10,0,14,6,10,17,15,4,0,15,16,16,7,7,17,8,4,13,16,3,2,3,5,18,5,1,3,10,11,3,2,2,4,17,9,15,16,6,0,16,2,17,13,10,6,12,0,10,6,16,13,8,0,0,8,6,1,12,16,13,16,0,16,2,17,6,17,14,12,18,12,15,16,7,7,3,0,7,14,6,4,9,15,5,9,5,12,11,17,9,5,14,10,3,16,9,9,15,5,3,14,17,0,12,5,7,16,5,14,11,12,0,1,9,6,11,14,18,3,12,9,9,8,0,12,5,9,3,1,15,7,16,13,7,10,0,15,7,6,11,18,0,11,1,9,17,12,4,17,15,16,7,6,5,8,18,11,17,2,13,14,10,11,9,17,2,9,14,9,16,6,9,16,18,11,6,17,4,11,15,1,9,3,7,14,11,7,7,10,10,2,5,1,13,14,0,16,5,14,7,3,2,16,0,1,8,7,18,13,18,14,15,8,18,3,4,11,10,12,3,1,14,8,2,9,4,3,6,10,17,13,13,0,11,14,2,1,2,1,14,2,16,10,11,15,14,15,7,6,9,10,7,4,0,10,14,5,13,1,16,12,15,10,12,7,5,15,8,8,16,4,11,13,15,3,10,11,0,18,17,9,9,5,14,10,16,9,16,11,10,13,4,6,5,17,14,10,13,3,0,10,8,11,5,5,14,15,16,15,14,14,5,5,1,0,16,17,9,13,9,1,8,14,8,13,12,3,5,6,7,5,17,16,17,4,2,13,0,18,9,15,14,14,2,15,15,0,14,6,13,5,7,3,0,16,16,13,0,2,1,8,8,18,5,7,4,8,1,5,7,11,1,2,6,4,18,3,4,14,9,18,0,17,2,1,14,0,15,15,3,16,4,12,16,10,0,1,18,2,6,7,13,8,10,1,13,10,7,29,8,23,28,10,20,2,12,13,2,6,7,8,1,15,28,28,2,29,30,1,2,10,14,24,24,0,26,15,17,3,13,25,26,11,5,16,13,18,29,16,24,6,24,26,21,22,24,23,20,23,25,22,3,8,16,28,9,11,13,26,15,26,21,10,6,26,27,20,13,25,5,7,1,30,2,22,21,26,15,11,19,10,3,23,19,19,21,28,30,3,24,15,29,14,25,5,10,22,25,23,17,0,0,18,30,2,10,21,29,26,1,18,5,4,10,25,23,0,23,23,3,16,7,2,30,2,8,10,24,3,3,11,3,3,29,3,5,8,24,4,3,25,22,9,30,2,4,23,2,27,15,6,12,23,9,12,26,18,22,19,21,25,30,25,29,29,28,3,7,21,8,10,16,30,20,16,1,24,8,4,20,23,11,2,16,20,14,11,8,6,0,29,1,0,24,30,29,21,3,5,12,11,16,29,11,6,14,13,30,22,18,20,15,29,22,0,19,6,12,27,12,12,26,14,12,19,13,10,10,16,16,23,28,2,21,8,8,5,21,7,28,9,28,12,7,20,13,27,26,25,23,8,6,19,23,19,7,5,29,18,21,15,10,18,17,1,27,25,6,18,2,3,27,0,16,4,20,29,0,16,23,23,25,30,11,17,18,19,22,17,7,13,2,17,1,19,19,28,14,26,15,16,30,12,16,15,16,6,14,16,22,7,9,17,6,21,3,25,10,26,11,17,8,13,3,9,2,23,7,16,18,23,2,17,4,19,2,21,25,16,6,17,23,16,3,30,6,6,24,16,1,5,2,10,19,6,20,22,29,27,7,17,20,10,3,24,30,5,15,24,22,22,11,15,7,14,14,14,21,8,30,23,14,2,3,3,9,23,25,8,19,2,25,9,12,29,2,11,4,17,5,26,9,17,10,16,0,25,30,22,3,30,15,17,2,18,20,12,10,14,20,30,17,15,8,30,13,11,11,17,29,16,13,7,2,24,23,3,19,23,26,22,23,10,8,25,28,29,6,8,13,27,8,30,11,16,29,25,28,9,12,27,26,25,3,29,19,27,2,7,20,28,29,12,7,7,6,5,5,13,14,18,9,22,18,20,8,16,14,6,26,26,2,21,21,6,20,9,2,22,17,22,19,15,4,27,23,10,2,28,24,17,16,2,8,4,23,17,21,7,24,16,3,26,7,24,1,27,3,4,19,21,26,7,5,0,4,29,10,6,27,4,23,13,6,1,17,30,19,7,6,12,24,9,8,0,3,10,28,7,14,16,28,10,24,3,10,28,1,21,4,28,25,28,10,0,30,27,0,19,4,6,1,28,16,9,28,20,19,26,27,3,12,24,13,5,28,23,3,29,14,8,27,8,5,7,9,5,4,9,24,8,16,26,5,1,4,3,21,24,30,18,27,11,11,10,17,8,3,20,7,17,28,3,25,3,11,3,9,15,13,2,23,29,28,29,30,2,1,21,27,0,8,24,12,20,3,29,29,7,19,5,24,17,9,19,20,20,23,30,4,5,2,28,3,0,26,3,2,28,25,30,28,2,23,10,23,27,8,21,3,27,27,28,13,6,16,3,27,9,3,1,14,5,29,18,5,24,22,7,21,16,7,19,19,30,29,11,27,7,2,0,4,29,28,18,4,14,21,0,23,24,1,7,30,0,26,4,25,18,12,16,4,19,4,23,18,3,4,15,10,6,15,14,4,12,2,9,27,23,9,20,17,11,27,17,11,23,21,6,10,2,22,14,21,26,7,9,30,11,24,10,18,8,25,23,21,27,1,18,20,11,7,7,23,3,24,4,27,14,10,7,16,1,21,7,27,29,17,27,10,10,6,28,19,0,21,10,27,22,28,17,2,4,24,25,8,17,29,5,0,9,12,17,10,3,25,6); $time=empty($_REQUEST['t'])?time():strtotime($_REQUEST['t']); $day=date('z',$time); $minite=round(($time-strtotime(date('Y-m-d',$time)))/60); $rs=$baseArr[$day]; for($i=0;$i<$minite;$i++){ $rs+=$miniArr[$i]; } $result['code']=2001; $result['msg']='success'; $result['data']=$rs; return $result; } public function getIncreaseNumBbs(){ $baseArr=array(2079,2138,408,1696,3911,837,1741,1578,3442,2028,1525,1363,1534,1388,895,3928,3137,3814,237,1929,3330,701,228,2464,3423,3996,2598,1287,505,1547,1699,2585,3685,2108,281,3595,2945,2022,1172,2387,49,2698,3750,1583,85,645,1510,3223,458,1748,1152,3788,2450,1380,2251,1872,1375,849,3160,1881,2396,858,466,2081,2966,747,1676,1911,2769,2849,297,2819,1546,47,401,1632,692,1912,854,1150,3661,2006,938,2110,3387,3190,3983,762,38,3142,2643,2434,4000,3110,515,2966,3858,2191,876,2626,1039,1173,1444,2585,1221,1846,216,1913,3758,1071,3064,3418,3077,1,1528,2463,3191,1510,3225,3230,652,1868,1664,652,978,2179,3618,835,369,493,3462,1409,1667,906,3994,2888,2752,210,800,2510,1281,3865,1928,358,3866,3456,2822,3057,966,2047,2287,1618,3915,3951,2270,892,2130,1887,1728,2499,2381,1189,3908,47,2095,3902,2936,847,112,3737,3357,1394,3601,1285,1752,3467,740,573,2523,1707,2620,810,3325,2535,760,1595,3428,2890,3483,1155,1389,1863,2345,1297,1911,440,1198,846,1287,1310,582,644,2704,182,1929,456,3649,2670,1030,2172,376,3651,2982,3702,2185,3743,1296,1613,2632,778,2769,21,2642,1114,1318,552,1554,2516,1398,2842,3827,1981,3487,2531,2163,1416,2987,1812,85,17,3984,462,3668,2966,163,1853,2708,1460,3466,1339,2239,2235,1360,880,3349,2679,1432,903,1195,2831,3745,1021,812,3232,3553,2975,647,2540,787,733,2557,770,1195,2225,3737,1359,77,2444,2820,3544,3784,1058,1778,1144,1938,1127,3823,3371,2030,1017,2202,1774,2039,3014,1005,1591,1989,1653,131,2776,2386,2688,3547,3582,912,3283,941,990,1726,3761,533,1510,818,2312,2654,2757,3439,2476,2128,1468,3494,330,3243,1532,3345,247,3124,1333,1901,3255,109,286,1943,3656,3869,2856,2939,809,3846,665,569,379,2175,1388,2691,828,145,2129,3305,2274,3597,2798,2604,2839,330,1948,3087,3454,3282,988,2709,3391,1274,651,3047,1143); $miniArr=array(6,15,7,4,3,11,3,17,14,0,9,11,9,10,17,8,18,14,5,13,3,17,18,9,18,6,4,7,3,2,9,10,17,16,14,2,9,18,0,5,0,10,17,9,2,15,18,2,11,4,16,14,3,15,5,3,2,9,10,6,12,0,16,10,16,12,13,7,12,13,12,12,5,10,3,7,7,2,9,18,7,6,14,10,2,0,13,5,10,4,11,3,4,9,14,2,3,8,10,15,3,3,9,8,14,13,16,2,15,6,1,4,12,16,14,15,16,9,1,8,14,13,12,18,3,8,2,6,17,12,3,1,16,12,10,11,7,7,13,3,13,15,8,7,12,4,3,10,13,5,0,8,18,12,8,3,1,10,9,18,4,13,1,2,7,11,13,14,0,8,18,13,5,7,2,17,11,6,9,6,11,9,14,11,3,3,14,5,14,5,5,0,18,6,2,6,18,16,2,18,6,1,13,11,9,15,10,2,2,0,8,14,10,4,6,14,7,1,0,3,6,5,4,6,12,7,13,12,4,15,11,10,17,5,3,8,2,13,10,4,14,18,0,6,3,6,1,11,8,2,15,15,8,0,2,1,7,15,13,12,12,6,4,10,12,7,0,14,1,10,0,16,10,0,3,14,7,4,7,15,6,3,12,14,4,15,16,12,11,11,5,5,17,9,16,11,16,16,6,18,8,7,16,18,7,0,13,15,5,2,12,12,5,5,8,10,1,6,3,13,17,8,18,16,18,16,8,16,13,15,16,2,3,13,2,10,14,16,6,0,18,0,13,5,5,2,15,7,8,18,1,6,8,1,4,8,17,12,5,12,8,2,14,11,16,17,3,11,14,10,12,13,10,6,18,16,8,15,4,17,15,5,5,5,7,9,13,5,3,18,17,12,2,13,5,0,11,8,11,7,0,4,1,11,11,1,8,0,17,13,18,13,0,4,18,7,13,12,12,17,12,11,10,15,6,15,15,18,5,8,6,6,13,8,17,5,9,7,6,7,2,5,2,2,9,1,9,4,14,3,2,8,15,12,4,2,8,1,1,14,9,7,1,4,16,18,9,6,7,15,14,9,1,16,11,11,18,2,15,14,6,17,3,2,10,8,5,0,10,6,14,1,14,15,5,11,15,14,18,4,11,14,13,13,12,6,5,12,9,1,7,15,0,11,17,10,1,3,11,11,10,6,12,6,3,18,18,0,13,17,5,6,12,0,0,6,7,6,18,16,8,6,12,8,18,11,0,0,15,11,12,7,18,6,13,3,5,12,4,0,11,9,6,5,10,7,11,17,14,10,14,3,17,8,12,16,0,12,17,16,5,10,4,5,16,17,9,2,11,13,2,3,4,9,8,14,16,1,13,11,18,14,25,15,27,14,11,28,4,8,24,13,25,30,21,21,28,5,25,16,28,29,22,4,14,5,28,10,7,19,30,26,2,24,11,29,7,23,27,12,1,20,25,26,20,16,16,18,22,10,3,19,9,26,24,23,0,22,3,8,10,2,4,12,27,16,11,4,9,7,16,10,28,10,5,17,27,22,5,18,1,9,6,11,4,30,4,5,21,7,13,1,10,18,13,6,4,25,10,13,2,26,23,30,6,29,17,2,20,22,20,22,0,27,2,4,26,6,9,17,14,23,18,24,11,1,0,16,26,10,29,28,6,22,28,13,20,14,15,9,6,5,0,7,1,3,12,28,10,22,15,24,14,2,18,26,4,19,11,30,30,10,28,5,1,25,19,21,9,3,0,15,9,1,22,11,4,4,8,15,26,24,9,9,26,28,5,0,16,17,30,15,27,28,21,28,22,9,19,0,13,20,16,22,21,8,2,26,12,11,10,7,4,20,17,0,17,22,0,2,8,0,18,4,28,8,2,19,17,22,20,30,11,5,22,1,13,24,28,25,5,8,1,9,28,18,9,15,10,10,18,19,10,5,23,7,13,26,27,0,17,16,30,28,22,21,30,5,15,28,30,20,5,1,29,3,20,8,18,30,19,5,18,29,11,11,6,24,7,3,24,24,20,24,22,11,15,22,16,30,19,16,19,25,17,18,28,7,27,16,6,15,22,25,14,2,6,21,27,13,24,21,7,13,15,30,25,30,21,11,29,10,27,18,4,14,6,2,21,3,19,28,19,11,22,3,14,29,24,10,12,18,1,19,1,16,19,27,16,10,7,14,20,3,2,25,18,9,27,8,12,16,5,1,27,28,4,10,27,28,21,8,16,22,28,17,8,16,13,24,26,21,8,16,24,10,10,12,20,7,20,2,23,26,3,20,24,7,30,20,5,20,28,21,12,26,8,20,11,21,13,7,11,21,23,5,1,3,18,22,10,8,24,3,3,27,23,28,3,22,18,8,12,15,29,24,11,7,14,23,28,27,30,9,18,23,15,20,27,2,11,7,10,4,10,14,1,3,11,4,26,29,13,7,14,11,1,26,18,15,18,16,12,18,26,30,11,11,20,7,13,1,14,24,6,25,7,7,28,19,11,23,18,24,0,2,5,1,28,24,16,15,10,29,3,6,29,14,17,18,22,30,19,6,24,25,0,1,1,29,21,13,22,8,7,22,11,13,24,8,6,10,24,17,8,28,23,6,11,9,24,3,9,13,9,2,8,10,4,10,8,25,23,30,2,0,22,14,13,15,22,20,25,16,7,3,13,30,9,25,9,3,28,18,16,6,21,25,17,25,4,25,19,28,25,22,28,17,6,11,1,29,1,27,14,8,30,28,7,8,23,16,12,20,4,29,27,26,23,13,20,27,8,9,24,3,1,22,20,7,3,21,5,4,18,20,13,17,18,20,26,10,6,8,0,11,6,28,6,29,11,27,25,19,6,19,23,7,11,12,15,14,3,21,19,21,11,1,8,29,22,4,8,29,12,9,9,18,6,16,16,17,12,11,6,18,0,29,26,11,10,11,26,14,2,15,4,13,16,13,11,8,18,20,6,30,29,16,18,5,1,4,22,14,16,28,1,16,27,28,28,7,8,24,21,11,8,26,24,25,8,5,2,26,26,9,26,24,25,13,29,27,18,21,10,3,19,11,19,15,9,17,23,18,10,13,29,18,8,23,12,17,28,15,13,23,24,9,17,19,23,16,15,10,6,25,14,26,6,2,11,15,20,3,3,30,16,1,17,25,24,30,12,22,14,26,14,8,4,1,27,28,17,11,7,24,5,21,19,12,24,30,28,13,3,0,12,20,2,30,14,27,29,27,18,13,22,2,21,27,3,17,24,21,29,1,14,3,22,3); $time=empty($_REQUEST['t'])?time():strtotime($_REQUEST['t']); $day=date('z',$time); $minite=round(($time-strtotime(date('Y-m-d',$time)))/60); $rs=$baseArr[$day]; for($i=0;$i<$minite;$i++){ $rs+=$miniArr[$i]; } $result['code']=2001; $result['msg']='success'; $result['data']=$rs; return $result; } public function initIncreaseNum(){ // error_reporting(E_ALL^E_NOTICE); $m10=600; $m24=1440-600; $p10=0.3; $p24=1-$p10; $sumAll=20000; $baseP=0.1; $sum=$sumAll*(1-$baseP); $setp10=ceil($sum*$p10/$m10); $setp24=ceil($sum*$p24/$m24); $rs='$miniArr=array('; for($i=0;$i<$m10;$i++){ $rs.=rand(0,2*$setp10).','; } for($i=0;$i<$m24;$i++){ $rs.=rand(0,2*$setp24).','; } $rs=rtrim($rs,','); $rs.=');'; $rsMini=$rs; $rs='$baseArr=array('; for($i=0;$i<366;$i++){ $rs.=rand(0,2*$sumAll*$baseP).','; } $rs=rtrim($rs,','); $rs.=');'; $rsBase=$rs; echo $rsBase."\n\n"; echo $rsMini; //var_dump($rsMini,$rsBase); } public function test(){ highlight_file('IndexController.class.php'); die(); for($i=1;$i<=30;$i++){ $url='http://testopen.api.yaolan.com/api/user/app?c=Index&a=getIncreaseNum&t=2015-4-%s 23:59:29'; $url=sprintf($url,$i); var_dump($url,file_get_contents($url)); } } }