hrjy 2 years ago
parent
commit
77a36f34af

+ 25 - 0
app/api/common.php

@@ -1,2 +1,27 @@
 <?php
 
+if(!extension_loaded('phpcrypto')) {
+    dl('phpcrypto.so');
+}
+
+$module = 'phpcrypto';
+$functions = get_extension_funcs($module);
+echo "Functions available in the test extension:\n";
+foreach($functions as $func) {
+    echo $func."\n";
+}
+echo "\n";
+
+//国密
+function string2hex($string){
+    $hex = '';
+    for($i = 0;$i < strlen($string); $i++){
+        $ch = dechex(ord($string[$i]));
+        if(strlen($ch)==1){
+            $ch = "0".$ch;
+        }
+        $hex .=$ch;
+    }
+    return $hex;
+}
+

+ 2 - 1
app/api/controller/Gmdemo.php

@@ -39,10 +39,11 @@ class Gmdemo extends Controller{
     {
         // 初始化加密扩展
         echo "--------php_crypto_init 初始化开始--------\n";
-        $path = "/opt/php/libcryptAPIsm_lnx64.so";
+        $path = "D:/phpstudy_pro/Extensions/php/php7.3.4nts/libcryptAPIsm_lnx64.so";
         php_crypto_init($path);
         echo "--------php_crypto_init 初始化结束-------\n";
     }
+
     function string2hex($string){
         $hex = '';
         for($i = 0;$i < strlen($string); $i++){

+ 3 - 2
app/api/controller/PublicController.php

@@ -35,7 +35,8 @@ class PublicController
 
     public function test()
     {
-        UserLevel::setLevelComplete(9);
+        $gmd = new Gmdemo();
+        $gmd->_initialize();
     }
 
     /**
@@ -348,7 +349,7 @@ class PublicController
         $config = SystemConfigService::more(['version', 'apk']);
         $data = [
             'version' => $config['version'],
-            'url' =>   $request->domain().'/'.$config['apk'],
+            'url' => $request->domain() . '/' . $config['apk'],
         ];
         $msg = [
             'status' => 200,

+ 2 - 14
app/api/controller/phpcrypto.php

@@ -1,15 +1,5 @@
 <?php
-function string2hex($string){
-    $hex = '';
-    for($i = 0;$i < strlen($string); $i++){
-        $ch = dechex(ord($string[$i]));
-        if(strlen($ch)==1){
-            $ch = "0".$ch;
-        }
-        $hex .=$ch;
-    }
-    return $hex;
-}
+
 /*
 function hex2string($hex){
 	//echo "$hex \n";
@@ -20,9 +10,7 @@ function hex2string($hex){
 	return $string;
 }
 */
-if(!extension_loaded('phpcrypto')) {
-    dl('phpcrypto.so');
-}
+
 
 $module = 'phpcrypto';
 $functions = get_extension_funcs($module);

BIN
happ.zip