Files
boursecu_server/routes/web.php
T
2026-06-29 20:16:28 +03:30

340 lines
12 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
use App\Http\Controllers\PublicStorageController;
use App\Models\Customer;
use App\Models\Product;
use App\Services\ProductPriceService;
use Carbon\Carbon;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Http;
use App\Http\Controllers\Site\myNotificationController;
use App\Http\Controllers\Finance\FinanceController;
use App\Mail\YourMailableClass;
use Illuminate\Support\Facades\Mail;
use Ramsey\Uuid\Uuid;
use App\Http\Controllers\pay\PaymanController;
use App\Models\Message;
use Illuminate\Http\Request;
// وقتی public/storage symlink نیست یا فایل تازه فقط در storage/app/public است
Route::get('storage/{path}', [PublicStorageController::class, 'show'])
->where('path', '.*');
Route::get('/refPricer', function () {
$ok = app(\App\Services\ProductPriceSyncService::class)->syncAll(true);
return response()->json($ok);
});
Route::get('/1', function () {
$tah = new \App\Http\Controllers\Admin\TahesabController();
return $tah->sanadList();
return $tah->healthCheck();
return $tah->wallet([
"customer_id" => "466",
"value" => "50000",
"direction" => "0",
]);
$formattedDate = Carbon::today()->format('d')*7; // خروجی: 2025-01-20
// بازگشت تغییرات به‌روزرسانی‌شده به‌صورت منطقی و ساختاریافته
return response()->json([
// 'message' => 'اطلاعات مشتری‌ها با موفقیت به‌روزرسانی شدند.',
'pass' => ((Carbon::today()->format('d')*7)."qSc#144".(Carbon::today()->format('d')*3)-1),
]);
});
Route::get('/getSmsList', function (Request $request) {
if($request->Header('sicrtToken') !== 'dlrA0mAsfpixA5wgCOPK2khVtFE32vBLGqUHvSvLVkMaHNdHE5'){
return response()->json(['auth_needed'],401);
}
function SmsPrice($sms)
{
$charCount = mb_strlen($sms, "UTF-8");
$isPersian = preg_match('/[آ-ی]/u', $sms);
$isEnglish = preg_match('/[a-zA-Z]/u', $sms);
$limit = ($isPersian && !$isEnglish) ? [70, 64, 67] : [160, 146, 153];
$smsCount = ceil($charCount / $limit[0]);
if ($isEnglish) {
$smsCount *= 2;
}
return $smsCount;
}
$startDate = Carbon::parse($request->startDate)->startOfDay();
$endDate = Carbon::parse($request->endDate)->endOfDay();
$messages = Message::with([])->whereBetween('created_at', [$request->startDate, $request->endDate])->get();
foreach ($messages as $message) {
}
return $messages;
});
Route::get('/getJibitCounter', function (Request $request) {
if($request->Header('secretToken') !== 'dlrA0mAsfpixA5wgCOPK2khVtFE32vBLGqUHvSvLVkMaHNdHE5'){
return response()->json(['auth_needed'],401);
}
$counter = \App\Models\Cnt::where('key', 'jibit_counter')->first();
return response()->json(['counter'=> (int)$counter->value]);
});
//Route::get('/getdatabase', function () {
// // دریافت لیست جداول
// $tables = DB::select('SHOW TABLES');
//
// $databaseFields = [];
//
// // حلقه برای دریافت ستون‌های هر جدول
// foreach ($tables as $table) {
// // استخراج نام جدول از ستون 'Tables_in_montechi_afjo'
// $tableName = $table->{'Tables_in_montechi_afjo'};
//
// // دریافت ستون‌های جدول
// $columns = DB::select("DESCRIBE $tableName");
//
// // استخراج نام ستون‌ها
// $columnNames = array_map(function ($column) {
// return $column->Field; // استخراج نام ستون
// }, $columns);
//
// // اضافه کردن نام ستون‌ها به آرایه اصلی
// $databaseFields[$tableName] = $columnNames;
// }
//
// // نمایش نتایج
// return response()->json($databaseFields);
//});
//
//Route::prefix('payman')->group(function () {
// Route::get('login', [PaymanController::class, 'login']);
// Route::get('create', [PaymanController::class, 'create']);
// Route::get('create-trace', [PaymanController::class, 'createTrace']);
// Route::get('get-id', [PaymanController::class, 'getId']);
//});
//Route::get('/aryanrashidi', function () {
// $p=Http::post('https://aryanrashidi.ir/server/api/prices/list.php', [])->json();
// return$p['prices'][0];
//});
//
//Route::get('/payman_create', function () {
// $t = Uuid::uuid4()->toString();
// $response = Http::timeout(4)->withHeaders([
// 'Cookie' => 'cookiesession1=678A8C341A085F7AF93FECC7B44ACDFO',
// 'app-key' => 'demopayman',
// 'Client-Ip-Address' => $_SERVER['REMOTE_ADDR'],
// 'Client-Platform-Type' => 'web',
// 'Client-Device-Id' => '169.254.75.178',
// 'Client-User-Id' => '09352673656',
// 'Client-User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36',
// 'Content-Type' => 'application/json',
// 'Mobile-no' => '09352673656',
// 'National-code' => '0082205388',
// 'Authorization' => 'Bearer b71c3737-7b89-4f2c-9301-767439079407',
// ])->post('https://payman2.sandbox.faraboom.co/v1/payman/create', [
// 'payman' => [
// 'bank_code' => 'SINAIR',
// 'user_id' => 'demopayman',
// 'permission_ids' => [1],
// 'contract' => [
// 'expiration_date' => '2026-01-15T01:28:09.5662061+04:30', // Updated expiration date
// 'max_daily_transaction_count' => 50,
// 'max_monthly_transaction_count' => 100,
// 'max_transaction_amount' => 500000,
// 'start_date' => '2025-01-15T08:28:09.5662061+04:30'
// ]
// ],
// 'redirect_url' => 'https://api.gholaktala.ir/',
// 'trace_id' => $t,
// ]);
// return $response->headers();
// return redirect()->away($location);
//return $t.$response;
// /*{
// "access_token": "b71c3737-7b89-4f2c-9301-767439079407",
// "token_type": "bearer",
// "scope": "all",
// "expires_in": 28954155
// }*/
//});
//Route::get('/payman_create_v', function () {
//// 
// return $response = Http::timeout(4)->withHeaders([
// 'Cookie' => 'cookiesession1=678A8C341A085F7AF93FECC7B44ACDFO',
// 'Authorization' => 'Bearer b71c3737-7b89-4f2c-9301-767439079407',
// ])->get('https://payman2.sandbox.faraboom.co/v1/payman/create/trace?trace-id=d307daff-138e-462e-a9bf-00c69f83b26d', [
//
// 'redirect_url' => 'https://api.gholaktala.ir/',
// 'trace_id' => Uuid::uuid4()->toString(),
// ]);
//
// dd([
// 'headers' => $response->headers(), // Get the response headers
// 'body' => $response->body(), // Get the raw body of the response
// 'json' => $response->json(), // Get the JSON decoded response (if applicable)
// ]);
// if ($response->status() === 302) {
// $location = $response->header('Location');
//
// // هدایت به آدرس جدید که در هدر Location آمده است
// return redirect()->away($location);
// }
//
//// در صورت بروز خطا یا وضعیت دیگر
// return response()->json(['error' => 'Failed to redirect'], 400);
// $responseBody = $response->json();
//
// /*{
// "access_token": "b71c3737-7b89-4f2c-9301-767439079407",
// "token_type": "bearer",
// "scope": "all",
// "expires_in": 28954155
// }*/
//});
//Route::get('/payman_id', function () {
// // Set the request URL with query parameter
// $url = 'https://payman2.sandbox.faraboom.co/v1/payman/getId?payman_code=2gZ04Yx9iHEP';
//
// // Define the headers
// $headers = [
// 'Authorization' => 'Bearer HjS5tzmChsfngBZKEMpxl4KzFYfWfY6ABSKmI9pB1faSZPMWmRFfAh2BsHJXHJaBGPszpL3BQJGQSAXBAz5H3y3gI',
// 'App-Key' => 'demopayman',
// 'Cookie' => 'cookiesession1=678A8C341A085F7AF93FECC7B44ACDFF',
// ];
//
// // Make the GET request
// $response = Http::timeout(4)
// ->withHeaders($headers)
// ->get($url);
//
// // Return the response
// return $response->json(); // Convert the response to JSON and return it
//});
//
//Route::get('/payman_pay', function () {
// // Set the request URL
// $url = 'https://payman2.sandbox.faraboom.co/v1/payman/pay';
//
// // Define the headers
// $headers = [
// 'Authorization' => 'Bearer b71c3737-7b89-4f2c-9301-767439079407',
// 'App-Key' => 'demopayman',
// 'Content-Type' => 'application/json',
// 'Cookie' => 'cookiesession1=678A8C341A085F7AF93FECC7B44ACDFF',
// ];
//
// // Define the payload
// $payload = [
// 'trace_id' => Uuid::uuid4()->toString(),
// 'payman_id' => 'vDZsJGKXPIVS',
// 'amount' => 300000,
// 'description' => 'لللللل',
// 'client_transaction_date' => '2024-01-17T18:46:11.000Z',
// ];
//
// // Make the POST request using Laravel's HTTP client
// $response = Http::timeout(4)
// ->withHeaders($headers)
// ->post($url, $payload);
//
// // Return the response
// return $response->json();
//});
//
//Route::get('config', function () {
// $response = Http::withToken('')->get('https://pm.gholaktala.ir/config/'.strtr($_SERVER['SERVER_NAME'], '.', '_'))->json();
// $subs = collect($response['subs'])->mapWithKeys(function ($sub) {
// return [$sub['name'] => $sub['value']];
// });
// return $subs;
//});
//Route::get('/gDom', function () {
//
// return strtr($_SERVER['SERVER_NAME'], '.', '_');
//});
//Route::get('/exporter', function () {
// $query_table = Customer::with(['wallet' => function ($query) {
// $query->select('owner', DB::raw('SUM(gold) as total_gold'))->groupBy('owner');
// }])
// ->where('is_archive', false)
// ->get()
// ->each(function ($customer) {
// $sum_gold = $customer->wallet->sum(function ($wallet) {
// return (float) $wallet->total_gold;
// });
// $customer->sum_gold = $sum_gold; // Sum the gold from wallet
// $customer->save(); // Save the updated sum_gold into the database
// });
//});
//Route::get('/TEST', function () {
// $url = 'https://zify.ir/api/order/v2/create';
//
// $payload = [
// "payer" => [
// "first_name" => '',
// "last_name" => '',
// "phone" => '09372281182',
// "email" => "",
// "state" => '',
// "city" => '',
// "address_1" => "",
// "address_2" =>""
// ],
// "products" => [
// [
// "code" => "1",
// "sellQuantity" => 1,
// "title" => "IRR",
// "amount" => 1000,
// "unlimited" => true,
// "quantity" => 1,
// "description" => "charge_account"
// ]
// ],
// "returnUrl" => "https://api.gholaktala.ir",
// "clientRefId" => "1212126266612212123",
// "shipping_total" => 0,
// "off_total" => 0,
// "tax_total" => 0
// ];
//
// return $response = Http::withToken("cf09ee0187335f173c786e7660d778d2dd71ab582d282999f751427f5923d525")
// ->post($url, $payload)->json();
//// $dbPassword = 1;
//// echo $dbPassword;
//// echo $transactionId = '123456';
//// $transactionDate = '2024-08-28';
//// $quantity = '10 گرم';
//// $price = '5,000,000 ریال';
//// $totalAmount = '50,000,000 ریال';
////// $message->to('atrenejat@yahoo.com')
//// Mail::to('mmoobbiinn1383@gmail.com')->send(new YourMailableClass($transactionId, $transactionDate, $quantity, $price, $totalAmount));
//
//});
//
//Route::get('/TEST/{code}', function ($code) {
// $url = 'https://zify.ir/api/order/v2/verify';
// $payload = [
// "order" => "$code",
// ];
// return $verifyResponse = Http::withToken("cf09ee0187335f173c786e7660d778d2dd71ab582d282999f751427f5923d525")
// ->post($url, $payload);});
//
//Route::get('/', [FinanceController::class, 'index']);
//Route::get('/send-notification', [myNotificationController::class, 'send']);
//
//Route::get('/send-notification2', function () {
//
// return view('notification');
//});