moshaorui 3 mesiacov pred
rodič
commit
7141bc8e67
100 zmenil súbory, kde vykonal 634 pridanie a 5351 odobranie
  1. 0 94
      app/Admin/Controllers/BaseProductCategoryController.php
  2. 0 248
      app/Admin/Controllers/BaseProductController.php
  3. 0 83
      app/Admin/Controllers/BaseProductParameterController.php
  4. 0 85
      app/Admin/Controllers/BaseVideoCategoryController.php
  5. 0 160
      app/Admin/Controllers/BaseVideoController.php
  6. 0 154
      app/Admin/Controllers/DistAdminDistributorController.php
  7. 0 148
      app/Admin/Controllers/DistAdminUserController.php
  8. 0 144
      app/Admin/Controllers/DistAppearanceController.php
  9. 0 155
      app/Admin/Controllers/DistAppearanceTemplateController.php
  10. 0 180
      app/Admin/Controllers/DistAppearanceVariableController.php
  11. 0 142
      app/Admin/Controllers/DistInquiryController.php
  12. 0 181
      app/Admin/Controllers/DistMessageController.php
  13. 0 201
      app/Admin/Controllers/DistSiteController.php
  14. 6 17
      app/Admin/Controllers/HomeController.php
  15. 284 0
      app/Admin/Controllers/SiteAlbumController.php
  16. 85 0
      app/Admin/Controllers/SiteAlbumFolderController.php
  17. 0 38
      app/Admin/Repositories/BaseIso3166.php
  18. 0 29
      app/Admin/Repositories/BaseProduct.php
  19. 0 84
      app/Admin/Repositories/BaseProductImage.php
  20. 0 25
      app/Admin/Repositories/BaseProductParameter.php
  21. 0 34
      app/Admin/Repositories/BaseVideoCategory.php
  22. 0 464
      app/Admin/Repositories/DistAdminDistributor.php
  23. 0 41
      app/Admin/Repositories/DistAdminUser.php
  24. 0 80
      app/Admin/Repositories/DistAppearance.php
  25. 0 33
      app/Admin/Repositories/DistAppearanceBak.php
  26. 0 50
      app/Admin/Repositories/DistAppearancePublishList.php
  27. 0 184
      app/Admin/Repositories/DistAppearanceTemplate.php
  28. 0 70
      app/Admin/Repositories/DistAppearanceTemplateLog.php
  29. 0 57
      app/Admin/Repositories/DistAppearanceVariable.php
  30. 0 64
      app/Admin/Repositories/DistInquiry.php
  31. 0 21
      app/Admin/Repositories/DistMessage.php
  32. 2 5
      app/Admin/Repositories/NullRepository.php
  33. 2 2
      app/Admin/Repositories/SiteAlbum.php
  34. 30 52
      app/Admin/Repositories/SiteAlbumFolder.php
  35. 0 18
      app/Admin/Repositories/SiteAppearanceTemplate.php
  36. 0 21
      app/Admin/Repositories/SiteAppearanceVariable.php
  37. 0 16
      app/Admin/Repositories/SiteBanner.php
  38. 0 61
      app/Admin/Repositories/SiteMenu.php
  39. 4 0
      app/Admin/bootstrap.php
  40. 4 31
      app/Admin/routes.php
  41. 0 16
      app/Models/BaseIso3166.php
  42. 0 43
      app/Models/BaseProduct.php
  43. 0 50
      app/Models/BaseProductCategory.php
  44. 0 30
      app/Models/BaseProductImage.php
  45. 0 35
      app/Models/BaseProductParameter.php
  46. 0 39
      app/Models/BaseVideo.php
  47. 0 29
      app/Models/BaseVideoCategory.php
  48. 0 63
      app/Models/DistAdminDistributor.php
  49. 0 9
      app/Models/DistAdminMenu.php
  50. 0 21
      app/Models/DistAdminUser.php
  51. 0 32
      app/Models/DistAppearance.php
  52. 0 126
      app/Models/DistAppearanceBak.php
  53. 0 14
      app/Models/DistAppearancePublishList.php
  54. 0 98
      app/Models/DistAppearanceTemplate.php
  55. 0 17
      app/Models/DistAppearanceTemplateLog.php
  56. 0 122
      app/Models/DistAppearanceVariable.php
  57. 0 38
      app/Models/DistInquiry.php
  58. 0 50
      app/Models/DistMessage.php
  59. 0 62
      app/Models/DistProduct.php
  60. 0 79
      app/Models/DistProductCategory.php
  61. 0 32
      app/Models/DistProductImage.php
  62. 0 14
      app/Models/DistProductParameter.php
  63. 0 26
      app/Models/DistReadStatus.php
  64. 0 38
      app/Models/DistVideo.php
  65. 0 29
      app/Models/DistVideoCategory.php
  66. 2 3
      app/Models/NullModel.php
  67. 4 4
      app/Models/SiteAlbum.php
  68. 27 0
      app/Models/SiteAlbumFolder.php
  69. 0 16
      app/Models/SiteAppearanceTemplate.php
  70. 0 17
      app/Models/SiteAppearanceVariable.php
  71. 0 26
      app/Models/SiteBanner.php
  72. 0 131
      app/Models/SiteMenu.php
  73. 0 44
      app/Models/SitePages.php
  74. 0 24
      app/Models/SitePagesTag.php
  75. 0 19
      app/Models/SitePagesTagRelationship.php
  76. 0 19
      app/Models/Test.php
  77. 0 44
      app/Models/User.php
  78. 6 0
      config/admin.php
  79. 4 7
      resources/views/admin/dashboard/title.blade.php
  80. 0 0
      resources/views/admin/form_custom/folder_tree.blade.php
  81. 3 0
      resources/views/admin/form_custom/hasmanytable.blade.php
  82. 29 3
      resources/views/admin/form_custom/trad-file.blade.php
  83. 142 0
      resources/views/admin/form_custom/trad-image.blade.php
  84. 0 43
      resources/views/distributor/dashboard/author.blade.php
  85. 0 15
      resources/views/distributor/dashboard/dependencies.blade.php
  86. 0 11
      resources/views/distributor/dashboard/environment.blade.php
  87. 0 52
      resources/views/distributor/dashboard/extensions.blade.php
  88. 0 37
      resources/views/distributor/dashboard/title.blade.php
  89. 0 27
      resources/views/distributor/filter/between-datetime.blade.php
  90. 0 13
      resources/views/distributor/filter/between.blade.php
  91. 0 24
      resources/views/distributor/filter/button.blade.php
  92. 0 19
      resources/views/distributor/filter/checkbox.blade.php
  93. 0 33
      resources/views/distributor/filter/container.blade.php
  94. 0 24
      resources/views/distributor/filter/datetime.blade.php
  95. 0 3
      resources/views/distributor/filter/gt.blade.php
  96. 0 3
      resources/views/distributor/filter/lt.blade.php
  97. 0 31
      resources/views/distributor/filter/multipleselect.blade.php
  98. 0 19
      resources/views/distributor/filter/radio.blade.php
  99. 0 26
      resources/views/distributor/filter/right-side-container.blade.php
  100. 0 30
      resources/views/distributor/filter/select.blade.php

+ 0 - 94
app/Admin/Controllers/BaseProductCategoryController.php

@@ -1,94 +0,0 @@
-<?php
-
-namespace App\Admin\Controllers;
-
-use App\Admin\Repositories\BaseProductCategory;
-use Dcat\Admin\Form;
-use Dcat\Admin\Grid;
-use Dcat\Admin\Http\Controllers\AdminController;
-use Dcat\Admin\Layout\Content;
-use App\Admin\Repositories\BaseProductParameter;
-
-class BaseProductCategoryController extends AdminController
-{
-
-    public function index(Content $content)
-    {
-        return $content
-            ->header(admin_trans( 'admin.proudct_category'))
-            ->description('')
-            ->breadcrumb(['text'=>'list','url'=>''])
-            ->body($this->grid());
-    }
-
-
-    /**
-     * Make a grid builder.
-     *
-     * @return Grid
-     */
-    protected function grid()
-    {
-        return Grid::make(BaseProductCategory::with('baseProductParameter'), function (Grid $grid) {
-            $grid->view('admin.grid-custom.table');
-            //默认分页条数
-            $grid->paginate(config('admin.per_page'));
-            $grid->column('id')->display(function () {
-                return $this->_index+1;
-            });
-            $grid->column('name')->display(function ($name) {
-                $level = $this->level; // 获取当前行的 level 字段值
-                $prefix = str_repeat('&nbsp; ', $level * 2). ' <i class="fa fa-angle-right"></i>&nbsp; '; // 生成 level * 3 个加号
-                return $prefix . ' ' . html_entity_decode($name); // 拼接加号和名称
-            });;
-            $grid->column('parent_id');
-            $grid->column('baseProductParameter.name',admin_trans_label('attribute_name'));
-            $grid->column('order');
-            $grid->column('enabled')->switch();
-            $grid->column('created_at');
-            $grid->column('updated_at')->sortable();
-            //过滤器
-            $grid->filter(function (Grid\Filter $filter) {
-                $filter->panel();
-                $filter->expand();
-                $filter->like('name')->width(2);
-                $filter->equal('enabled', admin_trans_label('enabled'))->select(admin_trans_array(config('dictionary.enabled')))->width(2);
-            });
-            //工具栏
-            $grid->disableViewButton();
-            $grid->showQuickEditButton();
-            $grid->enableDialogCreate();
-            $grid->disableEditButton();
-
-            $grid->disablePerPages();
-            //$grid->quickSearch('name');
-        });
-
-    }
-
-
-    /**
-     * Make a form builder.
-     *
-     * @return Form
-     */
-    protected function form()
-    {
-        return Form::make(new BaseProductCategory(), function (Form $form) {
-            $form->select('parent_id', admin_trans_field('parent'))
-                ->options(BaseProductCategory::selectMainOptions())
-                ->saving(function ($v) {
-                    return (int) $v;
-                });
-            $form->text('name')->required();
-            $form->select('parameter_id', admin_trans_field('attribute_name'))->options(BaseProductParameter::selectOptions())->required();
-            $form->textarea('remark')->rows(2);
-            $form->number('order')
-                ->default(0)
-                ->rules('numeric');
-            $form->switch('enabled')->default(1);
-          //  $form->display('created_at');
-          //  $form->display('updated_at');
-        });
-    }
-}

+ 0 - 248
app/Admin/Controllers/BaseProductController.php

@@ -1,248 +0,0 @@
-<?php
-
-namespace App\Admin\Controllers;
-
-use App\Admin\Repositories\BaseProduct;
-use Dcat\Admin\Admin;
-use Dcat\Admin\Form;
-use Dcat\Admin\Form\NestedForm;
-use Dcat\Admin\Grid;
-use Dcat\Admin\Layout\Content;
-use Dcat\Admin\Show;
-use Dcat\Admin\Http\Controllers\AdminController;
-use App\Admin\Repositories\BaseProductCategory;
-use App\Admin\Repositories\BaseProductImage;
-use Illuminate\Http\Request;
-use App\Libraries\CommonHelper;
-class BaseProductController extends AdminController
-{
-
-    public function title()
-    {
-        return admin_trans( 'admin.products_list');
-    }
-
-    public function index(Content $content)
-    {
-        return $content
-            ->header($this->title())
-            ->description('')
-            ->breadcrumb(['text'=>'list','url'=>''])
-            ->body($this->grid());
-    }
-
-    /**
-     * Make a grid builder.
-     *
-     * @return Grid
-     */
-    protected function grid()
-    {
-        return Grid::make(BaseProduct::with(['baseProductCategory','images']), function (Grid $grid) {
-            //默认分页条数
-            $grid->paginate(config('admin.per_page'));
-
-            $grid->column('id')->display(function () {
-                return $this->_index+1;
-            });
-            $grid->column('title');
-            $grid->column('sku');
-            $grid->column('base_product_category.name',admin_trans_label('category_name'));
-            $grid->column('images')->display(function ($images) {
-                $images = $images->toArray();
-                $dataImages = array_column($images, 'image_url');
-                // 限制最多显示2个缩略图
-                $dataImages = array_slice($dataImages, 0, 1);
-                return CommonHelper::displayImage($dataImages,100);
-            });
-            $grid->column('order')->sortable();
-            $grid->column('enabled')->switch();
-            $grid->column('created_at')->sortable();
-            $grid->column('updated_at')->sortable();
-            // 筛选
-            $grid->filter(function (Grid\Filter $filter) {
-                $filter->panel();
-                $filter->expand();
-                $filter->equal('sku')->width(2);
-                $filter->like('title')->width(2);
-                $filter->equal('category_id',admin_trans_label('category_name'))->select(BaseProductCategory::selectOptions())->width(3);
-                $filter->equal('enabled')->select(admin_trans_array(config('dictionary.enabled')))->width(2);
-            });
-            //排序
-            $grid->model()->orderBy('created_at','desc');
-        });
-    }
-
-    /**
-     * Make a show builder.
-     *
-     * @param mixed $id
-     *
-     * @return Show
-     */
-    protected function detail($id)
-    {
-        return Show::make($id, BaseProduct::with(['baseProductCategory','images']), function (Show $show) {
-            $show->field('title');
-            $show->field('sku');
-            $show->field('base_product_category.name',admin_trans_label('category_name'));
-            $show->field('issuance_date');
-            $show->field('parameters',admin_trans_label('attribute_name'))->as(function ($items) {
-                if (is_array($items)) {
-                    // 创建表格的表头
-                    $table = '<table class="table table-bordered table-condensed">';
-                    // 遍历数组并将数据填充到表格中
-                    foreach ($items as $item) {
-                        $table .= '<tr>';
-                        $table .= '<td style="vertical-align: middle !important;width: 20%">' . $item['key'] . '</td>';    // 商品名称
-                        $table .= '<td style="vertical-align: middle !important;">' . $item['value'] . '</td>'; // 数量
-                        $table .= '</tr>';
-                    }
-                    $table .= '</table>';
-                    return $table;
-                }
-                return ''; // 当没有数组数据时
-            })->unescape();
-            $show->field('images')->as(function ($images) {
-                // 开始生成 HTML
-                $dataImages = array_column($images, 'image_url');
-                return CommonHelper::displayImage($dataImages,150);
-            })->unescape();
-            $show->field('content')->unescape();
-            $show->field('seo_title');
-            $show->field('seo_keywords');
-            $show->field('seo_description');
-            $show->field('order');
-            $show->field('enabled')->using(admin_trans_array(config('dictionary.enabled')));
-            $show->field('created_at');
-            $show->field('updated_at');
-        });
-    }
-
-
-    /**
-     * Make a form builder.
-     *
-     * @return Form
-     */
-    protected function form()
-    {
-        return Form::make(BaseProduct::with('images'), function (Form $form) {
-            $form->select('category_id', admin_trans_label('category_name'))
-                ->options(BaseProductCategory::selectOptions())
-                ->required();
-            $form->text('title')->required();
-            $form->text('sku')->required();
-            $form->date('issuance_date');
-            $form->table('parameters',admin_trans_label('attribute_name'), function (Form\NestedForm $table) {
-                $table->text('key')->required();
-                $table->text('value')->required();
-            });
-            // 多图上传
-            $form->multipleImage('images', admin_trans_label('images'))
-                ->retainable()//禁止删OSS图
-                ->sortable() // 可拖动排序
-                ->removable() // 可移除图片
-                ->autoUpload() // 自动上传
-                ->uniqueName()
-                ->limit(config('admin.upload.oss_image.limit'))
-                ->accept(config('admin.upload.oss_image.accept'))
-                ->maxSize(config('admin.upload.oss_image.max_size'))
-                ->dir(config("admin.upload.directory.image").'/product/'.date("Ymd"))
-                ->customFormat(function ($images) {
-                    // 数据格式化为数组['1.jpg','2.jpg'] 编辑时用到
-                    return array_column($images, 'image_url');
-                })
-                ->saving(function ($images) use ($form) {
-                    $id = $form->getKey();
-                    $reslut =  BaseProductImage::formatData($id,$images);
-                    return $reslut;
-                });
-            $form->editor('content');
-            $form->text('seo_title');
-            $form->text('seo_keywords');
-            $form->text('seo_description');
-            $form->number('order')
-                ->default(0)
-                ->rules('numeric');
-            $form->switch('enabled')->default(1);
-
-            //插入参数联动JS
-            $this->addParametersJs();
-            //新建时插入JS
-            $form->creating(function (Form $form) {
-                CommonHelper::seoReplace('title',false);
-            });
-            //保存前回调
-            $form->saving(function ($form) {
-                //检查sku是否重复
-                $baseProduct = new BaseProduct();
-                if ($form->isCreating()) {
-                    $count = $baseProduct->model()->where('sku', $form->sku)->count();
-                } else {
-                    $count = $baseProduct->model()->where('sku', $form->sku)->where('id', '!=', $form->getKey())->count();
-                }
-                if ($count > 0) {
-                    return $form->response()->error('sku already exists');
-                }
-            });
-        });
-    }
-
-    /*
-     * 以json型式返回产品参数
-     */
-    public static function parameter(Request $request)
-    {
-        $id = $request->query('q');
-        $content = BaseProductCategory::getParameter($id);
-        return $content;
-    }
-
-    /**
-     * 分类与参数联动JS
-     * @return void
-     */
-    private function addParametersJs()
-    {
-        $prefix = config('admin.route.prefix');
-        //插入JS
-        Admin::script(
-            <<<JS
-var fill_param = function (key,val) {
-    lastForm = $(".has-many-table-parameters-form:last");
-    lastForm.find('input').eq(0).val(key);
-    lastForm.find('input').eq(1).val(val);
-}
-
-$('select[name="category_id"]').on('change', function() {
-    var category_id = $(this).val();
-    // 清空现有的表格行
-    $('.has-many-table-parameters-form').remove();
-    if (category_id > 0) {
-        $.ajax({
-            url: '/{$prefix}/base-product/parameter',
-            data: { q: category_id},
-            dataType: 'json',
-            type: 'GET',              // GET
-            success: function(data) { // success
-                if (Array.isArray(data) && data.length === 0) {
-                    return null;
-                }
-                // 动态添加新数据到表格
-                $.each(data, function(index, item) {
-                    $(".has-many-table-parameters").find(".add").click();
-                    fill_param(item.key,item.value);
-                });
-            },
-            error: function(error) {  // 错误时执行的代码
-                console.log('error:', error);
-            }
-        });
-    }
-
-});
-JS
-        );
-    }
-}

+ 0 - 83
app/Admin/Controllers/BaseProductParameterController.php

@@ -1,83 +0,0 @@
-<?php
-
-namespace App\Admin\Controllers;
-
-use App\Admin\Repositories\BaseProductParameter;
-use Dcat\Admin\Form;
-use Dcat\Admin\Grid;
-use Dcat\Admin\Layout\Content;
-use Dcat\Admin\Show;
-use Dcat\Admin\Http\Controllers\AdminController;
-use Dcat\Admin\Form\NestedForm;
-
-class BaseProductParameterController extends AdminController
-{
-    public function index(Content $content)
-    {
-        return $content
-            ->header(admin_trans( 'admin.product_attribute'))
-            ->description('')
-            ->breadcrumb(['text'=>'list','url'=>''])
-            ->body($this->grid());
-    }
-
-
-    /**
-     * Make a grid builder.
-     *
-     * @return Grid
-     */
-    protected function grid()
-    {
-        return Grid::make(new BaseProductParameter(), function (Grid $grid) {
-            //默认分页条数
-            $grid->paginate(config('admin.per_page'));
-            $grid->column('id')->display(function () {
-                return $this->_index+1;
-            });
-            $grid->column('name');
-            $grid->column('order');
-            $grid->column('enabled')->switch();
-            $grid->column('created_at');
-            $grid->column('updated_at')->sortable();
-            // 允许筛选
-            $grid->filter(function (Grid\Filter $filter) {
-                $filter->panel();
-                $filter->expand();
-                $filter->equal('name')->width(2);
-                $filter->equal('enabled', )->select(admin_trans_array(config('dictionary.enabled')))->width(2);
-            });
-            //按钮
-            $grid->disableViewButton();
-            $grid->showQuickEditButton();
-            $grid->enableDialogCreate();
-            $grid->disableEditButton();
-            //$grid->quickSearch('name');
-            //排序
-            $grid->model()->orderBy("order",'desc')->orderBy('id', 'desc');
-        });
-    }
-
-
-    /**
-     * Make a form builder.
-     *
-     * @return Form
-     */
-    protected function form()
-    {
-        return Form::make(new BaseProductParameter(), function (Form $form) {
-            $form->text('name')->required();
-            $form->table('content',admin_trans_label('attribute'), function (NestedForm $table) {
-                $table->text('key')->required();
-                $table->text('value');
-            })->setLabelClass('control-label')->default([
-                ['key' => '', 'value' => ''],
-            ]);
-            $form->number('order')
-                ->default(0)
-                ->rules('numeric');
-            $form->switch('enabled')->default(1);
-        });
-    }
-}

+ 0 - 85
app/Admin/Controllers/BaseVideoCategoryController.php

@@ -1,85 +0,0 @@
-<?php
-
-namespace App\Admin\Controllers;
-
-use App\Admin\Repositories\BaseProductCategory;
-use App\Admin\Repositories\BaseVideoCategory;
-use Dcat\Admin\Form;
-use Dcat\Admin\Grid;
-use Dcat\Admin\Show;
-use Dcat\Admin\Http\Controllers\AdminController;
-use Dcat\Admin\Layout\Content;
-use Dcat\Admin\Admin;
-
-class BaseVideoCategoryController extends AdminController
-{
-    public function title()
-    {
-        return admin_trans( 'admin.video_category');
-    }
-    /**
-     * page index
-     */
-    public function index(Content $content)
-    {
-        return $content
-            ->header($this->title())
-            ->description('')
-            ->breadcrumb(['text'=>'list','url'=>''])
-            ->body($this->grid());
-    }
-
-    /**
-     * Make a grid builder.
-     *
-     * @return Grid
-     */
-    protected function grid()
-    {
-        return Grid::make(new BaseVideoCategory(), function (Grid $grid) {
-            //默认分页条数
-            $grid->paginate(config('admin.per_page'));
-            $grid->column('id')->display(function () {
-                return $this->_index+1;
-            });
-            $grid->column('name');
-            //$grid->column('parent_id');
-            $grid->column('order');
-            $grid->column('enabled')->switch();
-            $grid->column('created_at');
-            $grid->column('updated_at')->sortable();
-            //$grid->quickSearch('name');
-            // 允许筛选
-            $grid->filter(function (Grid\Filter $filter) {
-                $filter->panel();
-                $filter->expand();
-                $filter->equal('name')->width(2);
-                $filter->equal('enabled', admin_trans_label('enabled'))->select(admin_trans_array(config('dictionary.enabled')))->width(2);
-            });
-            //按钮
-            $grid->disableViewButton();
-            $grid->showQuickEditButton();
-            $grid->enableDialogCreate();
-            $grid->disableEditButton();
-            //排序
-            $grid->model()->orderBy('order', 'desc')->orderBy('id','desc');
-        });
-    }
-
-    /**
-     * Make a form builder.
-     *
-     * @return Form
-     */
-    protected function form()
-    {
-        return Form::make(new BaseVideoCategory(), function (Form $form) {
-            //$form->display('id');
-            $form->text('name');
-            $form->number('order')
-                ->default(0)
-                ->rules('numeric');
-            $form->switch('enabled')->default(1);
-        });
-    }
-}

+ 0 - 160
app/Admin/Controllers/BaseVideoController.php

