mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-07 09:57:37 +00:00
fix: 同时删除多个任务负责人或协助人员任务动态显示错误的问题
This commit is contained in:
parent
b1395377a1
commit
a46ac38561
@ -682,7 +682,7 @@ class ProjectTask extends AbstractModel
|
||||
}
|
||||
$rows = ProjectTaskUser::whereTaskId($this->id)->whereOwner(1)->whereNotIn('userid', $array)->get();
|
||||
if ($rows->isNotEmpty()) {
|
||||
$this->addLog("删除{任务}负责人", ['userid' => $rows->implode('userid', ',')]);
|
||||
$this->addLog("删除{任务}负责人", ['userid' => $rows->pluck('userid')]);
|
||||
foreach ($rows as $row) {
|
||||
$row->delete();
|
||||
}
|
||||
@ -793,7 +793,7 @@ class ProjectTask extends AbstractModel
|
||||
}
|
||||
$rows = ProjectTaskUser::whereTaskId($this->id)->whereOwner(0)->whereNotIn('userid', $array)->get();
|
||||
if ($rows->isNotEmpty()) {
|
||||
$this->addLog("删除{任务}协助人员", ['userid' => $rows->implode('userid', ',')]);
|
||||
$this->addLog("删除{任务}协助人员", ['userid' => $rows->pluck('userid')]);
|
||||
foreach ($rows as $row) {
|
||||
$row->delete();
|
||||
}
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
@error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
|
||||
|
||||
use App\Models\ProjectLog;
|
||||
use App\Module\Base;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ProjectLogsRecordUserid extends Migration
|
||||
{
|
||||
/**
|
||||
* 处理日志格式
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
ProjectLog::whereIn('detail', [
|
||||
'删除任务负责人',
|
||||
'删除子任务负责人',
|
||||
'删除任务协助人员',
|
||||
'删除子任务协助人员',
|
||||
])->chunkById(100, function ($lists) {
|
||||
/** @var ProjectLog $log */
|
||||
foreach ($lists as $log) {
|
||||
$record = $log->record;
|
||||
if (is_string($record['userid']) && str_contains($record['userid'], ",")) {
|
||||
$record['userid'] = Base::explodeInt(',', $record['userid']);
|
||||
$log->record = Base::array2json($record);
|
||||
$log->save();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user