no message

This commit is contained in:
kuaifan
2022-03-29 14:48:36 +08:00
parent 80a21dbf4a
commit b2f8da500b
6 changed files with 66 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ use App\Tasks\DeleteTmpTask;
use App\Tasks\OverdueRemindEmailTask;
use Hhxsv5\LaravelS\Swoole\Task\Task;
use Redirect;
use Request;
/**
@@ -38,6 +39,19 @@ class IndexController extends InvokeController
return view('main', ['version' => Base::getVersion()]);
}
/**
* 获取版本号
* @return array
*/
public function version()
{
return [
'version' => Base::getVersion(),
'owner' => 'kuaifan',
'repo' => 'dootask-test',
];
}
/**
* 接口文档
* @return \Illuminate\Http\RedirectResponse
@@ -68,6 +82,43 @@ class IndexController extends InvokeController
return "success";
}
/**
* 桌面客户端发布
*/
public function desktop__publish($name = '')
{
$body = Request::input('body');
$genericVersion = Request::header('generic-version');
//
$latestFile = public_path("uploads/desktop/latest");
if (preg_match("/^\d+\.\d+\.\d+$/", $genericVersion)) {
$genericPath = "uploads/desktop/" . $genericVersion . "/";
$res = Base::upload([
"file" => Request::file('file'),
"type" => 'desktop',
"path" => $genericPath,
"fileName" => true
]);
if ($res) {
if ($body) {
file_put_contents(public_path($genericPath . "change.md"), $body);
}
file_put_contents($latestFile, $genericVersion);
}
return $res;
}
if ($name && file_exists($latestFile)) {
$genericVersion = file_get_contents($latestFile);
if (preg_match("/^\d+\.\d+\.\d+$/", $genericVersion)) {
$filePath = public_path("uploads/desktop/{$genericVersion}/{$name}");
if (file_exists($filePath)) {
return response()->download($filePath);
}
}
}
return abort(404);
}
/**
* 提取所有中文
* @return array|string