| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- // +----------------------------------------------------------------------
- // |
- // +----------------------------------------------------------------------
- // |
- // +----------------------------------------------------------------------
- // |
- // +----------------------------------------------------------------------
- // |
- // +----------------------------------------------------------------------
- // +----------------------------------------------------------------------
- // | Ajax异步请求接口
- // +----------------------------------------------------------------------
- namespace app\index\controller;
- use app\api\controller\Common;
- use app\common\controller\Frontend;
- use think\Response;
- class Ajax extends Frontend
- {
- protected $noNeedLogin = ['upload'];
- protected $noNeedRight = ['*'];
- /**
- * 生成后缀图标
- */
- public function icon(): Response
- {
- $suffix = $this->request->request("suffix", 'file');
- $data = build_suffix_image($suffix);
- $header = ['Content-Type' => 'image/svg+xml'];
- $offset = 30 * 60 * 60 * 24; // 缓存一个月
- $header['Cache-Control'] = 'public';
- $header['Pragma'] = 'cache';
- $header['Expires'] = gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
- return Response::create($data)->header($header);
- }
- /**
- * 上传文件
- */
- public function upload()
- {
- $api = app(Common::class);
- return $api->upload();
- }
- }
|