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

77 lines
2.3 KiB
PHP
Executable File

<?php
# @Author: 嗨噜客(三亚) <fm453>
# @Date: 2022-05-22T07:34:19+08:00
# @Email: fm453@lukegzs.com
# @Last modified by: fm453
# @Last modified time: 2022-05-22T07:34:19+08:00
# @Copyright: www.hiluker.cn
namespace backend\controllers;
use Yii;
use yii\data\Pagination;
use yii\helpers\Url;
class ErrorController extends Common
{
//主界面
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']]);
}
}