Files
NewTicket/app/admin/controller/Utill.php
2026-05-26 09:44:21 +08:00

31 lines
940 B
PHP
Raw 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
namespace app\admin\controller;
use app\BaseController;
use app\admin\service\UtillService;
use think\facade\Session;
class Utill extends BaseController
{
/* 获取需要导出的数据
$range范围week,month
*/
public function getExportData(UtillService $UtillService)
{
$range = $this->request->post('range');
try {
# session中获取当前登录是否是管理员
$isAdmin = Session::get('user_info.role') === 'admin' ? true : false; // 后续用来判断
if (!$isAdmin) {
return json(['code' => 403, 'msg' => '权限不足', 'data' => []]);
}
$data = $UtillService->getExportData($range);
return json(['code' => 200, 'msg' => '查询成功', 'data' => $data]);
} catch (\Exception $e) {
return json(['code' => 500, 'msg' => '查询失败', 'data' => []]);
}
}
}