chore(addon/huaweipay): mch_id -> merc_no

This commit is contained in:
2025-12-04 11:00:24 +08:00
parent 1793e4b2aa
commit 8e159edf1d
4 changed files with 41 additions and 39 deletions

View File

@@ -24,7 +24,7 @@ class Config extends BaseModel
// 加密字段
private $encrypt_fields = [
// 'mch_id',
// 'merc_no',
// 'app_id',
// 'mch_auth_id',
'private_key',

View File

@@ -1,4 +1,5 @@
<?php
/**
* 华为支付模型
*/
@@ -49,7 +50,8 @@ class Pay extends BaseModel
if (empty($config_data)) {
$config_info = (new Config())->getPayConfig($this->site_id)['data']['value'];
$this->config = $config_info;
if (empty($this->config)) throw new ApiException(-1, "平台未配置华为支付");
if (empty($this->config))
throw new ApiException(-1, "平台未配置华为支付");
} else {
$this->config = $config_data;
}
@@ -57,7 +59,7 @@ class Pay extends BaseModel
// 添加站点ID
$this->config['site_id'] = $this->site_id;
// 初始化华为支付客户端
// 创建华为支付客户端
$this->hwpay_client = new HuaweiPayClient($this->config);
}
@@ -94,7 +96,7 @@ class Pay extends BaseModel
$parameter = array(
"out_trade_no" => $param["out_trade_no"],
"subject" => mb_substr($param["pay_body"], 0, 128, 'UTF-8'), // 限制长度,支持中文
"total_amount" => number_format((float)$param["pay_money"], 2, '.', ''), // 确保金额格式正确
"total_amount" => number_format((float) $param["pay_money"], 2, '.', ''), // 确保金额格式正确
"body" => mb_substr($param["pay_body"], 0, 512, 'UTF-8'), // 限制长度,支持中文
);

View File

@@ -19,7 +19,7 @@ class Pay extends BaseShop
$config_model = new ConfigModel();
if (request()->isJson()) {
$app_id = input("app_id", "");//华为应用ID, // PETALPAY.APPID, 商户号关联的APPID
$mch_id = input("mch_id", "");//商户号, // PETALPAY.MERC_NO, 商户号
$merc_no = input("merc_no", "");//商户号, // PETALPAY.MERC_NO, 商户号
$private_key = input("private_key", "");//商户应用私钥, // PETALPAY.MERC_PRIVATE_KEY, 商户应用私钥
$private_key_text = input("private_key_text", "");//商户应用私钥文本, // PETALPAY.MERC_PRIVATE_KEY_TEXT, 商户应用私钥文本
$mch_auth_id = input("mch_auth_id", "");//商户证书id, // PETALPAY.MERC_AUTH_ID, 商户证书id
@@ -36,7 +36,7 @@ class Pay extends BaseShop
$data = array (
"app_id" => $app_id,
"mch_id" => $mch_id,
"merc_no" => $merc_no,
"private_key" => $private_key,
"private_key_text" => $private_key_text,
"mch_auth_id" => $mch_auth_id,

View File

@@ -15,9 +15,9 @@
</div>
<div class="layui-form-item">
<label class="layui-form-label" name="mch_id"><span class="required">*</span>商户号:</label>
<label class="layui-form-label" name="merc_no"><span class="required">*</span>商户号:</label>
<div class="layui-input-block">
<input name="mch_id" type="text" value="{$info.mch_id ?? ''}" class="layui-input len-long" lay-verify="required">
<input name="merc_no" type="text" value="{$info.merc_no ?? ''}" class="layui-input len-long" lay-verify="required">
</div>
<div class="word-aux"><span>[MERC_NO]</span>华为支付商户号 <a href="https://developer.huawei.com/consumer/cn/doc/pay-docs/hwzf-shanghuhao-0000001725982508" target="_blank">查看指引</a></div>
</div>