Files
boursecu_server/routes/web.php
T

335 lines
12 KiB
PHP
Raw Normal View History

2026-01-24 14:03:11 +00:00
<?php
use App\Models\Customer;
use App\Models\Product;
2026-06-02 16:00:33 +03:30
use App\Services\ProductPriceService;
2026-01-24 14:03:11 +00:00
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;
2026-03-12 12:50:42 +03:30
use App\Models\Message;
use Illuminate\Http\Request;
2026-01-24 14:03:11 +00:00
Route::get('/refPricer', function () {
2026-06-04 12:18:53 +03:30
$ok = app(\App\Services\EtehadiePriceService::class)->syncProductsFromApi();
2026-06-04 12:18:53 +03:30
return response()->json($ok);
2026-01-24 14:03:11 +00:00
});
Route::get('/1', function () {
$tah = new \App\Http\Controllers\Admin\TahesabController();
return $tah->sanadList();
return $tah->healthCheck();
2026-01-24 14:03:11 +00:00
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),
]);
});
2026-03-12 12:50:42 +03:30
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;
});
2026-01-24 14:03:11 +00:00
2026-05-11 18:35:22 +00:00
Route::get('/getJibitCounter', function (Request $request) {
2026-05-11 19:10:35 +00:00
if($request->Header('secretToken') !== 'dlrA0mAsfpixA5wgCOPK2khVtFE32vBLGqUHvSvLVkMaHNdHE5'){
2026-05-11 18:35:22 +00:00
return response()->json(['auth_needed'],401);
}
$counter = \App\Models\Cnt::where('key', 'jibit_counter')->first();
return response()->json(['counter'=> (int)$counter->value]);
});
2026-01-24 14:03:11 +00:00
//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');
//});