|
@@ -7,7 +7,7 @@ use think\console\Command;
|
|
|
use think\console\Input;
|
|
|
use think\console\input\Argument;
|
|
|
use think\console\input\Option;
|
|
|
-use think\console\Output;use think\facade\Db;
|
|
|
+use think\console\Output;use think\facade\Db;use think\facade\Env;
|
|
|
|
|
|
class makeModel extends Command
|
|
|
{
|
|
@@ -17,16 +17,17 @@ class makeModel extends Command
|
|
|
$this->setName('makemodel')
|
|
|
->setDescription('the makemodel command');
|
|
|
}
|
|
|
- static $schema = 'bugonline';
|
|
|
- static $prefix = 'Devcloud';
|
|
|
- static $epp = 'bug';
|
|
|
+ static $schema = 'sys_user_pre_release';
|
|
|
+ static $prefix = 'sys';
|
|
|
+ static $epp = 'user';
|
|
|
protected function execute(Input $input, Output $output)
|
|
|
{
|
|
|
+
|
|
|
//获取表名
|
|
|
$tables = Db::query("SELECT TABLE_NAME as 'name'
|
|
|
from information_schema.tables
|
|
|
WHERE TABLE_SCHEMA = :dataBase and TABLE_TYPE='BASE TABLE'", ['dataBase' => self::$schema]);
|
|
|
-
|
|
|
+ echo Db::getLastSql();
|
|
|
foreach ($tables as $key => $value) {
|
|
|
|
|
|
foreach ($value as $item) {
|
|
@@ -65,9 +66,9 @@ class makeModel extends Command
|
|
|
|
|
|
private static function snakeToCamel($str, $capitalized = true)
|
|
|
{
|
|
|
- $result = str_replace(['_',self::$prefix], ['',""], ucwords($str, '_'));
|
|
|
+ $result = ucwords(str_replace(['_',self::$prefix], ['',""],$str),"_");
|
|
|
echo $result."--";
|
|
|
- echo ucwords($str, '_');
|
|
|
+ echo str_replace(['_',self::$prefix], ['',''],$str);
|
|
|
if (!$capitalized) {
|
|
|
$result = lcfirst($result);
|
|
|
}
|