Sfoglia il codice sorgente

供应商时修改

moshaorui 5 mesi fa
parent
commit
41dffc84e6

+ 1 - 1
app/Admin/Controllers/DistAdminUserController.php

@@ -158,7 +158,7 @@ class DistAdminUserController extends AdminController
                         'name' => 'Default Category',
                         'order' => 0,
                         'enabled' => 1,
-                        'dist_user_id'=>$newId,
+                        'dist_id'=>$newId,
                     ]);
                 }
             });

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

@@ -0,0 +1,95 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+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
+{
+    /**
+     * page index
+     */
+    public function index(Content $content)
+    {
+        return $content
+            ->header('Appearance')
+            ->description('all')
+            ->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->column('id')->sortable();
+            $grid->column('title');
+            $grid->column('cover_image')->display(function ($image) {
+                // 开始生成 HTML
+                $dataImages = [$image];
+                return CommonHelper::displayImage($dataImages,100);
+            });
+            $grid->column('order')->orderable();
+            $grid->column('enabled')->switch();
+            $grid->column('created_at');
+            $grid->column('updated_at')->sortable();
+
+            $grid->filter(function (Grid\Filter $filter) {
+                $filter->equal('title');
+            });
+        });
+    }
+
+    /**
+     * 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('cover_image')->display(function ($image) {
+                // 开始生成 HTML
+                $dataImages = [$image];
+                return CommonHelper::displayImage($dataImages,100);
+            });
+            $show->field('describe');
+            $show->field('enabled')->using(config('dictionary.enabled'));
+            $show->field('created_at');
+            $show->field('updated_at');
+        });
+    }
+
+    /**
+     * 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('cover_image');
+            $form->text('describe');
+            $form->switch('enabled')->default(1);
+            $form->display('created_at');
+            $form->display('updated_at');
+        });
+    }
+}

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

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

+ 1 - 0
app/Admin/routes.php

@@ -30,4 +30,5 @@ Route::group([
     //询价管理
     $router->resource('dist-inquiry', 'DistInquiryController');
     //外观管理
+    $router->resource('dist-appearance', 'DistAppearanceController');
 });

+ 3 - 3
app/Models/DistAdminUserInfo.php → app/Models/DistAdminDistributor.php

@@ -5,13 +5,13 @@ namespace App\Models;
 use Dcat\Admin\Traits\HasDateTimeFormatter;
 use Illuminate\Database\Eloquent\Model;
 
-class DistAdminUserInfo extends Model
+class DistAdminDistributor extends Model
 {
 	use HasDateTimeFormatter;
-    protected $table = 'dist_admin_users_info';
+    protected $table = 'dist_admin_distributor';
 
     public function user()
     {
-        return $this->belongsTo(DistAdminUser::class, 'id', 'dist_user_id');
+        return $this->hasMany(DistAdminUser::class, 'dist_id', 'id');
     }
 }

+ 1 - 1
app/Models/DistAdminUser.php

@@ -16,6 +16,6 @@ class DistAdminUser extends Model
      */
     public function info()
     {
-        return $this->hasOne(DistAdminUserInfo::class, 'dist_user_id', 'id');
+        return $this->hasOne(DistAdminDistributor::class, 'id', 'dist_id');
     }
 }

+ 30 - 0
app/Models/DistAppearance.php

@@ -0,0 +1,30 @@
+<?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 implements Sortable
+{
+	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,    // 创建时自动排序
+    ];
+
+}

+ 334 - 0
dcat_admin_ide_helper.php

