205 lines
9.8 KiB
PHP
Executable File
205 lines
9.8 KiB
PHP
Executable File
<?php
|
|
|
|
/**
|
|
* @Author: fm453
|
|
* @Date: 2018-04-23 14:25:38
|
|
# @Last modified by: fm453
|
|
# @Last modified time: 2022-03-11T10:17:21+08:00
|
|
* @Email: fm453@lukegzs.com
|
|
*/
|
|
//主入口页
|
|
namespace backend\controllers;
|
|
|
|
use Yii;
|
|
use yii\data\Pagination;
|
|
use yii\helpers\Url;
|
|
use addons\models\AcPlat;
|
|
use common\models\CLog;
|
|
|
|
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;
|
|
$platModel = new AcPlat();
|
|
$_plats = $platModel->find()->where(['status_code'=>1,'deleted'=>0])->orderby('orderby DESC')->all();
|
|
$plats = [];
|
|
if($_plats){
|
|
foreach($_plats as $p){
|
|
$plats[$p->id] = $p->toArray();
|
|
}
|
|
}else{
|
|
$plats[] = ['id' => 1, 'title' => '安邮车联', 'thumb' => 'http://public.hiluker.com/qichetuoyun/logo.png'];
|
|
}
|
|
|
|
if(isset($_GET['pid'])){
|
|
$pid = (int)$_GET['pid'];
|
|
if($pid>0){
|
|
$session->set('pid',$pid);
|
|
return $this->actionWelcome();
|
|
}else{
|
|
return $this->render('index',['plats'=>$plats]);
|
|
}
|
|
}
|
|
$pid = $session->get('pid');
|
|
if(!$pid){
|
|
return $this->render('index',['plats'=>$plats]);
|
|
}else{
|
|
return $this->actionWelcome();
|
|
}
|
|
}
|
|
|
|
public function actionWelcome()
|
|
{
|
|
//登录系统欢迎界面,显示入口集
|
|
global $_HI,$_FM;
|
|
$user_id=Yii::$app->user->identity->getId();
|
|
|
|
//登录记录
|
|
$query = CLog::find();
|
|
$nowTable = CLog::tablename();
|
|
$count = $query->count();
|
|
$pages = new Pagination(['totalCount' => $count,'pageSize' => '10']);
|
|
$log = $query->offset($pages->offset)
|
|
->limit($pages->limit)
|
|
->orderBy('id desc')
|
|
->all();
|
|
|
|
$sql = "SELECT *,FROM_UNIXTIME(create_time,'%Y-%m') as period,COUNT(*) as times FROM ".$nowTable." GROUP BY period LIMIT 12";
|
|
$History = Yii::$app->db->createCommand($sql)->queryAll();
|
|
$HistoryMonthStr = '';
|
|
$HistoryMonthNum = '';
|
|
foreach($History as $val){
|
|
$HistoryMonthStr .= "'".$val['period']."',";
|
|
$HistoryMonthNum .= $val['times'].",";
|
|
}
|
|
$HistoryMonthStr = substr($HistoryMonthStr,0,-1);
|
|
$HistoryMonthNum = substr($HistoryMonthNum,0,-1);
|
|
$keywords = '';
|
|
$description = '';
|
|
return $this->render('welcome',[
|
|
'log' => $log,
|
|
'pages' => $pages,
|
|
'HistoryMonthStr' => $HistoryMonthStr,
|
|
'HistoryMonthNum' => $HistoryMonthNum,
|
|
'keywords' => $keywords,
|
|
'description' => $description,
|
|
]);
|
|
}
|
|
|
|
public function actionMenus()
|
|
{
|
|
//登录系统欢迎界面,显示入口集
|
|
global $_HI,$_FM;
|
|
$user_id=Yii::$app->user->identity->getId();
|
|
$navs = array();
|
|
$entries = array();
|
|
$entries[] = array('name'=>'车主列表','title'=>'对所运车辆的车主用户信息进行管理','url'=>Url::toRoute('carowner/list'),'icon'=>'fa fa-user','class'=>'primary');
|
|
$entries[] = array('name'=>'新增车主','title'=>'新增加一个托车车主','url'=>Url::toRoute('carowner/new'),'icon'=>'fa fa-user-plus','class'=>'primary');
|
|
$entries[] = array('name'=>'客车列表','title'=>'全部客户车辆记录','url'=>Url::toRoute('car/list'),'icon'=>'fa fa-car','class'=>'primary');
|
|
$entries[] = array('name'=>'新增客车','title'=>'新增一条客户车辆记录','url'=>Url::toRoute('car/new'),'icon'=>'fa fa-edit','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('truckol/list'),'icon'=>'fa fa-hourglass-half fa-spin','class'=>'primary');
|
|
$entries[] = array('name'=>'出车单','title'=>'查看在途板车的出车清单','url'=>Url::toRoute('truckol/index'),'icon'=>'fa fa-list','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('albums/list'),'icon'=>'fa fa-film','class'=>'primary');
|
|
$entries[] = array('name'=>'验商品车','title'=>'商品车提车验车','url'=>Url::toRoute('albums/newcar'),'icon'=>'fa fa-camera-retro','class'=>'primary');
|
|
$entries[] = array('name'=>'首发验车','title'=>'运单首发网点的验车记录','url'=>Url::toRoute(['albums/order','v'=>0]),'icon'=>'fa fa-camera','class'=>'primary');
|
|
$entries[] = array('name'=>'到站验车','title'=>'运单中转或到达网点的验车记录','url'=>Url::toRoute(['albums/order','v'=>1]),'icon'=>'fa fa-image','class'=>'primary');
|
|
$navs[] = array('name'=>'验车相册','entries'=>$entries);
|
|
|
|
$entries = array();
|
|
$entries[] = array('name'=>'运单费用','title'=>'所有运单相关的费用单据管理','url'=>Url::toRoute('feeorder/index'),'icon'=>'fa fa-book','class'=>'primary');
|
|
$entries[] = array('name'=>'待审运单','title'=>'所有等待财务确认的运单','url'=>Url::toRoute(['order/list','is_cwqr'=>0]),'icon'=>'fa fa-gavel','class'=>'primary');
|
|
$navs[] = array('name'=>'财务管理','entries'=>$entries);
|
|
|
|
$entries = array();
|
|
$entries[] = array('name'=>'网点列表','title'=>'对公司全部网点门店进行管理','url'=>Url::toRoute('store/list'),'icon'=>'fa fa-cubes','class'=>'primary');
|
|
$entries[] = array('name'=>'新增网点','title'=>'新增加一个网点','url'=>Url::toRoute('store/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');
|
|
$entries[] = array('name'=>'板车管理','title'=>'公司板车列表','url'=>Url::toRoute('truck/list'),'icon'=>'fa fa-truck','class'=>'primary');
|
|
$entries[] = array('name'=>'司机管理','title'=>'公司板车司机列表','url'=>Url::toRoute('driver/list'),'icon'=>'fa fa-group','class'=>'primary');
|
|
$navs[] = array('name'=>'公司管理','entries'=>$entries);
|
|
|
|
|
|
$entries = array();
|
|
$entries[] = array('name'=>'H5端','title'=>'H5版管理端','url'=>Yii::$app->params['H5Links'].'index.html','icon'=>'fa fa-cubes','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');
|
|
if($user_id==1){
|
|
$entries[] = array('name'=>'平台列表','title'=>'选择管理平台或新增平台','url'=>Url::toRoute(['plat/list']),'icon'=>'fa fa-desktop','class'=>'primary');
|
|
}
|
|
$entries[] = array('name'=>'客车品牌','title'=>'新增或编辑小车的品牌','url'=>Url::toRoute('carbrand/list'),'icon'=>'fa fa-registered','class'=>'primary');
|
|
$entries[] = array('name'=>'车型参数','title'=>'新增或编辑小车各车系车型的基础参数','url'=>Url::toRoute('carseries/list'),'icon'=>'fa fa-pie-chart','class'=>'primary');
|
|
$navs[] = array('name'=>'平台管理','entries'=>$entries);
|
|
|
|
unset($entries);
|
|
|
|
$keywords = '';
|
|
$description = '';
|
|
return $this->render('menus',[
|
|
'navs' => $navs,
|
|
'keywords' => $keywords,
|
|
'description' => $description,
|
|
]);
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|