get(Yii::$app->params['mtHttpServerUrl'] . "/MtService/getGroups")->send(); if ($response->getIsOk()) { $content = $response->getContent(); $jsonArr = @json_decode($content, true); foreach ((array)$jsonArr as $key => $row) { $result[] = isset($row['Name']) ? trim($row['Name']) : ''; } } else { Yii::warning($response->getContent(), __CLASS__); } return $result; } /** * 入金 * @param int $login * @param float $balance * @param string $comment * @return bool */ public static function deposit($login, $balance, $comment) { $mt4 = new Mt4Deposit(); $result = $mt4->deposit($login, $balance, $comment); if ($result['errCode'] == 0) { return true; } /* $client = new Client(); $data = [ 'login' => $login, 'balance' => $balance, 'comment' => $comment, ]; // http://192.168.1.100:9090/MtService/deposit?login=Int32&balance=Double&comment=String $response = $client->get(Yii::$app->params['mtHttpServerUrl'] . "/MtService/deposit", $data)->send(); if ($response->getIsOk()) { $content = $response->getContent(); $jsonArr = @json_decode($content, true); if ($jsonArr['Ret'] == 0) { return true; } } Yii::warning($response->getContent(), __CLASS__); */ return false; } /** * 出金 * @param int $login * @param float $balance * @param string $comment * @return bool */ public static function withdrawal($login, $balance, $comment) { $mt4 = new Mt4Deposit(); $result = $mt4->withdraw($login, $balance, $comment); if ($result['errCode'] == 0) { return true; } return false; } /** * 真实账户开户 * @param int $login * @param string $password * @param string $passwordInvestor * @param string $passwordPhone * @param string $name * @param int $group * @param string $email * @param string $phone * @param int $leverage * @param string $country * @param int $state * @param string $city * @param string $address * @param string $zipCode * @param int $id * @param int $agentAccount * @return bool|int */ public static function openUser($realip, $port, $login, $password, $passwordInvestor, $passwordPhone, $name, $group, $email, $phone, $leverage, $country, $state, $city, $address, $zipCode, $id, $agentAccount) { $data = [ 'LOGIN' => $login, 'PASSWORD' => $password, 'INVESTOR' => $passwordInvestor, 'PHONE_PASSWORD' => $passwordPhone, 'NAME' => $name, 'GROUP' => $group, 'EMAIL' => $email, 'PHONE' => $phone, 'LEVERAGE' => $leverage, 'COUNTRY' => $country, 'STATE' => $state, 'CITY' => $city, 'ADDRESS' => $address, 'ZIPCODE' => $zipCode, 'ID' => $id, 'AGENT_ACCOUNT' => $agentAccount, ]; $api = new Mt4Api($realip, $port); $result = $api->addAccount($data, 1); if ($result['Ret'] == 0) { return trim($result['Obj']['Login']); } else { Yii::warning(json_encode($result), __CLASS__); } return false; } /** * 模拟账户开户 * @param null $login * @param string $password * @param string $passwordInvestor * @param string $passwordPhone * @param string $name * @param null $group * @param string $email * @param string $phone * @param null $leverage * @param null $country * @param null $state * @param null $city * @param null $address * @param null $zipCode * @param null $id * @param null $agentAccount * @return bool|int|string */ public static function openUserDemo($realip, $port,$login = null, $password, $passwordInvestor, $passwordPhone, $name, $group = null, $email, $phone, $leverage = null, $country = null, $state = null, $city = null, $address = null, $zipCode = null, $id = null, $agentAccount = null) { $data = [ 'PASSWORD' => $password, 'INVESTOR' => $passwordInvestor, 'PHONE_PASSWORD' => $passwordPhone, 'NAME' => $name, 'EMAIL' => $email, 'PHONE' => $phone, ]; $api = new Mt4Api($realip, $port); $result = $api->addAccount($data, 0); if ($result['Ret'] == 0) { return $result['Obj']['Login']; } else { Yii::warning(json_encode($result), __CLASS__); } return false; } }