diff --git a/app/api/controller/Account.php b/app/api/controller/Account.php new file mode 100644 index 0000000..c1f9dfa --- /dev/null +++ b/app/api/controller/Account.php @@ -0,0 +1,174 @@ + $data['apikey'], + "ProductId" => $data['product'], + "PackageId" => $data['package'], + "Account" => $data['account'], + "Pwd" => $data['pwd'], + ); + + $data_string = json_encode($params); + + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string); + curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + 'Content-Type: application/json', + 'Content-Length: ' . strlen($data_string)) + ); + + $result = curl_exec($ch); + + echo $result; + } + + //通过接口开正式账号 + // /api/account/createAccount?apikey=1232455165&package=17&account=test123211&pwd=123&connect=1&orderType=1 + public function createAccount() + { + //获取传递的数据 + $data = $_GET; + $url = 'http://www.juip.com/product/ApiCreateOrder'; + + $params = array( + "apikey" => $data['apikey'], + "PackageId" => $data['package'], + "Account" => $data['account'], + "Pwd" => $data['pwd'], + "ConnectCount" =>$data['connect'], + "OrderType" => $data['type'], + "OPayType" => '100', + "PayChannel" => '50', + "UseAccountAmount" => '1', + ); + + $data_string = json_encode($params); + + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string); + curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + 'Content-Type: application/json', + 'Content-Length: ' . strlen($data_string)) + ); + + $result = curl_exec($ch); + + echo $result; + } + + //通过接口更改账号密码 + public function updateAccountPwd() + { + //获取传递的数据 + $data = $_GET; + $url = 'http://www.juip.com/user/ApiUpdateAccountPwd'; + + $params = array( + "apikey" => $data['apikey'], + "Account" => $data['account'], + "Pwd" => $data['pwd'], + "RePwd" => $data['newPwd'], + ); + + $data_string = json_encode($params); + + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string); + curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + 'Content-Type: application/json', + 'Content-Length: ' . strlen($data_string)) + ); + + $result = curl_exec($ch); + + echo $result; + } + + //获取账号在线状态 + public function onLine() + { + //获取传递的数据 + $data = $_GET; + $url = 'http://www.juip.com/api/course/v1/productaccount/OnLine?productId='.$data['product'].'&account='.$data['account']; + + $apikey = $data['apikey']; + $user_model = new User; + $user_info = $user_model->getOne(['apikey'=>$apikey]); + if (empty($user_info)){ + $data = [ + 'Code' => 0, + 'Message' => 'apikey不符合规范', + ]; + echo json_encode($data); + die; + } + + + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + 'Content-Type: application/json' + ) + ); + + $result = curl_exec($ch); + + echo $result; + } + + //踢线 + public function killOut() + { + //获取传递的数据 + $data = $_GET; + $url = 'http://www.juip.com/api/course/v1/productaccount/KillOut?productId='.$data['product'].'&id='.$data['id']; + + $apikey = $data['apikey']; + $user_model = new User; + $user_info = $user_model->getOne(['apikey'=>$apikey]); + if (empty($user_info)){ + $data = [ + 'Code' => 0, + 'Message' => 'apikey不符合规范', + ]; + echo json_encode($data); + die; + } + + + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + 'Content-Type: application/json' + ) + ); + + $result = curl_exec($ch); + + echo $result; + } +} \ No newline at end of file