Преглед изворни кода

encodeDistributionChannelId

zz пре 4 година
родитељ
комит
3664ccca00
1 измењених фајлова са 10 додато и 14 уклоњено
  1. 10 14
      app/Libs/functions/Helpers.php

+ 10 - 14
app/Libs/functions/Helpers.php

@@ -227,30 +227,26 @@ function ImageNewsToArray($datas)
 /**
 /**
  * 加密site id
  * 加密site id
  */
  */
-function encodeDistributionChannelId($id)
-{
-    $encrypt_pool = [];
-    if (isset($encrypt_pool[$id])) {
+function encodeDistributionChannelId($id){
+    $encrypt_pool = ['10497'=>'wdtest'];
+    if(isset($encrypt_pool[$id])){
         return $encrypt_pool[$id];
         return $encrypt_pool[$id];
     }
     }
-
-    $hashids = new \Hashids\Hashids('', 16, 'abcdefghjklmnopqrstuvwxyz1234567890');
+    $hashids = new \Hashids\Hashids(config('hashids.connections.main.salt'),16,'abcdefghjklmnopqrstuvwxyz1234567890');
     return $hashids->encode($id);
     return $hashids->encode($id);
 }
 }
 
 
 /**
 /**
  * 解密密site id
  * 解密密site id
  */
  */
-function decodeDistributionChannelId($code)
-{
-    $encrypt_pool = [];
-    if (isset($encrypt_pool[$code])) {
+function decodeDistributionChannelId($code){
+    $encrypt_pool = ['wdtest'=>'10497'];
+    if(isset($encrypt_pool[$code])){
         return $encrypt_pool[$code];
         return $encrypt_pool[$code];
     }
     }
-
-    $hashids = new \Hashids\Hashids('', 16, 'abcdefghjklmnopqrstuvwxyz1234567890');
-    $res     = $hashids->decode($code);
-    if ($res && isset($res[0])) {
+    $hashids = new \Hashids\Hashids(config('hashids.connections.main.salt'),16,'abcdefghjklmnopqrstuvwxyz1234567890');
+    $res = $hashids->decode($code);
+    if($res && isset($res[0])){
         return $res[0];
         return $res[0];
     }
     }
     return null;
     return null;