<?php

namespace App\Http\Controllers\API\Admin;

use App\Http\Controllers\Controller;
use App\Services\Login\LoginService;
use Illuminate\Http\Request;
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]));
    }
    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;
    }
}
