作者 刘锟

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

@@ -62,7 +62,7 @@ class UpdateBuildConfiguration extends Command @@ -62,7 +62,7 @@ class UpdateBuildConfiguration extends Command
62 */ 62 */
63 public function handle(){ 63 public function handle(){
64 $projectModel = new Project(); 64 $projectModel = new Project();
65 - $list = $projectModel->list(['delete_status'=>0,'id'=>1214],'id',['id'],'asc'); 65 + $list = $projectModel->list(['delete_status'=>0,'id'=>2874],'id',['id'],'asc');
66 foreach ($list as $k => $v){ 66 foreach ($list as $k => $v){
67 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 67 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
68 ProjectServer::useProject($v['id']); 68 ProjectServer::useProject($v['id']);
@@ -94,7 +94,7 @@ class UpdateBuildConfiguration extends Command @@ -94,7 +94,7 @@ class UpdateBuildConfiguration extends Command
94 $productModel = new Product(); 94 $productModel = new Product();
95 $page = 1; 95 $page = 1;
96 while (true){ 96 while (true){
97 - $lists = $productModel->lists(['id'=>361],$page,1,['id','content','describe']); 97 + $lists = $productModel->lists(['id'=>1185],$page,100,['id','content','describe']);
98 $detailModel = new Detail(); 98 $detailModel = new Detail();
99 if(!empty($lists['list'])){ 99 if(!empty($lists['list'])){
100 foreach ($lists['list'] as $k => $v){ 100 foreach ($lists['list'] as $k => $v){
@@ -10,18 +10,20 @@ @@ -10,18 +10,20 @@
10 namespace App\Helper; 10 namespace App\Helper;
11 11
12 use App\Models\ExtentModule\ExtensionModuleValue; 12 use App\Models\ExtentModule\ExtensionModuleValue;
  13 +use App\Services\ProjectServer;
  14 +use Illuminate\Support\Facades\DB;
13 15
14 class PayStripeApi 16 class PayStripeApi
15 { 17 {
16 private $secretKey; 18 private $secretKey;
17 //币种对应支付方式 19 //币种对应支付方式
18 public $currency_types = [ 20 public $currency_types = [
19 - 'usd' => ['card', 'alipay', 'wechat_pay', 'cashapp', 'link', 'afterpay_clearpay'], 21 + 'usd' => ['card', 'cashapp', 'link', 'afterpay_clearpay'],
20 'eur' => ['card', 'ideal', 'giropay', 'sofort', 'bancontact', 'klarna', 'link'], 22 'eur' => ['card', 'ideal', 'giropay', 'sofort', 'bancontact', 'klarna', 'link'],
21 'gbp' => ['card', 'apple_pay', 'google_pay', 'klarna', 'link', 'afterpay_clearpay'], 23 'gbp' => ['card', 'apple_pay', 'google_pay', 'klarna', 'link', 'afterpay_clearpay'],
22 'aud' => ['card', 'afterpay_clearpay', 'apple_pay', 'google_pay'], 24 'aud' => ['card', 'afterpay_clearpay', 'apple_pay', 'google_pay'],
23 'cad' => ['card', 'apple_pay', 'google_pay', 'link'], 25 'cad' => ['card', 'apple_pay', 'google_pay', 'link'],
24 - 'sgd' => ['card', 'grabpay', 'fpx', 'wechat_pay', 'apple_pay', 'google_pay'], 26 + 'sgd' => ['card', 'grabpay', 'fpx', 'google_pay'],
25 'jpy' => ['card', 'apple_pay', 'google_pay'], 27 'jpy' => ['card', 'apple_pay', 'google_pay'],
26 'cny' => ['alipay', 'wechat_pay'], 28 'cny' => ['alipay', 'wechat_pay'],
27 'brl' => ['card', 'boleto', 'pix'], 29 'brl' => ['card', 'boleto', 'pix'],
@@ -81,13 +83,13 @@ class PayStripeApi @@ -81,13 +83,13 @@ class PayStripeApi
81 * @method :post 83 * @method :post
82 * @time :2024/12/24 10:38 84 * @time :2024/12/24 10:38
83 */ 85 */
84 - public function createPaymentIntent($amount, $currency = 'usd', $paymentMethodTypes = 'card') 86 + public function createPaymentIntent($amount, $currency = 'usd')
85 { 87 {
86 $url = "https://api.stripe.com/v1/payment_intents"; 88 $url = "https://api.stripe.com/v1/payment_intents";
87 $data = [ 89 $data = [
88 'amount' => $amount, 90 'amount' => $amount,
89 'currency' => $currency, 91 'currency' => $currency,
90 - 'payment_method_types[]' => $paymentMethodTypes, 92 + 'payment_method_types' => $this->currency_types[$currency],
91 ]; 93 ];
92 return $this->sendRequest($url, 'POST', $data); 94 return $this->sendRequest($url, 'POST', $data);
93 } 95 }
@@ -176,7 +178,6 @@ class PayStripeApi @@ -176,7 +178,6 @@ class PayStripeApi
176 break; 178 break;
177 case 'payment_intent.payment_failed': 179 case 'payment_intent.payment_failed':
178 // 处理支付失败逻辑 180 // 处理支付失败逻辑
179 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($eventData, true) . PHP_EOL, FILE_APPEND);  
180 $error = $eventData['last_payment_error']; 181 $error = $eventData['last_payment_error'];
181 break; 182 break;
182 case 'charge.refunded': 183 case 'charge.refunded':
@@ -200,6 +201,8 @@ class PayStripeApi @@ -200,6 +201,8 @@ class PayStripeApi
200 * @time :2024/12/25 14:43 201 * @time :2024/12/25 14:43
201 */ 202 */
202 public static function getExtensionInfo($id,$eventData){ 203 public static function getExtensionInfo($id,$eventData){
  204 + @file_put_contents(storage_path('logs/lyh_3059_error.log'), var_export('进入', true) . PHP_EOL, FILE_APPEND);
  205 + ProjectServer::useProject(3059);
203 $extensionModel = new ExtensionModuleValue(); 206 $extensionModel = new ExtensionModuleValue();
204 $info = $extensionModel->read(['value'=>$id]); 207 $info = $extensionModel->read(['value'=>$id]);
205 if($info === false){ 208 if($info === false){
@@ -210,8 +213,9 @@ class PayStripeApi @@ -210,8 +213,9 @@ class PayStripeApi
210 ['uuid'=>$info['uuid'],'module_id'=>$info['module_id'],'field_id'=>6,'value'=>'success'], 213 ['uuid'=>$info['uuid'],'module_id'=>$info['module_id'],'field_id'=>6,'value'=>'success'],
211 ['uuid'=>$info['uuid'],'module_id'=>$info['module_id'],'field_id'=>7,'value'=>json_encode($eventData)], 214 ['uuid'=>$info['uuid'],'module_id'=>$info['module_id'],'field_id'=>7,'value'=>json_encode($eventData)],
212 ]; 215 ];
213 - $moduleValueModel = new ExtensionModuleValue();  
214 - $moduleValueModel->insertAll($data); 216 + $rs = $extensionModel->insertAll($data);
  217 + @file_put_contents(storage_path('logs/lyh_3059_error.log'), var_export('结束'.$rs, true) . PHP_EOL, FILE_APPEND);
  218 + DB::disconnect('custom_mysql');
215 } 219 }
216 220
217 /** 221 /**
@@ -36,7 +36,7 @@ class TestController extends BaseController @@ -36,7 +36,7 @@ class TestController extends BaseController
36 */ 36 */
37 public function ceshi(){ 37 public function ceshi(){
38 $pay = new PayStripeApi(); 38 $pay = new PayStripeApi();
39 - $data = $pay->createPaymentIntent(5000,'cny','alipay'); 39 + $data = $pay->createPaymentIntent(5000,'cny');
40 $this->response('success',Code::SUCCESS,$data); 40 $this->response('success',Code::SUCCESS,$data);
41 } 41 }
42 42