From 0faeaeb324811b129cfa46ba703a284d738050b2 Mon Sep 17 00:00:00 2001 From: hant Date: Sun, 22 Jun 2025 19:49:53 +0800 Subject: [PATCH] init --- application/admin/controller/Attributes.php | 37 ++++++++ application/admin/controller/Brands.php | 37 ++++++++ application/admin/controller/Cars.php | 37 ++++++++ application/admin/controller/Series.php | 37 ++++++++ application/admin/lang/zh-cn/brands.php | 5 + .../admin/lang/zh-cn/car/attributes.php | 8 ++ application/admin/lang/zh-cn/cars.php | 12 +++ application/admin/lang/zh-cn/series.php | 5 + application/admin/model/Brands.php | 40 ++++++++ application/admin/model/Cars.php | 40 ++++++++ application/admin/model/Series.php | 40 ++++++++ application/admin/model/car/Attributes.php | 49 ++++++++++ application/admin/validate/Brands.php | 27 ++++++ application/admin/validate/Cars.php | 27 ++++++ application/admin/validate/Series.php | 27 ++++++ application/admin/validate/car/Attributes.php | 27 ++++++ application/admin/view/attributes/add.html | 57 +++++++++++ application/admin/view/attributes/edit.html | 57 +++++++++++ application/admin/view/attributes/index.html | 29 ++++++ application/admin/view/brands/add.html | 33 +++++++ application/admin/view/brands/edit.html | 33 +++++++ application/admin/view/brands/index.html | 29 ++++++ application/admin/view/cars/add.html | 95 +++++++++++++++++++ application/admin/view/cars/edit.html | 95 +++++++++++++++++++ application/admin/view/cars/index.html | 29 ++++++ application/admin/view/series/add.html | 27 ++++++ application/admin/view/series/edit.html | 27 ++++++ application/admin/view/series/index.html | 29 ++++++ application/extra/site.php | 2 +- public/assets/js/backend/attributes.js | 56 +++++++++++ public/assets/js/backend/brands.js | 54 +++++++++++ public/assets/js/backend/cars.js | 65 +++++++++++++ public/assets/js/backend/series.js | 53 +++++++++++ 33 files changed, 1224 insertions(+), 1 deletion(-) create mode 100644 application/admin/controller/Attributes.php create mode 100644 application/admin/controller/Brands.php create mode 100644 application/admin/controller/Cars.php create mode 100644 application/admin/controller/Series.php create mode 100644 application/admin/lang/zh-cn/brands.php create mode 100644 application/admin/lang/zh-cn/car/attributes.php create mode 100644 application/admin/lang/zh-cn/cars.php create mode 100644 application/admin/lang/zh-cn/series.php create mode 100644 application/admin/model/Brands.php create mode 100644 application/admin/model/Cars.php create mode 100644 application/admin/model/Series.php create mode 100644 application/admin/model/car/Attributes.php create mode 100644 application/admin/validate/Brands.php create mode 100644 application/admin/validate/Cars.php create mode 100644 application/admin/validate/Series.php create mode 100644 application/admin/validate/car/Attributes.php create mode 100644 application/admin/view/attributes/add.html create mode 100644 application/admin/view/attributes/edit.html create mode 100644 application/admin/view/attributes/index.html create mode 100644 application/admin/view/brands/add.html create mode 100644 application/admin/view/brands/edit.html create mode 100644 application/admin/view/brands/index.html create mode 100644 application/admin/view/cars/add.html create mode 100644 application/admin/view/cars/edit.html create mode 100644 application/admin/view/cars/index.html create mode 100644 application/admin/view/series/add.html create mode 100644 application/admin/view/series/edit.html create mode 100644 application/admin/view/series/index.html create mode 100644 public/assets/js/backend/attributes.js create mode 100644 public/assets/js/backend/brands.js create mode 100644 public/assets/js/backend/cars.js create mode 100644 public/assets/js/backend/series.js diff --git a/application/admin/controller/Attributes.php b/application/admin/controller/Attributes.php new file mode 100644 index 0000000..66603a7 --- /dev/null +++ b/application/admin/controller/Attributes.php @@ -0,0 +1,37 @@ +model = new \app\admin\model\car\Attributes; + $this->view->assign("inputTypeList", $this->model->getInputTypeList()); + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + +} diff --git a/application/admin/controller/Brands.php b/application/admin/controller/Brands.php new file mode 100644 index 0000000..ecf29f0 --- /dev/null +++ b/application/admin/controller/Brands.php @@ -0,0 +1,37 @@ +model = new \app\admin\model\Brands; + + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + +} diff --git a/application/admin/controller/Cars.php b/application/admin/controller/Cars.php new file mode 100644 index 0000000..0691972 --- /dev/null +++ b/application/admin/controller/Cars.php @@ -0,0 +1,37 @@ +model = new \app\admin\model\Cars; + + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + +} diff --git a/application/admin/controller/Series.php b/application/admin/controller/Series.php new file mode 100644 index 0000000..516b622 --- /dev/null +++ b/application/admin/controller/Series.php @@ -0,0 +1,37 @@ +model = new \app\admin\model\Series; + + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + +} diff --git a/application/admin/lang/zh-cn/brands.php b/application/admin/lang/zh-cn/brands.php new file mode 100644 index 0000000..ca5d8ed --- /dev/null +++ b/application/admin/lang/zh-cn/brands.php @@ -0,0 +1,5 @@ + '属性名称,例如 排量', + 'Field_key' => '唯一标识,例如 displacement', + 'Options' => 'JSON数组:如 [{label:..., value:...}]', + 'Is_filter' => '是否参与筛选' +]; diff --git a/application/admin/lang/zh-cn/cars.php b/application/admin/lang/zh-cn/cars.php new file mode 100644 index 0000000..cf0db71 --- /dev/null +++ b/application/admin/lang/zh-cn/cars.php @@ -0,0 +1,12 @@ + '展示标题', + 'Brand_id' => '品牌 ID', + 'Series_id' => '车系 ID', + 'Price' => '展示价格(万元)', + 'Cover_image' => '封面图', + 'Location' => '城市名', + 'Contact_id' => '联系人 ID', + 'Is_active' => '是否上架' +]; diff --git a/application/admin/lang/zh-cn/series.php b/application/admin/lang/zh-cn/series.php new file mode 100644 index 0000000..ca5d8ed --- /dev/null +++ b/application/admin/lang/zh-cn/series.php @@ -0,0 +1,5 @@ + __('Text'), 'select' => __('Select'), 'range' => __('Range'), 'checkbox' => __('Checkbox')]; + } + + + public function getInputTypeTextAttr($value, $data) + { + $value = $value ?: ($data['input_type'] ?? ''); + $list = $this->getInputTypeList(); + return $list[$value] ?? ''; + } + + + + +} diff --git a/application/admin/validate/Brands.php b/application/admin/validate/Brands.php new file mode 100644 index 0000000..d3cc755 --- /dev/null +++ b/application/admin/validate/Brands.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/validate/Cars.php b/application/admin/validate/Cars.php new file mode 100644 index 0000000..4b48192 --- /dev/null +++ b/application/admin/validate/Cars.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/validate/Series.php b/application/admin/validate/Series.php new file mode 100644 index 0000000..72bde45 --- /dev/null +++ b/application/admin/validate/Series.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/validate/car/Attributes.php b/application/admin/validate/car/Attributes.php new file mode 100644 index 0000000..9fdbdcf --- /dev/null +++ b/application/admin/validate/car/Attributes.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/view/attributes/add.html b/application/admin/view/attributes/add.html new file mode 100644 index 0000000..1ffd6ca --- /dev/null +++ b/application/admin/view/attributes/add.html @@ -0,0 +1,57 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/application/admin/view/attributes/edit.html b/application/admin/view/attributes/edit.html new file mode 100644 index 0000000..3f06aa5 --- /dev/null +++ b/application/admin/view/attributes/edit.html @@ -0,0 +1,57 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/application/admin/view/attributes/index.html b/application/admin/view/attributes/index.html new file mode 100644 index 0000000..c880307 --- /dev/null +++ b/application/admin/view/attributes/index.html @@ -0,0 +1,29 @@ +
+ {:build_heading()} + +
+
+
+ +
+ +
+
+
diff --git a/application/admin/view/brands/add.html b/application/admin/view/brands/add.html new file mode 100644 index 0000000..368de0a --- /dev/null +++ b/application/admin/view/brands/add.html @@ -0,0 +1,33 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/application/admin/view/brands/edit.html b/application/admin/view/brands/edit.html new file mode 100644 index 0000000..54c1788 --- /dev/null +++ b/application/admin/view/brands/edit.html @@ -0,0 +1,33 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/application/admin/view/brands/index.html b/application/admin/view/brands/index.html new file mode 100644 index 0000000..e965dde --- /dev/null +++ b/application/admin/view/brands/index.html @@ -0,0 +1,29 @@ +
+ {:build_heading()} + +
+
+
+ +
+ +
+
+
diff --git a/application/admin/view/cars/add.html b/application/admin/view/cars/add.html new file mode 100644 index 0000000..a90064f --- /dev/null +++ b/application/admin/view/cars/add.html @@ -0,0 +1,95 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+ +
+
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    diff --git a/application/admin/view/cars/edit.html b/application/admin/view/cars/edit.html new file mode 100644 index 0000000..3d69db2 --- /dev/null +++ b/application/admin/view/cars/edit.html @@ -0,0 +1,95 @@ +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + +
    + + +
    + +
    +
      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      + +
      diff --git a/application/admin/view/cars/index.html b/application/admin/view/cars/index.html new file mode 100644 index 0000000..d8c4c7b --- /dev/null +++ b/application/admin/view/cars/index.html @@ -0,0 +1,29 @@ +
      + {:build_heading()} + +
      +
      +
      + +
      + +
      +
      +
      diff --git a/application/admin/view/series/add.html b/application/admin/view/series/add.html new file mode 100644 index 0000000..be58499 --- /dev/null +++ b/application/admin/view/series/add.html @@ -0,0 +1,27 @@ +
      + +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      + +
      diff --git a/application/admin/view/series/edit.html b/application/admin/view/series/edit.html new file mode 100644 index 0000000..f61accb --- /dev/null +++ b/application/admin/view/series/edit.html @@ -0,0 +1,27 @@ +
      + +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      + +
      diff --git a/application/admin/view/series/index.html b/application/admin/view/series/index.html new file mode 100644 index 0000000..2161603 --- /dev/null +++ b/application/admin/view/series/index.html @@ -0,0 +1,29 @@ +
      + {:build_heading()} + +
      +
      +
      + +
      + +
      +
      +
      diff --git a/application/extra/site.php b/application/extra/site.php index 9f282bb..8790b69 100644 --- a/application/extra/site.php +++ b/application/extra/site.php @@ -1,7 +1,7 @@ '我的网站', + 'name' => '车辆管理', 'beian' => '', 'cdnurl' => '', 'version' => '1.0.1', diff --git a/public/assets/js/backend/attributes.js b/public/assets/js/backend/attributes.js new file mode 100644 index 0000000..47db51a --- /dev/null +++ b/public/assets/js/backend/attributes.js @@ -0,0 +1,56 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'attributes/index' + location.search, + add_url: 'attributes/add', + edit_url: 'attributes/edit', + del_url: 'attributes/del', + multi_url: 'attributes/multi', + import_url: 'attributes/import', + table: 'attributes', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'name', title: __('Name'), operate: 'LIKE'}, + {field: 'field_key', title: __('Field_key'), operate: 'LIKE'}, + {field: 'input_type', title: __('Input_type'), searchList: {"text":__('Text'),"select":__('Select'),"range":__('Range'),"checkbox":__('Checkbox')}, formatter: Table.api.formatter.normal}, + {field: 'is_filter', title: __('Is_filter')}, + {field: 'sort_order', title: __('Sort_order')}, + {field: 'created_at', title: __('Created_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); diff --git a/public/assets/js/backend/brands.js b/public/assets/js/backend/brands.js new file mode 100644 index 0000000..42f78ce --- /dev/null +++ b/public/assets/js/backend/brands.js @@ -0,0 +1,54 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'brands/index' + location.search, + add_url: 'brands/add', + edit_url: 'brands/edit', + del_url: 'brands/del', + multi_url: 'brands/multi', + import_url: 'brands/import', + table: 'brands', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'name', title: __('Name'), operate: 'LIKE'}, + {field: 'logo', title: __('Logo'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'sort_order', title: __('Sort_order')}, + {field: 'created_at', title: __('Created_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); diff --git a/public/assets/js/backend/cars.js b/public/assets/js/backend/cars.js new file mode 100644 index 0000000..b3c6862 --- /dev/null +++ b/public/assets/js/backend/cars.js @@ -0,0 +1,65 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'cars/index' + location.search, + add_url: 'cars/add', + edit_url: 'cars/edit', + del_url: 'cars/del', + multi_url: 'cars/multi', + import_url: 'cars/import', + table: 'cars', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + fixedColumns: true, + fixedRightNumber: 1, + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'brand_id', title: __('Brand_id')}, + {field: 'series_id', title: __('Series_id')}, + {field: 'price', title: __('Price'), operate:'BETWEEN'}, + {field: 'cover_image', title: __('Cover_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'location', title: __('Location'), operate: 'LIKE'}, + {field: 'contact_name', title: __('Contact_name'), operate: 'LIKE'}, + {field: 'contact_id', title: __('Contact_id')}, + {field: 'contact_phone', title: __('Contact_phone'), operate: 'LIKE'}, + {field: 'wechat_qrcode', title: __('Wechat_qrcode'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'created_at', title: __('Created_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, + {field: 'updated_at', title: __('Updated_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, + {field: 'is_active', title: __('Is_active')}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); diff --git a/public/assets/js/backend/series.js b/public/assets/js/backend/series.js new file mode 100644 index 0000000..a54c98e --- /dev/null +++ b/public/assets/js/backend/series.js @@ -0,0 +1,53 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'series/index' + location.search, + add_url: 'series/add', + edit_url: 'series/edit', + del_url: 'series/del', + multi_url: 'series/multi', + import_url: 'series/import', + table: 'series', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'brand_id', title: __('Brand_id')}, + {field: 'name', title: __('Name'), operate: 'LIKE'}, + {field: 'created_at', title: __('Created_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +});