fix: 文件搜索不到根目录的共享

This commit is contained in:
kuaifan 2023-04-01 16:54:13 +08:00
parent 3c400af559
commit 79898d87c0
2 changed files with 27 additions and 0 deletions

View File

@ -181,6 +181,7 @@ class File extends AbstractModel
if ($this->share != $share) {
AbstractModel::transaction(function () use ($share) {
$this->share = $share;
$this->pshare = $share ? $this->id : 0;
$this->save();
File::where("pids", "like", "%,{$this->id},%")->update(['pshare' => $share ? $this->id : 0]);
if ($share === 0) {

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
class UpdateFilePshare extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
\App\Models\File::whereShare(1)->wherePshare(0)->update(['pshare' => DB::raw('id')]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}