-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.修复部分BUG
- Loading branch information
Showing
17 changed files
with
730 additions
and
234 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
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,81 @@ | ||
<?php | ||
|
||
namespace izyue\admin\controllers; | ||
|
||
use izyue\admin\components\MenuHelper; | ||
use Yii; | ||
use izyue\admin\models\Log; | ||
use izyue\admin\models\searchs\Log as LogSearch; | ||
use yii\helpers\Url; | ||
use yii\web\Controller; | ||
use yii\web\NotFoundHttpException; | ||
use yii\filters\VerbFilter; | ||
use izyue\admin\components\Helper; | ||
|
||
/** | ||
* LogController | ||
* | ||
* @author liulipeng | ||
* @since 1.0 | ||
*/ | ||
class LogController extends Controller | ||
{ | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function behaviors() | ||
{ | ||
return [ | ||
'verbs' => [ | ||
'class' => VerbFilter::className(), | ||
'actions' => [ | ||
'delete' => ['post'], | ||
], | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* Lists all Log models. | ||
* @return mixed | ||
*/ | ||
public function actionIndex() | ||
{ | ||
$searchModel = new LogSearch; | ||
$dataProvider = $searchModel->search(Yii::$app->request->getQueryParams()); | ||
|
||
return $this->render('index', [ | ||
'dataProvider' => $dataProvider, | ||
'searchModel' => $searchModel, | ||
]); | ||
} | ||
|
||
/** | ||
* Displays a single Log model. | ||
* @param integer $id | ||
* @return mixed | ||
*/ | ||
public function actionView($id) | ||
{ | ||
return $this->render('view', [ | ||
'model' => $this->findModel($id), | ||
]); | ||
} | ||
|
||
/** | ||
* Finds the Menu model based on its primary key value. | ||
* If the model is not found, a 404 HTTP exception will be thrown. | ||
* @param integer $id | ||
* @return Log the loaded model | ||
* @throws NotFoundHttpException if the model cannot be found | ||
*/ | ||
protected function findModel($id) | ||
{ | ||
if (($model = Log::findOne($id)) !== null) { | ||
return $model; | ||
} else { | ||
throw new NotFoundHttpException('The requested page does not exist.'); | ||
} | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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,52 @@ | ||
<?php | ||
|
||
|
||
use \izyue\admin\components\Configs; | ||
use yii\db\Migration; | ||
|
||
class m160712_034501_create_admin_log extends Migration | ||
{ | ||
public function up() | ||
{ | ||
$tableOptions = null; | ||
if ($this->db->driverName === 'mysql') { | ||
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci | ||
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; | ||
} | ||
$table = Configs::instance()->adminLogTable; | ||
// Check if the table exists | ||
if ($this->db->schema->getTableSchema($table, true) === null) { | ||
$this->createTable($table, [ | ||
'id' => $this->primaryKey(), | ||
'route' => $this->string(255)->notNull(), | ||
'url' => $this->string(255)->notNull(), | ||
'user_agent' => $this->string(255)->notNull(), | ||
'gets' => $this->text(), | ||
'posts' => $this->text()->notNull(), | ||
'admin_id' => $this->integer()->notNull(), | ||
'admin_email' => $this->string(255)->notNull(), | ||
'ip' => $this->string(255)->notNull(), | ||
'created_at' => $this->integer()->notNull(), | ||
'updated_at' => $this->integer()->notNull(), | ||
], $tableOptions); | ||
} | ||
} | ||
public function down() | ||
{ | ||
$userTable = Configs::instance()->adminTable; | ||
if ($this->db->schema->getTableSchema($userTable, true) !== null) { | ||
$this->dropTable($userTable); | ||
} | ||
} | ||
|
||
/* | ||
// Use safeUp/safeDown to run migration code within a transaction | ||
public function safeUp() | ||
{ | ||
} | ||
public function safeDown() | ||
{ | ||
} | ||
*/ | ||
} |
Oops, something went wrong.