@@ -1,160 +0,0 @@
-<?php
-
-namespace App\Admin\Controllers;
-
-use App\Admin\Repositories\BaseProductCategory;
-use App\Admin\Repositories\BaseVideo;
-use App\Admin\Repositories\BaseVideoCategory;
-use App\Libraries\CommonHelper;
-use Dcat\Admin\Form;
-use Dcat\Admin\Grid;
-use Dcat\Admin\Show;
-use Dcat\Admin\Http\Controllers\AdminController;
-use Dcat\Admin\Layout\Content;
-
-class BaseVideoController extends AdminController
-{
-    public function title()
-    {
-        return admin_trans( 'admin.video_list');
-    }
-    /**
-     * page index
-     */
-    public function index(Content $content)
-    {
-        return $content
-            ->header($this->title())
-            ->description('')
-            ->breadcrumb(['text'=>'list','url'=>''])
-            ->body($this->grid());
-    }
-
-    /**
-     * Make a grid builder.
-     *
-     * @return Grid
-     */
-    protected function grid()
-    {
-        return Grid::make(BaseVideo::with(['baseVideoCategory']), function (Grid $grid) {
-            //默认分页条数
-            $grid->paginate(config('admin.per_page'));
-            $grid->column('id')->display(function () {
-                return $this->_index+1;
-            });
-            $grid->column('title')->width('25%');
-            $grid->column('base_video_category.name',admin_trans_label('category_name'));
-            $grid->column('cover_image')->display(function ($image) {
-                // 开始生成 HTML
-                $dataImages = [$image];
-                return CommonHelper::displayImage($dataImages,100);
-            });
-            $grid->column('order');
-            $grid->column('enabled')->switch();
-            $grid->column('created_at')->sortable();
-            $grid->column('updated_at')->sortable();
-            // 筛选
-            $grid->filter(function (Grid\Filter $filter) {
-                $filter->panel();
-                $filter->expand();
-                $filter->equal('sku')->width(2);
-                $filter->like('title')->width(2);
-                $filter->equal('category_id',admin_trans_label('category'))->select(BaseVideoCategory::selectOptions())->width(2);
-                $filter->equal('enabled', admin_trans_label('enabled'))->select(admin_trans_array(config('dictionary.enabled')))->width(2);
-            });
-            //排序
-            $grid->model()->orderBy("order",'desc')->orderBy('id','desc');
-            //按钮
-        });
-    }
-
-    /**
-     * Make a show builder.
-     *
-     * @param mixed $id
-     *
-     * @return Show
-     */
-    protected function detail($id)
-    {
-        return Show::make($id, BaseVideo::with(['baseVideoCategory']), function (Show $show) {
-            $show->field('title');
-            $show->field('base_video_category.name',admin_trans_field('category_name'));
-            $show->field('cover_image')->as(function ($image) {
-                // 开始生成 HTML
-                $dataImages = [$image];
-                return CommonHelper::displayImage($dataImages,150);
-            })->unescape();
-            $show->html(function () {
-                $content = $this->video_url;
-                return view('admin::show.field', [
-                    'wrapped'=>true,
-                    'escape'=>false,
-                    'width'=>['label' => '2','field'=>'8'],
-                    'label'=>admin_trans_label('video_url'),
-                    'content'=>$content
-                ]);
-            });
-            $show->field('video_url',admin_trans_label('video_player'))->as(function ($value) {
-                $html = '
-                <iframe width="560" height="315" src="'.$value.'"
-                        title="YouTube video player"
-                        frameborder="0"
-                        allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
-                        allowfullscreen>
-                 </iframe>';
-                return $html;
-            })->unescape();
-            $show->field('remark')->unescape();
-            $show->field('order');
-            $show->field('enabled')->using(admin_trans_array(config('dictionary.enabled')));
-            $show->field('created_at');
-            $show->field('updated_at');
-        });
-    }
-
-    /**
-     * Make a form builder.
-     *
-     * @return Form
-     */
-    protected function form()
-    {
-        return Form::make(new BaseVideo(), function (Form $form) {
-            //$form->display('id');
-            $help = admin_trans_label('video_help');
-            $inputFormat = admin_trans_label('input_format');
-            $form->text('title')->required();
-            $form->select('category_id', admin_trans_field('category_name'))
-                ->options(BaseVideoCategory::selectOptions())
-                ->required();
-            $form->image("cover_image")
-                ->retainable()//禁止删OSS图
-                ->autoUpload()
-                ->uniqueName()
-                ->accept(config('admin.upload.oss_image.accept'))
-                ->maxSize(config('admin.upload.oss_image.max_size'))
-                ->dir(config("admin.upload.directory.image").'/video/'.date("Ymd"));//
-            $form->text("video_url")
-                ->required()
-                ->help('<a href="/help/youtube_url/index.html" target="_blank">'.$help. ' </a>, '.$inputFormat.' : https://www.youtube.com/embed/xxxxxxxx');
-            $form->editor('remark');
-            $form->number('order')
-                ->default(0)
-                ->rules('numeric');
-            $form->switch('enabled')->default(1);
-            $form->saving(function (Form $form) {
-                //替换youtube URL
-                if (strpos($form->video_url, '<iframe') !== false) {
-                    // 使用正则表达式提取 src 属性的值
-                    if (preg_match('/<iframe[^>]+src="([^"]+)"/', $form->video_url, $matches)) {
-                        $src = $matches[1];
-                        $form->video_url = $src;
-                    }
-                }
-            });
-        });
-    }
-
-}

+ 0 - 154
app/Admin/Controllers/DistAdminDistributorController.php

@@ -1,154 +0,0 @@
-<?php
-
-namespace App\Admin\Controllers;
-
-use App\Admin\Actions\Grid\InitAppearance;
-use App\Admin\Repositories\BaseIso3166;
-use App\Admin\Repositories\DistAdminDistributor;
-use App\Admin\Repositories\DistAppearance;
-use App\Libraries\CommonHelper;
-use App\Models\DistProductCategory;
-use Dcat\Admin\Form;
-use Dcat\Admin\Grid;
-use Dcat\Admin\Show;
-use Dcat\Admin\Http\Controllers\AdminController;
-use Dcat\Admin\Layout\Content;
-use Dcat\Admin\Admin;
-use Illuminate\Support\Facades\DB;
-
-class DistAdminDistributorController extends AdminController
-{
-    public function title()
-    {
-        return admin_trans( 'admin.distro_list');
-    }
-    /**
-     * page index
-     */
-    public function index(Content $content)
-    {
-        return $content
-            ->header($this->title())
-            ->description('')
-            ->breadcrumb(['text'=>'list','url'=>''])
-            ->body($this->grid());
-    }
-
-    /**
-     * Make a grid builder.
-     *
-     * @return Grid
-     */
-    protected function grid()
-    {
-
-        return Grid::make(DistAdminDistributor::with(['appearance']), function (Grid $grid) {
-            //默认分页条数
-            $grid->paginate(config('admin.per_page'));
-            //指定视图,去掉删除按钮
-            $grid->view('admin.grid.table');
-            $grid->column('id')->sortable();
-            $grid->column('client_code',admin_trans_label('client_code'))->width('15%');
-            $grid->column('dist_email',admin_trans_label('email'));
-            $grid->column('country',);
-            $grid->column('enabled')->switch();
-            $grid->column('created_at')->sortable();
-            // 过滤
-            $grid->filter(function (Grid\Filter $filter) {
-                $filter->panel();
-                $filter->expand();
-                $filter->equal('dist_code',admin_trans_label('client_code') )->width(2);
-                $filter->equal('secondary_domain')->width(2);
-                $filter->equal('enabled')->select(admin_trans_array(config('dictionary.enabled')))->width(2);
-            });
-            // 排序
-            $grid->model()->orderBy("id",'desc');
-            //按钮
-            $grid->showQuickEditButton();
-            $grid->enableDialogCreate();
-            $grid->disableEditButton();
-            $grid->disableDeleteButton();
-            //批量操作
-            $grid->batchActions(function (Grid\Tools\BatchActions $batch) {
-                $batch->disableDelete();
-                $batch->add(new InitAppearance());
-            });
-        });
-    }
-
-    /**
-     * Make a show builder.
-     *
-     * @param mixed $id
-     *
-     * @return Show
-     */
-    protected function detail($id)
-    {
-        return Show::make($id, DistAdminDistributor::with(['appearance']), function (Show $show) {
-            $show->field('client_code',admin_trans_label('client_code'));
-            $show->field('dist_email',admin_trans_label('email'));
-            $show->field('dist_contact_number',admin_trans_label('contact_number'));
-            $show->field('country');
-            $show->field('country_alpha_2');
-            $show->field('country_lang');
-            $show->field('address');
-            $show->field('created_at');
-            $show->field('updated_at');
-            $show->field('enabled')->using(admin_trans_array(config('dictionary.enabled')));
-            // 按钮
-            $show->disableDeleteButton();
-        });
-    }
-
-    /**
-     * Make a form builder.
-     *
-     * @return Form
-     */
-    protected function form()
-    {
-        return Form::make(new DistAdminDistributor(), function (Form $form) {
-            $form->text('client_code',admin_trans_label('client_code'))->width(9,3)->required();
-            $form->text('dist_email',admin_trans_label('email'))->width(9,3);
-            $form->text('dist_contact_number',admin_trans_label('contact_number'))->width(9,3);
-            $form->select('country')
-                ->options(BaseIso3166::selectOptions())
-                ->width(9,3)->required();
-            $form->text('country_lang')->width(9,3)->required()->help(admin_trans_label('country_lang_tips'));
-            $form->text('address')->width(9,3);
-            $form->switch('enabled')->width(9,3)->default(1);
-            $form->hidden('country_alpha_2');
-            //保存前回调
-            $form->saving(function (Form $form) {
-                $form->country_alpha_2 = BaseIso3166::getAlpha2($form->country);
-            });
-            //保存后回调
-            $form->saved(function (Form $form, $result) {
-                if ($form->isCreating()) {
-                    //创建后创建默认分类
-                    $newId = $form->getKey();
-                    //初始化分销商
-                    DistAdminDistributor::initDist($newId);
-                    return $form->response()->success(admin_trans_label('distributor_create_success'));
-                }
-            });
-        });
-    }
-
-    /*
-     * 新增事件事务
-     */
-    public function store()
-    {
-        try {
-            DB::beginTransaction();
-            $result =  parent::store();
-            DB::commit();
-            return $result;
-        } catch (\Exception $e) {
-            DB::rollBack();
-            throw $e;
-        }
-    }
-}

+ 0 - 148
app/Admin/Controllers/DistAdminUserController.php

@@ -1,148 +0,0 @@
-<?php
-
-namespace App\Admin\Controllers;
-
-use App\Admin\Renderable\DistDistributorTable;
-use App\Admin\Repositories\DistAdminUser;
-use App\Models\DistAdminDistributor;
-use Dcat\Admin\Form;
-use Dcat\Admin\Grid;
-use Dcat\Admin\Show;
-use Dcat\Admin\Http\Controllers\AdminController;
-use Dcat\Admin\Layout\Content;
-
-class DistAdminUserController extends AdminController
-{
-    public function title()
-    {
-        return admin_trans( 'admin.distro_user');
-    }
-    /**
-     * page index
-     */
-    public function index(Content $content)
-    {
-        return $content
-            ->header($this->title())
-            ->description('')
-            ->breadcrumb(['text'=>'list','url'=>''])
-            ->body($this->grid());
-    }
-
-    /**
-     * Make a grid builder.
-     *
-     * @return Grid
-     */
-    protected function grid()
-    {
-        return Grid::make(DistAdminUser::with(['distributor']), function (Grid $grid) {
-            //默认分页条数
-            $grid->paginate(config('admin.per_page'));
-            //指定表格视图,去掉右上角的操作按钮
-            $grid->view('admin.grid.table');
-            //设置列表
-            $grid->column('id')->sortable();
-            $grid->column('username');
-            $grid->column('name');
-            $grid->column('distributor.client_code',admin_trans_label('distributor_code'))->width('15%');
-            //$grid->column('language')->using(config('dictionary.languages'));
-            $grid->column('enabled')->switch();
-            $grid->column('created_at');
-            $grid->column('updated_at')->sortable();
-            //设置过滤器
-            $grid->filter(function (Grid\Filter $filter) {
-                $filter->panel();
-                $filter->expand();
-                $filter->equal('username')->width(2);
-                $filter->equal('name',)->width(2);
-                $filter->like('distributor.client_code', admin_trans_label('distributor_code'))->width(2);
-                $filter->equal('enabled', )->select(admin_trans_array(config('dictionary.enabled')))->width(2);
-            });
-            //排序
-            $grid->model()->orderBy("id",'desc');
-            //按钮
-            $grid->showQuickEditButton();
-            $grid->enableDialogCreate();
-            $grid->disableEditButton();
-            $grid->disableDeleteButton();
-            $grid->disableBatchDelete();
-        });
-    }
-
-    /**
-     * Make a show builder.
-     *
-     * @param mixed $id
-     *
-     * @return Show
-     */
-    protected function detail($id)
-    {
-        return Show::make($id, DistAdminUser::with(['distributor']), function (Show $show) {
-            $show->row(function ($show) {
-                $show->width(6)->field('username');
-                $show->width(6)->field('name');
-                $show->width(6)->field('distributor.client_code', admin_trans_label('distributor_code'));
-                $show->width(6)->field('enabled')->using(config('dictionary.enabled'));
-                $show->width(6)->field('created_at');
-                $show->width(6)->field('updated_at');
-            });
-
-            // 按钮
-            $show->disableDeleteButton();
-        });
-    }
-
-    /**
-     * Make a form builder.
-     *
-     * @return Form
-     */
-    protected function form()
-    {
-        return Form::make(DistAdminUser::with(['distributor']), function (Form $form) {
-            //$form->display('id');
-            $form->text('username')->help(admin_trans_label('username_tips'))->required();
-            $form->password('password')->customFormat(function ($v) {
-                return "";
-            });
-            $form->text('name',)->help(admin_trans_label('name_tips'))->required();
-            //$form->select('language')->options(config('dictionary.languages'))->required();
-            $form->selectTable('dist_id', admin_trans_label('distributor'))
-                ->title('distId')
-                ->from(DistDistributorTable::make())
-                ->model(DistAdminDistributor::class, 'id', 'client_code')
-                ->required();
-            $form->switch('enabled')->default(1);
-            //保存前回调
-            $form->saving(function (Form $form) {
-                //判断用户名是否重复
-                $count = DistAdminUser::findCountByUsername($form->getKey(), $form->username);
-                if ($count > 0) {
-                    return $form->response()->error('Username already exists');
-                }
-                if($form->isCreating() && ($form->password === null || $form->password === '')) {
-                    return $form->response()->error('Password cannot be empty');
-                }
-                //密码加密
-                if ($form->password) {
-                    $form->password = bcrypt($form->password);
-                } else {
-                    $form->deleteInput('password');
-                }
-            });
-            //保存后回调
-            $form->saved(function (Form $form, $result) {
-                if ($form->isCreating()) {
-                    //添加角色
-                    $newId = $form->getKey();
-                    if (! $newId) {
-                        return $form->response()->error('Failed to save data');
-                    }
-                    DistAdminUser::addRoleUser($newId, config('dictionary.dist_role_id'));//分销商角色ID 2
-                }
-            });
-        });
-    }
-}

+ 0 - 144
app/Admin/Controllers/DistAppearanceController.php

@@ -1,144 +0,0 @@
-<?php
-
-namespace App\Admin\Controllers;
-
-use App\Admin\Actions\Grid\AppearanceImport;
-use App\Admin\Repositories\DistAppearance;
-use App\Libraries\CommonHelper;
-use Dcat\Admin\Form;
-use Dcat\Admin\Grid;
-use Dcat\Admin\Show;
-use Dcat\Admin\Http\Controllers\AdminController;
-use Dcat\Admin\Layout\Content;
-use Dcat\Admin\Admin;
-
-class DistAppearanceController extends AdminController
-{
-    public function title()
-    {
-        return admin_trans( 'admin.template_list');
-    }
-    /**
-     * page index
-     */
-    public function index(Content $content)
-    {
-        return $content
-            ->header($this->title())
-            ->description('')
-            ->breadcrumb(['text'=>'list','url'=>''])
-            ->body($this->grid());
-    }
-
-    /**
-     * Make a grid builder.
-     *
-     * @return Grid
-     */
-    protected function grid()
-    {
-        return Grid::make(new DistAppearance(), function (Grid $grid) {
-            //默认分页条数
-            $grid->paginate(config('admin.per_page'));
-            $grid->column('id')->sortable();
-            // 标题
-            $grid->column('title');
-            // 文件夹
-            $grid->column('folder')->help('Folder names under the directory:/resources/appearance');
-            // 封面图
-            $grid->column('cover_image')->display(function ($image) {
-                $dataImages = [$image];
-                return CommonHelper::displayImage($dataImages,100);
-            });
-            // 排序
-            $grid->column('order');
-            //是否导入
-            $grid->column('imported')->using(config('dictionary.whether'))->label([
-                0 => 'default',
-                1 => 'success',
-            ]);
-            //是否启用
-            $grid->column('enabled')->switch();
-            // 时间
-            $grid->column('created_at');
-            $grid->column('updated_at')->sortable();
-            // 过滤器
-            $grid->filter(function (Grid\Filter $filter) {
-                $filter->panel();
-                $filter->expand();
-                $filter->equal('title')->width(2);
-                $filter->equal('enabled', )->select(admin_trans_array(config('dictionary.enabled')))->width(2);
-            });
-            // 操作
-            $grid->actions(function (Grid\Displayers\Actions $actions) {
-                $actions->disableDelete();
-                $actions->append(new AppearanceImport());
-            });
-            $grid->model()->orderBy('order', 'desc')->orderBy('id', 'desc');
-        });
-    }
-
-    /**
-     * Make a show builder.
-     *
-     * @param mixed $id
-     *
-     * @return Show
-     */
-    protected function detail($id)
-    {
-        return Show::make($id, new DistAppearance(), function (Show $show) {
-            //$show->field('id');
-            $show->field('title');
-            $show->field('folder');
-            $show->field('cover_image')->as(function ($image) {
-                // 开始生成 HTML
-                $dataImages = [$image];
-                return CommonHelper::displayImage($dataImages,100);
-            })->unescape();
-            $show->field('describe');
-            $show->field('order');
-            $show->field('enabled')->using(admin_trans_array(config('dictionary.enabled')));
-            $show->field('created_at');
-            $show->field('updated_at');
-            $show->disableDeleteButton();
-        });
-    }
-
-    /**
-     * Make a form builder.
-     *
-     * @return Form
-     */
-    protected function form()
-    {
-        return Form::make(new DistAppearance(), function (Form $form) {
-            //$form->display('id');
-            $form->text('title');
-            $form->text('folder');
-            $form->image("cover_image")
-                ->retainable()//禁止删OSS图
-                ->autoUpload()
-                ->uniqueName()
-                ->accept(config('admin.upload.oss_image.accept'))
-                ->maxSize(config('admin.upload.oss_image.max_size'))
-                ->dir(config("admin.upload.directory.image").'/appearance/'.date("Ymd"));//
-            $form->textarea('describe');
-            $form->number('order')
-                ->default(0)
-                ->rules('numeric');
-            $form->switch('enabled')->default(0)->readOnly();
-            $form->saving(function (Form $form) {
-                if ($form->isCreating() && $form->input('enabled') == 1) {
-                    return $form->response()->error('Please create the template first, then import it, and finally enable it.');
-                }
-                if (!$form->isCreating()) {
-                    if ($form->input('enabled') == 1 && $form->model()->imported == 0) {
-                        return $form->response()->error('Please select the import option first, then enable it.');
-                    }
-                }
-            });
-            $form->disableDeleteButton();
-        });
-    }
-}

+ 0 - 155
app/Admin/Controllers/DistAppearanceTemplateController.php

@@ -1,155 +0,0 @@
-<?php
-
-namespace App\Admin\Controllers;
-
-use App\Admin\Repositories\DistAdminDistributor;
-use App\Admin\Repositories\DistAppearance;
-use App\Admin\Repositories\DistAppearancePublishList;
-use App\Admin\Repositories\DistAppearanceTemplate;
-use App\Admin\Repositories\DistAppearanceTemplateLog;
-use Dcat\Admin\Form;
-use Dcat\Admin\Grid;
-use Dcat\Admin\Show;
-use Dcat\Admin\Http\Controllers\AdminController;
-use Dcat\Admin\Layout\Content;
-use Dcat\Admin\Admin;
-use App\Admin\Forms\AceLeft;
-use Illuminate\Http\Request;
-use Illuminate\Support\Str;
-use Dcat\Admin\Widgets\Card;
-
-
-class DistAppearanceTemplateController extends AdminController
-{
-    /*
-     * monaco editor 编辑代码
-     */
-    public function ace(Content $content,Request $request) {
-        $content->view('admin.pages-custom.ace_content');
-        if ($request->isMethod('post') || false == empty($request->get('act'))) {
-            if($request->get('act') == 'tree') {
-                //获取代码树形结构
-                $appearanceId = $request->get('appearance_id');
-                $distId = $request->get('dist_id');
-                return $this->showTree($appearanceId, $distId);
-            } elseif ($request->get('act') == 'content') {
-                //得到文件内容
-                $appearanceId = $request->get('appearance_id');
-                $distId = $request->get('dist_id');
-                $templateCode = $request->get('id');
-                return DistAppearanceTemplate::getContent($appearanceId,$distId,$templateCode);
-            } elseif ($request->get('act') == 'content_save') {
-                //保存文件内容
-                $appearanceId = $request->get('appearance_id');
-                $distId = $request->get('dist_id');
-                $templateCode = $request->get('template_code');
-                $content = $request->get('content');
-                return DistAppearanceTemplate::saveContent($appearanceId,$distId,$templateCode, $content);
-            } else if ($request->get('act') == 'add_del_tree') {
-                //新建或删除文件
-                $fileId = $request->get('file_id');
-                $appearanceId = $request->get('appearance_id');
-                $distId = $request->get('dist_id');
-                $fileName = $request->get('file_name_input');
-                $filePath = $request->get('file_path_name');
-                $type = $request->get('type');
-                return DistAppearanceTemplate::addDelTree($appearanceId,$distId,$fileId,$fileName, $filePath,$type);
-            }elseif ($request->get('act') == 'publish') {
-                //发报
-                $appearanceId = $request->get('appearance_id');
-                $distId = $request->get('dist_id');
-                DistAppearancePublishList::publish($appearanceId,$distId);
-                //清缓存
-                DistAdminDistributor::clearCache($distId);
-                return ['status'=>1];
-            } else if ($request->get('act') == 'get_appearance_id') {
-                //返回appearance_id
-                $distId = $request->get('dist_id');
-                $row = DistAdminDistributor::getOneById($distId);
-                return $row ? $row->appearance_id : '';
-            } else if ($request->get('act') == 'fetch_template_logs') {
-                //返回模版修改日志
-                $fileId = $request->get('file_id');
-                $appearanceId = $request->get('appearance_id');
-                $distId = $request->get('dist_id');
-                $rows = DistAppearanceTemplateLog::fetchTemplateLogs($appearanceId,$distId,$fileId);
-                return response()->json($rows);
-            } else if ($request->get('act') == 'fetch_template_log_content') {
-                //返回模版修改日志内容
-                $logId = $request->get('log_id');
-                $rows = DistAppearanceTemplateLog::fetchTemplateLogContent($logId);
-                $rows->previous_content = htmlspecialchars($rows->previous_content);
-                return response()->json($rows);
-            } else if ($request->get('act') == 'restore_template_log') {
-                //还原模版修改日志
-                $logId = $request->get('log_id');
-                DistAppearanceTemplateLog::restoreTemplateLog($logId);
-                return ['status'=>1];
-            }
-        }
-
-        $leftForm = new AceLeft();
-        return $content
-            ->header('Template Editor')
-            ->body(admin_view('admin.pages-custom.ace',['leftForm'=>$leftForm]));
-    }
-
-    /*
-     * 显示代码树
-     */
-    private function showTree($appearanceId, $distId) {
-        $appearanceId = empty($appearanceId) ? 0 : $appearanceId;
-        $distId = empty($distId) ? 0 : $distId;
-        $appearanceRow = DistAppearance::getOneById($appearanceId);
-
-        $tree = DistAppearanceTemplate::getTemplateTree($appearanceId, $distId);
-        //print_r($tree);exit;
-        $html = '<ul class="list-group list-group-flush">';
-        $i = 0;
-        foreach ($tree as $key => $value) {
-            $fa = 'fa-angle-down';
-            $file_name = $value['file_name'];
-            $file_name = empty($file_name) ? 'root' : $file_name;
-            $file_name = '<span class="custom-blue-bold">'. $file_name.'</span>';
-            if ($i == 0) {
-                $file_name .= " ({$distId} - {$appearanceId})";
-            }
-            $file_name = $file_name . '<span class="float-right"><a href="javascript:void(0)" title="Add File" data-toggle="modal" data-target="#addFileModal" file_path_name="'. $value['file_name']. '"><i class="feather icon-plus" style="font-size: 12px"></i></a></span>';
-            $html .= '<li class="list-group-item has-submenu">';
-            $html .= '<div style="padding-top: 5px;padding-bottom: 0px"><i class="fa '.$fa.'"></i> '. $file_name.'</div>';
-            $html .= $this->treeBuilder($value);
-            $html .= '</li>';
-            $i++;
-        }
-        $html .= '</ul>';
-        return $html;
-    }
-
-    private function treeBuilder($value) {
-        $html = '';
-        if (!empty($value['children'])) {
-            $html = '<ul class="submenu">';
-            foreach ($value['children'] as $k => $v) {
-                $fa = 'fa-angle-down';
-                $file_name = $v['file_name'];
-                if (empty($v['children'])) {
-                    $fa = 'fa-angle-right';
-                    $file_name = '<a href="#" class="file-action" file_id="'. $v['template_code'].'" title="'.$file_name.'">'. $file_name.'</a>'. '<span class="float-right"><a href="javascript:void(0)" title="delete File" class="delFileButton" file_id="'. $v['id'].'" file_name="'. $v['file_name'].'"><i class="feather icon-x"></i></a></span>';
-                } else {
-                    $file_name = '<span class="custom-blue-bold">'. $file_name.'</span>';
-                }
-                $html .= '<li class="list-group-item"><i class="fa '.$fa.'"></i> '. $file_name;
-                if (!empty($v['children'])) {
-                    $html .= $this->treeBuilder($v);
-                }
-                $html .=  '</li>';
-
-            }
-            $html .= '</ul>';
-        }
-        return $html;
-    }
-
-
-
-}

