added liman service
This commit is contained in:
@@ -194,9 +194,9 @@ class TahesabController extends Controller
|
||||
// if($data['bank'] == true) {
|
||||
// try {
|
||||
// $response = Http::withoutVerifying()->timeout(10)->withHeaders([
|
||||
// 'DBName' => $this->Config('tahesab_db'),
|
||||
// 'DBName' => $this->ConfigService('tahesab_db'),
|
||||
// 'Content-Type' => 'application/json',
|
||||
// 'Authorization' => "Bearer " . $this->Config('tahesab_token'),
|
||||
// 'Authorization' => "Bearer " . $this->ConfigService('tahesab_token'),
|
||||
// ])->post((string)env('TAHESAB'), [
|
||||
// "DoNewSanadVKHBank" => [
|
||||
// 1,//Sabte_Kol_Or_Movaghat_1_0
|
||||
@@ -209,7 +209,7 @@ class TahesabController extends Controller
|
||||
// (int)$data['direction'],//IsDayaftAzMoshtariOrPardakhtBeMoshtari_0_1
|
||||
// (int)$data['value'],//Mablagh
|
||||
// $data['direction'] == 0 ? "شارژ حساب" : "برداشت از حساب",//Sharh
|
||||
// (string)$this->Config('tahesab_bank_account'), //Name_Bank
|
||||
// (string)$this->ConfigService('tahesab_bank_account'), //Name_Bank
|
||||
// "$tahesab->id",//Code_Rahgiri
|
||||
// -1,//Factor_Code
|
||||
// -1,
|
||||
@@ -234,9 +234,9 @@ class TahesabController extends Controller
|
||||
// }else{
|
||||
// try {
|
||||
// $response = Http::withoutVerifying()->timeout(10)->withHeaders([
|
||||
// 'DBName' => $this->Config('tahesab_db'),
|
||||
// 'DBName' => $this->ConfigService('tahesab_db'),
|
||||
// 'Content-Type' => 'application/json',
|
||||
// 'Authorization' => "Bearer " . $this->Config('tahesab_token'),
|
||||
// 'Authorization' => "Bearer " . $this->ConfigService('tahesab_token'),
|
||||
// ])->post((string)env('TAHESAB'), [
|
||||
// "DoNewSanadTalabBedehi" => [
|
||||
// 1,//Sabte_Kol_Or_Movaghat_1_0,
|
||||
|
||||
@@ -85,7 +85,7 @@ class AuthController extends Controller
|
||||
$user->token_sms = $rand;
|
||||
$user->save();
|
||||
|
||||
// $this->SendMessage($mobile, 'رمز عبور یکبار مصرف شما جهت ورود به اپلیکشن ' . $this->Config('name_fa') . ' ' . $rand . ' می باشد' . PHP_EOL . "@$subDomain" . " #" . $r and,true ,"sms");
|
||||
// $this->SendMessage($mobile, 'رمز عبور یکبار مصرف شما جهت ورود به اپلیکشن ' . $this->ConfigService('name_fa') . ' ' . $rand . ' می باشد' . PHP_EOL . "@$subDomain" . " #" . $r and,true ,"sms");
|
||||
$this->SendMessage($mobile, 'رمز عبور یکبار مصرف شما جهت ورود به اپلیکشن ' . $this->Config('name_fa') . ' ' . $rand . ' می باشد' . PHP_EOL . "@$subDomain" . " #" . $rand,true ,"sms");
|
||||
|
||||
return $user->id;
|
||||
@@ -148,7 +148,7 @@ class AuthController extends Controller
|
||||
if (isset($data['referral_to_id'])) {
|
||||
$referrer = Customer::where('referral_id', $data['referral_to_id'])->first();
|
||||
if ($referrer) {
|
||||
// $messageRef = "{$data['name']} با کد معرف شما ثبت نام کرد.\nدر صورت احراز او پاداش میگیرید.\n" . $this->Config('name_fa');
|
||||
// $messageRef = "{$data['name']} با کد معرف شما ثبت نام کرد.\nدر صورت احراز او پاداش میگیرید.\n" . $this->ConfigService('name_fa');
|
||||
// $this->Send($referrer->mobile, $messageRef);
|
||||
$AdminMessage = "با معرفی {$referrer->name}، کاربر {$data['name']} در اپ {$this->Config('name_fa')} ثبت نام کرده و منتظر تایید شماست.";
|
||||
User::where('send_sms', 1)->get()->each(function ($admin) use ($AdminMessage, $data,) {
|
||||
|
||||
@@ -160,22 +160,6 @@ class Controller extends BaseController
|
||||
public static function Config($name)
|
||||
{
|
||||
return Setting::where('key',$name)->first()->value ?? false;
|
||||
|
||||
//
|
||||
// return $settings = collect(Setting::all())
|
||||
// ->mapWithKeys(function ($s) {
|
||||
// return [$s['key'] => $s['value']];
|
||||
// })->firstWhere('key', $name)['value'] ?? false;
|
||||
// return $settingValue = $settings->firstWhere('key', $name)['value'] ?? false;
|
||||
//
|
||||
// if (!$settingValue) {
|
||||
// $subs = collect(Http::withToken('')->get('https://pm.gholaktala.ir/config/'.strtr($_SERVER['SERVER_NAME'], '.', '_'))->json()['subs'])
|
||||
// ->firstWhere('name', $name)['value'] ?? false;
|
||||
//
|
||||
// return $subs;
|
||||
// }
|
||||
//
|
||||
// return $settingValue;
|
||||
}
|
||||
|
||||
public static function jibit($method, $p1 = null, $p2 = null, $p3 = null)
|
||||
|
||||
@@ -211,13 +211,13 @@ class WalletController extends Controller
|
||||
}
|
||||
/* try {
|
||||
$response = Http::withHeaders([
|
||||
'Authorization' => 'Bearer ' . $this->Config('liman_token')
|
||||
'Authorization' => 'Bearer ' . $this->ConfigService('liman_token')
|
||||
])->post('https://limangold.ir/kernel/customer/fin', [
|
||||
'receive_bank_shaba' => $bCart->shaba_number,
|
||||
'receive_bank_card' => $bCart->cart_number,
|
||||
'receive_name' => $customer->name,
|
||||
'receive_account_number' => $bCart->account_number,
|
||||
'description' => $this->Config('name_fa') . ' | ' . $customer->mobile . ' | ' . $customer->name . ' | ' . $Withdraw->id,
|
||||
'description' => $this->ConfigService('name_fa') . ' | ' . $customer->mobile . ' | ' . $customer->name . ' | ' . $Withdraw->id,
|
||||
'amount' => '1000'
|
||||
])->json();
|
||||
if (isset($response['id'])) {
|
||||
|
||||
@@ -483,7 +483,7 @@ class SingleOrderController extends Controller
|
||||
;
|
||||
if (isset($response['message']) && $response['message'] == 'no authorised') {
|
||||
$cnt = new Cnt();
|
||||
$response = Http::withToken($cnt->goldir_login())//$this->Config('liman_token'))
|
||||
$response = Http::withToken($cnt->goldir_login())//$this->ConfigService('liman_token'))
|
||||
->post($goldir_base_url."/server/customer/order", [
|
||||
"mazaneh" => ((int)$mazaneh),
|
||||
'amount' => $data['amount'],
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use League\Flysystem\Config;
|
||||
|
||||
class ConfigService
|
||||
{
|
||||
public static function Config($name)
|
||||
{
|
||||
return Setting::where('key',$name)->first()->value ?? false;
|
||||
}
|
||||
public static function UpdateConfig($name,$value)
|
||||
{
|
||||
return Setting::where('key',$name)->update(['value'=>$value]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use League\Flysystem\Config;
|
||||
use app\services\ConfigService;
|
||||
|
||||
class LimanService
|
||||
{
|
||||
public function liman_login(){
|
||||
$mobile = app(ConfigService::class)->Config('liman_mobile');
|
||||
$password = app(ConfigService::class)->Config('liman_password');
|
||||
|
||||
$liman = Http::post('http://212.23.201.173/server/auth/login', [
|
||||
'mobile' => $mobile,//شماره اکانت اپلیکیشن هنزا تو لیمان ایدی 1377
|
||||
'password' => $password,
|
||||
'provider' => 'customer',
|
||||
'type_app' => 'client',
|
||||
])->json();
|
||||
|
||||
app(ConfigService::class)->UpdateConfig('liman_token', $liman['token']);
|
||||
return $liman['access_token'];
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -199,7 +199,7 @@ return [
|
||||
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
|
||||
'Bus' => Illuminate\Support\Facades\Bus::class,
|
||||
'Cache' => Illuminate\Support\Facades\Cache::class,
|
||||
'Config' => Illuminate\Support\Facades\Config::class,
|
||||
'ConfigService' => Illuminate\Support\Facades\Config::class,
|
||||
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
||||
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
||||
'Date' => Illuminate\Support\Facades\Date::class,
|
||||
|
||||
+2
-2
@@ -282,13 +282,13 @@ Route::get('/getJibitCounter', function (Request $request) {
|
||||
//Route::get('testliman', function () {
|
||||
// $payload = [
|
||||
// 'amount' => "0.02",
|
||||
// 'description' =>$this->Config('name_fa')." - "."سس ",
|
||||
// 'description' =>$this->ConfigService('name_fa')." - "."سس ",
|
||||
// 'ref_id' => 000,
|
||||
// 'direction' => 1,
|
||||
// 'product_id' => 2
|
||||
// ];
|
||||
//
|
||||
// return $response = Http::withToken($this->Config('liman_token'))
|
||||
// return $response = Http::withToken($this->ConfigService('liman_token'))
|
||||
// ->post("https://limangold.ir/kernel/customer/order",$payload)->json();
|
||||
//
|
||||
//});
|
||||
|
||||
Reference in New Issue
Block a user