Skip to content

Commit 9307ff3

Browse files
author
yangyifan
committed
新增中间节和ajax提交表单回调
1 parent f8801ad commit 9307ff3

File tree

24 files changed

+1337
-3724
lines changed

24 files changed

+1337
-3724
lines changed

.idea/misc.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 201 additions & 344 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/Commands/.DS_Store

100644100755
File mode changed.

app/Commands/Admin/.DS_Store

100644100755
File mode changed.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Library\SqlMigrations;
6+
use Illuminate\Console\Command;
7+
use Symfony\Component\Console\Input\InputOption;
8+
use Symfony\Component\Console\Input\InputArgument;
9+
10+
class ConvertMigrationsCommand extends Command {
11+
12+
/**
13+
* The console command name.
14+
*
15+
* @var string
16+
*/
17+
protected $name = 'convert:migrations';
18+
19+
/**
20+
* The console command description.
21+
*
22+
* @var string
23+
*/
24+
protected $description = 'Converts an existing MySQL database to migrations.';
25+
26+
/**
27+
* Create a new command instance.
28+
*
29+
* @return void
30+
*/
31+
public function __construct()
32+
{
33+
parent::__construct();
34+
}
35+
36+
/**
37+
* Execute the console command.
38+
*
39+
* @return mixed
40+
*/
41+
public function fire()
42+
{
43+
self::createSqlMigrationsData(explode(',', str_replace(' ', '', $this->option('ignore'))), $this->argument('database'));
44+
//显示状态
45+
$this->info('Migration Created Successfully');
46+
}
47+
48+
/**
49+
* 执行迁移数据
50+
*
51+
* @param $ignoreInput
52+
* @param $database
53+
*/
54+
private static function createSqlMigrationsData($ignoreInput, $database)
55+
{
56+
//设置 ignore
57+
SqlMigrations::ignore($ignoreInput);
58+
//导出sql
59+
SqlMigrations::convert($database);
60+
//写入文件
61+
SqlMigrations::write();
62+
}
63+
64+
/**
65+
* Get the console command arguments.
66+
*
67+
* @return array
68+
*/
69+
protected function getArguments()
70+
{
71+
return [
72+
['database', InputArgument::REQUIRED, 'Name of Database to convert'],
73+
];
74+
}
75+
76+
/**
77+
* Get the console command options.
78+
*
79+
* @return array
80+
*/
81+
protected function getOptions()
82+
{
83+
return [
84+
['ignore', null, InputOption::VALUE_OPTIONAL, 'Tables to ignore', null],
85+
];
86+
}
87+
88+
}
89+
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php namespace App\Console\Commands;
2+
3+
use Illuminate\Console\Command;
4+
use Symfony\Component\Console\Input\InputOption;
5+
use Symfony\Component\Console\Input\InputArgument;
6+
7+
class helloConsole extends Command {
8+
9+
/**
10+
* The console command name.
11+
*
12+
* @var string
13+
*/
14+
protected $name = 'commond:hello {name} ';
15+
16+
/**
17+
* The console command description.
18+
*
19+
* @var string
20+
*/
21+
protected $description = 'Command description.';
22+
23+
/**
24+
* Create a new command instance.
25+
*
26+
* @return void
27+
*/
28+
public function __construct()
29+
{
30+
parent::__construct();
31+
}
32+
33+
/**
34+
* Execute the console command.
35+
*
36+
* @return mixed
37+
*/
38+
public function fire()
39+
{
40+
$this->info("111 " . $this->argument('name') );
41+
}
42+
43+
44+
/**
45+
* Get the console command arguments.
46+
*
47+
* @return array
48+
*/
49+
protected function getArguments()
50+
{
51+
return [
52+
['example', InputArgument::REQUIRED, 'An example argument.'],
53+
];
54+
}
55+
56+
/**
57+
* Get the console command options.
58+
*
59+
* @return array
60+
*/
61+
protected function getOptions()
62+
{
63+
return [
64+
['example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null],
65+
];
66+
}
67+
68+
}

app/Console/Kernel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class Kernel extends ConsoleKernel {
1212
*/
1313
protected $commands = [
1414
'App\Console\Commands\Inspire',
15+
'App\Console\Commands\ConvertMigrationsCommand',
1516
];
1617

1718
/**

app/Events/.DS_Store

100644100755
File mode changed.

app/Events/Admin/.DS_Store

100644100755
File mode changed.

app/Http/Controllers/Admin/BaseController.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,16 @@ public function __construct()
3434
{
3535
parent::__construct();
3636
$this->request = new Request();
37-
//检测登录
38-
$this->checkIsLogin();
3937
//显示管理者信息
4038
$this->showAdminInfo();
4139
//获得当前位置信息
4240
$this->getLocation();
43-
\App\Library\Cache::clearAll();
4441
//验证权限
4542
if ( $this->checkAccess() == false) {
4643
if (isAjax() == true) {
4744
echo $this->responseContent(self::ERROR_STATE_CODE, trans('response.unauthorized'));die;
4845
}
49-
echo '<script>alert("'.trans('response.unauthorized').'");window.location.href="'.createUrl("Admin\Admin\AdminInfoController@getIndex").'"</script>';die;
50-
}
51-
}
52-
53-
/**
54-
* 检测登录
55-
*
56-
* @return bool|\Illuminate\Http\RedirectResponse
57-
* @author yangyifan <[email protected]>
58-
*/
59-
private function checkIsLogin()
60-
{
61-
if ( isAdminLogin() <= 0 ) {
62-
echo "<script>window.location.href='".createUrl('Admin\LoginController@getIndex')."'</script>";
46+
echo '<script>alert("'.trans('response.unauthorized').'");window.location.href="'.createUrl("Admin\HomeController@getIndex").'"</script>';die;
6347
}
6448
}
6549

0 commit comments

Comments
 (0)