+ 0 - 180
app/Admin/Controllers/DistAppearanceVariableController.php

@@ -1,180 +0,0 @@
-<?php
-
-namespace App\Admin\Controllers;
-
-use App\Admin\Renderable\DistDistributorTable;
-use App\Admin\Repositories\DistAppearance;
-use App\Admin\Repositories\DistAppearanceVariable;
-use App\Libraries\CommonHelper;
-use Dcat\Admin\Form;
-use Dcat\Admin\Grid;
-use Dcat\Admin\Show;
-use Dcat\Admin\Http\Controllers\AdminController;
-use Dcat\Admin\Layout\Content;
-use Dcat\Admin\Admin;
-use Dcat\Admin\Widgets\Dropdown;
-
-
-class DistAppearanceVariableController extends AdminController
-{
-
-    public function index(Content $content)
-    {
-        return $content->full()->body($this->grid());
-    }
-
-    /**
-     * Make a grid builder.
-     *
-     * @return Grid
-     */
-    protected function grid()
-    {
-        $templateCode = isset($_GET['templateCode']) ? $_GET['templateCode'] : 0;
-        $appearanceId = isset($_GET['appearanceId']) ? intval($_GET['appearanceId']) : 0;
-        $distId = isset($_GET['distId']) ? intval($_GET['distId']) : 0;
-        if (empty($appearanceId)) {
-            die(' <h3>Please select the theme.<h3>');
-        }
-        return Grid::make(DistAppearanceVariable::with(['distributor','appearance']), function (Grid $grid) use ($templateCode, $appearanceId, $distId) {
-            $grid->column('id')->sortable();
-            $grid->column('distributor.company_name','Distributor Name')->display(function ($company_name) {
-                if (empty($company_name)) {
-                    return '-';
-                }
-                return $company_name;
-            });
-            $grid->column('appearance.title','Appearance');
-            //变量名
-            $grid->column('variable_name');
-            //变量类型
-            $grid->column('variable_type')->using(['1' => 'text', '2' => 'textarea', '3' => 'json']);
-            //是否是站点变量
-            $grid->column('templateCode','site variable')->display(function ($templateIds) {
-                if ($templateIds == 0) {
-                    return 'Yes';
-                } else {
-                    return 'No';
-                }
-            })->label([
-                '0' => 'success',
-                '1' => 'default',
-            ]);;
-            //搜索
-            $grid->quickSearch(['variable_name']);
-            //工具栏
-            $grid->disableViewButton();
-            $grid->showQuickEditButton();
-            $grid->enableDialogCreate();
-            $grid->disableEditButton();
-            $addUrl = 'templateCode='. $templateCode . '&appearanceId='. $appearanceId . '&distId='. $distId;
-            //排序
-            $grid->model()->where('appearance_id', $appearanceId)->where('dist_id', $distId)->whereIn('template_code', [0, $templateCode])->orderBy("id",'asc');
-            //增加js 向新增按钮添加参数还有编辑按钮添加参数
-
-
-            CommonHelper::replaceAddEditerUrl('.dialog-create', '.quick-edit', $addUrl);
-
-            /*
-            Admin::script(
-<<<JS
-var button = $('.dialog-create');
-var currentUrl = button.attr('data-url');
-if (currentUrl.indexOf('?') === -1) {
-    button.attr('data-url', currentUrl + '{$addUrl}');
-} else {
-    button.attr('data-url', currentUrl + '{$addUrl}');
-}
-
-$('.quick-edit').each(function() {
-    var currentUrl = $(this).attr('data-url');
-    if (currentUrl.indexOf('?') === -1) {
-        $(this).attr('data-url', currentUrl + '{$addUrl}');
-    } else {
-        // 如果已经有查询参数,添加 &id=123
-        $(this).attr('data-url', currentUrl + '{$addUrl}');
-    }
-});
-JS
-            );
-            */
-        });
-    }
-
-    /**
-     * Make a show builder.
-     *
-     * @param mixed $id
-     *
-     * @return Show
-     */
-//    protected function detail($id)
-//    {
-//        return Show::make($id, DistAppearanceVariable::with(['distributor','appearance']), function (Show $show) {
-//            $show->field('id');
-//            $show->field('distributor.company_name','Distributor Name')->as(function ($company_name) {
-//                if (empty($company_name)) {
-//                    return 'Site Variable';
-//                }
-//                return $company_name;
-//            });
-//            $show->field('appearance.title','Appearance Title');
-//            $show->field('variable_type')->using(['1' => 'text', '2' => 'textarea', '3' => 'json']);
-//            $show->field('variable_name');
-//            $show->field('variable_value');
-//
-//            $show->field('created_at');
-//            $show->field('updated_at');
-//        });
-//    }
-
-    /**
-     * Make a form builder.
-     *
-     * @return Form
-     */
-    protected function form()
-    {
-        $templateCode = isset($_GET['templateCode']) ? $_GET['templateCode'] : 0;
-        $appearanceId = isset($_GET['appearanceId']) ? intval($_GET['appearanceId']) : 0;
-        $distId = isset($_GET['distId']) ? intval($_GET['distId']) : 0;
-        return Form::make(new DistAppearanceVariable(), function (Form $form) use ($templateCode, $appearanceId, $distId) {
-            $form->hidden('appearance_id')->value($appearanceId);
-            $form->hidden('dist_id')->value($distId);
-            $form->hidden('template_code')->value($templateCode);
-            $form->hidden('variable_code');
-            //编辑时当template_id为0时,site_variable为默认值1,否则为0
-            $variableDefaul = 0;
-            if (!$form->isCreating()) {
-                if ($form->model()->template_id == 0) {
-                    $variableDefaul = 1;
-                }
-            }
-            $form->switch('site_variable')->value($variableDefaul)->width(9,3);
-            $form->radio('variable_type')->options([
-                '1'=>'text',
-                '2'=>'textarea',
-                '3'=>'json'
-            ])->width(9,3)->default(1);
-            $form->text('variable_name')->width(9,3);
-            $form->textarea('variable_value')->rows(12)->width(9,3);
-            $form->ignore(['site_variable']);
-
-            $form->submitted(function (Form $form) {
-                if ($form->input('site_variable') == 1) {
-                    $form->template_code = 0;
-                }
-                if ($form->isCreating()) {
-                    $form->variable_code = uniqueCode();
-                }
-                //检查json格式是否正确
-                if ($form->input('variable_type') == 3) {
-                    if (!isValidJson($form->input('variable_value'))) {
-                        return $form->response()->error('The JSON format is incorrect');
-                    }
-                }
-            });
-
-        });
-    }
-}

+ 0 - 142
app/Admin/Controllers/DistInquiryController.php

@@ -1,142 +0,0 @@
-<?php
-
-namespace App\Admin\Controllers;
-
-use App\Admin\Repositories\DistInquiry;
-use Dcat\Admin\Form;
-use Dcat\Admin\Grid;
-use Dcat\Admin\Show;
-use Dcat\Admin\Http\Controllers\AdminController;
-use Dcat\Admin\Layout\Content;
-use Dcat\Admin\Admin;
-use App\Admin\Actions\Grid\InquiryAssignment;
-
-class DistInquiryController extends AdminController
-{
-    public function title()
-    {
-        return admin_trans( 'admin.inquiry_list');
-    }
-
-    /**
-     * page index
-     */
-    public function index(Content $content)
-    {
-        return $content
-            ->header($this->title())
-            ->description('')
-            ->breadcrumb(['text'=>'list','url'=>''])
-            ->body($this->grid());
-    }
-
-    /**
-     * Make a grid builder.
-     *
-     * @return Grid
-     */
-    protected function grid()
-    {
-        return Grid::make(DistInquiry::with(['distributor']), function (Grid $grid) {
-            //默认分页条数
-            $grid->paginate(config('admin.per_page'));
-            //指定视图,去掉删除按钮
-            $grid->view('admin.grid.table');
-            //字段
-            $grid->column('id')->display(function () {
-                return $this->_index+1;
-            });
-            $grid->column('order_number')->width('15%');
-            $grid->column('customer_name')->width('15%');
-            $grid->column('company_name')->width('10%');
-            $grid->column('whats_app')->width('10%');;
-            $grid->column('consulting_products')->width('10%');
-            $grid->column('distributor.client_code', admin_trans_label('distributor_code'))->width('12%');
-            $grid->column('status')->using(admin_trans_array(config('dictionary.inquiryStatus')))->label([
-                0 => 'default',
-                1 => 'info',
-                2 => 'success',
-            ])->width('10%');
-            $grid->column('created_at')->width('10%');
-            //$grid->column('updated_at')->sortable();
-            //筛选
-            $grid->filter(function (Grid\Filter $filter) {
-                $filter->panel();
-                $filter->expand();
-                $filter->equal('order_number')->width(2);
-                $filter->equal('company_name')->width(2);
-                $filter->equal('customer_name')->width(2);
-                $filter->like('distributor.client_code',admin_trans_label('distributor_code'))->width(2);
-                $inquiryStatus = admin_trans_array(config('dictionary.inquiryStatus'));
-                $filter->equal('status')->select($inquiryStatus)->width(2);
-            });
-            //排序
-            $grid->model()->orderBy("id",'desc');
-            //按钮
-            $grid->showQuickEditButton();
-            $grid->disableCreateButton();
-            $grid->disableEditButton();
-            $grid->disableDeleteButton();
-            $grid->disableBatchDelete();
-            $grid->showBatchActions(true);
-            //批量操作
-            $grid->tools([new InquiryAssignment()]);
-        });
-    }
-
-    /**
-     * Make a show builder.
-     *
-     * @param mixed $id
-     *
-     * @return Show
-     */
-    protected function detail($id)
-    {
-        return Show::make($id, new DistInquiry(), function (Show $show) {
-            $show->field('order_number');
-            $show->field('customer_name');
-            $show->field('company_name');
-            $show->field('whats_app');
-            $show->field('email');
-            $show->field('consulting_products');
-            $show->field('freight_forwarder')->using(admin_trans_array(config('dictionary.freight_forwarder')));
-            $show->field('business_model');
-            $show->field('referer_url');
-            $show->field('content')->as(function ($content) {
-                return "<pre>{$content}</pre>";
-            })->unescape();
-            $show->field('ip_address');
-            $show->field('status')->using(admin_trans_array(config('dictionary.inquiryStatus')));
-            $show->field('created_at');
-            $show->field('updated_at');
-            $show->divider();
-            $show->field('allocate_time');
-            $show->field('distributor.distributor_code',admin_trans_label('distributor_code'));
-            //按钮
-            $show->disableDeleteButton();
-            $show->disableEditButton();
-        });
-    }
-
-    /**
-     * Make a form builder.
-     *
-     * @return Form
-     */
-    protected function form()
-    {
-        return Form::make(new DistInquiry(), function (Form $form) {
-            $form->display('order_number');
-            $form->text('customer_name');
-            $form->text('company_name');
-            $form->text('whats_app');
-            $form->email('email');
-            $form->text('consulting_products');
-            $form->select('freight_forwarder')->options(admin_trans_array(config('dictionary.freight_forwarder')));
-            $form->text('business_model');
-            $form->text('referer_url');
-            $form->textarea('content')->rows(10);
-        });
-    }
-}

+ 0 - 181
app/Admin/Controllers/DistMessageController.php

@@ -1,181 +0,0 @@
-<?php
-
-namespace App\Admin\Controllers;
-
-use App\Admin\Repositories\DistMessage;
-use Dcat\Admin\Form;
-use Dcat\Admin\Grid;
-use Dcat\Admin\Show;
-use Dcat\Admin\Http\Controllers\AdminController;
-use Dcat\Admin\Layout\Content;
-use Dcat\Admin\Admin;
-
-use App\Distributor\Repositories\DistAdminDistributor;
-
-class DistMessageController extends AdminController
-{
-    public function title()
-    {
-        return admin_trans('admin.messages');
-
-    }
-    /**
-     * page index
-     */
-    public function index(Content $content)
-    {
-        return $content
-            ->header(admin_trans( 'admin.messages'))
-            ->description(admin_trans('admin.all'))
-            ->breadcrumb(['text'=>'list','url'=>''])
-            ->body($this->grid());
-    }
-
-    /**
-     * Make a grid builder.
-     *
-     * @return Grid
-     */
-    protected function grid()
-    {
-        return Grid::make(new DistMessage(), function (Grid $grid) {
-            $grid->column('id')->sortable();
-            $grid->column('title', admin_trans_field('message_title'));
-            $grid->column('content');
-            //$grid->column('sender_id');
-            $grid->column('target_type')->display(function ($value) {
-                if ($value === 'all') {
-                    return admin_trans_label('all_users');
-                } elseif ($value === 'users') {
-                    return admin_trans_label('specified_users');
-                }
-                return $value;
-            });
-            //$grid->column('target_ids');
-            $grid->column('created_at');
-            $grid->column('updated_at')->sortable();
-
-            $grid->filter(function (Grid\Filter $filter) {
-                $filter->equal('id');
-
-            });
-        });
-    }
-
-    /**
-     * Make a show builder.
-     *
-     * @param mixed $id
-     *
-     * @return Show
-     */
-    protected function detail($id)
-    {
-        return Show::make($id, new DistMessage(), function (Show $show) use ($id) {
-            $show->field('id');
-            $show->field('title');
-            $show->field('content');
-            //$show->field('sender_id');
-            $show->field('target_type')->as(function ($value) {
-                if ($value === 'all') {
-                    return admin_trans_label('all_users');
-                } elseif ($value === 'users') {
-                    return admin_trans_label('specified_users');
-                }
-                return $value;
-            });
-            //$show->field('target_ids');
-//            $show->field('target_ids');
-            // 获取 target_ids 并显示对应的 company_name
-            $message = DistMessage::find($id);
-            $targetIds = json_decode($message->target_ids, true);
-
-            if ($targetIds) {
-                $companyNames = DistAdminDistributor::getCompanyNamesByIds($targetIds);
-                $show->field('target_ids')->as(function () use ($companyNames) {
-                    return implode(', ', $companyNames);
-                });
-            } else {
-               // $show->field('target_ids', 'Target IDs')->as('No specified users');
-            }
-            $show->field('created_at');
-            $show->field('updated_at');
-        });
-    }
-
-    /**
-     * Make a form builder.
-     *
-     * @return Form
-     */
-    protected function form()
-    {
-        //插入JS
-        Admin::script(
-            <<<JS
-    $(document).ready(function() {
-                var targetType = $('select[name="target_type"]');
-                var targetIds = $('div.form-group.row.form-field:has(select[name="target_ids[]"])');
-
-                // 初始化时根据 target_type 的值显示或隐藏 target_ids
-                toggleTargetIds(targetType.val());
-
-                // 监听 target_type 的变化
-                targetType.change(function() {
-                    toggleTargetIds($(this).val());
-                });
-
-                function toggleTargetIds(value) {
-                   // alert(value);
-                    if (value === 'users') {
-                        targetIds.show();
-                    } else {
-                        targetIds.hide();
-                    }
-                }
-            });
-
-JS
-        );
-
-        return Form::make(new DistMessage(), function (Form $form) {
-            $form->display('id')->rules('required');;
-            $form->text('title',admin_trans_field('message_title'))->rules('required');;
-            $form->textarea('content')->rules('required');;
-//            $form->text('sender_id')->rules('required');
-
-// 检查当前操作是创建还是编辑
-            if ($form->isEditing()) {
-                // 如果是编辑操作,设置 target_type 为只读
-                $form->select('target_type')->options([
-                    'all' => admin_trans_label('all_users'),
-                    'users' => admin_trans_label('specified_users'),
-                ])->rules('required')->readonly();
-            } else {
-                // 如果是创建操作,正常显示 target_type
-                $form->select('target_type')->options([
-                    'all' => admin_trans_label('all_users'),
-                    'users' => admin_trans_label('specified_users'),
-                ])->rules('required');
-            }
-
-            $form->multipleSelect('target_ids')
-               ->options(DistAdminDistributor::tags_all())
-                ->saving(function ($value) {
-
-                    return $value;
-                    //dd($value);
-                    // 转化成json字符串保存到数据库
-                    //return json_encode($value);
-                });
-
-            $form->display('created_at');
-            $form->display('updated_at');
-            $form->disableViewCheck();
-            $form->disableCreatingCheck();
-            $form->disableEditingCheck();
-
-
-        });
-    }
-}

+ 0 - 201
app/Admin/Controllers/DistSiteController.php

@@ -1,201 +0,0 @@
-<?php
-
-namespace App\Admin\Controllers;
-
-use App\Admin\Actions\Grid\InitAppearance;
-use App\Admin\Repositories\DistAdminDistributor;
-use App\Admin\Repositories\DistAppearance;
-use App\Libraries\CommonHelper;
-use Dcat\Admin\Form;
-use Dcat\Admin\Grid;
-use Dcat\Admin\Http\Controllers\AdminController;
-use Dcat\Admin\Layout\Content;
-use Dcat\Admin\Show;
-use Illuminate\Support\Facades\DB;
-
-class DistSiteController extends AdminController
-{
-    /**
-     * page index
-     */
-    public function index(Content $content)
-    {
-        return $content
-            ->header(admin_trans( 'admin.site_management'))
-            ->description('')
-            ->breadcrumb(['text'=>'list','url'=>''])
-            ->body($this->grid());
-    }
-
-    /**
-     * Make a grid builder.
-     *
-     * @return Grid
-     */
-    protected function grid()
-    {
-
-        return Grid::make(DistAdminDistributor::with(['appearance']), function (Grid $grid) {
-            //默认分页条数
-            $grid->paginate(config('admin.per_page'));
-            //指定视图,去掉删除按钮
-            $grid->view('admin.grid.table');
-
-            $grid->column('id')->sortable();
-            $grid->column('client_code',admin_trans_label('distributor_code'))->width('15%');
-            $grid->column('site_name');
-            $grid->column('appearance.title' ,admin_trans_field('appearance'));
-            $grid->column('domain_type')->using(admin_trans_array(config('dictionary.domain_type')));
-            $grid->column('secondary_domain');
-            $grid->column('custom_domain');
-            $grid->column('updated_at')->sortable();
-            // 过滤
-            $grid->filter(function (Grid\Filter $filter) {
-                $filter->panel();
-                $filter->expand();
-                $filter->equal('dist_code',admin_trans_label('client_code') )->width(2);
-                $filter->equal('site_name' )->width(2);
-            });
-            // 排序
-            $grid->model()->where('enabled',1)->orderBy("id",'desc');
-            //按钮
-            $grid->enableDialogCreate();
-            $grid->disableDeleteButton();
-            $grid->disableCreateButton();
-            //批量操作
-            $grid->batchActions(function (Grid\Tools\BatchActions $batch) {
-                $batch->disableDelete();
-            });
-        });
-    }
-
-    /**
-     * Make a show builder.
-     *
-     * @param mixed $id
-     *
-     * @return Show
-     */
-    protected function detail($id)
-    {
-        return Show::make($id, DistAdminDistributor::with(['appearance']), function (Show $show) {
-            $show->field('domain_type',admin_trans_label('domain_type'))->using(admin_trans_array(config('dictionary.domain_type')));
-            $show->field('secondary_domain');
-            $show->field('custom_domain');
-            $show->divider();
-            $show->field('site_name');
-            $show->field('appearance.title' ,admin_trans_field('appearance'));
-            $show->field('copy_right');
-            $show->field('logo')->as(function ($image) {
-                // 开始生成 HTML
-                $dataImages = [$image];
-                return CommonHelper::displayImage($dataImages,100);
-            })->unescape();
-            $show->field('seo_title');
-            $show->field('seo_keywords');
-            $show->field('seo_description');
-
-            $show->divider();
-            $show->field('company_name');
-            $show->field('company_address');
-            $show->field('country');
-            $show->field('contact_number');
-            $show->field('service_hotline');
-            $show->field('whats_app');
-            $show->field('facebook');
-            $show->field('instagram');
-            $show->field('youtube');
-            $show->field('linkedin');
-            $show->field('tiktok');
-            $show->field('copy_right');
-            $show->field('statistics_js');
-            $show->field('enabled')->using(admin_trans_array(config('dictionary.enabled')));
-            $show->field('created_at');
-            $show->field('updated_at');
-
-            // 按钮
-            $show->disableDeleteButton();
-
-
-        });
-    }
-
-    /**
-     * Make a form builder.
-     *
-     * @return Form
-     */
-    protected function form()
-    {
-        return Form::make(new DistAdminDistributor(), function (Form $form) {
-            $form->column(6, function (Form $form) {
-                $form->radio('domain_type')->width(9,3)
-                    ->options([0=>admin_trans_field('secondary_domain'),1=>admin_trans_field('custom_domain')])
-                    ->default(0)
-                    ->required();
-                $form->text('secondary_domain')->width(9,3)
-                    ->required()
-                    ->help('Please enter the domain name, such as demo.'.env('TOP_DOMAIN'));
-                $form->text('custom_domain')->width(9,3)->help('Please enter the domain name, such as www.example.com');
-                $form->text('site_name')->width(9,3)->required();
-                $form->text('seo_title')->width(9,3)->required();
-                $form->text('seo_keywords')->width(9,3);
-                $form->textarea('seo_description')->rows(2)->width(9,3);
-                $form->select('appearance_id',admin_trans_field('appearance'))->width(9,3)->options(DistAppearance::selectOptions())->required();
-                $form->cutImage("logo")
-                    ->aspectRatio(130/50)// 设置裁剪框比例
-                    ->retainable()//禁止删OSS图
-                    ->autoUpload()
-                    ->uniqueName()
-                    ->accept(config('distributor.upload.oss_image.accept'))
-                    ->maxSize(config('distributor.upload.oss_image.max_size'))
-                    ->dir(config("distributor.upload.directory.image").'/logo')
-                    ->width(4,3);
-            });
-            $form->column(6, function (Form $form) {
-                $form->text('company_name')->width(9,3);
-                $form->text('company_address',)->width(9,3);
-                $form->text('service_hotline')->width(9,3);
-                $form->text('dist_email',admin_trans_label('email'))->width(9,3);
-                $form->text('whats_app')->width(9,3);
-                $form->text('facebook')->width(9,3);
-                $form->text('instagram')->width(9,3);
-                $form->text('youtube')->width(9,3);
-                $form->text('linkedin')->width(9,3);
-                $form->text('tiktok')->width(9,3);
-                $form->text('copy_right')->width(9,3);
-                $form->textarea('statistics_js')->width(9,3);
-            });
-
-            //保存前回调
-            $form->saving(function (Form $form) {
-                if (!$form->isCreating()) {
-                    //如果appearance_id有变化,则更新模版与变量
-                    if ($form->model()->appearance_id != $form->input('appearance_id')) {
-                        $id = $form->model()->id;
-                        //更新模版与变量
-                        DistAppearance::switchTheme($form->input('appearance_id'), $id);
-                    }
-                }
-            });
-
-            //
-            //保存后回调
-            $form->saved(function (Form $form, $result) {
-                $newId = $form->getKey();
-                if ($form->isCreating()) {
-                    //创建后创建默认分类
-                    $appearanceId = $form->input('appearance_id');
-                    //更新模版与变量
-                    DistAppearance::switchTheme($appearanceId, $newId);
-                }
-                //更新缓存
-                DistAdminDistributor::clearCache($newId);
-            });
-
-            $form->disableDeleteButton();
-        });
-    }
-
-
-}

+ 6 - 17
app/Admin/Controllers/HomeController.php

