Initial commit,修正
This commit is contained in:
Executable
+125
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @Author: fm453
|
||||
* @Date: 2018-04-23 14:25:38
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2021-09-15T16:11:41+08:00
|
||||
* @Email: fm453@lukegzs.com
|
||||
*/
|
||||
//主入口页
|
||||
namespace backend\controllers;
|
||||
use common\models\Log;
|
||||
use backend\models\Menu;
|
||||
use yii\data\Pagination;
|
||||
use yii\helpers\Url;
|
||||
|
||||
use Yii;
|
||||
|
||||
class IndexController extends \yii\web\Controller
|
||||
{
|
||||
public $enableCsrfValidation = false;
|
||||
|
||||
//替代常规的_construct 析构函数;其他方法调用前执行
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
$session = Yii::$app->session;
|
||||
if(isset($_GET['pid']) && (int)$_GET['pid']>0){
|
||||
$session->set('pid',(int)$_GET['pid']);
|
||||
}
|
||||
}
|
||||
|
||||
public function beforeAction($action){
|
||||
$session = Yii::$app->session;
|
||||
$pid = $session->get('pid');
|
||||
if(!$pid){
|
||||
$action->actionMethod='actionIndex';
|
||||
$action->id='index';
|
||||
}
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$session = Yii::$app->session;
|
||||
if(isset($_GET['pid'])){
|
||||
$pid = (int)$_GET['pid'];
|
||||
if($pid>0){
|
||||
$session->set('pid',$pid);
|
||||
return $this->actionWelcome();
|
||||
exit;
|
||||
}else{
|
||||
return $this->render('index');
|
||||
}
|
||||
}
|
||||
$pid = $session->get('pid');
|
||||
if(!$pid){
|
||||
return $this->render('index');
|
||||
}else{
|
||||
return $this->actionWelcome();
|
||||
}
|
||||
}
|
||||
|
||||
public function actionWelcome()
|
||||
{
|
||||
//登录系统欢迎界面,显示入口集
|
||||
global $_HI,$_FM;
|
||||
|
||||
$navs = array();
|
||||
$entries = array();
|
||||
$entries[] = array('name'=>'客户列表','title'=>'对客户档案进行管理','url'=>Url::toRoute('guest/list'),'icon'=>'fa fa-users','class'=>'primary');
|
||||
$entries[] = array('name'=>'新增客户','title'=>'新增加一个客户','url'=>Url::toRoute('guest/new'),'icon'=>'fa fa-user-plus','class'=>'primary');
|
||||
$navs[] = array('name'=>'客户管理','entries'=>$entries);
|
||||
|
||||
$entries = array();
|
||||
$entries[] = array('name'=>'订单列表','title'=>'点击查看全部订单','url'=>Url::toRoute('order/list'),'icon'=>'fa fa-list','class'=>'primary');
|
||||
$entries[] = array('name'=>'新增订单','title'=>'新增一份订单','url'=>Url::toRoute('order/new'),'icon'=>'fa fa-pencil','class'=>'primary');
|
||||
$entries[] = array('name'=>'咨询列表','title'=>'所有已记录咨询过的客户','url'=>Url::toRoute('orderpre/list'),'icon'=>'fa fa-calendar','class'=>'primary');
|
||||
$entries[] = array('name'=>'记录咨询','title'=>'新记录一个客户咨询','url'=>Url::toRoute('orderpre/new'),'icon'=>'fa fa-calendar-plus-o','class'=>'primary');
|
||||
$navs[] = array('name'=>'订单管理','entries'=>$entries);
|
||||
|
||||
$entries = array();
|
||||
$entries[] = array('name'=>'酒店列表','title'=>'对全部酒店门店进行管理','url'=>Url::toRoute('hotel/list'),'icon'=>'fa fa-th-large','class'=>'primary');
|
||||
$entries[] = array('name'=>'新增酒店','title'=>'新增加一个酒店','url'=>Url::toRoute('hotel/new'),'icon'=>'fa fa-th-list','class'=>'primary');
|
||||
$entries[] = array('name'=>'客房列表','title'=>'对全部酒店门店进行管理','url'=>Url::toRoute('room/list'),'icon'=>'fa fa-cubes','class'=>'primary');
|
||||
$entries[] = array('name'=>'新增客房','title'=>'新增加一个客房','url'=>Url::toRoute('room/new'),'icon'=>'fa fa-cube','class'=>'primary');
|
||||
$entries[] = array('name'=>'员工列表','title'=>'对公司员工档案进行管理','url'=>Url::toRoute('employee/list'),'icon'=>'fa fa-venus-mars','class'=>'primary');
|
||||
$entries[] = array('name'=>'新增员工','title'=>'新增员工','url'=>Url::toRoute('employee/new'),'icon'=>'fa fa-venus-double','class'=>'primary');
|
||||
$navs[] = array('name'=>'酒店管理','entries'=>$entries);
|
||||
|
||||
$entries = array();
|
||||
$entries[] = array('name'=>'切换平台','title'=>'选择要管理的平台','url'=>Url::toRoute(['index/index','pid'=>0]),'icon'=>'fa fa-random','class'=>'primary');
|
||||
$navs[] = array('name'=>'平台管理','entries'=>$entries);
|
||||
|
||||
unset($entries);
|
||||
return $this->render('welcome',[
|
||||
'navs' => $navs,
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionMap()
|
||||
{
|
||||
$lat = (float) Yii::$app->request->get('lat');
|
||||
$lng = (float) Yii::$app->request->get('lng');
|
||||
if (empty($lat) || empty($lng)) {
|
||||
$lat = 0;
|
||||
$lng = 0;
|
||||
}
|
||||
$search = [];
|
||||
$search['keyword'] = Yii::$app->request->get('title');
|
||||
$callback = isset($_GET['callback']) ? $_GET['callback'] : 'showLatLng';
|
||||
return $this->render('map',[
|
||||
'lat'=>$lat,
|
||||
'lng'=>$lng,
|
||||
'search'=>$search,
|
||||
'callback'=>$callback,
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionMsg()
|
||||
{
|
||||
$params = Yii::$app->request->bodyParams;
|
||||
return $this->render('../layouts/msg',$params);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user