node_params = Yii::$app->params['trusteeship']; } else { $this->node_params = $parameter; } } public function urlBuild($uri = '') { $config = $this->node_params; $scheme = $config['scheme'] ?? 'http'; $host = $config['host'] ?? '127.0.0.1'; $port = (string)$config['port'] ?? ''; if ($port) { return $scheme . '://' . $host . ':' . $port . '/' . $uri; } else { return $scheme . '://' . $host . '/' . $uri; } } public function send($method = 'GET', $uri, $params = []) { $ch = new Curl(); if(!empty($params)) { $ch->setGetParams($params); } $result = $ch->$method($this->urlBuild($uri), false); if (!$result) { return ['code' => -1, 'msg' => $ch->errorText]; } if (200 == $result['code'] && isset($result['data'])) { return $result['data']; } else { return ['code' => -1, 'msg' => $result['error']]; } } public function getUserList($params = []) { $uri = 'backend/user/user-list'; return $this->send("GET", $uri, $params); } public function getWalletBalance($params = []) { $uri = 'backend/account/wallet-balance'; return $this->send("GET", $uri, $params); } }