@@ -30,26 +30,15 @@ class HomeController extends Controller
                    // ->row($alert->info())
                     ->row(function (Row $row) {
                         $row->column(12, function (Column $column) {
-                            $column->row(\App\Distributor\Controllers\Dashboard::title());
+                            $column->row(self::title());
                         });
-
-//                        $row->column(6, function (Column $column) {
-////                            $column->row(function (Row $row) {
-////                                $row->column(6, new Examples\NewUsers());
-////                                $row->column(6, new Examples\NewDevices());
-////                            });
-//                           // $column->row(Dashboard::author());
-//                            //$column->row(new Examples\Tickets());
-//                        });
-//
-//                        $row->column(6, function (Column $column) {
-//
-//
-//                        //    $column->row(new Examples\Sessions());
-//                            //$column->row(new Examples\ProductOrders());
-//                        });
                     });
 
         return $content;
     }
+
+    public static function title()
+    {
+        return view('admin.dashboard.title');
+    }
 }

+ 284 - 0
app/Admin/Controllers/SiteAlbumController.php

@@ -0,0 +1,284 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use App\Admin\Repositories\SiteAlbum;
+use App\Admin\Repositories\SiteAlbumFolder;
+use App\Libraries\CommonHelper;
+use App\Models\SiteAlbumFolder as SiteAlbumFolderModel;
+use Dcat\Admin\Form;
+use Dcat\Admin\Grid;
+use Dcat\Admin\Show;
+use Dcat\Admin\Http\Controllers\AdminController;
+use Dcat\Admin\Layout\Content;
+use Dcat\Admin\Admin;
+use App\Admin\Repositories\NullRepository;
+use Dcat\Admin\Traits\HasUploadedFile;
+use function Symfony\Component\Translation\t;
+
+class SiteAlbumController extends AdminController
+{
+    use HasUploadedFile;
+    /**
+     * page index
+     */
+    public function index(Content $content)
+    {
+        return $content
+            ->header(admin_trans( 'admin.album'))
+            ->body($this->indexForm());
+    }
+
+    protected function indexForm()
+    {
+        return Form::make(new NullRepository(), function (Form $form) {
+            $form->block(2, function (Form\BlockForm $form) {
+                $type = [
+                    'default'  => [
+                        'icon' => true,
+                    ],
+                ];
+                $plugins = ['types'];
+
+                $menuModel = new SiteAlbumFolderModel();
+                $form->tree()
+                    ->setTitleColumn('title')
+                    ->nodes($menuModel->allNodes())
+                    ->type($type)
+                    ->plugins($plugins)
+                    ->width(12,0);
+            });
+
+            $form->block(10, function (Form\BlockForm $form)  {
+                $form->html($this->grid())->width(12);
+            });
+        });
+    }
+
+    protected function grid()
+    {
+        return Grid::make(new SiteAlbum(), function (Grid $grid) {
+            //默认分页条数
+            $grid->paginate(config('admin.per_page'));
+            $grid->column('id')->sortable();
+            $grid->column('title');
+            $grid->column('model');
+            $grid->column('order')->sortable();
+            $grid->column('enabled')->switch();
+            $grid->column('created_at')->sortable();
+
+            $grid->quickSearch(['title','model']);
+
+            $grid->disableViewButton();
+            //$grid->showQuickEditButton();
+            $grid->disablePerPages();
+            $grid->disableRefreshButton();
+
+            $grid->model()->orderBy('order', 'asc')->orderBy('id', 'desc');
+            //弹窗大小
+            $grid->setDialogFormDimensions('830px','670px');
+        });
+    }
+
+    protected function form()
+    {
+        $thisObj = $this;
+        return Form::make(new SiteAlbum(), function (Form $form) use ($thisObj) {
+
+            $form->width(9, 1);
+            $form->disableViewButton();
+            $form->disableViewCheck();
+            $form->saving(function (Form $form) use ($thisObj) {
+                //处理video
+                $videos = $form->input('video');
+                if ($videos) {
+                    foreach ($videos as $key => $value) {
+                        if (empty($value['cover']) && $value['_remove_'] != 1) {
+                            //自动生成封面
+                            $result = $thisObj->autoGenerateCover($value['video_src']);
+                            if ($result['status']) {
+                                $videos[$key]['cover'] = $result['path'];
+                            } else {
+                                return $form->response()->error($result['msg']);
+                            }
+                        }
+                    }
+                } else {
+                    $videos = [];
+                }
+                $form->input('video', $videos);
+                //处理pdf
+                $pdfs = $form->input('pdf');
+                $pdfs = empty($pdfs) ? [] : $pdfs;
+                $form->input('pdf', $pdfs);
+            });
+            $form->tab(admin_trans_label('basic_info'), function (Form $form) {
+                $form->select('folder_id')->options(SiteAlbumFolder::selectOptions())->required();
+                $form->text('title')->required();
+                $form->text('model');
+            })->tab(admin_trans_label('cover'), function (Form $form) {
+                $form->multipleImage('cover')
+                    ->retainable()//禁止删OSS图
+                    ->sortable() // 可拖动排序
+                    ->removable() // 可移除图片
+                    ->autoUpload() // 自动上传
+                    ->uniqueName()
+                    ->limit(config('admin.upload.oss_image.limit'))
+                    ->accept(config('admin.upload.oss_image.accept'))
+                    ->maxSize(config('admin.upload.oss_image.max_size'))
+                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ymd"))
+                    ->saving(function ($images) use ($form) {
+                        return json_encode($images);
+                    });
+            })->tab(admin_trans_label('en_detail'), function (Form $form) {
+                $form->multipleImage('en_detail')
+                    ->retainable()//禁止删OSS图
+                    ->sortable() // 可拖动排序
+                    ->removable() // 可移除图片
+                    ->autoUpload() // 自动上传
+                    ->uniqueName()
+                    ->limit(config('admin.upload.oss_image.limit'))
+                    ->accept(config('admin.upload.oss_image.accept'))
+                    ->maxSize(config('admin.upload.oss_image.max_size'))
+                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ymd"))
+                    ->saving(function ($images) use ($form) {
+                        return json_encode($images);
+                    });
+            })->tab(admin_trans_label('cn_detail'), function (Form $form) {
+                $form->multipleImage('cn_detail')
+                    ->retainable()//禁止删OSS图
+                    ->sortable() // 可拖动排序
+                    ->removable() // 可移除图片
+                    ->autoUpload() // 自动上传
+                    ->uniqueName()
+                    ->limit(config('admin.upload.oss_image.limit'))
+                    ->accept(config('admin.upload.oss_image.accept'))
+                    ->maxSize(config('admin.upload.oss_image.max_size'))
+                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ymd"))
+                    ->saving(function ($images) use ($form) {
+                        return json_encode($images);
+                    });
+            })->tab(admin_trans_label('video'), function (Form $form) {
+                $count = 0;
+                $form->hasMany('video', function (Form\NestedForm $form)  use (&$count) {
+                    $videos = $form->model()->video;
+                    $imgArray = "";
+                    if ($videos) {
+                        $videos = json_decode($videos,true);
+                        foreach ($videos as $key => $value) {
+                            if ($value['cover'] && $key == $count-1) {
+                                $imgArray = [$value['cover']];
+                            }
+                        }
+                    }
+                    $imgHtml = CommonHelper::displayImage($imgArray);
+                    $form->html($imgHtml,admin_trans_label('image_preview'));
+                    $count++;
+
+                    $form->text('cover',admin_trans_label('video_cover'))->placeholder('为空则自动生成');
+                    $form->tradFile('video_src')
+                        ->retainable()//禁止删OSS图
+                        ->removable() // 可移除图片
+                        ->autoUpload() // 自动上传
+                        ->uniqueName()
+                        ->accept(config('admin.upload.oss_video.accept'))
+                        ->maxSize(config('admin.upload.oss_video.max_size'))
+                        ->dir(config("admin.upload.directory.video").'/uploads/'.date("Ymd"))
+                        ->chunkSize(1024)
+                        ->required();
+                })->useTable()
+                    ->customFormat(function ($data) {return json_decode($data,true);})
+                    ->setView('admin.form_custom.hasmanytable')
+                    ->saving(function ($input) {
+                        $data = [];
+                        foreach ($input as $value) {
+                            if ($value['_remove_'] != 1){
+                                $data[] = ['cover'=>$value['cover'],'video_src'=>$value['video_src']];
+                            }
+                        }
+                        return json_encode($data);
+                    });
+            })->tab(admin_trans_label('poster'), function (Form $form) {
+                $form->multipleImage('poster')
+                    ->retainable()//禁止删OSS图
+                    ->sortable() // 可拖动排序
+                    ->removable() // 可移除图片
+                    ->autoUpload() // 自动上传
+                    ->uniqueName()
+                    ->limit(config('admin.upload.oss_image.limit'))
+                    ->accept(config('admin.upload.oss_image.accept'))
+                    ->maxSize(config('admin.upload.oss_image.max_size'))
+                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ymd"))
+                    ->saving(function ($images) use ($form) {
+                        return json_encode($images);
+                    });
+            })->tab(admin_trans_label('cert'), function (Form $form) {
+                $form->multipleImage('cert')
+                    ->retainable()//禁止删OSS图
+                    ->sortable() // 可拖动排序
+                    ->removable() // 可移除图片
+                    ->autoUpload() // 自动上传
+                    ->uniqueName()
+                    ->limit(config('admin.upload.oss_image.limit'))
+                    ->accept(config('admin.upload.oss_image.accept'))
+                    ->maxSize(config('admin.upload.oss_image.max_size'))
+                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ymd"))
+                    ->saving(function ($images) use ($form) {
+                        return json_encode($images);
+                    });
+            })->tab(admin_trans_label('pdf'), function (Form $form) {
+                 $form->hasMany('pdf', function ($form) {
+                     $form->text('pdf_title')->required();
+                     $form->tradFile('pdf_src')
+                         ->retainable()//禁止删OSS图
+                         ->removable() // 可移除图片
+                         ->autoUpload() // 自动上传
+                         ->uniqueName()
+                         ->accept(config('admin.upload.oss_pdf.accept'))
+                         ->maxSize(config('admin.upload.oss_pdf.max_size'))
+                         ->dir(config("admin.upload.directory.pdf").'/uploads/'.date("Ymd"))
+                         ->chunkSize(1024)
+                         ->required();
+                })->useTable()
+                     ->customFormat(function ($data) {
+                         return json_decode($data,true);
+                     })
+                     ->setView('admin.form_custom.hasmanytable')
+                     ->saving(function ($input) {
+                         $data = [];
+                         foreach ($input as $value) {
+                             if ($value['_remove_'] != 1){
+                                 $data[] = ['pdf_title'=>$value['pdf_title'],'pdf_src'=>$value['pdf_src']];
+                             }
+                         }
+                         return json_encode($data);
+                     });
+            });
+        });
+    }
+
+    /*
+     * 自动生成视频封面
+     */
+    private function autoGenerateCover($videoSrc)
+    {
+        $cover = $videoSrc.'?x-oss-process=video/snapshot,t_2000,f_jpg,h_500,m_fast';
+        //TODO 上传到OSS
+        $cover = CommonHelper::ossUrl($cover);
+        $path = $this->upload($cover,'.jpg');
+        return $path;
+    }
+
+    private function upload($file,$imgType='.jpg')
+    {
+        $disk = $this->disk('oss');
+        $newName = uniqueCode("video_cover_").$imgType;
+        $dir = config("admin.upload.directory.image").'/uploads/'.date("Ymd").'/'.$newName;
+        $contents = file_get_contents($file);
+        if (!$contents) {
+            return ['status'=>false,'msg'=>'图片上传失败,请检查PHP配置'];
+        }
+        $disk->put($dir, $contents);
+        return ['status'=>true,'path'=>$dir];
+    }
+}

+ 85 - 0
app/Admin/Controllers/SiteAlbumFolderController.php

@@ -0,0 +1,85 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use App\Admin\Repositories\SiteAlbumFolder;
+use Dcat\Admin\Form;
+use Dcat\Admin\Grid;
+use Dcat\Admin\Show;
+use Dcat\Admin\Http\Controllers\AdminController;
+use Dcat\Admin\Layout\Content;
+use Dcat\Admin\Admin;
+
+class SiteAlbumFolderController extends AdminController
+{
+    /**
+     * page index
+     */
+    public function index(Content $content)
+    {
+        return $content
+            ->header(admin_trans( 'admin.folder'))
+            ->body($this->grid());
+    }
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        return Grid::make(new SiteAlbumFolder(), function (Grid $grid) {
+            $grid->column('id')->sortable();
+            $grid->column('title')->display(function ($title) {
+                $level = $this->level; // 获取当前行的 level 字段值
+                $prefix = str_repeat('&nbsp; ', $level * 2). ' <i class="fa fa-angle-right"></i>&nbsp; '; // 生成 level * 3 个加号
+                return $prefix . ' ' . html_entity_decode($title); // 拼接加号和名称
+            });;
+            $grid->column('parent_id');
+            $grid->column('order')->sortable();
+            $grid->column('enabled')->switch();
+            $grid->column('created_at')->sortable();
+
+            $grid->disableViewButton();
+            $grid->showQuickEditButton();
+            $grid->enableDialogCreate();
+            $grid->disableEditButton();
+            $grid->disablePerPages();
+        });
+    }
+
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        return Form::make(new SiteAlbumFolder(), function (Form $form) {
+            $form->select('parent_id', admin_trans_field('parent'))
+                ->options(SiteAlbumFolder::selectMainOptions())
+                ->saving(function ($v) {
+                    return (int) $v;
+                });
+            $form->text('title')->required();
+            $form->radio('folder_type')
+                ->options(admin_trans_array(config('dictionary.folder_type')))
+                ->default(0)->required();
+            $form->listbox('show_tabs')->options(admin_trans_array([
+                '0' => 'cover',
+                '1' => 'en_detail',
+                '2' => 'cn_detail',
+                '3' => 'video',
+                '4' => 'poster',
+                '5' => 'cert',
+                '6' => 'pdf',
+            ]))->default([0, 1, 2, 3, 4, 5, 6])->saving(function ($v) { return json_encode($v); });
+            $form->number('order')
+                ->default(0)
+                ->rules('numeric');
+            $form->switch('enabled')->default(1);
+        });
+    }
+}

+ 0 - 38
app/Admin/Repositories/BaseIso3166.php

@@ -1,38 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\BaseIso3166 as Model;
-use Dcat\Admin\Repositories\EloquentRepository;
-
-class BaseIso3166 extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-    public static function selectOptions()
-    {
-        $result = [];
-        $rows = Model::orderBy('id', 'asc')->get();
-        foreach ($rows as $row) {
-            $result[$row->country_name_en] = $row->country_name_en . ' - '. $row->country_name_zh;
-        }
-        return $result;
-    }
-
-    /*
-     * 通过英文国家名得到国家简称
-     */
-    public static function getAlpha2($countryNameEn)
-    {
-        $row = Model::where('country_name_en', $countryNameEn)->first();
-        if (empty($row)) {
-            return '';
-        }
-        return $row->alpha_2;
-    }
-}

+ 0 - 29
app/Admin/Repositories/BaseProduct.php

@@ -1,29 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\BaseProduct as Model;
-use Dcat\Admin\Form;
-use Dcat\Admin\Repositories\EloquentRepository;
-
-class BaseProduct extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-    /*
-     * 重写删除方法
-     */
-    public function delete(Form $form, array $originalData)
-    {
-        collect(explode(',', $form->getKey()))->filter()->each(function ($id) {
-            Model::find($id)->images()->delete();//把图片也删了
-            Model::find($id)->delete();
-        });
-        return true;
-    }
-}

+ 0 - 84
app/Admin/Repositories/BaseProductImage.php

@@ -1,84 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\BaseProductImage as Model;
-use Dcat\Admin\Repositories\EloquentRepository;
-use Carbon\Carbon;
-
-class BaseProductImage extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-
-    public static function deleteByProductId($productId)
-    {
-        Model::where('product_id', $productId)->delete();
-    }
-
-    public static function saveProductImages($productId, $imageUrls)
-    {
-        if (empty($productId) || empty($imageUrl)) {
-            return false;
-        }
-        // 准备数据集合
-        $data = [];
-        foreach ($imageUrls as $imageUrl) {
-            $data[] = [
-                'product_id' => $productId,
-                'image_url' => $imageUrl,
-                'created_at' => Carbon::now(),
-                'updated_at' => Carbon::now(),
-            ];
-        }
-        // 批量插入
-        return Model::insert($data);
-    }
-
-    //格式化数据,用于多图上传
-    public static function formatData($productId, $images)
-    {
-        $existingImages = Model::where('product_id', $productId)->get();
-        // 用于存储结果的数组
-        $result = [];
-        // 处理条件1:如果数据在 base_product_image 中有,但在 $images 上无
-        foreach ($existingImages as $existingImage) {
-            if (!in_array($existingImage->image_url, $images)) {
-                $result[] = [
-                    'id' => $existingImage->id,
-                    'image_url' => $existingImage->image_url,
-                    '_remove_' => 1,
-                ];
-            }
-        }
-        // 处理条件2:如果数据在 base_product_image 中无,但在 $images 有
-        $i = 1;
-        foreach ($images as $image) {
-            $found = $existingImages->firstWhere('image_url', $image);
-            if (!$found) {
-                $result[] = [
-                    'id' => 0,
-                    'image_url' => $image,
-                    'order' => $i,
-                ];
-            }
-            //更新库中排序
-            foreach ($existingImages as $existingImage) {
-                if ($existingImage->image_url == $image) {
-                    $existingImage->order = $i;
-                    $existingImage->save();
-                }
-            }
-            $i++;
-        }
-
-        return $result;
-    }
-
-
-}

+ 0 - 25
app/Admin/Repositories/BaseProductParameter.php

@@ -1,25 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\BaseProductParameter as Model;
-use Dcat\Admin\Repositories\EloquentRepository;
-
-class BaseProductParameter extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-    /*
-     * Select options for filter
-     */
-    public static function selectOptions() {
-        return Model::query()->where('enabled','=','1')->get()->pluck('name', 'id');
-    }
-
-
-}

+ 0 - 34
app/Admin/Repositories/BaseVideoCategory.php

@@ -1,34 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\BaseVideoCategory as Model;
-use Dcat\Admin\Repositories\EloquentRepository;
-
-class BaseVideoCategory extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-    // 调用模型方法
-    public static function selectOptions(\Closure $closure = null,$root = false)
-    {
-        if (!$closure) {
-            $closure = function ($query) {
-                $query = $query->where('enabled', 1);
-                $query =  $query->orderBy('order', 'desc')->orderBy('id', 'desc');
-                return $query;
-            };
-        }
-
-        $selectOptions =  Model::class::selectOptions($closure);
-        if ($root == false) {
-            unset($selectOptions[0]);
-        }
-        return $selectOptions;
-    }
-}

+ 0 - 464
app/Admin/Repositories/DistAdminDistributor.php

