Files
swiftadmin/app/admin/controller/system/Attachment.php

72 lines
2.0 KiB
PHP
Raw Normal View History

2022-08-19 19:48:37 +08:00
<?php
2023-04-25 20:11:49 +08:00
2022-08-19 19:48:37 +08:00
// +----------------------------------------------------------------------
// | swiftAdmin 极速开发框架 [基于WebMan开发]
// +----------------------------------------------------------------------
// | Copyright (c) 2020-2030 http://www.swiftadmin.net
// +----------------------------------------------------------------------
// | swiftAdmin.net High Speed Development Framework
// +----------------------------------------------------------------------
// | Author: meystack <coolsec@foxmail.com> Apache 2.0 License
// +----------------------------------------------------------------------
namespace app\admin\controller\system;
2023-07-03 10:05:58 +08:00
use app\admin\service\AttachmentService;
2022-08-19 19:48:37 +08:00
use app\AdminController;
use app\common\model\system\Attachment as AttachmentModel;
2023-07-03 10:05:58 +08:00
use support\Response;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
2022-08-19 19:48:37 +08:00
use Webman\Http\Request;
/**
* 附件管理
* Class Attachment
* @package app\admin\controller\system
*/
class Attachment extends AdminController
{
2022-11-28 19:11:12 +08:00
/**
* 上传文件夹地址
* @var mixed
*/
protected mixed $upload;
2022-08-19 19:48:37 +08:00
2022-11-28 19:11:12 +08:00
/**
* 初始化函数
2023-07-03 10:05:58 +08:00
* Attachment constructor.
* @throws \Exception|\Psr\SimpleCache\InvalidArgumentException
2022-11-28 19:11:12 +08:00
*/
2022-08-19 19:48:37 +08:00
public function __construct()
{
parent::__construct();
$this->model = new AttachmentModel();
$this->upload = saenv('upload_path');
}
/**
* 获取资源列表
2023-07-03 10:05:58 +08:00
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
2022-08-19 19:48:37 +08:00
*/
2023-07-03 10:05:58 +08:00
public function index(): Response
2022-08-19 19:48:37 +08:00
{
if (request()->isAjax()) {
2023-07-03 10:05:58 +08:00
$params = request()->post();
list($count, $list) = AttachmentService::dataList($params);
return $this->success('查询成功', "/", $list, $count);
2022-08-19 19:48:37 +08:00
}
return view('/system/attachment/index',[
'choose' => input('choose') ?: '',
]);
}
}