作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

... ... @@ -62,7 +62,7 @@ class UpdateBuildConfiguration extends Command
*/
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['delete_status'=>0,'id'=>1214],'id',['id'],'asc');
$list = $projectModel->list(['delete_status'=>0,'id'=>2874],'id',['id'],'asc');
foreach ($list as $k => $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
... ... @@ -94,7 +94,7 @@ class UpdateBuildConfiguration extends Command
$productModel = new Product();
$page = 1;
while (true){
$lists = $productModel->lists(['id'=>361],$page,1,['id','content','describe']);
$lists = $productModel->lists(['id'=>1185],$page,100,['id','content','describe']);
$detailModel = new Detail();
if(!empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
... ...
... ... @@ -10,18 +10,20 @@
namespace App\Helper;
use App\Models\ExtentModule\ExtensionModuleValue;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
class PayStripeApi
{
private $secretKey;
//币种对应支付方式
public $currency_types = [
'usd' => ['card', 'alipay', 'wechat_pay', 'cashapp', 'link', 'afterpay_clearpay'],
'usd' => ['card', 'cashapp', 'link', 'afterpay_clearpay'],
'eur' => ['card', 'ideal', 'giropay', 'sofort', 'bancontact', 'klarna', 'link'],
'gbp' => ['card', 'apple_pay', 'google_pay', 'klarna', 'link', 'afterpay_clearpay'],
'aud' => ['card', 'afterpay_clearpay', 'apple_pay', 'google_pay'],
'cad' => ['card', 'apple_pay', 'google_pay', 'link'],
'sgd' => ['card', 'grabpay', 'fpx', 'wechat_pay', 'apple_pay', 'google_pay'],
'sgd' => ['card', 'grabpay', 'fpx', 'google_pay'],
'jpy' => ['card', 'apple_pay', 'google_pay'],
'cny' => ['alipay', 'wechat_pay'],
'brl' => ['card', 'boleto', 'pix'],
... ... @@ -81,13 +83,13 @@ class PayStripeApi
* @method :post
* @time :2024/12/24 10:38
*/
public function createPaymentIntent($amount, $currency = 'usd', $paymentMethodTypes = 'card')
public function createPaymentIntent($amount, $currency = 'usd')
{
$url = "https://api.stripe.com/v1/payment_intents";
$data = [
'amount' => $amount,
'currency' => $currency,
'payment_method_types[]' => $paymentMethodTypes,
'payment_method_types' => $this->currency_types[$currency],
];
return $this->sendRequest($url, 'POST', $data);
}
... ... @@ -176,7 +178,6 @@ class PayStripeApi
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':
... ... @@ -200,6 +201,8 @@ class PayStripeApi
* @time :2024/12/25 14:43
*/
public static function getExtensionInfo($id,$eventData){
@file_put_contents(storage_path('logs/lyh_3059_error.log'), var_export('进入', true) . PHP_EOL, FILE_APPEND);
ProjectServer::useProject(3059);
$extensionModel = new ExtensionModuleValue();
$info = $extensionModel->read(['value'=>$id]);
if($info === false){
... ... @@ -210,8 +213,9 @@ class PayStripeApi
['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);
$rs = $extensionModel->insertAll($data);
@file_put_contents(storage_path('logs/lyh_3059_error.log'), var_export('结束'.$rs, true) . PHP_EOL, FILE_APPEND);
DB::disconnect('custom_mysql');
}
/**
... ...
... ... @@ -36,7 +36,7 @@ class TestController extends BaseController
*/
public function ceshi(){
$pay = new PayStripeApi();
$data = $pay->createPaymentIntent(5000,'cny','alipay');
$data = $pay->createPaymentIntent(5000,'cny');
$this->response('success',Code::SUCCESS,$data);
}
... ...