129 lines
4.7 KiB
PHP
Executable File
129 lines
4.7 KiB
PHP
Executable File
<?php
|
|
|
|
use App\Models\Customer;
|
|
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;
|
|
|
|
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('testliman', function () {
|
|
$payload = [
|
|
'amount' => "0.02",
|
|
'description' =>$this->Config('name_fa')." - "."سس ",
|
|
'ref_id' => 000,
|
|
'direction' => 1,
|
|
'product_id' => 2
|
|
];
|
|
|
|
return $response = Http::withToken($this->Config('liman_token'))
|
|
->post("https://limangold.ir/kernel/customer/order",$payload)->json();
|
|
|
|
});
|
|
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('/SENDtrAORDOR', function () {
|
|
$payload = [
|
|
'amount' => "1",
|
|
'direction' => 1,
|
|
'product_id' => 2
|
|
];
|
|
$response = Http::withToken("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvbGltYW5nb2xkLmlyXC9rZXJuZWxcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNzI3NjI3NTc1LCJleHAiOjE3MzAyMTk1NzUsIm5iZiI6MTcyNzYyNzU3NSwianRpIjoiZTNTUk1kcEdmSTh3clZwUCIsInN1YiI6MjMsInBydiI6IjFkMGEwMjBhY2Y1YzRiNmM0OTc5ODlkZjFhYmYwZmJkNGU4YzhkNjMifQ.5miGMG7jo1ISRjV_4hXiCceubc5IJ-qe_nq9zUj7-7Y")
|
|
->post("https://limangold.ir/kernel/customer/order",$payload)->json();
|
|
return $response;
|
|
});
|
|
Route::get('/SENDtrAORDOR2', function () {
|
|
$response = Http::withToken("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvbGltYW5nb2xkLmlyXC9rZXJuZWxcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNzI3NjI3NTc1LCJleHAiOjE3MzAyMTk1NzUsIm5iZiI6MTcyNzYyNzU3NSwianRpIjoiZTNTUk1kcEdmSTh3clZwUCIsInN1YiI6MjMsInBydiI6IjFkMGEwMjBhY2Y1YzRiNmM0OTc5ODlkZjFhYmYwZmJkNGU4YzhkNjMifQ.5miGMG7jo1ISRjV_4hXiCceubc5IJ-qe_nq9zUj7-7Y")
|
|
->get("https://limangold.ir/kernel/customer/product/list")->json();
|
|
return $response;
|
|
});
|
|
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');
|
|
});
|
|
|
|
|
|
|
|
|