my-app.php 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. use App\Exceptions\ParameterException;
  3. use App\Http\Controllers\Front\Dabory\Pro\Sso\SsoAppController;
  4. use Illuminate\Support\Facades\Artisan;
  5. use Illuminate\Support\Facades\Route;
  6. use App\Helpers\ProUtils;
  7. use Illuminate\Support\Facades\Storage;
  8. // my-app
  9. Route::middleware(['check.gate.token', 'app.token.manager'])->group(function () {
  10. //Route::group(['middleware' => 'check.pro.member'], function () {
  11. Route::group(['middleware' => 'check.pro.member'], function () {
  12. // Route::prefix('my-app')->name('my-app.')->group(function () {
  13. Route::group(['prefix' => 'my-app', 'as' => 'my-app.'], function () {
  14. Route::get('/country-code', function () {
  15. session()->put('member.CountryCode', request('code'));
  16. // dd(session('member'));
  17. return redirect()->back();
  18. });
  19. Route::post('/clear-menu-cache', function () {
  20. Storage::delete('dabory-footage/members/' . session('member')['MemberId'] . '/000000-member-menu-perm-page');
  21. });
  22. Route::get('/clear-cache', function () {
  23. Artisan::call('event:clear');
  24. Artisan::call('cache:clear');
  25. Artisan::call('optimize:clear');
  26. Artisan::call('route:clear');
  27. Artisan::call('view:clear');
  28. // Storage::deleteDirectory('dabory-footage/members/' . session('member')['MemberId']);
  29. Storage::deleteDirectory('dabory-footage/members');
  30. return redirect()->back();
  31. })->name('clear.cache');
  32. Route::get('/', function() {
  33. // dd(session('member'));
  34. return view('front.dabory.pro.my-app.index');
  35. })->name('index');
  36. Route::get('/sso/sso-app', [SsoAppController::class, 'index']);
  37. Route::get('/list-type/type1', function() {
  38. if (empty(request('bpa'))) { return redirect()->route('my-app.index'); }
  39. try {
  40. $type1 = (new App\Models\Parameter\Pro\Type1(request('bpa')));
  41. } catch (ParameterException $e) {
  42. return redirect()->route('my-app.index')->with('error', 'ErrorMessage: '.$e->getMessage().
  43. ' 경로에 Parameter 형식에 맞춰서 넣어주세요.');
  44. }
  45. $menuCode = ProUtils::bpaDecoding(request('bpa'))['menu_code'];
  46. return view('front.dabory.pro.my-app.list-type.type1',
  47. array_merge(compact('menuCode'), $type1->getData())
  48. );
  49. });
  50. });
  51. });
  52. });
  53. Route::post('/download/env-dabory', function () {
  54. $env = json_decode(request('env'), true);
  55. $prefix = request('prefix');
  56. $contents = $prefix . '_URL=' . "'" . $env['api_url'] . "'" . PHP_EOL;
  57. $contents .= $prefix . '_CLIENT_ID=' . "'" . $env['client_id'] . "'" . PHP_EOL;
  58. $contents .= $prefix . '_CLIENT_SECRET=' . "'" . $env['client_secret'] . "'" . PHP_EOL;
  59. $contents .= $prefix . '_BEFORE_BASE64=' . "'" . $env['before_base64'] . "'" . PHP_EOL;
  60. $dt = \Carbon\Carbon::now()->timezone('Asia/Seoul');
  61. $filename = $dt->format('ymd-His') . '.env.' . request('app_name', 'dabory');
  62. return response()->streamDownload(function () use ($contents) {
  63. echo $contents;
  64. }, $filename);
  65. });