Fix FS services amounts
This commit is contained in:
parent
5522d81073
commit
bfb0612ead
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Exports\RefundAmountExport;
|
use App\Exports\RefundAmountExport;
|
||||||
|
use App\Imports\RefundAmountImport;
|
||||||
use App\Jobs\TestJob;
|
use App\Jobs\TestJob;
|
||||||
use App\Models\AgentPlus;
|
use App\Models\AgentPlus;
|
||||||
use App\Models\ConfigWallet;
|
use App\Models\ConfigWallet;
|
||||||
|
@ -17,7 +18,9 @@ use App\Traits\ApiResponser;
|
||||||
use App\Traits\Helper;
|
use App\Traits\Helper;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
class HelperController extends Controller
|
class HelperController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -190,32 +193,34 @@ class HelperController extends Controller
|
||||||
return Excel::download($export, 'refund.xlsx');
|
return Excel::download($export, 'refund.xlsx');
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function fixTransactionAmount()
|
public function fixFSServicesAmounts()
|
||||||
// {
|
{
|
||||||
// $data = Excel::toArray(new RefundAmountImport, storage_path('refund.xlsx'));
|
$data = Excel::toArray(new RefundAmountImport, storage_path('refund.xlsx'));
|
||||||
// $result = [];
|
$result = [];
|
||||||
// foreach ($data[0] as $key => $row) {
|
foreach ($data[0] as $key => $row) {
|
||||||
// if ($key > 0) {
|
if ($key > 0) {
|
||||||
// array_push($result, $row);
|
array_push($result, $row);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// try {
|
try {
|
||||||
// DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
// // Fix amount
|
// Fix amount
|
||||||
// foreach ($result as $r) {
|
foreach ($result as $r) {
|
||||||
// if (isset($r[6])) {
|
if (isset($r[6])) {
|
||||||
// $wallet = Wallet::find($r[0]);
|
if ($r[3] == 'hyper') continue;
|
||||||
// $wallet->balance_com -= $r[6];
|
$refund = $r[3] == 'geolocated' ? 50 * $r[5] : 25 * $r[5];
|
||||||
// $wallet->save();
|
$wallet = Wallet::find($r[0]);
|
||||||
// }
|
$wallet->balance_com += $refund;
|
||||||
// }
|
$wallet->save();
|
||||||
// DB::commit();
|
}
|
||||||
// return $this->successResponse(trans('messages.success_treated_demand'));
|
}
|
||||||
// } catch (Throwable $exception) {
|
DB::commit();
|
||||||
// DB::rollBack();
|
return $this->successResponse(trans('messages.success_treated_demand'));
|
||||||
// Log::error($exception->getMessage());
|
} catch (Throwable $exception) {
|
||||||
// return $this->errorResponse(trans('errors.unexpected_error'));
|
DB::rollBack();
|
||||||
// }
|
Log::error($exception->getMessage());
|
||||||
// }
|
return $this->errorResponse(trans('errors.unexpected_error'));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ class CreateJobsTable extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('jobs', function (Blueprint $table) {
|
Schema::create('jobs', function (Blueprint $table) {
|
||||||
$table->bigIncrements('id');
|
$table->bigIncrements('id');
|
||||||
|
$table->string('uuid')->nullable()->unique();
|
||||||
$table->string('queue')->index();
|
$table->string('queue')->index();
|
||||||
$table->longText('payload');
|
$table->longText('payload');
|
||||||
$table->unsignedTinyInteger('attempts');
|
$table->unsignedTinyInteger('attempts');
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
//});
|
//});
|
||||||
$router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($router) {
|
$router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($router) {
|
||||||
// Helper routes
|
// Helper routes
|
||||||
|
$router->get('fixFSServicesAmounts', 'HelperController@fixFSServicesAmounts');
|
||||||
$router->post('update_password', 'UserController@updatePassword');
|
$router->post('update_password', 'UserController@updatePassword');
|
||||||
$router->get('agent_codes/{agent_code}', 'HelperController@agentCodes');
|
$router->get('agent_codes/{agent_code}', 'HelperController@agentCodes');
|
||||||
$router->get('countries', 'HelperController@countries');
|
$router->get('countries', 'HelperController@countries');
|
||||||
|
|
Loading…
Reference in New Issue