Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
yeosz committed Jun 13, 2017
1 parent 8a18a3c commit 265034e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ composer require "yeosz/dtool"
$provider = new \Yeosz\Dtool\Provider();

$data = [
'string' => $provider->getString(10),
'mb_string' => $provider->getMbString(10),
'city' => $provider->city,
'address' => $provider->address,
'uuid' => $provider->uuid,
'id_card' => $provider->id_card,
Expand Down Expand Up @@ -79,7 +82,7 @@ $sql = "CREATE TABLE `dtool_test` (
$db->query($sql);

$rows = $db->query("select * from dtool_test where " . $db->buildInCondition('id', [1,2,3,4], true) . " order by id desc");
print_r($row);
print_r($rows);

$row = $db->row("select id,name from dtool_test where id=:id", ['id'=>1]);
print_r($row);
Expand Down
11 changes: 8 additions & 3 deletions examples/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
$provider = new \Yeosz\Dtool\Provider();

$data = [
'string' => $provider->getString(10),
'mb_string' => $provider->getMbString(10),
'city' => $provider->city,
'address' => $provider->address,
'uuid' => $provider->uuid,
'id_card' => $provider->id_card,
Expand All @@ -27,10 +30,11 @@
'time' => $provider->time,
'integer' => $provider->integer,
'random' => $provider->randomValue([1, 2, 3]),
'payment' => $provider->payment,
'bank' => $provider->bank,
];
print_r($data);
$provider->addIncrement('sort', 1);

$provider->addIncrement('sort', 1);
var_dump($provider->sort);
var_dump($provider->sort);
var_dump($provider->sort);
Expand All @@ -39,8 +43,9 @@
return time();
});
var_dump($provider->my_time);

die;
//$db = new Yeosz\Dtool\DB('localhost;port=3306', 'dtool', 'root', '');

$db = new Yeosz\Dtool\DB('localhost;port=33060', 'homestead', 'homestead', 'secret');


Expand Down
3 changes: 3 additions & 0 deletions src/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @property string bitmap_url
* @property string company_name
* @property string id_card
* @property string city
* @property string address
* @property string datetime
* @property string timestamp
Expand Down Expand Up @@ -68,6 +69,7 @@ class Provider
'company_name' => 'getCompanyName',
'id_card' => 'getIdCard',
'address' => 'getAddress',
'city' => 'getCity',
'uuid' => 'getUuid',
'ip' => 'getIp',
'ean8' => 'getEan8',
Expand Down Expand Up @@ -427,6 +429,7 @@ public function getCity()
$ids[$area['id']] = $area['id'];
}
}
$ids = array_diff($ids, [110100, 120100, 139000, 419000, 429000, 469000, 500100, 500200, 659000]);
$id = $this->randomValue($ids);
return $regions[$id];
}
Expand Down

0 comments on commit 265034e

Please sign in to comment.