29 lines
727 B
PHP
29 lines
727 B
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\admin\validate\tools\GenerateTableValidate;
|
|
use app\admin\logic\tools\GeneratorLogic;
|
|
use app\common\controller\BaseLikeAdminController;
|
|
|
|
class IndexController extends BaseLikeAdminController
|
|
{
|
|
public function index()
|
|
{
|
|
return json(['msg' => 'hello']);
|
|
}
|
|
|
|
/**
|
|
* @notes 下载文件
|
|
*/
|
|
public function download()
|
|
{
|
|
$params = (new GenerateTableValidate())->goCheck('download');
|
|
$result = GeneratorLogic::download($params['file']);
|
|
if (false === $result) {
|
|
return $this->fail(GeneratorLogic::getError() ?: '下载失败');
|
|
}
|
|
return response()->download($result, 'webman-curd.zip');
|
|
}
|
|
}
|