forked from yupoxiong/region
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,10 @@ | |
"autoload": { | ||
"psr-4": { | ||
"yupoxiong\\region\\": "src" | ||
} | ||
}, | ||
"files": [ | ||
"helper.php" | ||
] | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
/** | ||
* region配置 | ||
*/ | ||
|
||
return [ | ||
//查询缓存秒数,false为不缓存 | ||
'cache' => 20140210, | ||
//查询字段,可选项:id,name,code,parent_id,initial,pingyin,citycode,adcode,lng_lat | ||
'field' => 'id,name', | ||
//排序,默认为adcode正序 | ||
'order' => 'adcode asc', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
if ('cli' === PHP_SAPI || 'phpdbg' === PHP_SAPI) { | ||
\think\Console::addDefaultCommands([ | ||
'region:publish' => \yupoxiong\region\command\Publish::class, | ||
'region:migrate' => \yupoxiong\region\command\Migrate::class, | ||
]); | ||
} | ||
|
||
\think\Loader::addClassAlias([ | ||
'Region' => \yupoxiong\region\facade\Casbin::class, | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace yupoxiong\region\command; | ||
|
||
use think\migration\command\migrate\Run as MigrateRun; | ||
use Db; | ||
|
||
class Migrate extends MigrateRun | ||
{ | ||
protected function configure() | ||
{ | ||
parent::configure(); | ||
$this->setName('region:migrate')->setDescription('Migrate the database for Region'); | ||
} | ||
|
||
protected function getPath() | ||
{ | ||
return __DIR__.'/../../database/migrations'; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace yupoxiong\region\command; | ||
|
||
use think\console\Command; | ||
use think\console\Input; | ||
use think\console\Output; | ||
|
||
class Publish extends Command | ||
{ | ||
protected function configure() | ||
{ | ||
$this->setName('region:publish')->setDescription('Publish Region'); | ||
} | ||
|
||
protected function execute(Input $input, Output $output) | ||
{ | ||
|
||
|
||
if (!file_exists(env('config_path').'region.php')) { | ||
copy(__DIR__.'/../../config/region.php', env('config_path').'region.php'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace \yupoxiong\region\facade; | ||
|
||
use think\Facade; | ||
|
||
class Region extends Facade | ||
{ | ||
protected static function getFacadeClass() | ||
{ | ||
|
||
return '\yupoxiong\region\model\Region'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters