wngur6076 4 月之前
父節點
當前提交
a4e21516ec
共有 3 個文件被更改,包括 25 次插入0 次删除
  1. 1 0
      app/Http/Controllers/Auth/SocialController.php
  2. 21 0
      app/helpers.php
  3. 3 0
      public/js/utils/lib.js

+ 1 - 0
app/Http/Controllers/Auth/SocialController.php

@@ -54,6 +54,7 @@ class SocialController extends Controller
 
         try {
             $userSocial = $this->setConfig($ssoBrand, $this->target)->user();
+            dd($userSocial);
         } catch (Exception $e) {
             return redirect()->route($loginRoute)->with(['mgs' => $e->getMessage()]);
         }

+ 21 - 0
app/helpers.php

@@ -6,6 +6,27 @@ use Illuminate\Support\Str;
 use Jenssegers\Agent\Agent as Agent;
 use Unirest\Request;
 
+function getHashSorderNo($sorderNo)
+{
+    $sorderNoExplode = explode('-', $sorderNo);
+    return $sorderNoExplode[0] . '-' . generate4DigitHash($sorderNo);
+}
+
+function generate4DigitHash($input)
+{
+    // Generate a SHA-256 hash
+    $hash = hash('sha256', $input);
+
+    // Convert hash to base 10 and get the first 4 digits
+    $decimalHash = base_convert($hash, 16, 10);
+
+    // Truncate or pad to ensure it's 4 digits long
+    $fourDigitHash = substr($decimalHash, 0, 4);
+
+    // Ensure it's always 4 digits
+    return str_pad($fourDigitHash, 4, '0', STR_PAD_LEFT);
+}
+
 function detect($view)
 {
     $agent = new Agent();

+ 3 - 0
public/js/utils/lib.js

@@ -143,6 +143,9 @@ function rand(min, max) {
 
 function format_decimal(val, number) {
     let format = decimal_convert(number);
+    // 소수점 버린다.
+    return numeral(Math.floor(val).toFixed(number)).format(format);
+    // 소수점 반올림.
     return numeral(parseFloat(val).toFixed(number)).format(format);
 }