no message
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\logic\community;
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\community\CommunityComment;
|
||||
use app\common\model\community\CommunityPost;
|
||||
|
||||
class CommunityCommentLogic extends BaseLogic
|
||||
{
|
||||
public static function updateStatus(array $params): bool
|
||||
{
|
||||
try {
|
||||
CommunityComment::update([
|
||||
'id' => $params['id'],
|
||||
'status' => $params['status'],
|
||||
]);
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function delete(array $params)
|
||||
{
|
||||
$comment = CommunityComment::findOrEmpty($params['id']);
|
||||
if (!$comment->isEmpty()) {
|
||||
CommunityPost::where('id', $comment->post_id)->dec('comment_count')->update();
|
||||
$comment->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user