From ee08d8d74022280ee7306b32e1aff5e196dad083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A6=E8=8D=A3=E8=B6=85?= <302645122@qq.com> Date: Wed, 9 Mar 2022 10:45:05 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BB=BB=E5=8A=A1=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E6=97=B6=E9=97=B4=E9=9C=80=E8=A6=81=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E4=BB=BB=E5=8A=A1=E9=82=AE=E4=BB=B6=E6=8F=90=E9=86=92?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/ProjectTask.php | 3 ++ app/Models/ProjectTaskMailLog.php | 6 +++- ...add_project_task_mail_logs_add_deletes.php | 34 +++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2022_03_09_100139_add_project_task_mail_logs_add_deletes.php diff --git a/app/Models/ProjectTask.php b/app/Models/ProjectTask.php index 998d4fea8..3a4bea77f 100644 --- a/app/Models/ProjectTask.php +++ b/app/Models/ProjectTask.php @@ -753,6 +753,9 @@ class ProjectTask extends AbstractModel $this->addLog("修改{任务}时间", [ 'change' => [$oldStringAt, $newStringAt] ]); + + //修改计划时间需要重置任务邮件提醒日志 + ProjectTaskMailLog::whereTaskId($this->id)->delete(); } // 以下紧顶级任务可修改 if ($this->parent_id === 0) { diff --git a/app/Models/ProjectTaskMailLog.php b/app/Models/ProjectTaskMailLog.php index 21a2432a1..984be8c2d 100644 --- a/app/Models/ProjectTaskMailLog.php +++ b/app/Models/ProjectTaskMailLog.php @@ -5,6 +5,8 @@ namespace App\Models; +use Illuminate\Database\Eloquent\SoftDeletes; + /** * App\Models\ProjectTaskMailLog * @@ -16,10 +18,12 @@ namespace App\Models; * @property int|null $is_send 邮件发送是否成功:0否,1是 * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at + * @property \Illuminate\Support\Carbon|null $deleted_at * @method static \Illuminate\Database\Eloquent\Builder|ProjectTaskMailLog newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|ProjectTaskMailLog newQuery() * @method static \Illuminate\Database\Eloquent\Builder|ProjectTaskMailLog query() * @method static \Illuminate\Database\Eloquent\Builder|ProjectTaskMailLog whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|ProjectTaskMailLog whereDeletedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|ProjectTaskMailLog whereEmail($value) * @method static \Illuminate\Database\Eloquent\Builder|ProjectTaskMailLog whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|ProjectTaskMailLog whereIsSend($value) @@ -31,6 +35,6 @@ namespace App\Models; */ class ProjectTaskMailLog extends AbstractModel { - + use SoftDeletes; } diff --git a/database/migrations/2022_03_09_100139_add_project_task_mail_logs_add_deletes.php b/database/migrations/2022_03_09_100139_add_project_task_mail_logs_add_deletes.php new file mode 100644 index 000000000..133e6f8c5 --- /dev/null +++ b/database/migrations/2022_03_09_100139_add_project_task_mail_logs_add_deletes.php @@ -0,0 +1,34 @@ +softDeletes(); + } + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('project_task_mail_logs', function (Blueprint $table) { + $table->dropSoftDeletes(); + }); + } +}