From 46b52e6ae5ba286bce8776cff1cf285e32cfa5a7 Mon Sep 17 00:00:00 2001 From: ztt <835303992@qq.com> Date: Sat, 16 Mar 2024 16:06:05 +0800 Subject: [PATCH 1/3] 1 --- addons/shopro/controller/Category.php | 14 ++++++++++++++ addons/shopro/controller/order/Order.php | 3 +++ 2 files changed, 17 insertions(+) diff --git a/addons/shopro/controller/Category.php b/addons/shopro/controller/Category.php index e581b18..1509a0f 100755 --- a/addons/shopro/controller/Category.php +++ b/addons/shopro/controller/Category.php @@ -3,6 +3,7 @@ namespace addons\shopro\controller; use app\admin\model\shopro\Category as CategoryModel; +use app\admin\model\shopro\goods\Goods; class Category extends Common { @@ -28,4 +29,17 @@ class Category extends Common $this->success('商城分类', $categories); } + + /** + * 商城列表 + * @return + */ + public function goodsList() { + $category = CategoryModel::where('parent_id', 0)->normal()->order('weigh', 'desc')->order('id', 'desc')->select(); + foreach ($category as &$item) { + $item['goods_list'] = Goods::where('category_ids', 'in', $item['id'])->show()->select(); + } + + $this->success('商城分类', $category); + } } diff --git a/addons/shopro/controller/order/Order.php b/addons/shopro/controller/order/Order.php index 3ca15ca..f48cfbb 100755 --- a/addons/shopro/controller/order/Order.php +++ b/addons/shopro/controller/order/Order.php @@ -37,6 +37,9 @@ class Order extends Common case 'nocomment': $orders = $orders->paid()->nocomment(); break; + case 'completed': + $orders = $orders->paid()->completed(); + break; } $orders = $orders->order('id', 'desc')->paginate(request()->param('list_rows', 10))->toArray(); From cc37b21349844a886013d4b99a6e13750cc1a0aa Mon Sep 17 00:00:00 2001 From: ztt <835303992@qq.com> Date: Sat, 16 Mar 2024 16:37:09 +0800 Subject: [PATCH 2/3] 1 --- addons/shopro/controller/Category.php | 20 +++++++++++++++++--- application/common.php | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/addons/shopro/controller/Category.php b/addons/shopro/controller/Category.php index 1509a0f..677d6e9 100755 --- a/addons/shopro/controller/Category.php +++ b/addons/shopro/controller/Category.php @@ -36,10 +36,24 @@ class Category extends Common */ public function goodsList() { $category = CategoryModel::where('parent_id', 0)->normal()->order('weigh', 'desc')->order('id', 'desc')->select(); - foreach ($category as &$item) { - $item['goods_list'] = Goods::where('category_ids', 'in', $item['id'])->show()->select(); + $category_ids = []; + foreach ($category as $item) { + $categories = CategoryModel::where('parent_id', $item['id'])->column('id'); + $category_ids = array_merge($category_ids, $categories); + } + $category = CategoryModel::where('id', 'in', $category_ids)->normal()->order('weigh', 'desc')->order('id', 'desc')->select(); + + foreach ($category as &$row) { + $row['image'] = formatImage($row['image']); + $row['goods_list'] = Goods::where('category_ids', 'in', $row['id'])->show()->select(); + foreach ($row['goods_list'] as $v) { + $v->image = formatImage($v->image); + $v->images = array_map('formatImage', $v->images); + } } - $this->success('商城分类', $category); } + + + } diff --git a/application/common.php b/application/common.php index 0259248..e1c5a84 100755 --- a/application/common.php +++ b/application/common.php @@ -560,3 +560,7 @@ EOT; return $icon; } } + + function formatImage($url) { + return request()->domain().$url; +} From ab83029544639b982bbebe6f691439c084a6b9c3 Mon Sep 17 00:00:00 2001 From: ztt <835303992@qq.com> Date: Sat, 16 Mar 2024 21:12:41 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BB=93=E5=BA=93=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Warehouse.php | 37 ++++++ application/admin/lang/zh-cn/warehouse.php | 11 ++ application/admin/model/Warehouse.php | 40 ++++++ application/admin/validate/Warehouse.php | 27 ++++ application/admin/view/warehouse/add.html | 33 +++++ application/admin/view/warehouse/edit.html | 33 +++++ application/admin/view/warehouse/index.html | 29 +++++ .../admin/view/warehouse/recyclebin.html | 25 ++++ public/assets/js/backend/warehouse.js | 116 ++++++++++++++++++ 9 files changed, 351 insertions(+) create mode 100644 application/admin/controller/Warehouse.php create mode 100644 application/admin/lang/zh-cn/warehouse.php create mode 100644 application/admin/model/Warehouse.php create mode 100644 application/admin/validate/Warehouse.php create mode 100644 application/admin/view/warehouse/add.html create mode 100644 application/admin/view/warehouse/edit.html create mode 100644 application/admin/view/warehouse/index.html create mode 100644 application/admin/view/warehouse/recyclebin.html create mode 100644 public/assets/js/backend/warehouse.js diff --git a/application/admin/controller/Warehouse.php b/application/admin/controller/Warehouse.php new file mode 100644 index 0000000..3c3d2a8 --- /dev/null +++ b/application/admin/controller/Warehouse.php @@ -0,0 +1,37 @@ +model = new \app\admin\model\Warehouse; + + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + +} diff --git a/application/admin/lang/zh-cn/warehouse.php b/application/admin/lang/zh-cn/warehouse.php new file mode 100644 index 0000000..ea1fc59 --- /dev/null +++ b/application/admin/lang/zh-cn/warehouse.php @@ -0,0 +1,11 @@ + '地址名称', + 'Linkname' => '联系人', + 'Linkphone' => '联系电话', + 'Address' => '地址', + 'Deletetime' => '删除时间', + 'Createtime' => '创建时间', + 'Updatetime' => '更新时间' +]; diff --git a/application/admin/model/Warehouse.php b/application/admin/model/Warehouse.php new file mode 100644 index 0000000..c492b64 --- /dev/null +++ b/application/admin/model/Warehouse.php @@ -0,0 +1,40 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/view/warehouse/add.html b/application/admin/view/warehouse/add.html new file mode 100644 index 0000000..9f0a742 --- /dev/null +++ b/application/admin/view/warehouse/add.html @@ -0,0 +1,33 @@ +
diff --git a/application/admin/view/warehouse/edit.html b/application/admin/view/warehouse/edit.html new file mode 100644 index 0000000..276dc0f --- /dev/null +++ b/application/admin/view/warehouse/edit.html @@ -0,0 +1,33 @@ + diff --git a/application/admin/view/warehouse/index.html b/application/admin/view/warehouse/index.html new file mode 100644 index 0000000..aeab4da --- /dev/null +++ b/application/admin/view/warehouse/index.html @@ -0,0 +1,29 @@ +