| Conditions | 3 |
| Paths | 18 |
| Total Lines | 21 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 30 | public function request($data = []) |
||
| 31 | { |
||
| 32 | $data['accesser_id'] = $this->config['accesser_id']; |
||
| 33 | $key = $this->config['private_key']; |
||
| 34 | if ($data) { |
||
| 35 | $this->body = array_merge($this->body, $data); |
||
| 36 | } |
||
| 37 | try { |
||
| 38 | $this->validate(); |
||
| 39 | $data = $this->body; |
||
| 40 | $gateway = $this->config['gateway'] . $this->api; |
||
| 41 | $data = json_encode($data); |
||
| 42 | $sign = hash('sha256', $data); |
||
| 43 | $method = $this->method; |
||
| 44 | $des = new DES($key, $method, DES::OUTPUT_HEX); |
||
| 45 | // 加密 |
||
| 46 | $str = $des->encrypt($data); |
||
| 47 | $url = $gateway . '?sign_data=' . $sign . '&json_data=' . $str . '&accesser_id=' . $this->config['accesser_id']; |
||
| 48 | return json_encode(['res_code' => '0000', 'res_msg' => 'success', 'url' => $url], JSON_UNESCAPED_SLASHES); |
||
| 49 | } catch (Exception $e) { |
||
| 50 | return json_encode(['res_code' => -1, 'res_msg' => $e->getMessage(), 'request_seq' => null]); |
||
| 51 | } |
||
| 54 |