1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-25 04:07:17 +08:00
course-tencent-cloud/app/Repos/CommentLike.php
2021-04-19 20:16:41 +08:00

38 lines
907 B
PHP

<?php
namespace App\Repos;
use App\Models\CommentLike as CommentLikeModel;
use Phalcon\Mvc\Model;
use Phalcon\Mvc\Model\Resultset;
use Phalcon\Mvc\Model\ResultsetInterface;
class CommentLike extends Repository
{
/**
* @param int $commentId
* @param int $userId
* @return CommentLikeModel|Model|bool
*/
public function findCommentLike($commentId, $userId)
{
return CommentLikeModel::findFirst([
'conditions' => 'comment_id = :comment_id: AND user_id = :user_id:',
'bind' => ['comment_id' => $commentId, 'user_id' => $userId],
]);
}
/**
* @param int $userId
* @return ResultsetInterface|Resultset|CommentLikeModel[]
*/
public function findByUserId($userId)
{
return CommentLikeModel::query()
->where('user_id = :user_id:', ['user_id' => $userId])
->execute();
}
}