getMessage(); } } public function testMakeType() { $reg = '/make_type=(\d+)/i'; $ret = preg_match($reg, '发送红包,红包单号: xxxxxx make_type=6', $arr); } public function testFollower() { $follower = relation_helper::follower(36490); if(!empty($follower)) { //$follower = self::separate_page($follower,$pages); $members = Model('member')->field('*')->where(array('member_id' => array('in',$follower)))->limit(false)->select(); $desc = array(); foreach ($members as $val) { $info = new member_info($val); } //return self::outsuccess(array('followers' => $follower,'mem_desc' => , 'mobile_page' => mobile_page($pages))); } } public function testDate() { $title = strftime("熊猫美妆%m月%d日红包风云榜",1469030400); } public function testSort() { $mod = Model('member_relation'); $item = $mod->field('*')->where(array('member_mobile' => '13911129867'))->find(); $mobiles = unserialize($item['unbuild_mobiles']); // perfor_start(); // for($i = 0; $i < 10000; ++$i) { // sort($mobiles); // } // perfor_end("testSort","string sort"); foreach ($mobiles as $mobile) { $iMobiles[] = intval($mobile); } perfor_start(); for($i = 0; $i < 10000; ++$i) { sort($iMobiles); } perfor_end("testSort","int sort"); $len = count($iMobiles); perfor_start(); for($i = 0; $i < 10000; ++$i) { $pos = $i % $len; $val = $iMobiles[$pos]; //algorithm::array_erase($iMobiles,$pos); $pos = algorithm::lower_bonud($iMobiles,$val); //algorithm::array_insert($iMobiles,$pos,$val); } perfor_end("testSort","int sort"); performance_helper::instance()->format_log(); } public function testArrayInsert() { $x = array(1,3,5,9,10); $pos = algorithm::lower_bonud($x,3); $posx = algorithm::upper_bound($x,3); $y = algorithm::array_insert($x,$pos,0); $pos = algorithm::lower_bonud($x,4); $posx = algorithm::upper_bound($x,4); //$find = algorithm_helper::binary_search($x,0); } public function testLowerbound() { //$x = array(1,3,5,9,10); $x = array(39625); $find = algorithm::binary_search($x,0); $find = algorithm::binary_search($x,39625); $pos = algorithm::lower_bonud($x,39625); $pos = algorithm::lower_bonud($x,2); $pos = algorithm::lower_bonud($x,3); $pos = algorithm::lower_bonud($x,14); } public function testUpper() { $x = array(1,3,5,9,10); $pos = algorithm::upper_bound($x,0); $pos = algorithm::upper_bound($x,2); $pos = algorithm::upper_bound($x,3); $pos = algorithm::upper_bound($x,14); } public function testRelation() { perfor_start(); for($i = 0; $i < 10000; ++$i) { $mod = Model('member_relation'); $mod->findByMobile('13911129867'); } perfor_end("testRelation","10000 findByMobile"); $mod = Model('member_relation'); $item = $mod->findByMobile('13911129867'); perfor_start(); for($i = 0; $i < 10000; ++$i) { unserialize($item['unbuild_mobiles']); } perfor_end("testRelation","10000 unserialize"); perfor_start(); for($i = 0; $i < 10000; ++$i) { $relation = new \relation\mem_relation(36490); //$relation->pass_subscribe(); } perfor_end("testRelation","10000 pass_subscribe"); performance_helper::instance()->format_log(); } }