From 543d52bffa6d7835c365bbb088574a09e1019d57 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 24 Sep 2026 22:02:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E9=A1=B5=E9=9D=A2=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=8F=8Abug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/lang/zh-cn/order/goods.php | 1 - .../application/admin/lang/zh-cn/orders.php | 3 - .../application/admin/view/data/logs/add.html | 6 +- .../admin/view/data/logs/edit.html | 9 ++- .../admin/view/demand/biddings/add.html | 3 +- .../admin/view/demand/biddings/edit.html | 3 +- .../admin/view/demand/contracts/add.html | 13 +--- .../admin/view/demand/contracts/edit.html | 16 ++--- .../admin/view/demand/group/chat/edit.html | 2 +- .../application/admin/view/messages/add.html | 4 +- .../application/admin/view/messages/edit.html | 6 +- .../admin/view/order/goods/add.html | 20 +++--- .../admin/view/order/goods/edit.html | 20 +++--- .../admin/view/order/payment/add.html | 4 +- .../admin/view/order/payment/edit.html | 4 +- .../application/admin/view/orders/add.html | 20 +----- .../application/admin/view/orders/edit.html | 20 +----- .../application/common/model/data/Logs.php | 72 ++++++++++++++++++- .../public/assets/js/backend/order/goods.js | 3 +- backend/public/assets/js/backend/orders.js | 3 - 20 files changed, 127 insertions(+), 105 deletions(-) diff --git a/backend/application/admin/lang/zh-cn/order/goods.php b/backend/application/admin/lang/zh-cn/order/goods.php index 99d0383..41139ba 100644 --- a/backend/application/admin/lang/zh-cn/order/goods.php +++ b/backend/application/admin/lang/zh-cn/order/goods.php @@ -5,7 +5,6 @@ return [ 'Order_no' => '订单号', 'Spu_id' => '商品SPU ID', 'Sku_id' => '商品SKU ID', - 'Room_id' => '房间ID', 'Goods_main_type' => '商品主类型', 'Goods_vice_type' => '商品副类型', 'Goods_name' => '商品名称', diff --git a/backend/application/admin/lang/zh-cn/orders.php b/backend/application/admin/lang/zh-cn/orders.php index c562940..070817e 100644 --- a/backend/application/admin/lang/zh-cn/orders.php +++ b/backend/application/admin/lang/zh-cn/orders.php @@ -3,9 +3,6 @@ return [ 'Id' => '主键ID', 'User_id' => '用户ID', - 'Saas_id' => 'SAAS ID', - 'Store_id' => '店铺ID', - 'Store_name' => '店铺名称', 'Parent_order_no' => '父订单号', 'Order_id' => '订单ID', 'Order_no' => '订单号', diff --git a/backend/application/admin/view/data/logs/add.html b/backend/application/admin/view/data/logs/add.html index b6911c1..5ab975c 100644 --- a/backend/application/admin/view/data/logs/add.html +++ b/backend/application/admin/view/data/logs/add.html @@ -15,19 +15,19 @@
- +
- +
- +
diff --git a/backend/application/admin/view/data/logs/edit.html b/backend/application/admin/view/data/logs/edit.html index 9640cd1..7018c3f 100644 --- a/backend/application/admin/view/data/logs/edit.html +++ b/backend/application/admin/view/data/logs/edit.html @@ -15,19 +15,22 @@
- + + + +
- +
- +
diff --git a/backend/application/admin/view/demand/biddings/add.html b/backend/application/admin/view/demand/biddings/add.html index 1d4f062..420ab63 100644 --- a/backend/application/admin/view/demand/biddings/add.html +++ b/backend/application/admin/view/demand/biddings/add.html @@ -3,7 +3,8 @@
- + +
diff --git a/backend/application/admin/view/demand/biddings/edit.html b/backend/application/admin/view/demand/biddings/edit.html index d73eaaa..eb01daf 100644 --- a/backend/application/admin/view/demand/biddings/edit.html +++ b/backend/application/admin/view/demand/biddings/edit.html @@ -3,7 +3,8 @@
- + +
diff --git a/backend/application/admin/view/demand/contracts/add.html b/backend/application/admin/view/demand/contracts/add.html index dd4f881..f864373 100644 --- a/backend/application/admin/view/demand/contracts/add.html +++ b/backend/application/admin/view/demand/contracts/add.html @@ -3,13 +3,13 @@
- +
- +
@@ -52,14 +52,7 @@
-
-
- {:__('Key')} - {:__('Value')} -
-
{:__('Append')}
- -
+
diff --git a/backend/application/admin/view/demand/contracts/edit.html b/backend/application/admin/view/demand/contracts/edit.html index 03fad42..c3c6d0f 100644 --- a/backend/application/admin/view/demand/contracts/edit.html +++ b/backend/application/admin/view/demand/contracts/edit.html @@ -3,13 +3,16 @@
- +
- + + + +
@@ -52,14 +55,7 @@
-
-
- {:__('Key')} - {:__('Value')} -
-
{:__('Append')}
- -
+
diff --git a/backend/application/admin/view/demand/group/chat/edit.html b/backend/application/admin/view/demand/group/chat/edit.html index d056a1d..0d08c38 100644 --- a/backend/application/admin/view/demand/group/chat/edit.html +++ b/backend/application/admin/view/demand/group/chat/edit.html @@ -3,7 +3,7 @@
- +
diff --git a/backend/application/admin/view/messages/add.html b/backend/application/admin/view/messages/add.html index 39eaa70..f474024 100644 --- a/backend/application/admin/view/messages/add.html +++ b/backend/application/admin/view/messages/add.html @@ -15,13 +15,13 @@
- +
- +
diff --git a/backend/application/admin/view/messages/edit.html b/backend/application/admin/view/messages/edit.html index 1ae4085..d7b113c 100644 --- a/backend/application/admin/view/messages/edit.html +++ b/backend/application/admin/view/messages/edit.html @@ -15,13 +15,13 @@
- +
- +
@@ -46,7 +46,7 @@ {:__('Value')}
{:__('Append')}
- + diff --git a/backend/application/admin/view/order/goods/add.html b/backend/application/admin/view/order/goods/add.html index 33f7b81..e499ba1 100644 --- a/backend/application/admin/view/order/goods/add.html +++ b/backend/application/admin/view/order/goods/add.html @@ -9,19 +9,13 @@
- +
- -
-
-
- -
- +
@@ -45,7 +39,15 @@
- +
+ +
+ + +
+ +
+
    diff --git a/backend/application/admin/view/order/goods/edit.html b/backend/application/admin/view/order/goods/edit.html index 88fde7d..77aaf8b 100644 --- a/backend/application/admin/view/order/goods/edit.html +++ b/backend/application/admin/view/order/goods/edit.html @@ -9,19 +9,13 @@
    - +
    - -
    -
    -
    - -
    - +
    @@ -45,7 +39,15 @@
    - +
    + +
    + + +
    + +
    +
      diff --git a/backend/application/admin/view/order/payment/add.html b/backend/application/admin/view/order/payment/add.html index 34f391b..70db1ea 100644 --- a/backend/application/admin/view/order/payment/add.html +++ b/backend/application/admin/view/order/payment/add.html @@ -9,7 +9,7 @@
      - +
      @@ -39,7 +39,7 @@
      - +
      diff --git a/backend/application/admin/view/order/payment/edit.html b/backend/application/admin/view/order/payment/edit.html index 6259bd2..754fc37 100644 --- a/backend/application/admin/view/order/payment/edit.html +++ b/backend/application/admin/view/order/payment/edit.html @@ -9,7 +9,7 @@
      - +
      @@ -39,7 +39,7 @@
      - +
      diff --git a/backend/application/admin/view/orders/add.html b/backend/application/admin/view/orders/add.html index 35be7ca..b014c1d 100644 --- a/backend/application/admin/view/orders/add.html +++ b/backend/application/admin/view/orders/add.html @@ -6,24 +6,6 @@
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      @@ -33,7 +15,7 @@
      - +
      diff --git a/backend/application/admin/view/orders/edit.html b/backend/application/admin/view/orders/edit.html index dc1f90c..271da46 100644 --- a/backend/application/admin/view/orders/edit.html +++ b/backend/application/admin/view/orders/edit.html @@ -6,24 +6,6 @@
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      @@ -33,7 +15,7 @@
      - +
      diff --git a/backend/application/common/model/data/Logs.php b/backend/application/common/model/data/Logs.php index 6546bc8..9f535b1 100644 --- a/backend/application/common/model/data/Logs.php +++ b/backend/application/common/model/data/Logs.php @@ -29,9 +29,77 @@ class Logs extends Model ]; protected $type = [ - 'before_data' => 'array', - 'after_data' => 'array', + ]; + + // JSON 字段统一处理:读取时输出 JSON 字符串,写入时接受数组或 JSON 字符串 + public function getBeforeDataAttr($value) + { + return $this->stringifyJsonData($value); + } + + public function getAfterDataAttr($value) + { + return $this->stringifyJsonData($value); + } + + public function setBeforeDataAttr($value) + { + return $this->normalizeJsonData($value); + } + + public function setAfterDataAttr($value) + { + return $this->normalizeJsonData($value); + } + + /** + * 将数据库值转换为可展示的 JSON 字符串 + */ + protected function stringifyJsonData($value) + { + $flag = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT; + + if (is_array($value)) { + return empty($value) ? '' : json_encode($value, $flag); + } + + $value = $value === null ? '' : trim((string)$value); + if ($value === '') { + return ''; + } + + $decoded = json_decode($value, true); + if (json_last_error() !== JSON_ERROR_NONE) { + return $value; + } + + return json_encode($decoded, $flag); + } + + /** + * 将输入(数组或 JSON 字符串)规范化为存储的 JSON 字符串 + */ + protected function normalizeJsonData($value) + { + $flag = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES; + + if (is_array($value)) { + return json_encode($value, $flag); + } + + $value = $value === null ? '' : trim((string)$value); + if ($value === '') { + return ''; + } + + $decoded = json_decode($value, true); + if (json_last_error() !== JSON_ERROR_NONE) { + return json_encode([$value], $flag); + } + + return json_encode($decoded, $flag); + } diff --git a/backend/public/assets/js/backend/order/goods.js b/backend/public/assets/js/backend/order/goods.js index a78729d..edcc47f 100644 --- a/backend/public/assets/js/backend/order/goods.js +++ b/backend/public/assets/js/backend/order/goods.js @@ -31,11 +31,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'order_no', title: __('Order_no'), operate: 'LIKE'}, {field: 'spu_id', title: __('Spu_id'), operate: 'LIKE'}, {field: 'sku_id', title: __('Sku_id'), operate: 'LIKE'}, - {field: 'room_id', title: __('Room_id'), operate: 'LIKE'}, {field: 'goods_main_type', title: __('Goods_main_type')}, {field: 'goods_vice_type', title: __('Goods_vice_type')}, {field: 'goods_name', title: __('Goods_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, - {field: 'goods_picture_url', title: __('Goods_picture_url'), operate: 'LIKE', formatter: Table.api.formatter.url}, + {field: 'goods_picture_url', title: __('Goods_picture_url'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'origin_price', title: __('Origin_price'), operate:'BETWEEN'}, {field: 'actual_price', title: __('Actual_price'), operate:'BETWEEN'}, {field: 'buy_quantity', title: __('Buy_quantity')}, diff --git a/backend/public/assets/js/backend/orders.js b/backend/public/assets/js/backend/orders.js index 2376170..bd80a24 100644 --- a/backend/public/assets/js/backend/orders.js +++ b/backend/public/assets/js/backend/orders.js @@ -29,9 +29,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'user_id', title: __('User_id')}, - {field: 'saas_id', title: __('Saas_id'), operate: 'LIKE'}, - {field: 'store_id', title: __('Store_id'), operate: 'LIKE'}, - {field: 'store_name', title: __('Store_name'), operate: 'LIKE'}, {field: 'parent_order_no', title: __('Parent_order_no'), operate: 'LIKE'}, {field: 'order_id', title: __('Order_id'), operate: 'LIKE'}, {field: 'order_no', title: __('Order_no'), operate: 'LIKE'},