@@ -1,464 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\DistAdminDistributor as Model;
-use App\Models\DistProductCategory;
-use App\Models\DistProduct;
-use App\Models\SitePagesTag;
-use App\Models\SitePages;
-use App\Models\SitePagesTagRelationship;
-use Carbon\Carbon;
-use Dcat\Admin\Repositories\EloquentRepository;
-use App\Models\SiteBanner;
-
-class DistAdminDistributor extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-    /*
-     * 查找最新的N个标签
-     */
-    public static function selectOptionsNew($limit=30)
-    {
-        return Model::orderBy('created_at', 'desc')->limit($limit)->pluck('client_code', 'id');
-    }
-
-    /*
-     * 清缓存
-     */
-    public static function clearCache($distId,$timeOut = 2)
-    {
-        //使用二级域名清缓存
-        $domain = self::getDomain($distId,0);
-        $url = $domain . '/?__clear_cache=1';
-        curlGet($url,$timeOut);
-    }
-
-    /*
-     * 得到指定分销商的域名
-     * type 0:当前域名 1:二级域名 2:自定义域名
-     */
-    public static function getDomain($distId,$type=0)
-    {
-        $model = new Model();
-        return $model->getDomain($distId,$type);
-    }
-    /*
-     * 获取一个标签
-     */
-    public static function getOneById($id)
-    {
-        return Model::where('id', $id)->first();
-    }
-
-    /*
-     * 始始化分销商
-     */
-    public static function initDist($distId)
-    {
-        //初始化数据,现在用默认,以后有可能不同主题不同
-        self::default($distId);
-    }
-
-    //默认
-    public static function default($distId)
-    {
-        //生成默认的banner
-        $siteBanner = new SiteBanner();
-        $bannerRow = $siteBanner->create([
-            'title' => 'Default Banner',
-            'image_url' => 'static/common/images/banner-1.jpg',
-            'show' => 1,
-            'order' => 0,
-            'position' => 1,
-            'dist_id'=>$distId,
-            'created_at'=>Carbon::now(),
-            'updated_at'=>Carbon::now(),
-        ]);
-
-        //生成默认产品分类
-        $distProductCategory = new DistProductCategory();
-        $categoryRow = $distProductCategory->create([
-            'parent_id' => 0,
-            'name' => 'Default Category',
-            'order' => 0,
-            'enabled' => 1,
-            'dist_id'=>$distId,
-            'seo_title' => 'Default Category',
-            'slug' => 'default-category',
-            'created_at'=>Carbon::now(),
-            'updated_at'=>Carbon::now(),
-        ]);
-        //生成默认产品
-        $distProduct = new DistProduct();
-        $productRow = $distProduct->create([
-            'category_id' => $categoryRow->id,
-            'title' => 'Default Product',
-            'sku' => 'sku001',
-            'order' => 0,
-            'enabled' => 1,
-            'dist_id'=>$distId,
-            'content' => 'Default Content',
-            'slug' => 'default-product',
-            'seo_title' => 'Default Product',
-            'issuance_date' => Carbon::now(),
-            'created_at'=>Carbon::now(),
-            'updated_at'=>Carbon::now(),
-        ]);
-        $productRow->save();
-        //生成默认tab
-        $sitePagesTag = new SitePagesTag();
-        $tagRow = $sitePagesTag->create([
-            'name' => 'News',
-            'dist_id'=>$distId,
-            'slug' => 'news',
-            'seo_title' => 'News',
-            'created_at'=>Carbon::now(),
-            'updated_at'=>Carbon::now(),
-        ]);
-        //生成默认页面
-        $sitePages = new SitePages();
-        $pageRow = $sitePages->create([
-            'title' => 'Default Page',
-            'status' => 1,
-            'author' => 'admin',
-            'dist_id'=>$distId,
-            'content' => 'Default Content',
-            'slug' => 'default-page',
-            'seo_title' => 'Default Page',
-            'post_date' => Carbon::now(),
-            'created_at'=>Carbon::now(),
-            'updated_at'=>Carbon::now(),
-            'page_type' => 0,
-        ]);
-        //生成绑定关系
-        $sitePagesTagRelationship = new SitePagesTagRelationship();
-        $sitePagesTagRelationship->create([
-            'tag_id' => $tagRow->id,
-            'pages_id' => $pageRow->id,
-        ]);
-        //生成about-us
-        $aboutUs = $sitePages->create([
-            'title' => 'About Us',
-            'status' => 1,
-            'author' => 'admin',
-            'dist_id'=>$distId,
-            'content' => 'Default Content',
-            'slug' => 'about-us',
-            'seo_title' => 'About Us',
-            'post_date' => Carbon::now(),
-            'created_at'=>Carbon::now(),
-            'updated_at'=>Carbon::now(),
-            'page_type' => 1,
-            'template_file' => config('dictionary.landing_page_default_template')
-        ]);
-        //生成privacy
-//        $privacy = $sitePages->create([
-//            'title' => 'Privacy',
-//            'status' => 1,
-//            'author' => 'admin',
-//            'dist_id'=>$distId,
-//            'content' => 'Default Content',
-//            'slug' => 'privacy',
-//            'seo_title' => 'Privacy',
-//            'post_date' => Carbon::now(),
-//            'created_at'=>Carbon::now(),
-//            'updated_at'=>Carbon::now(),
-//            'page_type' => 1,
-//            'template_file' => config('dictionary.landing_page_default_template')
-//        ]);
-        //生成sales
-        $sales = $sitePages->create([
-            'title' => 'Sales',
-            'status' => 1,
-            'author' => 'admin',
-            'dist_id'=>$distId,
-            'content' => 'Default Content',
-            'slug' => 'sales',
-            'seo_title' => 'Sales',
-            'post_date' => Carbon::now(),
-            'created_at'=>Carbon::now(),
-            'updated_at'=>Carbon::now(),
-            'page_type' => 1,
-            'template_file' => config('dictionary.landing_page_default_template')
-        ]);
-        //生成service
-        $service = $sitePages->create([
-            'title' => 'Services',
-            'status' => 1,
-            'author' => 'admin',
-            'dist_id'=>$distId,
-            'content' => 'Default Content',
-            'slug' => 'services',
-            'seo_title' => 'Services',
-            'post_date' => Carbon::now(),
-            'created_at'=>Carbon::now(),
-            'updated_at'=>Carbon::now(),
-            'page_type' => 1,
-            'template_file' => config('dictionary.landing_page_default_template')
-        ]);
-        //生成faqs
-        $faqs = $sitePages->create([
-            'title' => 'FAQs',
-            'status' => 1,
-            'author' => 'admin',
-            'dist_id'=>$distId,
-            'content' => 'Default Content',
-            'slug' => 'faqs',
-            'seo_title' => 'FAQs',
-            'post_date' => Carbon::now(),
-            'created_at'=>Carbon::now(),
-            'updated_at'=>Carbon::now(),
-            'page_type' => 1,
-            'template_file' => config('dictionary.landing_page_default_template')
-        ]);
-        //生成contact
-        $contact = $sitePages->create([
-            'title' => 'Contact us',
-            'status' => 1,
-            'author' => 'admin',
-            'dist_id'=>$distId,
-            'content' => 'Default Content',
-            'slug' => 'contact-us',
-            'seo_title' => 'Contact us',
-            'post_date' => Carbon::now(),
-            'created_at'=>Carbon::now(),
-            'updated_at'=>Carbon::now(),
-            'page_type' => 1,
-            'template_file' => config('dictionary.landing_page_contact_us_template')
-        ]);
-        //生成菜单
-        $siteMenu = new SiteMenu();
-        $menuConfig = [
-            'collections_type' => '',
-            'product_category' => '',
-            'pages_tag' => '',
-            'product' => '',
-            'pages' => '',
-            'url' => '',
-            'landing_page' => '',
-        ];
-        /*
-         * ==========================================
-         * 顶部菜单
-         * ==========================================
-         */
-        //----------------主页------------------
-        $data = [];
-        $newMenuConfig = $menuConfig;
-        $menuType = 0; //主页
-        $data[1] = [
-            'parentId' => 0,
-            'title' => 'Home',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$menuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 0,
-        ];
-
-        //----------------Products------------------
-        $menuType = 0; //主页
-        $newMenuConfig = $menuConfig;
-        $data[2] = [
-            'parentId' => 0,
-            'title' => 'Products',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$menuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 0,
-        ];
-        //----------------Products Category------------------
-        $newMenuConfig = $menuConfig;
-        $newMenuConfig['collections_type'] = 0;
-        $newMenuConfig['product_category'] = $categoryRow->id;
-        $menuType = 1;//collections
-        $data[3] = [
-            'parentId' => 2,
-            'title' => 'Default Category',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$newMenuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 0,
-        ];
-        //----------------news------------------
-        $newMenuConfig = $menuConfig;
-        $newMenuConfig['collections_type'] = 1;
-        $newMenuConfig['pages_tag'] = $tagRow->id;
-        $menuType = 1;//collections
-        $data[4] = [
-            'parentId' => 0,
-            'title' => 'News',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$newMenuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 0,
-        ];
-        //----------------About Us------------------
-        $newMenuConfig = $menuConfig;
-        $newMenuConfig['landing_page'] = $aboutUs->id;
-        $menuType = 4;//pages
-        $data[5] = [
-            'parentId' => 0,
-            'title' => 'About Us',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$newMenuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 0,
-        ];
-        //----------------Contact------------------
-        $newMenuConfig = $menuConfig;
-        $newMenuConfig['landing_page'] = $contact->id;
-        $menuType = 4;//pages
-        $data[6] = [
-            'parentId' => 0,
-            'title' => 'Contact',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$newMenuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 0,
-        ];
-        $siteMenu->createMenuBatch($data);
-
-        /*
-         * ==========================================
-         * 底部菜单
-         * ==========================================
-         */
-        //----------------SUPPORT------------------
-        $data = [];
-        $newMenuConfig = $menuConfig;
-        $menuType = 0; //主页
-        $data[1] = [
-            'parentId' => 0,
-            'title' => 'SUPPORT',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$menuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 1,
-        ];
-        //----------------FAQ------------------
-        $newMenuConfig = $menuConfig;
-        $newMenuConfig['landing_page'] = $faqs->id;
-        $menuType = 4;//pages
-        $data[2] = [
-            'parentId' => 1,
-            'title' => 'FAQ',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$newMenuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 1,
-        ];
-        //----------------Sales------------------
-        $newMenuConfig = $menuConfig;
-        $newMenuConfig['landing_page'] = $sales->id;
-        $menuType = 4;//pages
-        $data[3] = [
-            'parentId' => 1,
-            'title' => 'Sales',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$newMenuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 1,
-        ];
-
-        //----------------COMPANY------------------
-        $newMenuConfig = $menuConfig;
-        $menuType = 0; //主页
-        $data[4] = [
-            'parentId' => 0,
-            'title' => 'COMPANY',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$menuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 1,
-        ];
-
-        //----------------Home------------------
-        $newMenuConfig = $menuConfig;
-        $menuType = 0; //主页
-        $data[5] = [
-            'parentId' => 4,
-            'title' => 'Home',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$menuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 1,
-        ];
-
-        //----------------About Us------------------
-        $newMenuConfig = $menuConfig;
-        $newMenuConfig['landing_page'] = $aboutUs->id;
-        $menuType = 4;//pages
-        $data[6] = [
-            'parentId' => 4,
-            'title' => 'About Us',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$newMenuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 1,
-        ];
-        //----------------Services------------------
-        $newMenuConfig = $menuConfig;
-        $newMenuConfig['landing_page'] = $service->id;
-        $menuType = 4;//pages
-        $data[7] = [
-            'parentId' => 4,
-            'title' => 'Services',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$newMenuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 1,
-        ];
-
-        //----------------News------------------
-        $newMenuConfig = $menuConfig;
-        $newMenuConfig['collections_type'] = 1;
-        $newMenuConfig['pages_tag'] = $tagRow->id;
-        $menuType = 1;//collections
-        $data[8] = [
-            'parentId' => 4,
-            'title' => 'News',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$newMenuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 1,
-        ];
-        //----------------Contact------------------
-        $newMenuConfig = $menuConfig;
-        $newMenuConfig['landing_page'] = $contact->id;
-        $menuType = 4;//pages
-        $data[9] = [
-            'parentId' => 4,
-            'title' => 'Contact',
-            'distId'=>$distId,
-            'uri' =>  $siteMenu->generateUri($menuType,$newMenuConfig,$distId),
-            'menuType' => $menuType,
-            'menuConfig' => $newMenuConfig,
-            'menuLocation' => 1,
-        ];
-
-        $siteMenu->createMenuBatch($data);
-    }
-
-
-}

+ 0 - 41
app/Admin/Repositories/DistAdminUser.php

@@ -1,41 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\DistAdminUser as Model;
-use Dcat\Admin\Repositories\EloquentRepository;
-use App\Models\DistAdminRoleUser;
-class DistAdminUser extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-
-    /*
-     * 增加角色用户色关系
-     */
-    public static function addRoleUser($userId,$roleId) {
-        $distAdminRoleUser = new DistAdminRoleUser();
-        $distAdminRoleUser->role_id = $roleId;
-        $distAdminRoleUser->user_id = $userId;
-        $distAdminRoleUser->save();
-    }
-
-    /*
-     * 判断用户名是否存在
-     */
-    public static function findCountByUsername($id,$username)
-    {
-        $instance = new self();
-        if ($id) {
-            $count = $instance->Model()::where('username', $username)->where('id', '!=', $id)->count();
-        } else {
-            $count = $instance->Model()::where('username', $username)->count();
-        }
-        return $count;
-    }
-}

+ 0 - 80
app/Admin/Repositories/DistAppearance.php

@@ -1,80 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\DistAppearance as Model;
-use Carbon\Carbon;
-use Dcat\Admin\Repositories\EloquentRepository;
-
-class DistAppearance extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-    /*
-     * 获取一个标签
-     */
-    public static function getOneById($id)
-    {
-        return Model::where('id', $id)->first();
-    }
-
-    public static function selectOptions($valueShowId = false)
-    {
-        $data = Model::where('enabled', 1)->get();
-        $options = [];
-        foreach ($data as $item) {
-            if ($valueShowId) {
-                $options[$item->id] = $item->id.' - '.$item->title;
-            } else {
-                $options[$item->id] = $item->title;
-            }
-        }
-        return $options;
-    }
-
-    /*
-     * 设置状态为已导入
-     */
-    public static function setStatusToImported($id)
-    {
-        $row = Model::where('id', $id)->first();
-        if ($row) {
-            $row->updated_at = Carbon::now();
-            $row->imported = 1;
-            $row->save();
-        }
-        return true;
-    }
-
-    /*
-     * 切换主题操作,生成销应商主题模版与变量
-     * (如果原本就有模板与变量,不会重复生成)
-     */
-    public static function switchTheme($appearanceId,$distId) {
-        //复制原始模版到指定分销商
-        DistAppearanceTemplate::copyTemplateToDist($appearanceId, $distId);
-        DistAppearanceVariable::copyAppearanceVariable($appearanceId, $distId);
-        //发报到正式环境
-        DistAppearancePublishList::publish($appearanceId,$distId);
-        //清除缓存
-        DistAdminDistributor::clearCache($distId);
-        return true;
-    }
-
-    /*
-     * 初始化分销商模版与变量
-     */
-    public static function initTheme($appearanceId,$distId)
-    {
-        //请空模版与变量
-        DistAppearanceTemplate::deleteTemplates($appearanceId,$distId);
-        DistAppearanceVariable::deleteVariable($appearanceId, $distId);
-        //重新生成模版与变量
-        self::switchTheme($appearanceId, $distId);
-    }
-}

+ 0 - 33
app/Admin/Repositories/DistAppearanceBak.php

@@ -1,33 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\DistAppearanceBak as Model;
-use Dcat\Admin\Repositories\EloquentRepository;
-
-class DistAppearanceBak extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-    /*
-     * 备份数据
-     */
-    static public function backupData($appearanceId,$distId) {
-        $model = new Model();
-        return $model->backupData($appearanceId,$distId);
-    }
-
-
-    static public function restoreDataByVersion($version)
-    {
-        $model = new Model();
-        return $model->restoreDataByVersion($version);
-    }
-
-
-}

+ 0 - 50
app/Admin/Repositories/DistAppearancePublishList.php

@@ -1,50 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\DistAppearancePublishList as Model;
-use Dcat\Admin\Repositories\EloquentRepository;
-
-class DistAppearancePublishList extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-
-    /*
-     * 更新发布版本
-     */
-    public static function publishVersion($appearanceId,$distId)
-    {
-        $model = new Model();
-        $row = $model->where('appearance_id',$appearanceId)->where('dist_id',$distId)->first();
-        if ($row) {
-            $row->template_update_code = generateVersionNumber();
-            $row->save();
-        } else {
-            $model->appearance_id = $appearanceId;
-            $model->dist_id = $distId;
-            $model->template_version = '1.0';
-            $model->template_update_code = generateVersionNumber();
-            $model->template_local_code = '';
-            $model->save();
-        }
-    }
-
-    /*
-     * 发布模版与变量
-     */
-    public static function publish($appearanceId,$distId) {
-        //同步模版到正式表
-        DistAppearanceTemplate::syncAppearanceTemplates($appearanceId,$distId);
-        //同步变量到正式表
-        DistAppearanceVariable::syncAppearanceVariables($appearanceId, $distId);
-        //发布版本号
-        DistAppearancePublishList::publishVersion($appearanceId,$distId);
-        return true;
-    }
-}

+ 0 - 184
app/Admin/Repositories/DistAppearanceTemplate.php

@@ -1,184 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\DistAppearanceTemplate as Model;
-use App\Models\SiteAppearanceTemplate;
-use Dcat\Admin\Repositories\EloquentRepository;
-use Illuminate\Support\Carbon;
-
-class DistAppearanceTemplate extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-    public static function getContent($appearanceId,$distId,$templateCode)
-    {
-        $appearanceId = intval($appearanceId);
-        $distId = intval($distId);
-        $data = Model::where('appearance_id', $appearanceId)->where('dist_id', $distId)->where('template_code', $templateCode)->first();
-        if ($data) {
-            return $data->content;
-        }
-        return '';
-    }
-    public static function getTemplateTree($appearance_id,$dist_id)
-    {
-        $data = Model::where('appearance_id', $appearance_id)->where('dist_id', $dist_id)->orderBy('file_name', 'asc')->get(['id', 'file_name', 'file_path','template_code']);
-        return self::buildTree($data->toArray());
-    }
-
-    public static function buildTree(array $data) {
-        $result = [];
-        foreach ($data as $item) {
-            // Extract the path and file information
-            $path = $item['file_path'];
-            $id = $item['id'];
-            $file_name = $item['file_name'];
-
-            // Initialize a new entry for this path if it doesn't exist
-            if (!isset($result[$path])) {
-                $result[$path] = [
-                    'id' => 0, // default, as there's no parent ID
-                    'dist_id' => 0, // assuming dist_id for path
-                    'file_name' => trim($path, '/'), // using the directory name for file_name
-                    'children' => []
-                ];
-            }
-
-            // Add the file to the children of the respective path
-            $result[$path]['children'][] = [
-                'id' => $id,
-                'dist_id' => 0, // assuming dist_id
-                'file_name' => $file_name,
-                'template_code' => $item['template_code']
-            ];
-        }
-
-        $result = array_values($result);
-        return $result;
-    }
-
-    /*
-     * 保存模板内容
-     */
-    public static function saveContent($appearanceId,$distId,$templateCode, $content)
-    {
-        $appearanceId = intval($appearanceId);
-        $distId = intval($distId);
-        $data = Model::where('dist_id', $distId)->where('appearance_id', $appearanceId)->where('appearance_id', $appearanceId)->where('template_code', $templateCode)->first();
-        if ($data) {
-            $currentContent = $content;
-            $previousContent = $data->content;
-            //保存
-            $data->content = $content;
-            $data->save();
-            //加入模版修改日志
-            DistAppearanceTemplateLog::insertLog($appearanceId,$distId,$data->file_name,$data->file_path,$templateCode,$currentContent,$previousContent);
-            return true;
-        }
-        return false;
-    }
-
-    public static function addDelTree($appearanceId,$distId,$fileId,$fileName, $filePath,$type) {
-        if (empty($appearanceId) || empty($distId)) {
-            return ['status' => 0,'msg' => 'Missing required parameters'];
-        }
-        $model = new Model();
-        if ($type == 'add') {
-            $count = $model->where('appearance_id', $appearanceId)->where('dist_id', $distId)->where('file_name', $fileName)->count();
-            if ($count > 0) {
-                return ['status' => 0,'msg' => 'File name already exists'];
-            }
-            $filePath = empty($filePath)?'':$filePath;
-            $model = new Model();
-            $model->dist_id = $distId;
-            $model->appearance_id = $appearanceId;
-            $model->file_name = $fileName;
-            $model->file_path = $filePath;
-            $model->content = '';
-            $model->template_code = uniqueCode('');
-            $model->save();
-            return ['status' => 1];
-        } else {
-            $row = $model->where('appearance_id', $appearanceId)->where('dist_id', $distId)->where('id', $fileId)->first();
-            if ($row) {
-                $row->delete();
-                //加入模版修改日志
-                DistAppearanceTemplateLog::insertLog($appearanceId,$distId,$row->file_name,$row->file_path,$row->template_code,'',$row->content);
-                return ['status' => 1];
-            }
-            return ['status' => 0,'msg' => 'File ID not found'];
-        }
-    }
-
-    /*
-     * 请空指定模板
-     */
-    public static function deleteTemplates($appearanceId,$distId) {
-        Model::deleteTemplates($appearanceId, $distId);
-        return true;
-    }
-
-    /*
-     * 插入模版文件夹
-     */
-//    public static function insertTemplateFolder($distId,$appearanceId,$filePath,$fileName,$parentId) {
-//        $self = new self();
-//        $model = $self->model();
-//        $model->dist_id = $distId;
-//        $model->appearance_id = $appearanceId;
-//        $model->file_name = $fileName;
-//        $model->parent_id = $parentId;
-//        $model->file_type = 0;
-//        $model->file_path = $filePath;
-//        $model->template_code = uniqueCode('');
-//        $model->save();
-//        // 获取插入数据的 ID
-//        $insertedId = $model->id;
-//        return $insertedId;
-//    }
-
-    /*
-     * 插入模版文件内容
-     */
-    public static function insertTemplateContent($distId,$appearanceId,$filePath,$fileName,$content) {
-        $self = new self();
-        $model = $self->model();
-        $model->dist_id = $distId;
-        $model->appearance_id = $appearanceId;
-        $model->file_name = $fileName;
-        $model->file_path = $filePath;
-        $model->content = $content;
-        $model->template_code = uniqueCode('');
-        $model->save();
-        // 获取插入数据的 ID
-        $insertedId = $model->id;
-        return $insertedId;
-    }
-
-    /*
-     * 把原始模板复制给分销商
-     */
-    public static function copyTemplateToDist($appearanceId,$distId) {
-        return Model::copyTemplateToDist($appearanceId, $distId);
-    }
-
-
-    /*
-     * 同步模版到正式表上
-     */
-    public static function syncAppearanceTemplates($appearanceId,$distId)
-    {
-        $model = new Model();
-        return $model->syncAppearanceTemplates($appearanceId,$distId);
-    }
-
-
-
-
-}

+ 0 - 70
app/Admin/Repositories/DistAppearanceTemplateLog.php

@@ -1,70 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\DistAppearanceTemplateLog as Model;
-use Dcat\Admin\Repositories\EloquentRepository;
-
-class DistAppearanceTemplateLog extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-    /*
-     *  添加模版修改日志
-     *  $currentContent 修改后的内容
-     *  $previousContent 修改前的内容
-     */
-    public static function insertLog($appearanceId,$distId,$fileName,$filePath,$templateCode,$currentContent,$previousContent)
-    {
-        $model = new Model();
-        $model->dist_id = $distId;
-        $model->file_name = $fileName;
-        $model->file_path = $filePath;
-        $model->appearance_id = $appearanceId;
-        $model->template_code = $templateCode;
-        $model->current_content = $currentContent;
-        $model->previous_content = $previousContent;
-        $model->version = generateVersionNumber();
-        $model->save();
-    }
-
-    /*
-     *  获取模版修改日志
-     */
-    public static function fetchTemplateLogs($appearanceId,$distId,$templateCode)
-    {
-        $model = new Model();
-        $model = $model->where('appearance_id','=',$appearanceId)->where('dist_id','=',$distId)->where('template_code','=',$templateCode)->orderBy('id','desc')->select('id','version','created_at')->get();
-        return $model;
-    }
-
-    /*
-     *  获取单条模版修改日志内容
-     */
-    public static function fetchTemplateLogContent($logId)
-    {
-        $model = new Model();
-        $model = $model->where('id','=',$logId)->first();
-        return $model;
-    }
-    /*
-     * 还原模版
-     */
-    public static function restoreTemplateLog($logId) {
-        $model = new Model();
-        $model = $model->where('id', '=', $logId)->first();
-        if ($model) {
-            $appearanceId = $model->appearance_id;
-            $distId = $model->dist_id;
-            $templateCode = $model->template_code;
-            $content = $model->previous_content;
-            DistAppearanceTemplate::saveContent($appearanceId, $distId, $templateCode, $content);
-        }
-    }
-
-}

+ 0 - 57
app/Admin/Repositories/DistAppearanceVariable.php

@@ -1,57 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\DistAppearanceVariable as Model;
-use Dcat\Admin\Form;
-use Dcat\Admin\Repositories\EloquentRepository;
-use App\Models\SiteAppearanceVariable;
-use Illuminate\Support\Carbon;
-
-class DistAppearanceVariable extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-
-    public static function getVariableRow($distId,$appearanceId,$templateId)
-    {
-        $model = new Model();
-        $variable = $model->where('dist_id',$distId)->where('appearance_id',$appearanceId)->whereIn('template_id',[0,$templateId])->get();
-        if($variable){
-            return $variable;
-        }else{
-            return '';
-        }
-    }
-
-    /*
-     * 把原始变量复制给分销商
-     */
-    public static function copyAppearanceVariable($appearanceId, $distId){
-        Model::copyAppearanceVariable($appearanceId, $distId);
-    }
-
-
-    /*
-     * 删除分销商主题变量
-     */
-    public static function deleteVariable($appearanceId,$distId)
-    {
-        return Model::deleteVariable($appearanceId, $distId);
-    }
-
-
-    /*
-     * 同步变量到正式表
-     */
-    public static function syncAppearanceVariables($appearanceId,$distId) {
-      $model = new Model();
-      return $model->syncAppearanceVariables($appearanceId,$distId);
-    }
-
-}

+ 0 - 64
app/Admin/Repositories/DistInquiry.php

@@ -1,64 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\DistInquiry as Model;
-use Carbon\Carbon;
-use Dcat\Admin\Repositories\EloquentRepository;
-
-class DistInquiry extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-
-    /*
-     * 检测状态是否为0,即未处理
-     */
-    public static function assessTheStatus($ids) {
-        $inquirieCount = Model::whereIn('id', $ids)->where('status', '=', 0)->count();
-        if ($inquirieCount != count($ids)) {
-            return false;
-        }
-        return true;
-    }
-
-    /*
-     * 分配询价单
-     */
-    public static function assignData($ids, $distId) {
-        $inquiries = Model::whereIn('id', $ids)->get();
-        foreach ($inquiries as $inquiry) {
-            $inquiry->dist_id = $distId;
-            $inquiry->status = 1;
-            $inquiry->allocate_time = Carbon::now();
-            $inquiry->save();
-        }
-    }
-
-
-
-    /*
-     * 供应商把询价单设置为已处理
-     */
-    public static function distSetStatusProcessed($ids)
-    {
-        $result = true;
-        foreach ($ids as $id) {
-            $id = intval($id);
-            $row = Model::find($id);
-            if ($row && $row->dist_id == getDistributorId() && $row->status == 1) {
-                $row->status = 2;
-                $row->save();
-            } else {
-                $result = false;
-            }
-        }
-        return $result;
-    }
-
-}

+ 0 - 21
app/Admin/Repositories/DistMessage.php

@@ -1,21 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\DistMessage as Model;
-use Dcat\Admin\Repositories\EloquentRepository;
-
-class DistMessage extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-    public static function find($id)
-    {
-        return Model::find($id);
-    }
-}

+ 2 - 5
app/Admin/Repositories/BaseVideo.php → app/Admin/Repositories/NullRepository.php

@@ -2,10 +2,10 @@
 
 namespace App\Admin\Repositories;
 
-use App\Models\BaseVideo as Model;
+use App\Models\NullModel as Model;
 use Dcat\Admin\Repositories\EloquentRepository;
 
-class BaseVideo extends EloquentRepository
+class NullRepository extends EloquentRepository
 {
     /**
      * Model.
@@ -13,7 +13,4 @@ class BaseVideo extends EloquentRepository
      * @var string
      */
     protected $eloquentClass = Model::class;
-
-
-
 }

+ 2 - 2
app/Admin/Repositories/Test.php → app/Admin/Repositories/SiteAlbum.php

@@ -2,10 +2,10 @@
 
 namespace App\Admin\Repositories;
 
-use App\Models\Test as Model;
+use App\Models\SiteAlbum as Model;
 use Dcat\Admin\Repositories\EloquentRepository;
 
