mirror of
				https://github.com/v2board/v2board.git
				synced 2025-11-04 11:21:46 +08:00 
			
		
		
		
	update
This commit is contained in:
		@@ -86,6 +86,10 @@ class ConfigController extends Controller
 | 
				
			|||||||
                ],
 | 
					                ],
 | 
				
			||||||
                'email' => [
 | 
					                'email' => [
 | 
				
			||||||
                    'email_template' => config('v2board.email_template', 'default')
 | 
					                    'email_template' => config('v2board.email_template', 'default')
 | 
				
			||||||
 | 
					                ],
 | 
				
			||||||
 | 
					                'telegram' => [
 | 
				
			||||||
 | 
					                    'telegram_bot_enable' => config('v2board.telegram_bot_enable', 0),
 | 
				
			||||||
 | 
					                    'telegram_bot_token' => config('v2board.telegram_bot_token')
 | 
				
			||||||
                ]
 | 
					                ]
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
        ]);
 | 
					        ]);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,7 +61,10 @@ class ConfigSave extends FormRequest
 | 
				
			|||||||
        'apple_id' => 'email',
 | 
					        'apple_id' => 'email',
 | 
				
			||||||
        'apple_id_password' => '',
 | 
					        'apple_id_password' => '',
 | 
				
			||||||
        // email
 | 
					        // email
 | 
				
			||||||
        'email_template' => ''
 | 
					        'email_template' => '',
 | 
				
			||||||
 | 
					        // telegram
 | 
				
			||||||
 | 
					        'telegram_bot_enable' => 'in:0,1',
 | 
				
			||||||
 | 
					        'telegram_bot_token' => ''
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -120,9 +120,12 @@ class OrderService
 | 
				
			|||||||
            'month_price' => 1,
 | 
					            'month_price' => 1,
 | 
				
			||||||
            'quarter_price' => 3,
 | 
					            'quarter_price' => 3,
 | 
				
			||||||
            'half_year_price' => 6,
 | 
					            'half_year_price' => 6,
 | 
				
			||||||
            'year_price' => 12
 | 
					            'year_price' => 12,
 | 
				
			||||||
 | 
					            'onetime_price' => 0
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
        $orderModel = Order::where('user_id', $user->id)->where('cycle', '!=', 'reset_price')->where('status', 3);
 | 
					        $orderModel = Order::where('user_id', $user->id)
 | 
				
			||||||
 | 
					            ->where('cycle', '!=', 'reset_price')
 | 
				
			||||||
 | 
					            ->where('status', 3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $totalValue = $orderModel->sum('total_amount') + $orderModel->sum('balance_amount');
 | 
					        $totalValue = $orderModel->sum('total_amount') + $orderModel->sum('balance_amount');
 | 
				
			||||||
        if ($totalValue <= 0) {
 | 
					        if ($totalValue <= 0) {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										29
									
								
								library/Telegram.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								library/Telegram.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					namespace Library;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use \Curl\Curl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Telegram {
 | 
				
			||||||
 | 
					    protected $api;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function __construct()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->api = 'https://api.telegram.org/bot' . config('v2board.telegram_bot_token') . '/';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function sendMessage(int $chatId, string $text, string $parseMode = '')
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->request('sendMessage', [
 | 
				
			||||||
 | 
					            'chat_id' => $chatId,
 | 
				
			||||||
 | 
					            'text' => $text,
 | 
				
			||||||
 | 
					            'parse_mode' => $parseMode
 | 
				
			||||||
 | 
					        ]);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private function request(string $method, array $params)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $curl = new Curl();
 | 
				
			||||||
 | 
					        $curl->post($this->api . $method, http_build_query($params));
 | 
				
			||||||
 | 
					        $curl->close();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user