33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
<?php
|
|
namespace app\controllers\index;
|
|
use Yii;
|
|
use yii\web\Controller;
|
|
class CommonController extends Controller{
|
|
function init(){
|
|
if(Yii::$app->request->isPost){
|
|
$request_type='post';
|
|
$parameter=json_encode(Yii::$app->request->post());
|
|
}
|
|
if(Yii::$app->request->isGet){
|
|
$request_type='get';
|
|
$request_data=Yii::$app->request->get();
|
|
unset($request_data['r']);
|
|
if($request_data){
|
|
$parameter=json_encode($request_data);
|
|
}
|
|
}
|
|
$model_name=substr(Yii::$app->requestedRoute,strpos(Yii::$app->requestedRoute, '/')+1);
|
|
$data=array(
|
|
'domain_url'=>$_SERVER['HTTP_HOST'],
|
|
'model'=>'index',
|
|
'modelname'=>$model_name,
|
|
'date'=>date('Y-m-d H:i:s',time()),
|
|
'type'=>2, //1后台访问 2前台访问
|
|
'ip'=>getIps(),
|
|
'request_type'=>$request_type,
|
|
'par_str'=>$parameter,
|
|
);
|
|
YII::$app->db->createCommand()->insert('{{%ybwm_visit_list}}', $data)->execute();
|
|
parent::init();
|
|
}
|
|
} |