-class Test extends EloquentRepository
+class SiteAlbum extends EloquentRepository
 {
     /**
      * Model.

+ 30 - 52
app/Admin/Repositories/BaseProductCategory.php → app/Admin/Repositories/SiteAlbumFolder.php

@@ -2,16 +2,11 @@
 
 namespace App\Admin\Repositories;
 
-use App\Models\BaseProductCategory as Model;
-use App\Models\BaseProductParameter;
+use App\Models\SiteAlbumFolder as Model;
 use Dcat\Admin\Repositories\EloquentRepository;
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-use Dcat\Admin\Traits\ModelTree;
-use Illuminate\Support\Facades\Session;
 
-class BaseProductCategory extends EloquentRepository
+class SiteAlbumFolder extends EloquentRepository
 {
-
     /**
      * Model.
      *
@@ -19,22 +14,27 @@ class BaseProductCategory extends EloquentRepository
      */
     protected $eloquentClass = Model::class;
 
+    /*
+ * 改写列表显示返回的数据
+ */
+    public function get(Grid\Model|\Dcat\Admin\Grid\Model $model)
+    {
+        // 获取模型对象
+        $obj = $this->model();
+        // 获取数据
+        $tree = $obj->orderBy('order', 'desc')->orderBy('id', 'desc')->get();
+        $treeData = $tree->toArray();
 
+        // 构建树形结构
+        $data=buildTree($treeData);
 
+        // 转换成一维数组
+        $data=flattenTree($data);
 
-    // 调用模型方法
-    public static function selectOptions(\Closure $closure = null)
-    {
-        if (!$closure) {
-            $closure = function ($query) {
-                $query = $query->where('enabled', 1);
-                $query =  $query->orderBy('order', 'desc')->orderBy('id', 'desc');
-                return $query;
-            };
-        }
-
-        $selectOptions =  Model::class::selectOptions($closure);
-        return $selectOptions;
+        return $model->makePaginator(
+            count($data), // 传入总记录数
+            $data // 传入数据二维数组
+        );
     }
 
     public static function selectMainOptions(\Closure $closure = null)
@@ -55,42 +55,20 @@ class BaseProductCategory extends EloquentRepository
         return $selectOptions;
     }
 
-
-    public static function getParameter($categoryId)
-    {
-        $categoryRow =  Model::Class::find($categoryId);
-        if ($categoryRow->baseProductParameter) {
-            return $categoryRow->baseProductParameter->content;
-        } else {
-            return "[]";
-        }
-    }
-
-    /*
-     * 改写列表显示返回的数据
-     */
-    public function get(Grid\Model|\Dcat\Admin\Grid\Model $model)
+    // 调用模型方法
+    public static function selectOptions(\Closure $closure = null)
     {
-        // 获取模型对象
-        $obj = $this->model();
-        // 获取数据
-        $tree = $obj->orderBy('order', 'desc')->orderBy('id', 'desc')->get();
-        $treeData = $tree->toArray();
-        foreach ($tree as $key => $value) {
-            $treeData[$key]['baseProductParameter.name'] = $value->baseProductParameter->name?? '';
+        if (!$closure) {
+            $closure = function ($query) {
+                $query = $query->where('enabled', 1);
+                $query =  $query->orderBy('order', 'desc')->orderBy('id', 'desc');
+                return $query;
+            };
         }
-        // 构建树形结构
-        $data=buildTree($treeData);
-
-        // 转换成一维数组
-        $data=flattenTree($data);
 
-        return $model->makePaginator(
-            count($data), // 传入总记录数
-            $data // 传入数据二维数组
-        );
+        $selectOptions =  Model::class::selectOptions($closure);
+        return $selectOptions;
     }
 
 
-
 }

+ 0 - 18
app/Admin/Repositories/SiteAppearanceTemplate.php

@@ -1,18 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\SiteAppearanceTemplate as Model;
-use Dcat\Admin\Repositories\EloquentRepository;
-use Illuminate\Support\Carbon;
-
-class SiteAppearanceTemplate extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-}

+ 0 - 21
app/Admin/Repositories/SiteAppearanceVariable.php

@@ -1,21 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\SiteAppearanceVariable as Model;
-use Dcat\Admin\Repositories\EloquentRepository;
-
-class SiteAppearanceVariable extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-
-
-
-
-}

+ 0 - 16
app/Admin/Repositories/SiteBanner.php

@@ -1,16 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\SiteBanner as Model;
-use Dcat\Admin\Repositories\EloquentRepository;
-
-class SiteBanner extends EloquentRepository
-{
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-}

+ 0 - 61
app/Admin/Repositories/SiteMenu.php

@@ -1,61 +0,0 @@
-<?php
-
-namespace App\Admin\Repositories;
-
-use App\Models\SiteMenu as Model;
-use Dcat\Admin\Repositories\EloquentRepository;
-
-class SiteMenu extends EloquentRepository
-{
-
-    /**
-     * Model.
-     *
-     * @var string
-     */
-    protected $eloquentClass = Model::class;
-
-
-
-
-    /*
-     * 只能显示2层
-     */
-    public static function selectOptions(\Closure $closure = null)
-    {
-        if (!$closure) {
-            $closure = function ($query) {
-                $query =  $query->where('dist_id', getDistributorId())->orderBy('order', 'asc');
-                return $query;
-            };
-        }
-        $selectOptions =  Model::class::selectOptions($closure);
-        //只显示2层
-        foreach ($selectOptions as $key => $value) {
-            if (substr_count($value,'&nbsp;') > 2) {
-                unset($selectOptions[$key]);
-            }
-        }
-        return $selectOptions;
-    }
-
-    /*
-    * 获取一个标签
-    */
-    public static function getOneById($id)
-    {
-        return Model::where('id', $id)->where('dist_id', getDistributorId())->first();
-    }
-
-    public static function createMenuBatch($data) {
-        $model = new Model();
-        return $model->createMenuBatch($data);
-    }
-
-    //生成uri
-    public static function generateUri($menuType,$menuConfig,$distId,$isId = true) {
-        $model = new Model();
-        return $model->generateUri($menuType,$menuConfig,$distId,$isId);
-    }
-
-}

+ 4 - 0
app/Admin/bootstrap.php

@@ -2,7 +2,9 @@
 
 use App\Exceptions\Form\CutImage;
 use App\Exceptions\Form\MultipleCutImage;
+use App\Exceptions\Form\TradImage;
 use Dcat\Admin\Admin;
+use App\Exceptions\Form\TradFile;
 use Dcat\Admin\Form\Field\MultipleImage;
 use Dcat\Admin\Grid;
 use Dcat\Admin\Form;
@@ -61,3 +63,5 @@ Editor::resolving(function (Editor $editor) {
 //裁剪图片表单扩展
 Form::extend('multipleCutImage', MultipleCutImage::class);
 Form::extend('cutImage', CutImage::class);
+Form::extend('tradFile', TradFile::class);
+Form::extend('tradImage', TradImage::class);

+ 4 - 31
app/Admin/routes.php

@@ -14,42 +14,15 @@ Route::group([
 ], function (Router $router) {
     //主页
     $router->get('/', 'HomeController@index');
-    //产品
-    $router->get('base-product/parameter', 'BaseProductController@parameter');
-    $router->resource('base-product', 'BaseProductController');
-    //分类
-    $router->resource('product-category', 'BaseProductCategoryController');
-    //参数
-    $router->resource('product-parameter', 'BaseProductParameterController');
-    //视频分类
-    $router->resource('video-category', 'BaseVideoCategoryController');
-    //视频管理
-    $router->resource('base-video', 'BaseVideoController');
-    //分销商管理
-    $router->resource('dist-admin-distributor', 'DistAdminDistributorController');
-    //分销商用户管理
-    $router->resource('dist-admin-user', 'DistAdminUserController');
-    //分销商站点
-    $router->resource('dist-site', 'DistSiteController');
-    //询价管理
-    $router->resource('dist-inquiry', 'DistInquiryController');
-    //外观管理
-    $router->resource('dist-appearance', 'DistAppearanceController');
-    //模板管理
-    $router->any('dist-template/ace', [DistAppearanceTemplateController::class, 'ace']);
-    //模板变量
-    $router->resource('dist-template-var', 'DistAppearanceVariableController');
-
-    $router->resource('messages', 'DistMessageController');
 
     // 定义切换语言的路由
     $router->get('language-switch','LanguageController@index');
-
     // 不需要登录的路由
     $router->get('captcha','CaptchaController@generate');
-
-    //api接口
-    $router->get('api/dist', 'ApiController@dist');
+    //文件夹
+    $router->resource('site-folder', 'SiteAlbumFolderController');
+    //相册
+    $router->resource('site-album', 'SiteAlbumController');
 });
 
 /*

+ 0 - 16
app/Models/BaseIso3166.php

@@ -1,16 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-
-class BaseIso3166 extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'base_iso_3166';
-    public $timestamps = false;
-
-
-}

+ 0 - 43
app/Models/BaseProduct.php

@@ -1,43 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use App\Traits\SortableTraitPinned;
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Dcat\Admin\Traits\ModelTree;
-use Illuminate\Database\Eloquent\Model;
-use Spatie\EloquentSortable\Sortable;
-use Spatie\EloquentSortable\SortableTrait;
-
-class BaseProduct extends Model
-{
-    use HasDateTimeFormatter;
-    use SortableTraitPinned;
-
-    protected $table = 'base_product';
-
-    // 可选:你可以在这里自定义排序配置
-    public $sortable = [
-        'order_column_name' => 'order',  // 排序字段
-        'sort_when_creating' => true,    // 创建时自动排序
-    ];
-
-    protected $casts = [
-        'created_at' => 'datetime:Y-m-d H:i:s',
-        'updated_at' => 'datetime:Y-m-d H:i:s',
-        'parameters' => 'json', // 将 attributes 字段转换为数组
-    ];
-
-    public function baseProductCategory()
-    {
-        return $this->hasOne(BaseProductCategory::class,'id','category_id');
-    }
-
-    // 一对多关联
-    public function images()
-    {
-        return $this->hasMany(BaseProductImage::class, 'product_id','id')->orderBy('order', 'asc')->orderBy('id', 'asc');
-    }
-
-}

+ 0 - 50
app/Models/BaseProductCategory.php

@@ -1,50 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Dcat\Admin\Traits\ModelTree;
-use Illuminate\Database\Eloquent\Model;
-use Spatie\EloquentSortable\Sortable;
-
-class BaseProductCategory extends Model
-{
-    use HasDateTimeFormatter,
-        ModelTree {
-        ModelTree::boot as treeBoot;
-    }
-
-    //名称
-    protected $titleColumn = 'name';
-    //排序
-    protected $orderColumn = 'order';
-    //父级
-    protected $parentColumn = 'parent_id';
-
-    protected $table = 'base_product_category';
-
-    protected $casts = [
-        'created_at' => 'datetime:Y-m-d H:i:s',
-        'updated_at' => 'datetime:Y-m-d H:i:s',
-    ];
-
-    protected $fillable = [
-        'name', 'parent_id', 'order','enabled','parameter_id', // 假设已有的可填充字段
-    ];
-
-    /*
-     * 关联产品参数
-     */
-    public function baseProductParameter()
-    {
-        return $this->hasOne(BaseProductParameter::class,'id','parameter_id');
-    }
-
-
-//    public static function selectOptions(\Closure $closure = null)
-//    {
-//        $options = (new static())->withQuery($closure)->buildSelectOptions();
-//        return collect($options)->all();
-//    }
-}

+ 0 - 30
app/Models/BaseProductImage.php

@@ -1,30 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-use Illuminate\Database\Eloquent\Model;
-
-class BaseProductImage extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'base_product_image';
-
-    protected $casts = [
-        'created_at' => 'datetime:Y-m-d H:i:s',
-        'updated_at' => 'datetime:Y-m-d H:i:s',
-    ];
-    protected $fillable = [
-        'image_url',
-        'product_id',
-        'order',
-    ];
-
-    // 反向关联,属于某个产品
-    public function product()
-    {
-        return $this->belongsTo(BaseProduct::class, 'id');
-    }
-
-
-}

+ 0 - 35
app/Models/BaseProductParameter.php

@@ -1,35 +0,0 @@
-<?php
-
-namespace App\Models;
-
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Dcat\Admin\Traits\ModelTree;
-use Illuminate\Database\Eloquent\Model;
-use Spatie\EloquentSortable\Sortable;
-use Spatie\EloquentSortable\SortableTrait;
-use Illuminate\Database\Eloquent\Builder;
-
-class BaseProductParameter extends Model
-{
-    use SortableTrait;
-
-    protected $table = 'base_product_parameter';
-
-
-
-    protected $casts = [
-        'created_at' => 'datetime:Y-m-d H:i:s',
-        'updated_at' => 'datetime:Y-m-d H:i:s',
-        'content' => 'json', // 将 attributes 字段转换为数组
-    ];
-
-
-    // 可选:你可以在这里自定义排序配置
-    public $sortable = [
-        'order_column_name' => 'order',  // 排序字段
-        'sort_when_creating' => true,    // 创建时自动排序
-    ];
-
-}

+ 0 - 39
app/Models/BaseVideo.php

@@ -1,39 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-use Spatie\EloquentSortable\Sortable;
-use Spatie\EloquentSortable\SortableTrait;
-use App\Traits\SortableTraitPinned;
-
-class BaseVideo extends Model
-{
-	use HasDateTimeFormatter;
-    use SortableTraitPinned;
-
-    protected $table = 'base_video';
-
-    // 可选:你可以在这里自定义排序配置
-    public $sortable = [
-        'order_column_name' => 'order',  // 排序字段
-        'sort_when_creating' => true,    // 创建时自动排序
-    ];
-
-    protected $casts = [
-        'created_at' => 'datetime:Y-m-d H:i:s',
-        'updated_at' => 'datetime:Y-m-d H:i:s',
-    ];
-
-    /*
-     * 分类一对多关联
-     */
-    public function baseVideoCategory()
-    {
-        return $this->hasOne(BaseVideoCategory::class,'id','category_id');
-    }
-
-
-}

+ 0 - 29
app/Models/BaseVideoCategory.php

@@ -1,29 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Dcat\Admin\Traits\ModelTree;
-use Illuminate\Database\Eloquent\Model;
-use Spatie\EloquentSortable\Sortable;
-
-class BaseVideoCategory extends Model
-{
-    use HasDateTimeFormatter,
-        ModelTree {
-        ModelTree::boot as treeBoot;
-    }
-    protected $table = 'base_video_category';
-    //名称
-    protected $titleColumn = 'name';
-    //排序
-    protected $orderColumn = 'order';
-    //父级
-    protected $parentColumn = 'parent_id';
-
-    protected $casts = [
-        'created_at' => 'datetime:Y-m-d H:i:s',
-        'updated_at' => 'datetime:Y-m-d H:i:s',
-    ];
-}

+ 0 - 63
app/Models/DistAdminDistributor.php

@@ -1,63 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-
-class DistAdminDistributor extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'dist_admin_distributor';
-
-
-
-    /*
-     * 用户一对多关联
-     */
-    public function user()
-    {
-        return $this->hasMany(DistAdminUser::class, 'dist_id', 'id');
-    }
-
-    /*
-     * 外观一对一关联
-     */
-    public function appearance()
-    {
-        return $this->hasOne(DistAppearance::class, 'id', 'appearance_id');
-    }
-
-    /*
-     * 得到分销商域名
-     * type 0:当前域名 1:二级域名 2:自定义域名
-     */
-    public function getDomain($distId,$type = 0)
-    {
-        $domain = '';
-        $row = $this->where('id', $distId)->first();
-        $http = 'http://';
-        if (env('ADMIN_HTTPS') == true) {
-            $http = 'https://';
-        }
-        if ($row) {
-            if ($type == 0) {
-                if ($row->domain_type == 0) {
-                    $domain = $http.$row->secondary_domain;
-                } else {
-                    $domain = $http.$row->custom_domain;
-                }
-            } else if ($type == 1) {
-                $domain = $http.$row->secondary_domain;
-            } else {
-                $domain = $http.$row->custom_domain;
-            }
-        }
-        if (env('DIST_SITE_PORT') != 80 && env('DIST_SITE_PORT') != 443) {
-            $domain .= ':' . env('DIST_SITE_PORT');
-        }
-        return $domain;
-    }
-
-}

+ 0 - 9
app/Models/DistAdminMenu.php

@@ -1,9 +0,0 @@
-<?php
-
-namespace App\Models;
-use Dcat\Admin\Models\Menu;
-
-class DistAdminMenu extends Menu
-{
-    protected $table = 'dist_admin_menu';
-}

+ 0 - 21
app/Models/DistAdminUser.php

@@ -1,21 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-
-class DistAdminUser extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'dist_admin_users';
-
-    /*
-     * 一对一关联
-     */
-    public function distributor()
-    {
-        return $this->hasOne(DistAdminDistributor::class, 'id', 'dist_id');
-    }
-}

+ 0 - 32
app/Models/DistAppearance.php

@@ -1,32 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Contracts\TreeRepository;
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-use Spatie\EloquentSortable\Sortable;
-use Spatie\EloquentSortable\SortableTrait;
-
-class DistAppearance extends Model
-{
-	use HasDateTimeFormatter;
-    use SortableTrait;
-
-    protected $table = 'dist_appearance';
-
-    protected $casts = [
-        'created_at' => 'datetime:Y-m-d H:i:s',
-        'updated_at' => 'datetime:Y-m-d H:i:s',
-    ];
-
-    // 可选:你可以在这里自定义排序配置
-    public $sortable = [
-        'order_column_name' => 'order',  // 排序字段
-        'sort_when_creating' => true,    // 创建时自动排序
-    ];
-
-
-
-}

+ 0 - 126
app/Models/DistAppearanceBak.php

@@ -1,126 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Carbon\Carbon;
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Log;
-
-class DistAppearanceBak extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'dist_appearance_bak';
-
-    protected $fillable = [
-        'original_table',
-        'data',
-        'created_at',
-        'updated_at',
-        'dist_id',
-        'appearance_id',
-        'version'
-    ];
-
-    /*
-     * 备份数据dist_appearance_template和dist_appearance_variable到dist_appearance_bak的data字段中
-     */
-    public static function backupData($appearanceId,$distId)
-    {
-        $version = generateVersionNumber();
-        // 获取需要备份的数据
-        $templates = DistAppearanceTemplate::where('dist_id', $distId)->where('appearance_id', $appearanceId)->get();
-        $variables = DistAppearanceVariable::where('dist_id', $distId)->where('appearance_id', $appearanceId)->get();
-
-        // 备份模板数据
-        foreach ($templates as $template) {
-            self::create([
-                'dist_id' => $distId,
-                'appearance_id' => $appearanceId,
-                'original_table' => 'dist_appearance_template',
-                'data' => json_encode($template->getAttributes()),
-                'created_at' => Carbon::now(),
-                'updated_at' => Carbon::now(),
-                'version' => $version
-            ]);
-        }
-
-        // 备份变量数据
-        foreach ($variables as $variable) {
-            self::create([
-                'dist_id' => $distId,
-                'appearance_id' => $appearanceId,
-                'original_table' => 'dist_appearance_variable',
-                'data' => json_encode($variable->getAttributes()),
-                'created_at' => Carbon::now(),
-                'updated_at' => Carbon::now(),
-                'version' => $version
-            ]);
-        }
-    }
-
-
-    /*
-     * 用于恢复指定版本的备份数据
-     * @param $version 版本号
-     */
-    public function restoreDataByVersion($version)
-    {
-        DB::beginTransaction();
-
-        try {
-            // Fetch all backup records with the specified version
-            $backupRecords = DistAppearanceBak::where('version', $version)->get();
-
-            // Group records by appearance_id and dist_id
-            $groupedRecords = [];
-            foreach ($backupRecords as $record) {
-                $key = "{$record->appearance_id}-{$record->dist_id}";
-                $groupedRecords[$key][] = $record;
-            }
-
-            // Process each group
-            foreach ($groupedRecords as $key => $records) {
-                list($appearanceId, $distId) = explode('-', $key);
-
-                // Delete existing records in dist_appearance_template
-                DB::table('dist_appearance_template')
-                    ->where('appearance_id', $appearanceId)
-                    ->where('dist_id', $distId)
-                    ->delete();
-
-                // Delete existing records in dist_appearance_variable
-                DB::table('dist_appearance_variable')
-                    ->where('appearance_id', $appearanceId)
-                    ->where('dist_id', $distId)
-                    ->delete();
-
-                // Insert backup data into original tables
-                foreach ($records as $record) {
-                    $originalTable = $record->original_table;
-                    $data = json_decode($record->data, true);
-
-                    if (!is_array($data)) {
-                        continue; // Skip if data is not an array
-                    }
-
-                    // Insert data into the original table
-                    DB::table($originalTable)->insert($data);
-                }
-            }
-
-            DB::commit();
-        } catch (\Exception $e) {
-            DB::rollback();
-            Log::error('Error restoring data: ' . $e->getMessage());
-            throw $e; // Rethrow or handle the exception as needed
-        }
-    }
-
-
-
-
-
-}

+ 0 - 14
app/Models/DistAppearancePublishList.php

@@ -1,14 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-
-class DistAppearancePublishList extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'dist_appearance_publish_list';
-    
-}

+ 0 - 98
app/Models/DistAppearanceTemplate.php

@@ -1,98 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Carbon\Carbon;
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Support\Facades\DB;
-
-class DistAppearanceTemplate extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'dist_appearance_template';
-
-    /*
-     * 把原始模板复制给分销商
-     */
-    public static function copyTemplateToDist($appearanceId,$distId) {
-        $appearanceId = intval($appearanceId);
-        $distId = intval($distId);
-        $count = self::where('dist_id', $distId)->where('appearance_id', $appearanceId)->count();
-        if ($count > 0) {
-            return;
-        }
-        $baseDistId = config('dictionary.base_dist_id');
-        //复制
-        DB::statement("
-INSERT INTO `dist_appearance_template` (`dist_id`, `appearance_id`, `file_name`, `file_path`, `content`, `created_at`, `updated_at`,  `template_code`)
-SELECT {$distId}, `appearance_id`, `file_name`, `file_path`, `content`, NOW(), NOW(), `template_code`
-FROM `dist_appearance_template`
-WHERE `dist_id` = {$baseDistId} AND `appearance_id` = {$appearanceId};
-        ");
-    }
-
-    public static function deleteTemplates($appearanceId,$distId) {
-        self::where('dist_id',$distId)->where('appearance_id',$appearanceId)->delete();
-        return true;
-    }
-
-
-
-    public function syncAppearanceTemplates($appearanceId,$distId)
-    {
-        $appearanceId = intval($appearanceId);
-        $distId = intval($distId);
-
-        $criteria = ['dist_id' => $distId, 'appearance_id' => $appearanceId];
-
-        $tmpModel = $this;
-        $tempRecords = $tmpModel
-            ->where($criteria)
-            ->get();
-
-        $siteModel = new SiteAppearanceTemplate();
-        $siteRecords = $siteModel
-            ->where($criteria)
-            ->get()
-            ->keyBy('id'); // Use IDs as keys for easier comparison
-
-
-        foreach ($tempRecords as $tempRecord) {
-            $siteRecord = $siteRecords->get($tempRecord->id);
-            if ($siteRecord) {
-                // If record exists in `site_appearance_template`, check for updates
-                if ($tempRecord->updated_at > $siteRecord->updated_at) {
-                    $siteModel->where('id', $siteRecord->id)
-                        ->update([
-                            'file_name' => $tempRecord->file_name,
-                            'file_path' => $tempRecord->file_path,
-                            'content' => $tempRecord->content,
-                            'updated_at' => Carbon::now(),
-                        ]);
-                }
-            } else {
-                // If record does not exist, insert it
-                $siteModel->insert([
-                    'id' => $tempRecord->id,
-                    'dist_id' => $tempRecord->dist_id,
-                    'appearance_id' => $tempRecord->appearance_id,
-                    'file_name' => $tempRecord->file_name,
-                    'file_path' => $tempRecord->file_path,
-                    'content' => $tempRecord->content,
-                    'created_at' => Carbon::now(),
-                    'updated_at' => Carbon::now(),
-                    'template_code' => $tempRecord->template_code,
-                ]);
-            }
-        }
-
-        // Delete records from `site_appearance_template` that don’t match `dist_id=1` and `appearance_id=1`
-        $siteModel
-            ->where($criteria)
-            ->whereNotIn('id', $tempRecords->pluck('id')->toArray())
-            ->delete();
-    }
-
-}

+ 0 - 17
app/Models/DistAppearanceTemplateLog.php

@@ -1,17 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Support\Facades\DB;
-
-class DistAppearanceTemplateLog extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'dist_appearance_template_log';
-
-
-
-
-}

+ 0 - 122
app/Models/DistAppearanceVariable.php