@@ -0,0 +1,334 @@
+<?php
+
+/**
+ * A helper file for Dcat Admin, to provide autocomplete information to your IDE
+ *
+ * This file should not be included in your code, only analyzed by your IDE!
+ *
+ * @author jqh <841324345@qq.com>
+ */
+namespace Dcat\Admin {
+    use Illuminate\Support\Collection;
+
+    /**
+     * @property Grid\Column|Collection width
+     * @property Grid\Column|Collection id
+     * @property Grid\Column|Collection name
+     * @property Grid\Column|Collection type
+     * @property Grid\Column|Collection version
+     * @property Grid\Column|Collection detail
+     * @property Grid\Column|Collection created_at
+     * @property Grid\Column|Collection updated_at
+     * @property Grid\Column|Collection is_enabled
+     * @property Grid\Column|Collection parent_id
+     * @property Grid\Column|Collection order
+     * @property Grid\Column|Collection icon
+     * @property Grid\Column|Collection uri
+     * @property Grid\Column|Collection extension
+     * @property Grid\Column|Collection permission_id
+     * @property Grid\Column|Collection menu_id
+     * @property Grid\Column|Collection slug
+     * @property Grid\Column|Collection http_method
+     * @property Grid\Column|Collection http_path
+     * @property Grid\Column|Collection role_id
+     * @property Grid\Column|Collection user_id
+     * @property Grid\Column|Collection value
+     * @property Grid\Column|Collection username
+     * @property Grid\Column|Collection password
+     * @property Grid\Column|Collection avatar
+     * @property Grid\Column|Collection remember_token
+     * @property Grid\Column|Collection keywords
+     * @property Grid\Column|Collection sku
+     * @property Grid\Column|Collection category_id
+     * @property Grid\Column|Collection issuance_date
+     * @property Grid\Column|Collection enabled
+     * @property Grid\Column|Collection content
+     * @property Grid\Column|Collection parameters
+     * @property Grid\Column|Collection is_pinned
+     * @property Grid\Column|Collection parameter_id
+     * @property Grid\Column|Collection image_url
+     * @property Grid\Column|Collection product_id
+     * @property Grid\Column|Collection remark
+     * @property Grid\Column|Collection video_url
+     * @property Grid\Column|Collection cover_image
+     * @property Grid\Column|Collection language
+     * @property Grid\Column|Collection dist_user_id
+     * @property Grid\Column|Collection country
+     * @property Grid\Column|Collection contact_number
+     * @property Grid\Column|Collection service_hotline
+     * @property Grid\Column|Collection whats_app
+     * @property Grid\Column|Collection facebook
+     * @property Grid\Column|Collection instagram
+     * @property Grid\Column|Collection youtube
+     * @property Grid\Column|Collection linkedin
+     * @property Grid\Column|Collection tiktok
+     * @property Grid\Column|Collection site_name
+     * @property Grid\Column|Collection second_level_domain
+     * @property Grid\Column|Collection company_address
+     * @property Grid\Column|Collection describe
+     * @property Grid\Column|Collection order_noumber
+     * @property Grid\Column|Collection company_name
+     * @property Grid\Column|Collection customer_name
+     * @property Grid\Column|Collection email
+     * @property Grid\Column|Collection consulting_products
+     * @property Grid\Column|Collection freight_forwarder
+     * @property Grid\Column|Collection business_model
+     * @property Grid\Column|Collection ip_address
+     * @property Grid\Column|Collection status
+     * @property Grid\Column|Collection allocate_time
+     * @property Grid\Column|Collection token
+     * @property Grid\Column|Collection tokenable_type
+     * @property Grid\Column|Collection tokenable_id
+     * @property Grid\Column|Collection abilities
+     * @property Grid\Column|Collection last_used_at
+     * @property Grid\Column|Collection expires_at
+     *
+     * @method Grid\Column|Collection width(string $label = null)
+     * @method Grid\Column|Collection id(string $label = null)
+     * @method Grid\Column|Collection name(string $label = null)
+     * @method Grid\Column|Collection type(string $label = null)
+     * @method Grid\Column|Collection version(string $label = null)
+     * @method Grid\Column|Collection detail(string $label = null)
+     * @method Grid\Column|Collection created_at(string $label = null)
+     * @method Grid\Column|Collection updated_at(string $label = null)
+     * @method Grid\Column|Collection is_enabled(string $label = null)
+     * @method Grid\Column|Collection parent_id(string $label = null)
+     * @method Grid\Column|Collection order(string $label = null)
+     * @method Grid\Column|Collection icon(string $label = null)
+     * @method Grid\Column|Collection uri(string $label = null)
+     * @method Grid\Column|Collection extension(string $label = null)
+     * @method Grid\Column|Collection permission_id(string $label = null)
+     * @method Grid\Column|Collection menu_id(string $label = null)
+     * @method Grid\Column|Collection slug(string $label = null)
+     * @method Grid\Column|Collection http_method(string $label = null)
+     * @method Grid\Column|Collection http_path(string $label = null)
+     * @method Grid\Column|Collection role_id(string $label = null)
+     * @method Grid\Column|Collection user_id(string $label = null)
+     * @method Grid\Column|Collection value(string $label = null)
+     * @method Grid\Column|Collection username(string $label = null)
+     * @method Grid\Column|Collection password(string $label = null)
+     * @method Grid\Column|Collection avatar(string $label = null)
+     * @method Grid\Column|Collection remember_token(string $label = null)
+     * @method Grid\Column|Collection keywords(string $label = null)
+     * @method Grid\Column|Collection sku(string $label = null)
+     * @method Grid\Column|Collection category_id(string $label = null)
+     * @method Grid\Column|Collection issuance_date(string $label = null)
+     * @method Grid\Column|Collection enabled(string $label = null)
+     * @method Grid\Column|Collection content(string $label = null)
+     * @method Grid\Column|Collection parameters(string $label = null)
+     * @method Grid\Column|Collection is_pinned(string $label = null)
+     * @method Grid\Column|Collection parameter_id(string $label = null)
+     * @method Grid\Column|Collection image_url(string $label = null)
+     * @method Grid\Column|Collection product_id(string $label = null)
+     * @method Grid\Column|Collection remark(string $label = null)
+     * @method Grid\Column|Collection video_url(string $label = null)
+     * @method Grid\Column|Collection cover_image(string $label = null)
+     * @method Grid\Column|Collection language(string $label = null)
+     * @method Grid\Column|Collection dist_user_id(string $label = null)
+     * @method Grid\Column|Collection country(string $label = null)
+     * @method Grid\Column|Collection contact_number(string $label = null)
+     * @method Grid\Column|Collection service_hotline(string $label = null)
+     * @method Grid\Column|Collection whats_app(string $label = null)
+     * @method Grid\Column|Collection facebook(string $label = null)
+     * @method Grid\Column|Collection instagram(string $label = null)
+     * @method Grid\Column|Collection youtube(string $label = null)
+     * @method Grid\Column|Collection linkedin(string $label = null)
+     * @method Grid\Column|Collection tiktok(string $label = null)
+     * @method Grid\Column|Collection site_name(string $label = null)
+     * @method Grid\Column|Collection second_level_domain(string $label = null)
+     * @method Grid\Column|Collection company_address(string $label = null)
+     * @method Grid\Column|Collection describe(string $label = null)
+     * @method Grid\Column|Collection order_noumber(string $label = null)
+     * @method Grid\Column|Collection company_name(string $label = null)
+     * @method Grid\Column|Collection customer_name(string $label = null)
+     * @method Grid\Column|Collection email(string $label = null)
+     * @method Grid\Column|Collection consulting_products(string $label = null)
+     * @method Grid\Column|Collection freight_forwarder(string $label = null)
+     * @method Grid\Column|Collection business_model(string $label = null)
+     * @method Grid\Column|Collection ip_address(string $label = null)
+     * @method Grid\Column|Collection status(string $label = null)
+     * @method Grid\Column|Collection allocate_time(string $label = null)
+     * @method Grid\Column|Collection token(string $label = null)
+     * @method Grid\Column|Collection tokenable_type(string $label = null)
+     * @method Grid\Column|Collection tokenable_id(string $label = null)
+     * @method Grid\Column|Collection abilities(string $label = null)
+     * @method Grid\Column|Collection last_used_at(string $label = null)
+     * @method Grid\Column|Collection expires_at(string $label = null)
+     */
+    class Grid {}
+
+    class MiniGrid extends Grid {}
+
+    /**
+     * @property Show\Field|Collection width
+     * @property Show\Field|Collection id
+     * @property Show\Field|Collection name
+     * @property Show\Field|Collection type
+     * @property Show\Field|Collection version
+     * @property Show\Field|Collection detail
+     * @property Show\Field|Collection created_at
+     * @property Show\Field|Collection updated_at
+     * @property Show\Field|Collection is_enabled
+     * @property Show\Field|Collection parent_id
+     * @property Show\Field|Collection order
+     * @property Show\Field|Collection icon
+     * @property Show\Field|Collection uri
+     * @property Show\Field|Collection extension
+     * @property Show\Field|Collection permission_id
+     * @property Show\Field|Collection menu_id
+     * @property Show\Field|Collection slug
+     * @property Show\Field|Collection http_method
+     * @property Show\Field|Collection http_path
+     * @property Show\Field|Collection role_id
+     * @property Show\Field|Collection user_id
+     * @property Show\Field|Collection value
+     * @property Show\Field|Collection username
+     * @property Show\Field|Collection password
+     * @property Show\Field|Collection avatar
+     * @property Show\Field|Collection remember_token
+     * @property Show\Field|Collection keywords
+     * @property Show\Field|Collection sku
+     * @property Show\Field|Collection category_id
+     * @property Show\Field|Collection issuance_date
+     * @property Show\Field|Collection enabled
+     * @property Show\Field|Collection content
+     * @property Show\Field|Collection parameters
+     * @property Show\Field|Collection is_pinned
+     * @property Show\Field|Collection parameter_id
+     * @property Show\Field|Collection image_url
+     * @property Show\Field|Collection product_id
+     * @property Show\Field|Collection remark
+     * @property Show\Field|Collection video_url
+     * @property Show\Field|Collection cover_image
+     * @property Show\Field|Collection language
+     * @property Show\Field|Collection dist_user_id
+     * @property Show\Field|Collection country
+     * @property Show\Field|Collection contact_number
+     * @property Show\Field|Collection service_hotline
+     * @property Show\Field|Collection whats_app
+     * @property Show\Field|Collection facebook
+     * @property Show\Field|Collection instagram
+     * @property Show\Field|Collection youtube
+     * @property Show\Field|Collection linkedin
+     * @property Show\Field|Collection tiktok
+     * @property Show\Field|Collection site_name
+     * @property Show\Field|Collection second_level_domain
+     * @property Show\Field|Collection company_address
+     * @property Show\Field|Collection describe
+     * @property Show\Field|Collection order_noumber
+     * @property Show\Field|Collection company_name
+     * @property Show\Field|Collection customer_name
+     * @property Show\Field|Collection email
+     * @property Show\Field|Collection consulting_products
+     * @property Show\Field|Collection freight_forwarder
+     * @property Show\Field|Collection business_model
+     * @property Show\Field|Collection ip_address
+     * @property Show\Field|Collection status
+     * @property Show\Field|Collection allocate_time
+     * @property Show\Field|Collection token
+     * @property Show\Field|Collection tokenable_type
+     * @property Show\Field|Collection tokenable_id
+     * @property Show\Field|Collection abilities
+     * @property Show\Field|Collection last_used_at
+     * @property Show\Field|Collection expires_at
+     *
+     * @method Show\Field|Collection width(string $label = null)
+     * @method Show\Field|Collection id(string $label = null)
+     * @method Show\Field|Collection name(string $label = null)
+     * @method Show\Field|Collection type(string $label = null)
+     * @method Show\Field|Collection version(string $label = null)
+     * @method Show\Field|Collection detail(string $label = null)
+     * @method Show\Field|Collection created_at(string $label = null)
+     * @method Show\Field|Collection updated_at(string $label = null)
+     * @method Show\Field|Collection is_enabled(string $label = null)
+     * @method Show\Field|Collection parent_id(string $label = null)
+     * @method Show\Field|Collection order(string $label = null)
+     * @method Show\Field|Collection icon(string $label = null)
+     * @method Show\Field|Collection uri(string $label = null)
+     * @method Show\Field|Collection extension(string $label = null)
+     * @method Show\Field|Collection permission_id(string $label = null)
+     * @method Show\Field|Collection menu_id(string $label = null)
+     * @method Show\Field|Collection slug(string $label = null)
+     * @method Show\Field|Collection http_method(string $label = null)
+     * @method Show\Field|Collection http_path(string $label = null)
+     * @method Show\Field|Collection role_id(string $label = null)
+     * @method Show\Field|Collection user_id(string $label = null)
+     * @method Show\Field|Collection value(string $label = null)
+     * @method Show\Field|Collection username(string $label = null)
+     * @method Show\Field|Collection password(string $label = null)
+     * @method Show\Field|Collection avatar(string $label = null)
+     * @method Show\Field|Collection remember_token(string $label = null)
+     * @method Show\Field|Collection keywords(string $label = null)
+     * @method Show\Field|Collection sku(string $label = null)
+     * @method Show\Field|Collection category_id(string $label = null)
+     * @method Show\Field|Collection issuance_date(string $label = null)
+     * @method Show\Field|Collection enabled(string $label = null)
+     * @method Show\Field|Collection content(string $label = null)
+     * @method Show\Field|Collection parameters(string $label = null)
+     * @method Show\Field|Collection is_pinned(string $label = null)
+     * @method Show\Field|Collection parameter_id(string $label = null)
+     * @method Show\Field|Collection image_url(string $label = null)
+     * @method Show\Field|Collection product_id(string $label = null)
+     * @method Show\Field|Collection remark(string $label = null)
+     * @method Show\Field|Collection video_url(string $label = null)
+     * @method Show\Field|Collection cover_image(string $label = null)
+     * @method Show\Field|Collection language(string $label = null)
+     * @method Show\Field|Collection dist_user_id(string $label = null)
+     * @method Show\Field|Collection country(string $label = null)
+     * @method Show\Field|Collection contact_number(string $label = null)
+     * @method Show\Field|Collection service_hotline(string $label = null)
+     * @method Show\Field|Collection whats_app(string $label = null)
+     * @method Show\Field|Collection facebook(string $label = null)
+     * @method Show\Field|Collection instagram(string $label = null)
+     * @method Show\Field|Collection youtube(string $label = null)
+     * @method Show\Field|Collection linkedin(string $label = null)
+     * @method Show\Field|Collection tiktok(string $label = null)
+     * @method Show\Field|Collection site_name(string $label = null)
+     * @method Show\Field|Collection second_level_domain(string $label = null)
+     * @method Show\Field|Collection company_address(string $label = null)
+     * @method Show\Field|Collection describe(string $label = null)
+     * @method Show\Field|Collection order_noumber(string $label = null)
+     * @method Show\Field|Collection company_name(string $label = null)
+     * @method Show\Field|Collection customer_name(string $label = null)
+     * @method Show\Field|Collection email(string $label = null)
+     * @method Show\Field|Collection consulting_products(string $label = null)
+     * @method Show\Field|Collection freight_forwarder(string $label = null)
+     * @method Show\Field|Collection business_model(string $label = null)
+     * @method Show\Field|Collection ip_address(string $label = null)
+     * @method Show\Field|Collection status(string $label = null)
+     * @method Show\Field|Collection allocate_time(string $label = null)
+     * @method Show\Field|Collection token(string $label = null)
+     * @method Show\Field|Collection tokenable_type(string $label = null)
+     * @method Show\Field|Collection tokenable_id(string $label = null)
+     * @method Show\Field|Collection abilities(string $label = null)
+     * @method Show\Field|Collection last_used_at(string $label = null)
+     * @method Show\Field|Collection expires_at(string $label = null)
+     */
+    class Show {}
+
+    /**
+     * @method \Dcat\Admin\Form\Extend\Distpicker\Form\Distpicker distpicker(...$params)
+     * @method \Dcat\Admin\Form\Extend\Diyforms\Form\DiyForm diyForm(...$params)
+     */
+    class Form {}
+
+}
+
+namespace Dcat\Admin\Grid {
+    /**
+     * @method $this distpicker(...$params)
+     */
+    class Column {}
+
+    /**
+     * @method \Dcat\Admin\Form\Extend\Distpicker\Filter\DistpickerFilter distpicker(...$params)
+     */
+    class Filter {}
+}
+
+namespace Dcat\Admin\Show {
+    /**
+     * @method $this diyForm(...$params)
+     */
+    class Field {}
+}

+ 16 - 0
lang/en/dist-appearance.php

@@ -0,0 +1,16 @@
+<?php 
+return [
+    'labels' => [
+        'DistAppearance' => 'DistAppearance',
+        'dist-appearance' => 'DistAppearance',
+    ],
+    'fields' => [
+        'title' => 'title',
+        'cover_image' => 'cover_image',
+        'describe' => 'describe',
+        'order' => 'order',
+        'enabled' => 'enabled',
+    ],
+    'options' => [
+    ],
+];