<?php

namespace App\Admin\Repositories;

use App\Libraries\RpcClient;
use App\Models\NullModel as Model;
use Dcat\Admin\Repositories\EloquentRepository;
use Dcat\Admin\Show;

/*
 * RPC调用相册
 */

class RpcAlbumFolder extends EloquentRepository
{
    /**
     * Model.
     *
     * @var string
     */
    protected $eloquentClass = Model::class;

    public function execute($method, $params = [])
    {
        return RpcClient::albumExecute($method, $params);
    }


    /*
     * 获取相册文件夹列表
     * $inIds 传入的相册ID数组，为空时获取全部相册
     */
    public static function selectOptions($lang = 'en') {
        $self = new self();
        $result = $self->execute('siteAlbumFolderSelectOptionsAll', ['lang'=>$lang]);
        $data = $result['data'] ?? [];
        return $data;
    }

    /*
     * 获取相册文件夹树
     */
    public static function allNodes() {
        $self = new self();
        $result = $self->execute('siteAlbumFolderAllNodes', []);
        $data = $result['data'] ?? [];
        return $data;
    }
}
