作者 lyh

gx

... ... @@ -9,6 +9,8 @@
namespace App\Helper;
use App\Models\ExtentModule\ExtensionModuleValue;
class PayStripeApi
{
private $secretKey;
... ... @@ -169,13 +171,12 @@ class PayStripeApi
switch ($eventType) {
case 'payment_intent.succeeded':
// 处理支付成功逻辑
@file_put_contents(storage_path('logs/lyh_error.log'), var_export('success', true) . PHP_EOL, FILE_APPEND);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($eventType, true) . PHP_EOL, FILE_APPEND);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($eventData, true) . PHP_EOL, FILE_APPEND);
$paymentIntentId = $eventData['id'];
self::getExtensionInfo($paymentIntentId,$eventData);
break;
case 'payment_intent.payment_failed':
// 处理支付失败逻辑
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($eventData, true) . PHP_EOL, FILE_APPEND);
$error = $eventData['last_payment_error'];
break;
case 'charge.refunded':
... ... @@ -192,6 +193,28 @@ class PayStripeApi
}
/**
* @remark :根据id获取当前数据详情
* @name :getExtensionInfo
* @author :lyh
* @method :post
* @time :2024/12/25 14:43
*/
public static function getExtensionInfo($id,$eventData){
$extensionModel = new ExtensionModuleValue();
$info = $extensionModel->read(['value'=>$id]);
if($info === false){
@file_put_contents(storage_path('logs/lyh_3059_error.log'), var_export($id.':当前数据错误', true) . PHP_EOL, FILE_APPEND);
}
//组装数据保存
$data = [
['uuid'=>$info['uuid'],'module_id'=>$info['module_id'],'field_id'=>6,'value'=>'success'],
['uuid'=>$info['uuid'],'module_id'=>$info['module_id'],'field_id'=>7,'value'=>json_encode($eventData)],
];
$moduleValueModel = new ExtensionModuleValue();
$moduleValueModel->insertAll($data);
}
/**
* @remark :验证签名
* @name :verifySignature
* @author :lyh
... ...
... ... @@ -87,7 +87,7 @@ class Extension3059ModuleController extends BaseController
['field_id'=>9, 'value'=>'cny'],
['field_id'=>10, 'value'=>'alipay'],
['field_id'=>14, 'value'=>'二仙桥大爷'],
['field_id'=>14, 'value'=>'15687012587'],
['field_id'=>15, 'value'=>'15687012587'],
]
];
// $this->request->validate([
... ...