京东药急送订单信息中手机号、收货地址、收货人字段解密

1.下载官方SDK,文档上有地址
2.下载的SDK引入会报错,缺少类Monolog/Logger,需要用SDK中composer加载,然后放入SDK中
3.我用的tp5.1框架,SDK放到了项目vendor目录下,方法中需要引入SDK中三个类文件,具体代码:

public function test(){
        header("Content-type: text/html; charset=utf-8");
        vendor('JD_DECRYPT_SDK.vendor.autoload');//这里的vendor是composer加载的文件
        vendor("JD_DECRYPT_SDK.security.SecretJdClient");
        vendor("JD_DECRYPT_SDK.security.TDEClient");
        //$this->accessToken是accessToken , $this->appKey是appKey , $this->appSecret是appSercret
        $tde = \ACES\SecretJdClient::getInstance($this->accessToken, $this->appKey, $this->appSecret);
        //加密方法encrypt
        // $ct = $tde->encrypt($pt);
        // echo $ct;
        $ct = 'AATdzwjhRcQuGgpzE0j+XhVquJ1g0k6/uL9SjrgaJ/wnro6JGAKzLQquLhyk3QRgtTg=';
        //解密方法decrypt
        $decrypted = $tde->decrypt($ct);
        return $decrypted;
}

你可能感兴趣的:(京东药急送订单信息中手机号、收货地址、收货人字段解密)