175 lines
4.2 KiB
PHP
Executable File
175 lines
4.2 KiB
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controllers;
|
|
|
|
use App\Services\Auth;
|
|
use Psr\Http\Message\ResponseInterface;
|
|
use Slim\Http\Response;
|
|
use Slim\Http\ServerRequest;
|
|
use Smarty\Exception as SmartyException;
|
|
use App\Services\Auth as AuthService;
|
|
use App\Models\Product;
|
|
use App\Models\Config;
|
|
use App\Models\UserCoupon;
|
|
use App\Services\Cron as CronService;
|
|
use App\Services\Reward;
|
|
|
|
use App\Services\TomTool\Http;
|
|
|
|
|
|
session_start();
|
|
|
|
final class TestController extends BaseController
|
|
{
|
|
|
|
public function test4 ()
|
|
{
|
|
// session_start();
|
|
|
|
$oHttp = new Http();
|
|
|
|
$oHttp->sMethod = "get";
|
|
$oHttp->sToUrl = $_ENV['baseUrl']."/api/tg/hook";
|
|
$oHttp->sToUrl = 'https://fuc.loc/test3';
|
|
// $oHttp->bIsJson = true;
|
|
//$oHttp->aData[]
|
|
$oHttp->aData = [
|
|
'update_id' => 123456789,
|
|
'message' => [
|
|
'message_id' => 1,
|
|
'from' => [
|
|
'id' => 987654321,
|
|
'is_bot' => false,
|
|
'first_name' => 'John',
|
|
'last_name' => 'Doe',
|
|
'username' => 'johndoe',
|
|
'language_code' => 'en'
|
|
],
|
|
'chat' => [
|
|
'id' => -4668400285,
|
|
'first_name' => 'John',
|
|
'last_name' => 'Doe',
|
|
'username' => 'johndoe',
|
|
'type' => 'private'
|
|
],
|
|
'date' => 1610000000,
|
|
'text' => '22'
|
|
]
|
|
];
|
|
|
|
$r = $oHttp->send();
|
|
|
|
var_dump($r);
|
|
exit;
|
|
}
|
|
|
|
public function test2()
|
|
{
|
|
|
|
$_SESSION['test'] = 333;
|
|
var_dump($_SESSION);
|
|
|
|
http_response_code(200);exit;
|
|
}
|
|
|
|
public function test3()
|
|
{
|
|
|
|
var_dump($_SESSION);
|
|
|
|
http_response_code(200);exit;
|
|
}
|
|
|
|
public function test1(ServerRequest $request, Response $response, array $args): ResponseInterface
|
|
{
|
|
|
|
error_reporting(E_ALL); // 报告所有错误
|
|
ini_set('display_errors', 1); // 显示错误
|
|
|
|
$k = $request->getQueryParam('k');
|
|
|
|
if ($k !== "wocaonide") {
|
|
exit('x');
|
|
}
|
|
|
|
|
|
$url = 'https://fuc.loc/api/tg/hook';
|
|
$data = [
|
|
'message' => [
|
|
'chat' => [
|
|
'id' => '-4668400285'
|
|
],
|
|
'text' => '/reply 11 sss'
|
|
]
|
|
];
|
|
|
|
$options = [
|
|
'http' => [
|
|
'header' => "Content-Type: application/json\r\n",
|
|
'method' => 'POST',
|
|
'content' => json_encode($data),
|
|
],
|
|
'ssl' => [
|
|
'verify_peer' => false,
|
|
'verify_peer_name' => false,
|
|
],
|
|
];
|
|
|
|
$context = stream_context_create($options);
|
|
$result = file_get_contents($url, false, $context);
|
|
|
|
if ($result === FALSE) {
|
|
die('Error');
|
|
}
|
|
|
|
echo $result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exit;
|
|
|
|
$jobs = new CronService();
|
|
|
|
$jobs->bandwidthMerge();
|
|
|
|
exit;
|
|
if ($_ENV['is_loc'] !== true) {
|
|
exit;
|
|
}
|
|
|
|
$user_id = 3;
|
|
$user_ref_by = 4;
|
|
$paylist_total = 43;
|
|
$paylist_invoice_id = rand(1,99999);
|
|
$invoice_order_id = 10;
|
|
|
|
$r = Reward::issuePaybackReward($user_id, $user_ref_by, $paylist_total, $paylist_invoice_id, $invoice_order_id);
|
|
var_dump($r);
|
|
exit;
|
|
|
|
$user = AuthService::getUser();
|
|
|
|
$taocan = (new Product())->where('status', '1')
|
|
->where('type_by_time', '30')
|
|
->orderBy('price')
|
|
->get();
|
|
|
|
foreach ($taocan as $taocanTmp) {
|
|
$taocanTmp->content = json_decode($taocanTmp->content);
|
|
$taocanTmp->price = (int) $taocanTmp->price;
|
|
}
|
|
|
|
return $response->write(
|
|
$this->view()
|
|
->assign('is_login', $user->isLogin)
|
|
->assign('taocan', $taocan)
|
|
->fetch('email_test/verify_code.tpl')
|
|
);
|
|
}
|
|
}
|