1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-23 20:00:27 +08:00
course-tencent-cloud/app/Repos/ArticleTag.php
koogua 0336a54911 1.源文件增加版权信息
2.群组状态和课程协同
2021-06-13 15:49:47 +08:00

54 lines
1.3 KiB
PHP

<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Repos;
use App\Models\ArticleTag as ArticleTagModel;
use Phalcon\Mvc\Model;
use Phalcon\Mvc\Model\Resultset;
use Phalcon\Mvc\Model\ResultsetInterface;
class ArticleTag extends Repository
{
/**
* @param int $articleId
* @param int $tagId
* @return ArticleTagModel|Model|bool
*/
public function findArticleTag($articleId, $tagId)
{
return ArticleTagModel::findFirst([
'conditions' => 'article_id = :article_id: AND tag_id = :tag_id:',
'bind' => ['article_id' => $articleId, 'tag_id' => $tagId],
]);
}
/**
* @param array $tagIds
* @return ResultsetInterface|Resultset|ArticleTagModel[]
*/
public function findByTagIds($tagIds)
{
return ArticleTagModel::query()
->inWhere('tag_id', $tagIds)
->execute();
}
/**
* @param array $articleIds
* @return ResultsetInterface|Resultset|ArticleTagModel[]
*/
public function findByArticleIds($articleIds)
{
return ArticleTagModel::query()
->inWhere('article_id', $articleIds)
->execute();
}
}