@@ -1,122 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Carbon\Carbon;
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Support\Facades\DB;
-
-class DistAppearanceVariable extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'dist_appearance_variable';
-
-    protected $fillable = ['dist_id', 'appearance_id', 'variable_name','variable_value','variable_type','created_at','updated_at','template_id'];
-
-    /*
-     * 关联到分销商表
-     */
-    public function distributor()
-    {
-        return $this->hasOne(DistAdminDistributor::class, 'id', 'dist_id');
-    }
-
-    /*
-     * 关联到外观表
-     */
-    public function appearance()
-    {
-        return $this->hasOne(DistAppearance::class, 'id', 'appearance_id');
-    }
-
-
-    /*
-     * 把原始变量复制给分销商
-     */
-    public static function copyAppearanceVariable($appearanceId, $distId){
-        $distId = intval($distId);
-        $appearanceId = intval($appearanceId);
-
-        $count = self::where('dist_id', $distId)->where('appearance_id', $appearanceId)->count();
-        if ($count > 0) {
-            return;
-        }
-        $baseDistId = config('dictionary.base_dist_id');
-        //复制
-        DB::statement("
-INSERT INTO `dist_appearance_variable` (`dist_id`, `appearance_id`, `variable_name`, `variable_value`, `variable_type`, `created_at`, `updated_at`, `template_code`,`variable_code`)
-SELECT {$distId}, `appearance_id`, `variable_name`, `variable_value`, `variable_type`, NOW(), NOW(), `template_code`,`variable_code`
-FROM `dist_appearance_variable`
-WHERE `dist_id` = {$baseDistId} AND `appearance_id` = {$appearanceId};
-        ");
-    }
-
-    public static function deleteVariable($appearanceId,$distId)
-    {
-        return self::where('appearance_id', $appearanceId)->where('dist_id', $distId)->delete();
-    }
-
-    public  function syncAppearanceVariables($appearanceId,$distId) {
-        $appearanceId = intval($appearanceId);
-        $distId = intval($distId);
-
-        // Define criteria for filtering
-        $criteria = ['dist_id' => $distId, 'appearance_id' => $appearanceId];
-
-        $tmpModel = $this;
-        // Retrieve records from both tables
-        $tempVariables = $tmpModel
-            ->where($criteria)
-            ->get();
-
-        $siteModel = new SiteAppearanceVariable();
-        $siteVariables = $siteModel
-            ->where($criteria)
-            ->get()
-            ->keyBy('id'); // Use IDs as keys for easier comparison
-
-        foreach ($tempVariables as $tempVariable) {
-            $siteVariable = $siteVariables->get($tempVariable->id);
-
-            if ($siteVariable) {
-                // If record exists in `site_appearance_variable`, check for updates
-                if ($tempVariable->updated_at > $siteVariable->updated_at) {
-                    $siteModel
-                        ->where('id', $siteVariable->id)
-                        ->update([
-                            'variable_name' => $tempVariable->variable_name,
-                            'variable_value' => $tempVariable->variable_value,
-                            'variable_type' => $tempVariable->variable_type,
-                            'template_code' => $tempVariable->template_code,
-                            'variable_code' => $tempVariable->variable_code,
-                            'updated_at' => Carbon::now(),
-                        ]);
-                }
-            } else {
-                // If record does not exist, insert it
-                $siteModel->insert([
-                    'id' => $tempVariable->id,
-                    'dist_id' => $tempVariable->dist_id,
-                    'appearance_id' => $tempVariable->appearance_id,
-                    'variable_name' => $tempVariable->variable_name,
-                    'variable_value' => $tempVariable->variable_value,
-                    'variable_type' => $tempVariable->variable_type,
-                    'template_code' => $tempVariable->template_code,
-                    'variable_code' => $tempVariable->variable_code,
-                    'created_at' => Carbon::now(),
-                    'updated_at' => Carbon::now(),
-                ]);
-            }
-        }
-
-        // Delete records from `site_appearance_variable` that don’t match `dist_id=1` and `appearance_id=1`
-        $siteModel
-            ->where($criteria)
-            ->whereNotIn('id', $tempVariables->pluck('id')->toArray())
-            ->delete();
-
-    }
-
-}

+ 0 - 38
app/Models/DistInquiry.php

@@ -1,38 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-
-class DistInquiry extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'dist_inquiry';
-
-    /*
-     * 关联到分销商
-     */
-    public function distributor()
-    {
-        return $this->hasOne(DistAdminDistributor::class,'id', 'dist_id');
-    }
-
-    /*
-     * 生成订单号
-     */
-    public static function generateOrderNumber()
-    {
-        // 获取当前日期,格式为YYYYMMDD
-        $date = now()->format('Ymd');
-
-        // 查询当天订单数量
-        $todayOrderCount = self::whereDate('created_at', Carbon::today())->count();
-
-        // 订单号:日期 + 当天订单数量 + 1
-        $orderNumber = $date . str_pad($todayOrderCount + 1, 4, '0', STR_PAD_LEFT);
-
-        return 'Q'.$orderNumber;
-    }
-}

+ 0 - 50
app/Models/DistMessage.php

@@ -1,50 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Illuminate\Database\Eloquent\Factories\HasFactory;
-use Illuminate\Database\Eloquent\Model;
-
-class DistMessage extends Model
-{
-    use HasFactory;
-
-    protected $table = 'dist_messages';
-    protected $fillable = ['title', 'content', 'sender_id', 'target_type', 'target_ids', 'created_at', 'updated_at'];
-
-    protected $casts = [
-        'target_ids' => 'json',
-        'created_at' => 'datetime:Y-m-d H:i:s',
-        'updated_at' => 'datetime:Y-m-d H:i:s',
-    ];
-
-
-
-    // 消息的发送者
-    public function sender()
-    {
-        return $this->belongsTo(DistAdminDistributor::class, 'sender_id');
-    }
-
-    // 消息的阅读状态
-    public function readStatuses()
-    {
-        return $this->hasMany(DistReadStatus::class, 'message_id');
-    }
-
-    // 检查消息是否针对某用户
-    public function isForUser($userId)
-    {
-        if ($this->target_type === 'all') {
-            return true;
-        }
-
-        if ($this->target_type === 'users' && is_array($this->target_ids)) {
-            return in_array($userId, $this->target_ids);
-        }
-
-        return false;
-    }
-
-
-}

+ 0 - 62
app/Models/DistProduct.php

@@ -1,62 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-use App\Traits\SortableTraitPinned;
-use Illuminate\Database\Eloquent\Model;
-use Spatie\EloquentSortable\Sortable;
-
-class DistProduct extends Model
-{
-	use HasDateTimeFormatter;
-    use SortableTraitPinned;
-    protected $table = 'dist_product';
-
-    // 可选:你可以在这里自定义排序配置
-    public $sortable = [
-        'order_column_name' => 'order',  // 排序字段
-        'sort_when_creating' => true,    // 创建时自动排序
-    ];
-
-    protected $casts = [
-        'created_at' => 'datetime:Y-m-d H:i:s',
-        'updated_at' => 'datetime:Y-m-d H:i:s',
-        'parameters' => 'json', // 将 attributes 字段转换为数组
-    ];
-
-    protected $fillable = [
-        'id',
-        'title',
-        'keywords',
-        'description',
-        'sku',
-        'category_id',
-        'issuance_date',
-        'order',
-        'enabled',
-        'content',
-        'parameters',
-        'created_at',
-        'updated_at',
-        'is_pinned',
-        'dist_id',
-        'seo_title',
-        'seo_keywords',
-        'seo_description',
-        'slug',
-    ];
-
-
-    public function distProductCategory()
-    {
-        return $this->hasOne(DistProductCategory::class,'id','category_id');
-    }
-
-    // 一对多关联
-    public function images()
-    {
-        return $this->hasMany(DistProductImage::class, 'product_id')->orderBy('order', 'asc')->orderBy('id', 'asc');
-    }
-
-}

+ 0 - 79
app/Models/DistProductCategory.php

@@ -1,79 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Dcat\Admin\Traits\ModelTree;
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Support\Facades\Session;
-use Spatie\EloquentSortable\Sortable;
-use Illuminate\Database\Eloquent\Scope;
-
-use App\Distributor\Scopes;
-class DistProductCategory extends Model
-{
-    use HasDateTimeFormatter,
-        ModelTree {
-        ModelTree::boot as treeBoot;
-    }
-	use HasDateTimeFormatter;
-    protected $table = 'dist_product_category';
-
-    //名称
-    protected $titleColumn = 'name';
-    //排序
-    protected $orderColumn = 'order';
-    //父级
-    protected $parentColumn = 'parent_id';
-
-
-    protected $casts = [
-        'created_at' => 'datetime:Y-m-d H:i:s',
-        'updated_at' => 'datetime:Y-m-d H:i:s',
-    ];
-
-    protected $fillable = [
-        'name', 'parent_id', 'order','enabled','dist_id','slug','created_at', 'updated_at',// 假设已有的可填充字段
-        'seo_title', 'seo_keywords', 'seo_description',
-    ];
-
-
-    protected $distributor = null;
-
-
-
-    /*
-     * 关联产品参数
-     */
-    public function distProductParameter()
-    {
-        return $this->hasOne(DistProductParameter::class,'id','parameter_id');
-    }
-
-
-    public static function selectOptions(\Closure $closure = null)
-    {
-        $options = (new static())->withQuery($closure)->buildSelectOptions();
-        return collect($options)->all();
-    }
-    public function getAllCategories($parentId = null)
-    {
-        // Retrieve categories with the specified parentId, or all if no parentId is specified
-        $query = self::query();
-
-        if ($parentId !== null) {
-            $query->where('parent_id', $parentId);
-        }
-
-        $categories = $query->orderBy($this->orderColumn)->get();
-
-        // If you want a hierarchical structure, you can recursively build it
-        $categories->each(function ($category) {
-            $category->children = $category->getAllCategories($category->id);
-        });
-
-        return $categories;
-    }
-
-}

+ 0 - 32
app/Models/DistProductImage.php

@@ -1,32 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-
-class DistProductImage extends Model
-{
-    use HasDateTimeFormatter;
-    protected $table = 'dist_product_image';
-
-    protected $casts = [
-        'created_at' => 'datetime:Y-m-d H:i:s',
-        'updated_at' => 'datetime:Y-m-d H:i:s',
-    ];
-    protected $fillable = [
-        'image_url',
-        'product_id',
-        'order',
-        'created_at',
-        'updated_at'
-        ];
-
-    // 反向关联,属于某个产品
-    public function product()
-    {
-        return $this->belongsTo(DistProduct::class, 'id');
-    }
-
-}

+ 0 - 14
app/Models/DistProductParameter.php

@@ -1,14 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-
-class DistProductParameter extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'dist_product_parameter';
-    
-}

+ 0 - 26
app/Models/DistReadStatus.php

@@ -1,26 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Illuminate\Database\Eloquent\Factories\HasFactory;
-use Illuminate\Database\Eloquent\Model;
-
-class DistReadStatus extends Model
-{
-    use HasFactory;
-
-    protected $table = 'dist_read_status';
-    protected $fillable = ['user_id', 'message_id', 'is_read', 'created_at', 'updated_at'];
-
-    // 阅读状态属于一个用户
-    public function user()
-    {
-        return $this->belongsTo(DistAdminDistributor::class, 'user_id');
-    }
-
-    // 阅读状态属于一条消息
-    public function message()
-    {
-        return $this->belongsTo(DistMessage::class, 'message_id');
-    }
-}

+ 0 - 38
app/Models/DistVideo.php

@@ -1,38 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-use Spatie\EloquentSortable\Sortable;
-use Spatie\EloquentSortable\SortableTrait;
-use App\Traits\SortableTraitPinned;
-
-class DistVideo extends Model
-{
-    use HasDateTimeFormatter;
-    use SortableTraitPinned;
-
-    protected $table = 'dist_video';
-
-    // 可选:你可以在这里自定义排序配置
-    public $sortable = [
-        'order_column_name' => 'order',  // 排序字段
-        'sort_when_creating' => true,    // 创建时自动排序
-    ];
-
-    protected $casts = [
-        'created_at' => 'datetime:Y-m-d H:i:s',
-        'updated_at' => 'datetime:Y-m-d H:i:s',
-    ];
-
-    /*
-     * 分类一对多关联
-     */
-    public function distVideoCategory()
-    {
-        return $this->hasOne(DistVideoCategory::class,'id','category_id');
-    }
-
-}

+ 0 - 29
app/Models/DistVideoCategory.php

@@ -1,29 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Dcat\Admin\Traits\ModelTree;
-use Illuminate\Database\Eloquent\Model;
-use Spatie\EloquentSortable\Sortable;
-
-class DistVideoCategory extends Model
-{
-    use HasDateTimeFormatter,
-        ModelTree {
-        ModelTree::boot as treeBoot;
-    }
-    protected $table = 'dist_video_category';
-    //名称
-    protected $titleColumn = 'name';
-    //排序
-    protected $orderColumn = 'order';
-    //父级
-    protected $parentColumn = 'parent_id';
-
-    protected $casts = [
-        'created_at' => 'datetime:Y-m-d H:i:s',
-        'updated_at' => 'datetime:Y-m-d H:i:s',
-    ];
-}

+ 2 - 3
app/Models/DistAdminUsersSetting.php → app/Models/NullModel.php

@@ -6,9 +6,8 @@ use Dcat\Admin\Traits\HasDateTimeFormatter;
 
 use Illuminate\Database\Eloquent\Model;
 
-class DistAdminUsersSetting extends Model
+class NullModel extends Model
 {
-	use HasDateTimeFormatter;
-    protected $table = 'dist_admin_users_settings';
+    use HasDateTimeFormatter;
 
 }

+ 4 - 4
app/Models/DistAdminRoleUser.php → app/Models/SiteAlbum.php

@@ -3,12 +3,12 @@
 namespace App\Models;
 
 use Dcat\Admin\Traits\HasDateTimeFormatter;
+
 use Illuminate\Database\Eloquent\Model;
 
-class DistAdminRoleUser extends Model
+class SiteAlbum extends Model
 {
 	use HasDateTimeFormatter;
-    protected $table = 'dist_admin_role_users';
-
-
+    protected $table = 'site_album';
+    
 }

+ 27 - 0
app/Models/SiteAlbumFolder.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App\Models;
+
+use Dcat\Admin\Traits\HasDateTimeFormatter;
+
+use Dcat\Admin\Traits\ModelTree;
+use Illuminate\Database\Eloquent\Model;
+
+class SiteAlbumFolder extends Model
+{
+	use HasDateTimeFormatter;
+    protected $table = 'site_album_folder';
+
+    use HasDateTimeFormatter,
+        ModelTree {
+        ModelTree::boot as treeBoot;
+    }
+
+    public function allNodes()
+    {
+        return $this->callQueryCallbacks(new static())
+            ->orderBy($this->getOrderColumn(), 'desc')
+            ->get();
+    }
+
+}

+ 0 - 16
app/Models/SiteAppearanceTemplate.php

@@ -1,16 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Support\Facades\DB;
-
-class SiteAppearanceTemplate extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'site_appearance_template';
-
-
-
-}

+ 0 - 17
app/Models/SiteAppearanceVariable.php

@@ -1,17 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Support\Facades\DB;
-
-class SiteAppearanceVariable extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'site_appearance_variable';
-
-    protected $fillable = ['dist_id', 'appearance_id', 'variable_name','variable_value','variable_type','created_at','updated_at','template_id'];
-
-
-}

+ 0 - 26
app/Models/SiteBanner.php

@@ -1,26 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-
-class SiteBanner extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'site_banner';
-
-    protected $fillable = [
-        'image_url',
-        'order',
-        'banner_url',
-        'title',
-        'show',
-        'position',
-        'created_at',
-        'updated_at',
-        'dist_id',
-    ];
-
-}

+ 0 - 131
app/Models/SiteMenu.php

@@ -1,131 +0,0 @@
-<?php
-
-namespace App\Models;
-
-
-use Carbon\Carbon;
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-use Dcat\Admin\Traits\ModelTree;
-
-class SiteMenu extends Model
-{
-	use HasDateTimeFormatter;
-    use ModelTree;
-
-    protected $table = 'site_menu';
-
-    protected $parentColumn = 'parent_id';
-
-    // 排序字段名称,默认值为 order
-    protected $orderColumn = 'order';
-
-    // 标题字段名称,默认值为 title
-    protected $titleColumn = 'title';
-
-    protected $casts = [
-        'created_at' => 'datetime:Y-m-d H:i:s',
-        'updated_at' => 'datetime:Y-m-d H:i:s',
-        'menu_config' => 'json', // 将 menu_config 字段转换为数组
-    ];
-
-    protected $fillable = [
-        'parent_id',
-        'order',
-        'title',
-        'uri',
-        'show',
-        'menu_type',
-        'menu_config',
-        'menu_location',
-        'dist_id',
-    ];
-
-
-    /**
-     * @return 批量生成菜单
-     */
-    public function createMenuBatch($data) {
-        $parentIdArray = [];
-        $i = 0;
-        foreach ($data as $item) {
-            $parentId = $item['parentId'] == 0 ? 0 : $parentIdArray[$item['parentId']];
-            $i++;
-            $row = $this->create([
-                'parent_id' => $parentId,
-                'title' => $item['title'],
-                'order' => $i,
-                'dist_id'=>$item['distId'],
-                'uri' => $item['uri'],
-                'menu_type' => $item['menuType'],
-                'menu_config' => $item['menuConfig'],
-                'menu_location' => $item['menuLocation'],//0顶部 1底部
-                'show'  => 1,
-                'created_at'=>Carbon::now(),
-                'updated_at'=>Carbon::now(),
-            ]);
-            $parentIdArray[$i] = $row->id;
-        }
-    }
-
-
-    public  function generateUri($menuType,$menuConfig,$distId,$isId = true) {
-        switch ($menuType) {
-            case 0: //选择产品
-                $uri ="/";
-                break;
-            case 1: //集合
-                if ($menuConfig['collections_type'] == 0) {
-                    $distProductCategory = new DistProductCategory();
-                    $row = $distProductCategory->where('dist_id', $distId)->where('id', $menuConfig['product_category'])->first();
-                    //产品分类
-                    $slug = $isId ? $row->id : $row->slug;
-                    $uri = $row ? config('dictionary.site_url.product_category').'/'.$slug : "/";
-                } else if ($menuConfig['collections_type'] == 1) {
-                    $sitePagesTag = new SitePagesTag();
-                    $row = $sitePagesTag->where('dist_id', $distId)->where('id', $menuConfig['pages_tag'])->first();
-                    $slug = $isId ? $row->id : $row->slug;
-                    //文章标签
-                    $uri = $row ? config('dictionary.site_url.tags').'/'.$slug : "/";
-                } else if ($menuConfig['collections_type'] == 2) {
-                    $distProductCategory = new DistVideoCategory();
-                    $row = $distProductCategory->where('dist_id', $distId)->where('id', $menuConfig['video_category'])->first();
-                    $slug = $isId ? $row->id : $row->slug;
-                    $uri = $row ? config('dictionary.site_url.video_category').'/'.$slug : "/";
-                }
-                break;
-            case 2: //选择产品
-                $distProduct = new DistProduct();
-                $row = $distProduct->where('dist_id', $distId)->where('id', $menuConfig['product'])->first();
-                $slug = $isId ? $row->id : $row->slug;
-                $uri = $row ? config('dictionary.site_url.products').'/' .$slug : "/";
-                break;
-            case 3: //选择页面
-                $sitePages = new SitePages();
-                $row = $sitePages->where('dist_id', $distId)->where('id', $menuConfig['pages'])->first();
-                $slug = $isId ? $row->id : $row->slug;
-                $uri = $row ? config('dictionary.site_url.pages').'/'.$slug : "/";
-                break;
-            case 4: //选择页面
-                $sitePages = new SitePages();
-                $row = $sitePages->where('dist_id', $distId)->where('id', $menuConfig['landing_page'])->first();
-                $slug = $isId ? $row->id : $row->slug;
-                $uri = $row ? config('dictionary.site_url.pages').'/'.$slug : "/";
-                break;
-            case 5: //视频
-                $distVideo = new DistVideo();
-                $row = $distVideo->where('dist_id', $distId)->where('id', $menuConfig['videos'])->first();
-                $slug = $isId ? $row->id : $row->slug;
-                $uri = $row ? config('dictionary.site_url.video').'/'.$slug : "/";
-                break;
-            case 10: //url
-                $uri = $menuConfig['url'];
-                break;
-        }
-        return $uri;
-    }
-
-
-
-}

+ 0 - 44
app/Models/SitePages.php

@@ -1,44 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-
-class SitePages extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'site_pages';
-
-    protected $fillable = [
-        'title',
-        'content',
-        'status',
-        'author',
-        'post_date',
-        'dist_id',
-        'cover_image',
-        'slug',
-        'seo_title',
-        'seo_keywords',
-        'seo_description',
-        'page_type',
-        'template_file'
-    ];
-
-    /**
-     * 定义你的关联模型.
-     *
-     * @return BelongsToMany
-     */
-    public function pagesTag()
-    {
-
-        $pivotTable = 'site_pages_tag_relationship'; // 中间表
-
-        $relatedModel = SitePagesTag::class; // 关联模型类名
-
-        return $this->belongsToMany($relatedModel, $pivotTable, 'pages_id', 'tag_id');
-    }
-}

+ 0 - 24
app/Models/SitePagesTag.php

@@ -1,24 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use App\Traits\DistSlugTrait;
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-
-class SitePagesTag extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'site_pages_tag';
-    public $timestamps = false;
-    protected $fillable = [
-        'name',
-        'slug',
-        'dist_id',
-        'created_at',
-        'seo_title',
-        'seo_keywords',
-        'seo_description'
-    ];
-}

+ 0 - 19
app/Models/SitePagesTagRelationship.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-
-class SitePagesTagRelationship extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'site_pages_tag_relationship';
-    public $timestamps = false;
-
-    protected $fillable = [
-        'pages_id',
-        'tag_id',
-    ];
-}

+ 0 - 19
app/Models/Test.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Dcat\Admin\Traits\HasDateTimeFormatter;
-
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Support\Facades\DB;
-
-class Test extends Model
-{
-	use HasDateTimeFormatter;
-    protected $table = 'test';
-
-    public function __construct()
-    {
-        parent::__construct();
-    }
-}

+ 0 - 44
app/Models/User.php

@@ -1,44 +0,0 @@
-<?php
-
-namespace App\Models;
-
-// use Illuminate\Contracts\Auth\MustVerifyEmail;
-use Illuminate\Database\Eloquent\Factories\HasFactory;
-use Illuminate\Foundation\Auth\User as Authenticatable;
-use Illuminate\Notifications\Notifiable;
-use Laravel\Sanctum\HasApiTokens;
-
-class User extends Authenticatable
-{
-    use HasApiTokens, HasFactory, Notifiable;
-
-    /**
-     * The attributes that are mass assignable.
-     *
-     * @var array<int, string>
-     */
-    protected $fillable = [
-        'name',
-        'email',
-        'password',
-    ];
-
-    /**
-     * The attributes that should be hidden for serialization.
-     *
-     * @var array<int, string>
-     */
-    protected $hidden = [
-        'password',
-        'remember_token',
-    ];
-
-    /**
-     * The attributes that should be cast.
-     *
-     * @var array<string, string>
-     */
-    protected $casts = [
-        'email_verified_at' => 'datetime',
-    ];
-}

+ 6 - 0
config/admin.php

@@ -393,6 +393,12 @@ return [
         'dir' => base_path('dcat-admin-extensions'),
     ],
 
