Przeglądaj źródła

new encrypt distribution channel id

zz 6 lat temu
rodzic
commit
692c78a945
1 zmienionych plików z 16 dodań i 0 usunięć
  1. 16 0
      app/Libs/Helpers.php

+ 16 - 0
app/Libs/Helpers.php

@@ -223,6 +223,14 @@ function ImageNewsToArray($datas){
  * 加密site id
  */
 function encodeDistributionChannelId($id){
+    $db_encrypt_info = \DB::table('distribution_channel_id_encrypt')
+        ->where('distribution_channel_id',$id)
+        ->where('is_enable',1)
+        ->select('en_distribution_channel_id')
+        ->first();
+    if($db_encrypt_info && $db_encrypt_info->en_distribution_channel_id){
+        return $db_encrypt_info->en_distribution_channel_id;
+    }
     $hashids = new \Hashids\Hashids('',16,'abcdefghjklmnopqrstuvwxyz1234567890');
     return $hashids->encode($id);
 }
@@ -231,6 +239,14 @@ function encodeDistributionChannelId($id){
  * 解密密site id
  */
 function decodeDistributionChannelId($code){
+    $db_encrypt_info = \DB::table('distribution_channel_id_encrypt')
+        ->where('en_distribution_channel_id',$code)
+        ->where('is_enable',1)
+        ->select('distribution_channel_id')
+        ->first();
+    if($db_encrypt_info && $db_encrypt_info->distribution_channel_id){
+        return $db_encrypt_info->distribution_channel_id;
+    }
     $hashids = new \Hashids\Hashids('',16,'abcdefghjklmnopqrstuvwxyz1234567890');
     $res = $hashids->decode($code);
     if($res && isset($res[0])){