RpcAlbumFolder.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace App\Distributor\Repositories;
  3. use App\Libraries\RpcClient;
  4. use App\Models\NullModel as Model;
  5. use Dcat\Admin\Repositories\EloquentRepository;
  6. use Dcat\Admin\Show;
  7. /*
  8. * RPC调用相册
  9. */
  10. class RpcAlbumFolder extends EloquentRepository
  11. {
  12. /**
  13. * Model.
  14. *
  15. * @var string
  16. */
  17. protected $eloquentClass = Model::class;
  18. public $albumFolder = [];
  19. public function __construct($modelOrRelations = [])
  20. {
  21. $this->initModel($modelOrRelations);
  22. $distInfo = DistAdminDistributor::getInfo();
  23. $albumFolder = empty($distInfo->album_folder) ? [] : json_decode($distInfo->album_folder,true);
  24. $this->albumFolder = $albumFolder;
  25. }
  26. /*
  27. * RPC调用
  28. */
  29. public function execute($method, $params = [])
  30. {
  31. return RpcClient::albumExecute($method, $params);
  32. }
  33. /*
  34. * 获取相册文件夹列表
  35. * $inIds 传入的相册ID数组,为空时获取全部相册
  36. */
  37. public static function selectOptions($lang = 'en') {
  38. $self = new self();
  39. $inIds = $self->albumFolder;
  40. if ($lang == 'en') {
  41. $result = $self->execute('siteAlbumFolderSelectOptionsEn', ['inIds' => $inIds]);
  42. } else {
  43. $result = $self->execute('siteAlbumFolderSelectOptions', ['inIds' => $inIds]);
  44. }
  45. $data = $result['data'] ?? [];
  46. return $data;
  47. }
  48. }