+    'multi_app' => [
+        // 与新应用的配置文件名称一致
+        // 设置为true启用,false则是停用
+        'distributor' => false,
+    ],
+
 
     /*
      * 默认分页条数

+ 4 - 7
resources/views/admin/dashboard/title.blade.php

@@ -27,17 +27,14 @@
 <div class="dashboard-title card bg-primary">
     <div class="card-body">
         <div class="text-center ">
-            <img class="avatar img-circle shadow mt-1" src="{{ admin_asset('@admin/images/logo.png') }}">
+            <img class="avatar img-circle shadow mt-1" src="/static/images/logo.svg">
 
             <div class="text-center mb-1">
-                <h1 class="mb-3 mt-2 text-white">Dcat Admin</h1>
+                <h1 class="mb-3 mt-2 text-white">Mietubl Album</h1>
                 <div class="links">
-                    <a href="https://github.com/jqhph/dcat-admin" target="_blank">Github</a>
-                    <a href="http://www.dcatadmin.com/" id="doc-link" target="_blank">{{ __('admin.documentation') }}</a>
-                    <a href="http://www.dcatadmin.com/" id="demo-link" target="_blank">{{ __('admin.extensions') }}</a>
-                    <a href="https://jqhph.github.io/dcat-admin/demo.html" id="demo-link" target="_blank">{{ __('admin.demo') }}</a>
+
                 </div>
             </div>
         </div>
     </div>
-</div>
+</div>

+ 0 - 0
resources/views/admin/form_custom/folder_tree.blade.php


+ 3 - 0
resources/views/distributor/form/hasmanytable.blade.php → resources/views/admin/form_custom/hasmanytable.blade.php

@@ -1,5 +1,8 @@
 <style>
     .table-has-many .input-group{flex-wrap: nowrap!important}
+    .table-has-many  th{vertical-align: middle!important;}
+    .table-has-many  td{vertical-align: middle!important;height: 102px;}
+    .table-has-many .remove{margin-bottom: 1.5rem}
 </style>
 
 <div class="row form-group">

+ 29 - 3
resources/views/distributor/form/file.blade.php → resources/views/admin/form_custom/trad-file.blade.php

@@ -19,13 +19,40 @@
         border: none;
     }
 
+    .trad-file-container .web-uploader {
+        margin-top: 0px;
+    }
+    .trad-file-container .web-uploader .placeholder {
+        border: none;
+        text-align: left;
+    }
+    .trad-file-container .web-uploader .placeholder:before {
+        content: "";
+        display: block;
+        position: absolute;
+    }
+
+    .trad-file-container .web-uploader .placeholder .webuploader-pick {
+        margin: 0px;
+    }
+    .trad-file-container .form-group {
+        margin-bottom: 0px;
+    }
+    .trad-file-container .web-uploader .statusBar .info {
+        display: none;
+    }
+    .trad-file-container .web-uploader.file .filelist li {
+        margin-bottom: 0px;
+    }
+
+
 </style>
 
-<div class="{{$viewClass['form-group']}} {{ $class }}">
+<div class="{{$viewClass['form-group']}} {{ $class }} trad-file-outer-container">
 
     <label for="{{$column}}" class="{{$viewClass['label']}} control-label">{!! $label !!}</label>
 
-    <div class="{{$viewClass['field']}}">
+    <div class="{{$viewClass['field']}} trad-file-container">
 
         @include('admin::form.error')
 
@@ -35,7 +62,6 @@
             <div class="queueList dnd-area" @if(!empty($upimgdemo)) style="width: 220px;float: left;" @endif>
                 <div class="placeholder">
                     <div class="file-picker"></div>
-                    <p>{{trans('admin.uploader.drag_file')}}</p>
                 </div>
             </div>
             {{-- 上传图片示例--}}

+ 142 - 0
resources/views/admin/form_custom/trad-image.blade.php

@@ -0,0 +1,142 @@
+<style>
+    .webuploader-pick {
+        background-color: @primary;
+    }
+
+    .web-uploader .placeholder .flashTip a {
+        color: @primary(-10);
+    }
+
+    .web-uploader .statusBar .upload-progress span.percentage,
+    .web-uploader .filelist li p.upload-progress span {
+        background: @primary(-8);
+    }
+
+    .web-uploader .dnd-area.webuploader-dnd-over {
+        border: 3px dashed #999 !important;
+    }
+    .web-uploader .dnd-area.webuploader-dnd-over .placeholder {
+        border: none;
+    }
+
+    .trad-file-container .web-uploader {
+        margin-top: 0px;
+    }
+    .trad-file-container .web-uploader .placeholder {
+        border: none;
+        text-align: left;
+    }
+    .trad-file-container .web-uploader .placeholder:before {
+        content: "";
+        display: block;
+        position: absolute;
+    }
+
+    .trad-file-container .web-uploader .placeholder .webuploader-pick {
+        margin: 0px;
+    }
+    .trad-file-container .form-group {
+        margin-bottom: 0px;
+    }
+    .trad-file-container .web-uploader .statusBar .info {
+        display: none;
+    }
+
+
+</style>
+
+<div class="{{$viewClass['form-group']}} {{ $class }} trad-file-outer-container">
+
+    <label for="{{$column}}" class="{{$viewClass['label']}} control-label">{!! $label !!}</label>
+
+    <div class="{{$viewClass['field']}} trad-file-container">
+
+        @include('admin::form.error')
+
+        <input name="{{ $name }}" class="file-input" type="hidden" {!! $attributes !!}/>
+
+        <div class="web-uploader {{ $fileType }}">
+            <div class="queueList dnd-area" style="width: 185px;float: left;" >
+                <div class="placeholder">
+                    <div class="file-picker"></div>
+                </div>
+            </div>
+            {{-- 上传图片示例--}}
+            @include('admin::form.upload-img-demo')
+            <div class="statusBar" style="display:none;">
+                <div class="upload-progress progress progress-bar-primary pull-left">
+                    <div class="progress-bar progress-bar-striped active" style="line-height:18px">0%</div>
+                </div>
+                <div class="info"></div>
+                <div class="btns">
+                    <div class="add-file-button"></div>
+                    @if($showUploadBtn)
+                    &nbsp;
+                    <div class="upload-btn btn btn-primary"><i class="feather icon-upload"></i> &nbsp;{{trans('admin.upload')}}</div>
+                    @endif
+                </div>
+            </div>
+        </div>
+
+        @include('admin::form.help-block')
+    </div>
+</div>
+
+<script require="@webuploader" init="{!! $selector !!}">
+    var uploader,
+        newPage,
+        options = {!! $options !!},
+        events = options.events;
+
+    init();
+
+    function init() {
+        var opts = $.extend({
+            selector: $this,
+            addFileButton: $this.find('.add-file-button'),
+            inputSelector: $this.find('.file-input'),
+        }, options);
+
+        opts.upload = $.extend({
+            pick: {
+                id: $this.find('.file-picker'),
+                name: '_file_',
+                label: '<i class="feather icon-folder"><\/i>&nbsp; {!! trans('admin.uploader.add_new_media') !!}'
+            },
+            dnd: $this.find('.dnd-area'),
+            paste: $this.find('.web-uploader')
+        }, opts);
+
+        uploader = Dcat.Uploader(opts);
+        uploader.build();
+        uploader.preview();
+
+        for (var i = 0; i < events.length; i++) {
+            var evt = events[i];
+            if (evt.event && evt.script) {
+                if (evt.once) {
+                    uploader.uploader.once(evt.event, evt.script.bind(uploader))
+                } else {
+                    uploader.uploader.on(evt.event, evt.script.bind(uploader))
+                }
+            }
+        }
+
+        function resize() {
+            setTimeout(function () {
+                if (! uploader) return;
+
+                uploader.refreshButton();
+                resize();
+
+                if (! newPage) {
+                    newPage = 1;
+                    $(document).one('pjax:complete', function () {
+                        uploader = null;
+                    });
+                }
+            }, 250);
+        }
+        resize();
+    }
+</script>

+ 0 - 43
resources/views/distributor/dashboard/author.blade.php

@@ -1,43 +0,0 @@
-<style>
-    .dashboard-title .links {
-        text-align: center;
-        margin-bottom: 2.5rem;
-    }
-    .dashboard-title .links > a {
-        padding: 0 25px;
-        font-size: 12px;
-        font-weight: 600;
-        letter-spacing: .1rem;
-        text-decoration: none;
-        text-transform: uppercase;
-        color: #fff;
-    }
-    .dashboard-title h1 {
-        font-weight: 200;
-        font-size: 2.5rem;
-    }
-    .dashboard-title .avatar {
-        background: #fff;
-        border: 2px solid #fff;
-        width: 70px;
-        height: 70px;
-    }
-</style>
-
-<div class="dashboard-title card bg-primary">
-    <div class="card-body">
-        <div class="text-center ">
-            <img class="avatar img-circle shadow mt-1" src="https://m.saishiyun.net/imgpic/work-photo.png">
-            <div class="text-center mb-1">
-                <div class="mb-1 mt-1 text-white">微信号:Q3664839</div>
-                <h1 class="mb-1 mt-1 text-white">杨光</h1>
-                <div class="links">
-                    <a href="https://www.saishiyun.net" target="_blank">个人博客</a>
-                    {{--<a href="http://www.dcatadmin.com/" id="doc-link" target="_blank">{{ __('admin.documentation') }}</a>
-                    <a href="http://www.dcatadmin.com/" id="demo-link" target="_blank">{{ __('admin.extensions') }}</a>
-                    <a href="https://jqhph.github.io/dcat-admin/demo.html" id="demo-link" target="_blank"></a>--}}
-                </div>
-            </div>
-        </div>
-    </div>
-</div>

+ 0 - 15
resources/views/distributor/dashboard/dependencies.blade.php

@@ -1,15 +0,0 @@
-<style>
-    .table tr:first-child td {
-        border-top: 0;
-    }
-</style>
-<div class="table-responsive">
-    <table class="table">
-        @foreach($dependencies as $dependency => $version)
-            <tr>
-                <td width="240px" class="bold text-80">{{ $dependency }}</td>
-                <td><span class="label bg-primary">{{ $version }}</span></td>
-            </tr>
-        @endforeach
-    </table>
-</div>

+ 0 - 11
resources/views/distributor/dashboard/environment.blade.php

@@ -1,11 +0,0 @@
-<div class="table-responsive">
-    <table class="table">
-
-        @foreach($envs as $env)
-            <tr>
-                <td width="120px" class="bold text-80">{{ $env['name'] }}</td>
-                <td>{{ $env['value'] }}</td>
-            </tr>
-        @endforeach
-    </table>
-</div>

+ 0 - 52
resources/views/distributor/dashboard/extensions.blade.php

@@ -1,52 +0,0 @@
-<style>
-    .ext-icon {
-        color: rgba(0,0,0,0.5);
-        margin-left: 10px;
-    }
-    .installed {
-        color: #00a65a;
-        margin-right: 15px;
-        font-size:20px;
-    }
-</style>
-<ul class="products-list product-list-in-box" id="extension-box" style="margin-top:10px;min-height: 100px">
-    @foreach($extensions as $extension)
-        <li class="item hidden">
-            <div class="product-img">
-                <i class="{{$extension['icon']}} fa-2x ext-icon"></i>
-            </div>
-            <div class="product-info" data-key="{{$extension['key']}}">
-                <a href="{{ $extension['link'] }}" target="_blank" class="">
-                    {{ $extension['name'] }}
-                </a>
-                @if($extension['installed'])
-                    <span class="pull-right installed"><i class="ti-check"></i></span>
-                @endif
-            </div>
-        </li>
-@endforeach
-
-</ul>
-
-<div class="box-footer text-center">
-    <a href="https://github.com/jqhph/dcat-admin#%E6%89%A9%E5%B1%95" target="_blank" class="uppercase">View All Extensions</a>
-</div>
-
-<script>Dcat.ready(function () {
-    // var $box = $('#extension-box');
-    // $box.loading();
-    //
-    // $.ajax({
-    //     url: 'https://jqhph.github.io/dcat-admin/extra/extensions.html',
-    //     success: function (response) {
-    //         $box.loading(false);
-    //
-    //         $box.html(response);
-    //     },
-    //     error: function () {
-    //         $box.loading(false);
-    //
-    //         $box.find('.item').removeClass('hidden');
-    //     }
-    // });
-})</script>

+ 0 - 37
resources/views/distributor/dashboard/title.blade.php

@@ -1,37 +0,0 @@
-<style>
-    .dashboard-title .links {
-        text-align: center;
-        margin-bottom: 2.5rem;
-    }
-    .dashboard-title .links > a {
-        padding: 0 25px;
-        font-size: 12px;
-        font-weight: 600;
-        letter-spacing: .1rem;
-        text-decoration: none;
-        text-transform: uppercase;
-        color: #fff;
-    }
-    .dashboard-title h1 {
-        font-weight: 200;
-        font-size: 2.5rem;
-    }
-    .dashboard-title .avatar {
-        background: #fff;
-        border: 2px solid #fff;
-        width: 70px;
-        height: 70px;
-    }
-</style>
-
-<div class="dashboard-title card bg-primary">
-    <div class="card-body">
-        <div class="text-center ">
-
-            <div class="text-center mb-1">
-                <h1 class="mb-3 mt-2 text-white">  Welcome to Mietubl Online Marketing System </h1>
-
-            </div>
-        </div>
-    </div>
-</div>

+ 0 - 27
resources/views/distributor/filter/between-datetime.blade.php

@@ -1,27 +0,0 @@
-<div class="filter-input col-sm-{{ $width }}"  style="{!! $style !!}">
-    <div class="form-group">
-        <div class="input-group input-group-sm">
-
-            <div class="input-group-prepend">
-                <span class="input-group-text bg-white text-capitalize"><b>{!! $label !!}</b>&nbsp;<i class="feather icon-calendar"></i></span>
-            </div>
-
-            <input autocomplete="off" type="text" class="form-control" id="{{$id['start']}}" placeholder="{{$label}}" name="{{$name['start']}}" value="{{ request($name['start'], \Illuminate\Support\Arr::get($value, 'start')) }}">
-            <span class="input-group-addon" style="border-left: 0; border-right: 0;">To</span>
-            <input autocomplete="off" type="text" class="form-control" id="{{$id['end']}}" placeholder="{{$label}}" name="{{$name['end']}}" value="{{ request($name['end'], \Illuminate\Support\Arr::get($value, 'end')) }}">
-        </div>
-    </div>
-</div>
-
-<script require="@moment,@bootstrap-datetimepicker">
-    var options = {!! admin_javascript_json($dateOptions) !!};
-
-    $('#{{ $id['start'] }}').datetimepicker(options);
-    $('#{{ $id['end'] }}').datetimepicker($.extend(options, {useCurrent: false}));
-    $("#{{ $id['start'] }}").on("dp.change", function (e) {
-        $('#{{ $id['end'] }}').data("DateTimePicker").minDate(e.date);
-    });
-    $("#{{ $id['end'] }}").on("dp.change", function (e) {
-        $('#{{ $id['start'] }}').data("DateTimePicker").maxDate(e.date);
-    });
-</script>

+ 0 - 13
resources/views/distributor/filter/between.blade.php

@@ -1,13 +0,0 @@
-<div class="filter-input col-sm-{{ $width }} "  style="{!! $style !!}">
-    <div class="form-group" >
-        <div class="input-group input-group-sm">
-            <div class="input-group-prepend">
-                <span class="input-group-text text-capitalize bg-white"><b>{!! $label !!}</b></span>
-            </div>
-
-            <input type="text" class="form-control" placeholder="{{$label}}" name="{{$name['start']}}" value="{{ request($name['start'], \Illuminate\Support\Arr::get($value, 'start')) }}">
-            <span class="input-group-addon" style="border-left: 0; border-right: 0;">To</span>
-            <input type="text" class="form-control" placeholder="{{$label}}" name="{{$name['end']}}" value="{{ request($name['end'], \Illuminate\Support\Arr::get($value, 'end')) }}">
-        </div>
-    </div>
-</div>

+ 0 - 24
resources/views/distributor/filter/button.blade.php

@@ -1,24 +0,0 @@
-<div class="btn-group filter-button-group dropdown" style="margin-right:3px">
-    <button
-            class="btn btn-primary {{ $btn_class }}"
-            @if($only_scopes)data-toggle="dropdown"@endif
-            @if($scopes->isNotEmpty()) style="border-right: 0" @endif
-    >
-        <i class="feather icon-filter"></i>@if($filter_text)<span class="d-none d-sm-inline">&nbsp;&nbsp;{{ trans('admin.filter') }}</span>@endif
-
-        <span class="filter-count">@if($valueCount) &nbsp;({!! $valueCount !!}) @endif</span>
-    </button>
-    @if($scopes->isNotEmpty())
-        <ul class="dropdown-menu" role="menu">
-            @foreach($scopes as $scope)
-                {!! $scope->render() !!}
-            @endforeach
-            <li role="separator" class="dropdown-divider"></li>
-            <li class="dropdown-item"><a href="{{ $url_no_scopes }}">{{ trans('admin.cancel') }}</a></li>
-        </ul>
-        <button type="button" class="btn btn-primary" data-toggle="dropdown" style="border-left: 0">
-            @if($current_label) <span>{{ $current_label }}&nbsp;</span>@endif <i class="feather icon-chevron-down"></i>
-        </button>
-    @endif
-</div>
-

+ 0 - 19
resources/views/distributor/filter/checkbox.blade.php

@@ -1,19 +0,0 @@
-<div class="input-group input-group-sm">
-    @php
-        $checkbox = new \Dcat\Admin\Widgets\Checkbox($name.'[]', $options);
-        if ($inline) $checkbox->inline();
-
-        $checkbox->check(request($name, is_null($value) ? [] : $value))->circle(false);
-
-    @endphp
-    @if($showLabel)
-        <div class="pull-left text-capitalize" style="margin-top: 6px;margin-right: 15px;">
-            <b>{{ $label }}</b>
-        </div>
-        <div class="pull-left">
-            {!! $checkbox !!}
-        </div>
-    @else
-        {!! $checkbox !!}
-    @endif
-</div>

+ 0 - 33
resources/views/distributor/filter/container.blade.php

@@ -1,33 +0,0 @@
-<style>
-    .filter-box {
-        border-top: 1px solid #eee;
-        margin-top: 10px;
-        margin-bottom: -.5rem!important;
-        padding: 1.8rem;
-    }
-</style>
-
-<div class="filter-box shadow-0 card mb-0 {{ $expand ? '' : 'd-none' }} {{$containerClass}}">
-    <div class="card-body" style="{!! $style !!}"  id="{{ $filterID }}">
-        <form action="{!! $action !!}" class="form-horizontal grid-filter-form" pjax-container method="get">
-            <div class="row mb-0">
-                @foreach($layout->columns() as $column)
-                    @foreach($column->filters() as $filter)
-                        {!! $filter->render() !!}
-                    @endforeach
-                @endforeach
-
-                <button class="btn btn-primary btn-sm btn-mini submit" style="margin-left: 12px">
-                    <i class="feather icon-search"></i><span class="d-none d-sm-inline">&nbsp;&nbsp;{{ trans('admin.search') }}</span>
-                </button>
-
-                @if(!$disableResetButton)
-                <a style="margin-left: 6px" href="{!! $action !!}" class="reset btn btn-white btn-sm ">
-                    <i class="feather icon-rotate-ccw"></i><span class="d-none d-sm-inline">&nbsp;&nbsp;{{ trans('admin.reset') }}</span>
-                </a>
-                @endif
-            </div>
-
-        </form>
-    </div>
-</div>

+ 0 - 24
resources/views/distributor/filter/datetime.blade.php

@@ -1,24 +0,0 @@
-<div class="input-group input-group-sm">
-    @if($group)
-        <div class="input-group-prepend dropdown">
-            <a class="filter-group input-group-text bg-white dropdown-toggle" data-toggle="dropdown">
-                <span class="{{ $group_name }}-label">{{ $default['label'] }}&nbsp; </span>
-            </a>
-            <input type="hidden" name="{{ $id }}_group" class="{{ $group_name }}-operation" value="{{ request($id.'_group', 0) }}" />
-            <ul class="dropdown-menu {{ $group_name }}">
-                @foreach($group as $index => $item)
-                    <li class="dropdown-item"><a href="#" data-index="{{ $index }}"> {{ $item['label'] }} </a></li>
-                @endforeach
-            </ul>
-        </div>
-    @endif
-
-    <div class="input-group-prepend">
-        <span class="input-group-text bg-white text-capitalize"><b>{!! $label !!}</b>&nbsp;<i class="feather icon-calendar"></i></span>
-    </div>
-    <input class="form-control" id="{{$id}}" autocomplete="off" placeholder="{{$label}}" name="{{$name}}" value="{{ request($name, $value) }}">
-</div>
-
-<script require="@moment,@bootstrap-datetimepicker">
-    $('#{{ $id }}').datetimepicker({!! admin_javascript_json($options) !!});
-</script>

+ 0 - 3
resources/views/distributor/filter/gt.blade.php

@@ -1,3 +0,0 @@
-<div class="filter-input col-sm-{{ $width }} " >
-    <div class="form-group">{!! $presenter() !!}</div>
-</div>

+ 0 - 3
resources/views/distributor/filter/lt.blade.php

@@ -1,3 +0,0 @@
-<div class="filter-input col-sm-{{ $width }} " >
-    <div class="form-group">{!! $presenter() !!}</div>
-</div>

+ 0 - 31
resources/views/distributor/filter/multipleselect.blade.php

@@ -1,31 +0,0 @@
-<div class="input-group input-group-sm">
-    <div class="input-group-prepend">
-        <span class="input-group-text bg-white text-capitalize"><b>{!! $label !!}</b></span>
-    </div>
-
-    <select class="form-control {{ $class }}" name="{{$name}}[]" multiple style="width: 100%;" data-value="{{implode(',',(array) $value)}}">
-        @foreach($options as $select => $option)
-            <option value="{{$select}}" {{ in_array((string)$select, (array) $value)  ?'selected':'' }}>{{$option}}</option>
-        @endforeach
-    </select>
-</div>
-
-@include('admin::scripts.select')
-
-<script require="@select2?lang={{ config('app.locale') === 'en' ? '' : str_replace('_', '-', config('app.locale')) }}">
-    var configs = {!! admin_javascript_json($configs) !!};
-
-    @yield('admin.select-ajax')
-
-    @if(isset($remote))
-    $.ajax({!! admin_javascript_json($remote['ajaxOptions']) !!}).done(function(data) {
-        $("{{ $selector }}").select2($.extend({!! admin_javascript_json($configs) !!}, {
-            data: data,
-        })).val({!! json_encode($remote['values']) !!}).trigger("change");
-    });
-    @else
-    $("{!! $selector !!}").select2(configs);
-    @endif
-</script>
-
-@yield('admin.select-load')

+ 0 - 19
resources/views/distributor/filter/radio.blade.php

@@ -1,19 +0,0 @@
-<div class="input-group input-group-sm">
-    @php
-        $radio = new \Dcat\Admin\Widgets\Radio($name, $options);
-        if ($inline) $radio->inline();
-
-        $radio->check(request($name, is_null($value) ? [] : $value));
-
-    @endphp
-    @if($showLabel)
-        <div class="pull-left text-capitalize" style="margin-top: 6px;margin-right: 15px;">
-            <b>{{ $label }}</b>
-        </div>
-        <div class="pull-left">
-            {!! $radio !!}
-        </div>
-    @else
-        {!! $radio !!}
-    @endif
-</div>

+ 0 - 26
resources/views/distributor/filter/right-side-container.blade.php

@@ -1,26 +0,0 @@
-<div class="hidden">
-    <div class="filter-box right-side-filter-container" style="{!! $style !!}"  id="{{ $filterID }}">
-        <form action="{!! $action !!}" class="form-horizontal grid-filter-form" pjax-container method="get">
-            <div class="mb-1" style="height: 55px">
-                <div class="p-1 position-fixed d-flex justify-content-between header">
-                    <div>
-                        <button type="submit" class=" btn btn-sm btn-primary submit">
-                            <i class="feather icon-search"></i> &nbsp;{{ __('admin.search') }}
-                        </button>&nbsp;
-                        @if(!$disableResetButton)
-                            <a href="{!! $action !!}" class="reset btn btn-sm btn-white">
-                                <i class="feather icon-rotate-ccw"></i> &nbsp;{{ __('admin.reset') }}
-                            </a>
-                        @endif
-                    </div>
-                </div>
-            </div>
-
-            @foreach($layout->columns() as $column)
-                @foreach($column->filters() as $filter)
-                    {!! $filter->render() !!}
-                @endforeach
-            @endforeach
-        </form>
-    </div>
-</div>

+ 0 - 30
resources/views/distributor/filter/select.blade.php

@@ -1,30 +0,0 @@
-<div class="input-group input-group-sm">
-    <div class="input-group-prepend">
-        <span class="input-group-text bg-white text-capitalize"><b>{!! $label !!}</b></span>
-    </div>
-
-    <select class="form-control {{ $class }}" name="{{$name}}" data-value="{{ $value }}" style="width: 100%;">
-        <option value=""></option>
-        @foreach($options as $select => $option)
-            <option value="{{$select}}" {{ Dcat\Admin\Support\Helper::equal($select, $value) ?'selected':'' }}>{{$option}}</option>
-        @endforeach
-    </select>
-</div>
-
-@include('admin::scripts.select')
-
-<script require="@select2?lang={{ config('app.locale') === 'en' ? '' : str_replace('_', '-', config('app.locale')) }}">
-    var configs = {!! admin_javascript_json($configs) !!};
-
-    @yield('admin.select-ajax')
-
-    @if(isset($remote))
-    $.ajax({!! admin_javascript_json($remote['ajaxOptions']) !!}).done(function(data) {
-        $("{{ $selector }}").select2($.extend({!! admin_javascript_json($configs) !!}, {
-            data: data,
-        })).val({!! json_encode($remote['values']) !!}).trigger("change");
-    });
-    @else
-    $("{!! $selector !!}").select2(configs);
-    @endif
-</script>

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov