NASER send orders to gold.ir

This commit is contained in:
2026-03-10 15:39:30 +03:30
parent 068e673fec
commit 5fa7582d93
3 changed files with 145 additions and 43 deletions
+19
View File
@@ -4,6 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Http;
class Cnt extends Model
{
@@ -18,4 +19,22 @@ class Cnt extends Model
protected $casts = [
'value_json'=>'array'
];
public function goldir_login(){
$mobile = self::where('key', 'goldir_mobile')->value('value');
$password = self::where('key', 'goldir_password')->value('value');
$goldir = Http::post('https://gold.ir/server/auth/login', [
'mobile' => $mobile,
'password' => $password,
'provider' => 'customer',
'type_app' => 'client',
])->json();
Cnt::where('key', 'goldir')->update([
'value' => $goldir['access_token'],
'updated_at' => now()
]);
return $goldir['access_token'];
}
}