|
@@ -390,8 +390,59 @@ class TestAddData extends TestCase
|
|
|
$this->addFile($file);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public function testFindCard()
|
|
|
+ {
|
|
|
+ $card_key = Model('card_key');
|
|
|
+
|
|
|
+ $count = 1000;
|
|
|
+ $i = 0;
|
|
|
+
|
|
|
+ $pairs = [];
|
|
|
+ $pair = ['start' => 0,'end' => 0];
|
|
|
+ while (true)
|
|
|
+ {
|
|
|
+ $start = $i * $count;
|
|
|
+ $items = $card_key->field('*')->order('card_no asc')->limit("{$start},{$count}")->select();
|
|
|
+ if(empty($items)) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $i++;
|
|
|
+
|
|
|
+ foreach ($items as $item)
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ $card_no = intval($item['card_no']);
|
|
|
+
|
|
|
+ if($pair['end'] + 1 == $card_no) {
|
|
|
+ $pair['end'] = $card_no;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $pairs[] = $pair;
|
|
|
+ $pair = ['start' => $card_no,'end' => $card_no];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception $ex) {
|
|
|
+ Log::record($ex->getMessage(),Log::DEBUG);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($pairs as $pair) {
|
|
|
+ $count = $pair['end'] - $pair['start'] + 1;
|
|
|
+ Log::record("{$pair['start']}------{$pair['end']} count = {$count}",Log::DEBUG);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testCardCheck()
|
|
|
+ {
|
|
|
+ $card_no = 1000113300023292731;
|
|
|
+ $topcard = Model('topcard');
|
|
|
+ $items = $topcard->get_cards($card_no - 500,$card_no + 500);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//docker-compose -f ./docker-compose-dev.yml run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestAddData::testCancelOrder)( .*)?$/" --test-suffix TestAddData.php /var/www/html/test
|
|
|
//docker-compose -f ./docker-compose-dev.yml run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestAddData::test20200821_addCard)( .*)?$/" --test-suffix TestAddData.php /var/www/html/test
|
|
|
//docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestAddData::test20200910_addCard)( .*)?$/" --test-suffix TestAddData.php /var/www/html/test
|
|
|
+
|