diff --git a/app/Http/Controllers/Customer/CustomerController.php b/app/Http/Controllers/Customer/CustomerController.php index 8c9549c..fc23734 100644 --- a/app/Http/Controllers/Customer/CustomerController.php +++ b/app/Http/Controllers/Customer/CustomerController.php @@ -8,6 +8,7 @@ use App\Http\Controllers\Controller; use App\Models\Address; use App\Models\Customer; use App\Models\User; +use App\Models\Cnt; use App\Models\TransactionsAdmin; use App\Models\Withdraw; use Illuminate\Http\Request; @@ -146,6 +147,14 @@ class CustomerController extends Controller // $tah = new TahesabController(); // $tah->store(["customer_id" => $customer->id]); if (!$customer->is_legal) { + $counter = Cnt::where('key', 'jibit_counter')->first(); + if(empty($counter)){ + $counter = new Cnt(); + $counter->key = "jibit_counter"; + $counter->value = 0; + $counter->save(); + } + $nationalCode = $customer->n_code; $mobileNumber = $customer->mobile; // Storage::put('accessTokenGibit', ['accessToken']); @@ -163,6 +172,11 @@ class CustomerController extends Controller $response = Http::withoutVerifying()->withToken(Storage::get('accessTokenGibit')) ->get("https://napi.jibit.ir/ide/v1/services/matching?nationalCode=".$nationalCode."&mobileNumber=".$mobileNumber)->json(); } + + //update jibit counter + $counter->value = (int)$counter->value + 1; + $counter->save(); + // $response = Http::withHeaders([ // 'Authorization' => 'Bearer mob83EBzqU7GWBmnc-6gXIp6r2G57P_94', // 'Content-Type' => 'application/json',