ctms/ctms-admin/controllers/ErrorController.php
2025-04-10 23:19:13 +08:00

78 lines
2.4 KiB
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* @Author: fm453
* @Date: 2018-08-17 19:39:41
* @Last Modified by: fm453
* @Last Modified time: 2018-10-09 04:42:25
* @Email: fm453@lukegzs.com
*/
namespace backend\controllers;
use Yii;
use yii\data\Pagination;
use yii\helpers\Url;
class ErrorController extends \yii\web\Controller
{
public $enableCsrfValidation = false; //取消csrf令牌验证
//主界面
public function actionIndex()
{
return $this->render('../layouts/dev',[]);
}
public function actionReport()
{
$request = Yii::$app->request;
$get = $request->get();
$url = Urldecode($get['url']);
$code = 0;
if($request->isPost){
$code = getMillisecond().'_'.rand(0,999);
$filename = $code.'.php';
$post = $request->post();
$code = $post['code']!=0 ? $post['code'] : $code;
$post['time'] = time();
fm_load()->fm_func('error');
fmFunc_error_write($filename,$post);
$msg = [];
$msg['title'] = '报错提交通知';
$msg['content'] = '感谢反馈,工程师将尽快处理!您本次的反馈工单号为<code>'.$code.'</code>';
$msg['class'] = 'success';
$btn = [];
$btn['title'] = '返回';
// $btn['url'] = Url::current();
$btn['url'] = $url;
$btn['class'] = 'primary';
$msg['buttons'][] = $btn;
$btn = [];
$btn['title'] = '查看工单';
$btn['url'] = Url::toRoute(['error/order','code'=>$code]);
$btn['class'] = 'warning';
$msg['buttons'][] = $btn;
$btn = [];
$btn['title'] = '回到首页';
$btn['url'] = Url::home();
$btn['class'] = 'info';
$msg['buttons'][] = $btn;
return $this->render('../layouts/msg',$msg);
}
return $this->render('report',['url'=>$url]);
}
public function actionOrder()
{
$request = Yii::$app->request;
$get = $request->get();
$code = Urldecode($get['code']);
$filename = $code.'.php';
fm_load()->fm_func('error');
$data = [];
$file = fmFunc_error_get($code);
include $file;
return $this->render('report',['code'=>$code,'data'=>$data,'url'=>$data['url']]);
}
}