|
|
|
@ -1,13 +1,4 @@ |
|
|
|
|
<?php |
|
|
|
|
// +---------------------------------------------------------------------- |
|
|
|
|
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ] |
|
|
|
|
// +---------------------------------------------------------------------- |
|
|
|
|
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved. |
|
|
|
|
// +---------------------------------------------------------------------- |
|
|
|
|
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行 |
|
|
|
|
// +---------------------------------------------------------------------- |
|
|
|
|
// | Author: 萤火科技 <admin@yiovo.com> |
|
|
|
|
// +---------------------------------------------------------------------- |
|
|
|
|
declare (strict_types=1); |
|
|
|
|
|
|
|
|
|
namespace app\store\model; |
|
|
|
@ -60,6 +51,14 @@ class PaymentTemplate extends PaymentTemplateModel |
|
|
|
|
$data['store_id'] = self::$storeId; |
|
|
|
|
// 写入证书文件 |
|
|
|
|
$data['config'] = [$data['method'] => $this->certFileName($data['method'], $methodConfig)]; |
|
|
|
|
// 记录微信支付v3平台证书序号 |
|
|
|
|
if ($data['method'] === 'wechat' && $data['config']['wechat']['version'] === 'v3') { |
|
|
|
|
$data['wechatpay_serial'] = $data['config']['wechat'][$data['config']['wechat']['mchType']]['platformCertSerial']; |
|
|
|
|
$info = PaymentTemplateModel::findByWechatpaySerial($data['wechatpay_serial']); |
|
|
|
|
if ($info) { |
|
|
|
|
throwError("当前商户号已使用过了"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 写入到数据库 |
|
|
|
|
return $this->save($data); |
|
|
|
|
} |
|
|
|
@ -83,6 +82,11 @@ class PaymentTemplate extends PaymentTemplateModel |
|
|
|
|
// 记录微信支付v3平台证书序号 |
|
|
|
|
if ($data['method'] === 'wechat' && $data['config']['wechat']['version'] === 'v3') { |
|
|
|
|
$data['wechatpay_serial'] = $data['config']['wechat'][$data['config']['wechat']['mchType']]['platformCertSerial']; |
|
|
|
|
$info = PaymentTemplateModel::findByWechatpaySerial($data['wechatpay_serial']); |
|
|
|
|
if ($info && $info->template_id != $data['templateId']) { |
|
|
|
|
throwError("当前商户号已使用过了"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// 更新到数据库 |
|
|
|
|
return $this->save($data) !== false; |
|
|
|
|