NASER fix tahesab issues

This commit is contained in:
gholak tala
2026-03-14 16:21:42 +00:00
parent b5463e1208
commit fe83dc661a
2 changed files with 35 additions and 28 deletions
@@ -108,16 +108,16 @@ class TahesabController extends Controller
// directon: 0 = daryaft az moshtari // directon: 0 = daryaft az moshtari
// directon: 1 = pardakht be moshtari // directon: 1 = pardakht be moshtari
public function wallet($input = null) public function wallet($data)
{ {
if ($input instanceof \Illuminate\Http\Request) { // if ($input instanceof \Illuminate\Http\Request) {
$data = $input->all(); // $data = $input->all();
} elseif (is_array($input)) { // } elseif (is_array($input)) {
$data = $input; // $data = $input;
} else { // } else {
$data = request()->all(); // $data = request()->all();
} // }
if (!isset($data['customer_id']) || !isset($data['value'])) { if (!isset($data['customer_id']) || !isset($data['value'])) {
return request()->expectsJson() return request()->expectsJson()
@@ -169,28 +169,31 @@ class TahesabController extends Controller
-1, -1,
//MultiRadif //MultiRadif
] ]
]); ])->json();
} catch (\Exception $e) { } catch (\Exception $e) {
return $e->getMessage(); return $e->getMessage();
} }
if ($response['OK']) { if ($response['OK']) {
$tahesab->sh_factor = $response['Sh_factor']; Tahesab::where('id', $tahesab->id)->update([
$tahesab->tahesab_id = $response['OK']; "sh_factor" => $response['Sh_factor'],
$tahesab->save(); "tahesab_id" => $response['OK'],
"res" => json_encode($response, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT),
]);
return $data; return $data;
} }
return false; return false;
} }
public function walletGold($input = null) public function walletGold($data)
{ {
if ($input instanceof \Illuminate\Http\Request) { // if ($input instanceof \Illuminate\Http\Request) {
$data = $input->all(); // $data = $input->all();
} elseif (is_array($input)) { // } elseif (is_array($input)) {
$data = $input; // $data = $input;
} else { // } else {
$data = request()->all(); // $data = request()->all();
} // }
// return ($data); // return ($data);
if (!isset($data['customer_id'])) { if (!isset($data['customer_id'])) {
@@ -256,18 +259,20 @@ class TahesabController extends Controller
0, //Jens_Felez 0, //Jens_Felez
(string)$date, (string)$date,
] ]
]); ])->json();
} catch (Exception $e) { } catch (Exception $e) {
return $e->getMessage(); return $e->getMessage();
} }
if ($response['OK']) { if ($response['OK']) {
$tahesab->sh_factor = $response['Sh_factor']; Tahesab::where('id', $tahesab->id)->update([
$tahesab->tahesab_id = $response['OK']; "sh_factor" => $response['Sh_factor'],
$tahesab->factor_number = $response['Factor_Number']; "tahesab_id" => $response['OK'],
$tahesab->tah_id = $response['ID']; "factor_number" => $response['Factor_Number'],
$tahesab->res = $response; "tah_id" => $response['ID'],
$tahesab->data = $data; "data" => json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT),
$tahesab->save(); "res" => json_encode($response, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT),
]);
return $data; return $data;
} }
return false; return false;
+2
View File
@@ -24,6 +24,8 @@ class Tahesab extends Model
'res', 'res',
'factor_number', 'factor_number',
'tah_id', 'tah_id',
'type',
'data',
]; ];