NASER add jibit counter for national code
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Models\Address;
|
use App\Models\Address;
|
||||||
use App\Models\Customer;
|
use App\Models\Customer;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Models\Cnt;
|
||||||
use App\Models\TransactionsAdmin;
|
use App\Models\TransactionsAdmin;
|
||||||
use App\Models\Withdraw;
|
use App\Models\Withdraw;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -146,6 +147,14 @@ class CustomerController extends Controller
|
|||||||
// $tah = new TahesabController();
|
// $tah = new TahesabController();
|
||||||
// $tah->store(["customer_id" => $customer->id]);
|
// $tah->store(["customer_id" => $customer->id]);
|
||||||
if (!$customer->is_legal) {
|
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;
|
$nationalCode = $customer->n_code;
|
||||||
$mobileNumber = $customer->mobile;
|
$mobileNumber = $customer->mobile;
|
||||||
// Storage::put('accessTokenGibit', ['accessToken']);
|
// Storage::put('accessTokenGibit', ['accessToken']);
|
||||||
@@ -163,6 +172,11 @@ class CustomerController extends Controller
|
|||||||
$response = Http::withoutVerifying()->withToken(Storage::get('accessTokenGibit'))
|
$response = Http::withoutVerifying()->withToken(Storage::get('accessTokenGibit'))
|
||||||
->get("https://napi.jibit.ir/ide/v1/services/matching?nationalCode=".$nationalCode."&mobileNumber=".$mobileNumber)->json();
|
->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([
|
// $response = Http::withHeaders([
|
||||||
// 'Authorization' => 'Bearer mob83EBzqU7GWBmnc-6gXIp6r2G57P_94',
|
// 'Authorization' => 'Bearer mob83EBzqU7GWBmnc-6gXIp6r2G57P_94',
|
||||||
// 'Content-Type' => 'application/json',
|
// 'Content-Type' => 'application/json',
|
||||||
|
|||||||
Reference in New Issue
Block a user