refactor(zy): 修改消息通知的类型和功能

This commit is contained in:
2025-06-09 10:52:18 +08:00
parent c9a8b9d5e8
commit 70baaa2fd5
5 changed files with 127 additions and 109 deletions

View File

@@ -134,18 +134,18 @@ class Circle extends Base
'avatar' => $user['avatar'],
'gender' => $user['gender'],
]);
(new Message())->allowField(true)->save([ // 消息通知
'type' => 1,
'name' => '互动消息',
'avatar' => '',
'from_id' => 0,
'user_id' => $circle->user_id,
'content' => json_encode([
'topic' => '点赞',
'content' => $user['nickname'] . '点赞了你的帖子',
'circle_id' => $circle->id
])
]);
// (new Message())->allowField(true)->save([ // 消息通知
// 'type' => 1,
// 'name' => '互动消息',
// 'avatar' => '',
// 'from_id' => 0,
// 'user_id' => $circle->user_id,
// 'content' => json_encode([
// 'topic' => '点赞',
// 'content' => $user['nickname'] . '点赞了你的帖子',
// 'circle_id' => $circle->id
// ])
// ]);
} else { // 取消点赞
$like->delete();
}
@@ -186,18 +186,18 @@ class Circle extends Base
'gender' => $user['gender'],
'content' => $params['content'],
]);
(new Message())->allowField(true)->save([ // 消息通知
'type' => 1,
'name' => '互动消息',
'avatar' => '',
'from_id' => 0,
'target_id' => $circle->user_id,
'content' => json_encode([
'topic' => '评论',
'content' => $user['nickname'] . '评论了你的帖子',
'circle_id' => $circle->id
])
]);
// (new Message())->allowField(true)->save([ // 消息通知
// 'type' => 1,
// 'name' => '互动消息',
// 'avatar' => '',
// 'from_id' => 0,
// 'target_id' => $circle->user_id,
// 'content' => json_encode([
// 'topic' => '评论',
// 'content' => $user['nickname'] . '评论了你的帖子',
// 'circle_id' => $circle->id
// ])
// ]);
Db::commit();
} catch (ValidateException | PDOException | Exception $e) {
Db::rollback();
@@ -231,18 +231,18 @@ class Circle extends Base
throw new Exception($model->id . ' 此记录不在待审核状态');
}
$model->save(['status' => $params['status']]);
(new Message())->allowField(true)->save([ // 消息通知
'type' => 3,
'name' => '通知消息',
'avatar' => '',
'from_id' => 1,
'user_id' => $model->user_id,
'content' => json_encode([
'topic' => '影圈审核',
'result' => ($params['status'] == 1) ? '通过' : '不通过',
'circle_id' => $model->id
])
]);
// (new Message())->allowField(true)->save([ // 消息通知
// 'type' => 3,
// 'name' => '通知消息',
// 'avatar' => '',
// 'from_id' => 1,
// 'user_id' => $model->user_id,
// 'content' => json_encode([
// 'topic' => '影圈审核',
// 'result' => ($params['status'] == 1) ? '通过' : '不通过',
// 'circle_id' => $model->id
// ])
// ]);
}
Db::commit();
} catch (ValidateException | PDOException | Exception $e) {