| @@ 290-313 (lines=24) @@ | ||
| 287 | //获取业务参数 |
|
| 288 | $apiParams = $request->getApiParas(); |
|
| 289 | ||
| 290 | if (method_exists($request,"getNeedEncrypt") &&$request->getNeedEncrypt()){ |
|
| 291 | ||
| 292 | $sysParams["encrypt_type"] = $this->encryptType; |
|
| 293 | ||
| 294 | if ($this->checkEmpty($apiParams['biz_content'])) { |
|
| 295 | ||
| 296 | throw new Exception(" api request Fail! The reason : encrypt request is not supperted!"); |
|
| 297 | } |
|
| 298 | ||
| 299 | if ($this->checkEmpty($this->encryptKey) || $this->checkEmpty($this->encryptType)) { |
|
| 300 | ||
| 301 | throw new Exception(" encryptType and encryptKey must not null! "); |
|
| 302 | } |
|
| 303 | ||
| 304 | if ("AES" != $this->encryptType) { |
|
| 305 | ||
| 306 | throw new Exception("加密类型只支持AES"); |
|
| 307 | } |
|
| 308 | ||
| 309 | // 执行加密 |
|
| 310 | $enCryptContent = encrypt($apiParams['biz_content'], $this->encryptKey); |
|
| 311 | $apiParams['biz_content'] = $enCryptContent; |
|
| 312 | ||
| 313 | } |
|
| 314 | ||
| 315 | //print_r($apiParams); |
|
| 316 | $totalParams = array_merge($apiParams, $sysParams); |
|
| @@ 404-427 (lines=24) @@ | ||
| 401 | //获取业务参数 |
|
| 402 | $apiParams = $request->getApiParas(); |
|
| 403 | ||
| 404 | if (method_exists($request,"getNeedEncrypt") &&$request->getNeedEncrypt()){ |
|
| 405 | ||
| 406 | $sysParams["encrypt_type"] = $this->encryptType; |
|
| 407 | ||
| 408 | if ($this->checkEmpty($apiParams['biz_content'])) { |
|
| 409 | ||
| 410 | throw new Exception(" api request Fail! The reason : encrypt request is not supperted!"); |
|
| 411 | } |
|
| 412 | ||
| 413 | if ($this->checkEmpty($this->encryptKey) || $this->checkEmpty($this->encryptType)) { |
|
| 414 | ||
| 415 | throw new Exception(" encryptType and encryptKey must not null! "); |
|
| 416 | } |
|
| 417 | ||
| 418 | if ("AES" != $this->encryptType) { |
|
| 419 | ||
| 420 | throw new Exception("加密类型只支持AES"); |
|
| 421 | } |
|
| 422 | ||
| 423 | // 执行加密 |
|
| 424 | $enCryptContent = encrypt($apiParams['biz_content'], $this->encryptKey); |
|
| 425 | $apiParams['biz_content'] = $enCryptContent; |
|
| 426 | ||
| 427 | } |
|
| 428 | ||
| 429 | ||
| 430 | //签名 |
|
| @@ 64-86 (lines=23) @@ | ||
| 61 | //获取业务参数 |
|
| 62 | $apiParams = $request->getApiParas(); |
|
| 63 | ||
| 64 | if (method_exists($request, "getNeedEncrypt") && $request->getNeedEncrypt()) { |
|
| 65 | ||
| 66 | $sysParams["encrypt_type"] = $this->encryptType; |
|
| 67 | ||
| 68 | if ($this->checkEmpty($apiParams['biz_content'])) { |
|
| 69 | ||
| 70 | throw new Exception(" api request Fail! The reason : encrypt request is not supperted!"); |
|
| 71 | } |
|
| 72 | ||
| 73 | if ($this->checkEmpty($this->encryptKey) || $this->checkEmpty($this->encryptType)) { |
|
| 74 | ||
| 75 | throw new Exception(" encryptType and encryptKey must not null! "); |
|
| 76 | } |
|
| 77 | ||
| 78 | if ("AES" != $this->encryptType) { |
|
| 79 | ||
| 80 | throw new Exception("加密类型只支持AES"); |
|
| 81 | } |
|
| 82 | ||
| 83 | // 执行加密 |
|
| 84 | $enCryptContent = \Kaylyu\Alipay\F2fpay\Base\Aop\encrypt($apiParams['biz_content'], $this->encryptKey); |
|
| 85 | $apiParams['biz_content'] = $enCryptContent; |
|
| 86 | } |
|
| 87 | //签名 |
|
| 88 | $sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams), $this->signType); |
|
| 89 | ||