You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.9 KiB
PHP
86 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Login\LoginService;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Crypt;
|
|
use Yz;
|
|
use App\Lib\HSM;
|
|
use App\Lib\XTSign;
|
|
class LoginController extends Controller
|
|
{
|
|
public function Login(){
|
|
$username =request('username');
|
|
$password= request('password');
|
|
$login=app()->make(LoginService::class);
|
|
//$login= new LoginService();
|
|
return Yz::echo($login->Login(['username'=>$username,'password'=>$password]));
|
|
}
|
|
function de_hunxiao($str)
|
|
{
|
|
$decodedString = base64_decode($str);
|
|
|
|
// 第二步:移除固定的前缀和后缀
|
|
$strippedString = str_replace('a5331_', '', $decodedString);
|
|
$strippedString = str_replace('_a454d', '', $strippedString);
|
|
|
|
// 第三步:反转字符串以恢复原始顺序
|
|
$reversedString = strrev($strippedString);
|
|
|
|
// 第四步:字符替换(包括字母和数字)
|
|
$charMap = [
|
|
'z' => 'a', 'y' => 'b', 'x' => 'c', 'w' => 'd', 'v' => 'e',
|
|
'u' => 'f', 't' => 'g', 's' => 'h', 'r' => 'i', 'q' => 'j',
|
|
'p' => 'k', 'o' => 'l', 'n' => 'm', 'm' => 'n', 'l' => 'o',
|
|
'k' => 'p', 'j' => 'q', 'i' => 'r', 'h' => 's', 'g' => 't',
|
|
'f' => 'u', 'e' => 'v', 'd' => 'w', 'c' => 'x', 'b' => 'y',
|
|
'a' => 'z',
|
|
'@' => '0', '!' => '1', '#' => '2', '$' => '3', '%' => '4',
|
|
'^' => '5', '&' => '6', '*' => '7', '(' => '8', ')' => '9'
|
|
];
|
|
$originalString = '';
|
|
for ($i = 0; $i < strlen($reversedString); $i++) {
|
|
$char = $reversedString[$i];
|
|
$originalString .= isset($charMap[$char]) ? $charMap[$char] : $char;
|
|
}
|
|
|
|
// 输出解码后的字符串
|
|
return $originalString;
|
|
}
|
|
public function test(){
|
|
//加密解密测试
|
|
// dd( HSM::HsmDecrypt("9bef05d29d91d1058b742261638b8d1c"));
|
|
|
|
//登录签名测试
|
|
$data=[
|
|
"userName"=>"张三",
|
|
"idType"=>"SF",
|
|
"idNumber"=>"513436200005039287",
|
|
"department"=>'QT',
|
|
"mobile"=>"18745292116",
|
|
];
|
|
|
|
//产生激活码测试
|
|
$data=[
|
|
'userId'=>'b24d281af0b7f2bc3a49c90cf1853cd2e59569c982cb10970aa60a254bcc83f7'
|
|
];
|
|
|
|
//添加任务签名
|
|
$data=[
|
|
// "userId"=>"b24d281af0b7f2bc3a49c90cf1853cd2e59569c982cb10970aa60a254bcc83f7",
|
|
"title"=>"测试签名",
|
|
"dataType"=>"DATA",
|
|
"algo"=>"SM3withSM2",
|
|
"description"=>"签名数据描述信息",
|
|
"expiryDate"=>"1440",
|
|
"data"=>"562+5ZCN5rWL6K+V5pWw5o2u",
|
|
"requireQrCode"=>"N",
|
|
"callBackUrl"=>"https://www.yanzai.vip/common/laravel/public/api/XTSignNotify"
|
|
];
|
|
$r=XTSign::XTRequest('addSignJob',$data);
|
|
return $r;
|
|
}
|
|
}
|