no message

This commit is contained in:
kuaifan 2023-03-07 23:54:49 +08:00
parent 31c1466b42
commit 05b169c172
10 changed files with 19 additions and 19 deletions

View File

@ -1573,7 +1573,7 @@ class DialogController extends AbstractController
if ($array) {
$dialog->updateInstance($array);
$dialog->save();
WebSocketDialogUser::whereDialogId($dialog->id)->update(['updated_at' => Carbon::now()->toDateTimeString('millisecond')]);
WebSocketDialogUser::whereDialogId($dialog->id)->change(['updated_at' => Carbon::now()->toDateTimeString('millisecond')]);
}
//
return Base::retSuccess('修改成功', $data);

View File

@ -510,7 +510,7 @@ class ProjectController extends AbstractController
}
//
AbstractModel::transaction(function() use ($owner_userid, $project) {
ProjectUser::whereProjectId($project->id)->update(['owner' => 0]);
ProjectUser::whereProjectId($project->id)->change(['owner' => 0]);
ProjectUser::updateInsert([
'project_id' => $project->id,
'userid' => $owner_userid,
@ -571,11 +571,11 @@ class ProjectController extends AbstractController
if (!is_array($item['task'])) continue;
$index = 0;
foreach ($item['task'] as $task_id) {
if (ProjectTask::whereId($task_id)->whereProjectId($project->id)->whereCompleteAt(null)->update([
if (ProjectTask::whereId($task_id)->whereProjectId($project->id)->whereCompleteAt(null)->change([
'column_id' => $item['id'],
'sort' => $index
])) {
ProjectTask::whereParentId($task_id)->whereProjectId($project->id)->update([
ProjectTask::whereParentId($task_id)->whereProjectId($project->id)->change([
'column_id' => $item['id'],
]);
}

View File

@ -15,8 +15,6 @@ use Illuminate\Support\Facades\DB;
* @method static \Illuminate\Database\Eloquent\Builder|AbstractModel newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|AbstractModel newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|AbstractModel query()
* @method static \Illuminate\Database\Eloquent\Builder|AbstractModel modify(array $values)
* @method static \Illuminate\Database\Eloquent\Builder|AbstractModel remove()
* @method static \Illuminate\Database\Eloquent\Builder|AbstractModel saveOrIgnore()
* @method static \Illuminate\Database\Eloquent\Builder|AbstractModel getKeyValue()
* @method static \Illuminate\Database\Eloquent\Model|object|static|null cancelAppend()
@ -25,6 +23,8 @@ use Illuminate\Support\Facades\DB;
* @method static \Illuminate\Database\Query\Builder|static select($columns = [])
* @method static \Illuminate\Database\Query\Builder|static whereIn($column, $values, $boolean = 'and', $not = false)
* @method static \Illuminate\Database\Query\Builder|static whereNotIn($column, $values, $boolean = 'and')
* @method int change(array $array)
* @method int remove()
* @mixin \Eloquent
*/
class AbstractModel extends Model
@ -44,15 +44,15 @@ class AbstractModel extends Model
/**
* 通过模型修改数据
* @param AbstractModel $builder
* @param $values
* @param $array
* @return int
*/
protected function scopeModify($builder, $values)
protected function scopeChange($builder, $array)
{
$line = 0;
$rows = $builder->get();
foreach ($rows as $row) {
$row->updateInstance($values);
$row->updateInstance($array);
if ($row->save()) {
$line++;
}

View File

@ -252,7 +252,7 @@ class Project extends AbstractModel
$this->archived_userid = User::userid();
$this->addLog("项目取消归档");
$this->pushMsg('recovery', $this);
ProjectTask::whereProjectId($this->id)->whereArchivedFollow(1)->modify([
ProjectTask::whereProjectId($this->id)->whereArchivedFollow(1)->change([
'archived_at' => null,
'archived_follow' => 0
]);
@ -262,7 +262,7 @@ class Project extends AbstractModel
$this->archived_userid = User::userid();
$this->addLog("项目归档");
$this->pushMsg('archived');
ProjectTask::whereProjectId($this->id)->whereArchivedAt(null)->modify([
ProjectTask::whereProjectId($this->id)->whereArchivedAt(null)->change([
'archived_at' => $archived_at,
'archived_follow' => 1
]);
@ -441,7 +441,7 @@ class Project extends AbstractModel
});
//
foreach ($upTaskList as $id => $value) {
ProjectTask::whereFlowItemId($id)->update([
ProjectTask::whereFlowItemId($id)->change([
'flow_item_name' => $value
]);
}

View File

@ -81,7 +81,7 @@ class ProjectFlowItem extends AbstractModel
*/
public function deleteFlowItem()
{
ProjectTask::whereFlowItemId($this->id)->update([
ProjectTask::whereFlowItemId($this->id)->change([
'flow_item_id' => 0,
'flow_item_name' => "",
]);

View File

@ -1265,7 +1265,7 @@ class ProjectTask extends AbstractModel
'archived_at' => $this->archived_at,
'archived_userid' => $this->archived_userid,
]);
self::whereParentId($this->id)->modify([
self::whereParentId($this->id)->change([
'archived_at' => $this->archived_at,
'archived_userid' => $this->archived_userid,
'archived_follow' => $this->archived_follow,

View File

@ -855,7 +855,7 @@ class WebSocketDialogMsg extends AbstractModel
$dialogMsg->send = 1;
$dialogMsg->key = $dialogMsg->generateMsgKey();
$dialogMsg->save();
WebSocketDialogUser::whereDialogId($dialog->id)->update(['updated_at' => Carbon::now()->toDateTimeString('millisecond')]);
WebSocketDialogUser::whereDialogId($dialog->id)->change(['updated_at' => Carbon::now()->toDateTimeString('millisecond')]);
});
//
$task = new WebSocketDialogMsgTask($dialogMsg->id);

View File

@ -27,7 +27,7 @@ class ProjectTasksAddArchivedFollow extends Migration
// 更新数据
Project::whereNotNull('archived_at')->chunkById(100, function ($lists) {
foreach ($lists as $item) {
ProjectTask::whereProjectId($item->id)->whereArchivedAt(null)->modify([
ProjectTask::whereProjectId($item->id)->whereArchivedAt(null)->change([
'archived_at' => $item->archived_at,
'archived_follow' => 1
]);

View File

@ -18,7 +18,7 @@ class ProjectTasksUpdateSubtaskArchivedDelete extends Migration
->chunkById(100, function ($lists) {
/** @var ProjectTask $task */
foreach ($lists as $task) {
ProjectTask::whereParentId($task->id)->modify([
ProjectTask::whereParentId($task->id)->change([
'archived_at' => $task->archived_at,
'archived_userid' => $task->archived_userid,
'archived_follow' => $task->archived_follow,
@ -32,7 +32,7 @@ class ProjectTasksUpdateSubtaskArchivedDelete extends Migration
->chunkById(100, function ($lists) {
/** @var ProjectTask $task */
foreach ($lists as $task) {
ProjectTask::whereParentId($task->id)->update([
ProjectTask::whereParentId($task->id)->change([
'deleted_at' => $task->deleted_at,
]);
}

View File

@ -25,7 +25,7 @@ class AddWebSocketDialogUsersInviterImportant extends Migration
\App\Models\WebSocketDialog::whereIn('group_type', ['project', 'task'])->chunkById(100, function ($lists) {
/** @var \App\Models\WebSocketDialog $item */
foreach ($lists as $item) {
\App\Models\WebSocketDialogUser::whereDialogId($item->id)->update([
\App\Models\WebSocketDialogUser::whereDialogId($item->id)->change([
'important' => 1,
]);
}