models/Collection.php
public static function isCollected($model, $modelId, $user_id = null)
    {
        return static::find()->where([
            'user_id' => $user_id ? $user_id : Yii::$app->user->getId(),
            'model_class' => $model,
            'model_id' => $modelId
        ])->exists();
    }
public static function isCollected($model, $modelId, $user_id = null)
    {
        return static::find()->where([
            'user_id' => $user_id ? $user_id : Yii::$app->user->getId(),
            'model_class' => $model,
            'model_id' => $modelId
        ])->exists();
    }
是否收藏
@param string $model
@param integer $modelId
@param integer $user_id
@return bool