diff --git a/app/admin/controller/Config.php b/app/admin/controller/Config.php index a14bce0..74250a5 100755 --- a/app/admin/controller/Config.php +++ b/app/admin/controller/Config.php @@ -31,6 +31,7 @@ class Config extends Base 'name' => '默认商户', 'mch_id' => $old_config['mch_id'] ?? '', 'keys' => $old_config['keys'] ?? '', + 'order_prefix' => $old_config['order_prefix'] ?? 'MYH', 'weight' => 1 ] ] @@ -92,6 +93,23 @@ class Config extends Base $data = input("post."); $data['update_time'] = time(); + // 处理微信支付商户前缀验证 + if ($data['key'] == 'weixinpay_setting' && isset($data['merchants']) && is_array($data['merchants'])) { + // 检查前缀的唯一性 + $prefixes = []; + foreach ($data['merchants'] as $index => $merchant) { + if (empty($merchant['order_prefix']) || strlen($merchant['order_prefix']) !== 3) { + return $this->renderError('商户前缀必须是3位字符'); + } + + if (in_array($merchant['order_prefix'], $prefixes)) { + return $this->renderError('商户前缀"'.$merchant['order_prefix'].'"重复,每个商户的前缀必须唯一'); + } + + $prefixes[] = $merchant['order_prefix']; + } + } + // 处理同步地址数据格式 if ($data['key'] == 'systemconfig') { $syncAddresses = []; diff --git a/app/admin/view/Config/systemconfig.html b/app/admin/view/Config/systemconfig.html index 30c63a2..b0f7cc3 100755 --- a/app/admin/view/Config/systemconfig.html +++ b/app/admin/view/Config/systemconfig.html @@ -4,60 +4,7 @@

系统设置

-
-
-
盒子同步地址
-
-
- -
- -
-
- {if isset($data.sync_address) && is_array($data.sync_address)} - {foreach $data.sync_address as $index => $address} -
-
- -
-
- -
- -
- {/foreach} - {else} -
-
- -
-
- -
- -
- {/if} -
-
- - -
-
-
-
-
-
-
+
@@ -126,6 +73,61 @@
+
+
+
盒子同步地址
+
+
+ +
+ +
+
+ {if isset($data.sync_address) && is_array($data.sync_address)} + {foreach $data.sync_address as $index => $address} +
+
+ +
+
+ +
+ +
+ {/foreach} + {else} +
+
+ +
+
+ +
+ +
+ {/if} +
+
+ + +
+
+
+
+
+
+
+
微信公众号设置
diff --git a/app/admin/view/Config/weixinpay.html b/app/admin/view/Config/weixinpay.html index c3b109e..cc23fb8 100755 --- a/app/admin/view/Config/weixinpay.html +++ b/app/admin/view/Config/weixinpay.html @@ -14,7 +14,7 @@
- 微信Appid和AppSecret已移至系统设置页面,请在那里设置 + 微信Appid和AppSecret已移至系统设置页面,请在那里设置。ps:权重越高,支付几率越多。订单前缀必填,用于区分哪一个商户号支付的。
@@ -41,6 +41,12 @@
+
+ +
+ +
+
@@ -71,6 +77,12 @@
+
+ +
+ +
+
@@ -101,6 +113,56 @@