2021-05-12 16:22:35 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
|
|
|
|
|
|
use app\api\model\User;
|
2021-06-02 11:50:51 +08:00
|
|
|
|
use app\api\model\ProductAccount;
|
2021-05-12 16:22:35 +08:00
|
|
|
|
|
|
|
|
|
|
class Account
|
|
|
|
|
|
{
|
2021-05-13 09:41:26 +08:00
|
|
|
|
|
|
|
|
|
|
public function __construct ()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(empty($_GET['apikey'])){
|
|
|
|
|
|
die;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-06-02 11:50:51 +08:00
|
|
|
|
//查询账号信息 ?apikey=1232455165&product=5&account=test1231
|
|
|
|
|
|
public function queryAccount()
|
|
|
|
|
|
{
|
|
|
|
|
|
//获取传递的数据
|
|
|
|
|
|
$data = $_GET;
|
|
|
|
|
|
$apikey = $data['apikey'];
|
|
|
|
|
|
$user_model = new User;
|
|
|
|
|
|
$user_info = $user_model->getOne(['apikey'=>$apikey]);
|
|
|
|
|
|
if (empty($user_info)){
|
|
|
|
|
|
$return_data = [
|
|
|
|
|
|
'Code' => 0,
|
|
|
|
|
|
'Message' => 'apikey不符合规范',
|
|
|
|
|
|
];
|
|
|
|
|
|
echo json_encode($return_data);
|
|
|
|
|
|
die;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$account_model = new ProductAccount;
|
|
|
|
|
|
$info = $account_model->getOne(['Account'=>$data['account'],"ProductId" => $data['product'],'UserId'=>$user_info['Id']],'ProductName,PackageName,Account,ConnectCount,StartTime,EndTime');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$return_data = [
|
|
|
|
|
|
'Code' => 0,
|
|
|
|
|
|
'Data' => $info,
|
|
|
|
|
|
'Message' => '',
|
|
|
|
|
|
];
|
|
|
|
|
|
echo json_encode($return_data);
|
|
|
|
|
|
}
|
2021-05-12 16:22:35 +08:00
|
|
|
|
//通过接口开测试
|
|
|
|
|
|
// /api/account/creeatTest?apikey=1232455165&product=5&package=61&account=test1231&pwd=123
|
|
|
|
|
|
public function createTest()
|
|
|
|
|
|
{
|
|
|
|
|
|
//获取传递的数据
|
|
|
|
|
|
$data = $_GET;
|
|
|
|
|
|
//请求的url
|
2024-03-14 10:38:32 +08:00
|
|
|
|
$url = 'https://juip.com/api/course/v1/productaccount/ApiCreateTestAccount';
|
2021-05-12 16:22:35 +08:00
|
|
|
|
|
|
|
|
|
|
//请求参数
|
|
|
|
|
|
$params = array(
|
|
|
|
|
|
"apikey" => $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;
|
2024-03-14 10:38:32 +08:00
|
|
|
|
$url = 'https://juip.com/product/ApiCreateOrder';
|
2021-05-12 16:22:35 +08:00
|
|
|
|
|
2025-05-14 09:30:08 +08:00
|
|
|
|
|
|
|
|
|
|
if ((strpos($data['account'], ',') !== false || strpos($data['account'], '、') !== false || strpos($data['account'], ',') !== false)) {
|
|
|
|
|
|
$data = [
|
|
|
|
|
|
'Code' => 0,
|
|
|
|
|
|
'Message' => '请操作单个账户',
|
|
|
|
|
|
];
|
|
|
|
|
|
echo json_encode($data);
|
|
|
|
|
|
die;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-12 14:13:36 +08:00
|
|
|
|
if ($data['type'] == 3) {
|
|
|
|
|
|
|
|
|
|
|
|
$account_model = new ProductAccount;
|
|
|
|
|
|
$info = $account_model->getOne(['Account'=>$data['account'],"PackageId" => $data['package']],'ProductName,PackageName,Account,ConnectCount,StartTime,EndTime');
|
|
|
|
|
|
|
|
|
|
|
|
if ($data['connect'] != $info['ConnectCount']) {
|
|
|
|
|
|
$data = [
|
|
|
|
|
|
'Code' => 0,
|
|
|
|
|
|
'Message' => '连接数不正确,请核对后重新请求',
|
|
|
|
|
|
];
|
|
|
|
|
|
echo json_encode($data);
|
|
|
|
|
|
die;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-05-12 16:22:35 +08:00
|
|
|
|
$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;
|
2024-03-14 10:38:32 +08:00
|
|
|
|
$url = 'https://juip.com/user/ApiUpdateAccountPwd';
|
2021-05-12 16:22:35 +08:00
|
|
|
|
|
|
|
|
|
|
$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;
|
2024-03-14 10:38:32 +08:00
|
|
|
|
$url = 'https://juip.com/api/course/v1/productaccount/OnLine?productId='.$data['product'].'&account='.$data['account'];
|
2021-05-12 16:22:35 +08:00
|
|
|
|
|
|
|
|
|
|
$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;
|
2024-03-14 10:38:32 +08:00
|
|
|
|
$url = 'https://juip.com/api/course/v1/productaccount/KillOut?productId='.$data['product'].'&id='.$data['id'];
|
2021-05-12 16:22:35 +08:00
|
|
|
|
|
|
|
|
|
|
$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;
|
|
|
|
|
|
}
|
2024-12-02 15:02:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//退款
|
|
|
|
|
|
public function refund()
|
|
|
|
|
|
{
|
|
|
|
|
|
//获取传递的数据
|
|
|
|
|
|
$data = $_GET;
|
2025-04-27 14:31:44 +08:00
|
|
|
|
$url = 'https://juip.com/api/course/v1/order/ApiRefund';
|
2024-12-02 15:02:24 +08:00
|
|
|
|
|
|
|
|
|
|
$params = array(
|
|
|
|
|
|
"apikey" => $data['apikey'],
|
|
|
|
|
|
"Account" => $data['account']
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
$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;
|
|
|
|
|
|
}
|
2025-05-15 16:35:34 +08:00
|
|
|
|
|
|
|
|
|
|
//退款
|
|
|
|
|
|
public function deleteAcct()
|
|
|
|
|
|
{
|
|
|
|
|
|
$data = $_GET;
|
|
|
|
|
|
$apikey = $data['apikey'];
|
|
|
|
|
|
$user_model = new User;
|
|
|
|
|
|
$user_info = $user_model->getOne(['apikey'=>$apikey]);
|
|
|
|
|
|
$account_model = new ProductAccount;
|
|
|
|
|
|
|
|
|
|
|
|
if ($user_info['Id'] != 163642) {
|
|
|
|
|
|
die;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$where = [
|
|
|
|
|
|
'UserId' => $user_info['Id'],
|
|
|
|
|
|
'account' => $data['account'],
|
|
|
|
|
|
'DeleteTag' => 0
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
$account_info = $account_model->getOne($where);
|
|
|
|
|
|
|
|
|
|
|
|
$update_data['DeleteTag'] = 1;
|
|
|
|
|
|
|
|
|
|
|
|
if ($account_info['ProductId'] == 29) {
|
|
|
|
|
|
$url = "http://124.236.113.166:18702/api/agent/deleteAcct/apikey/80cf4f64e990b78a9fc5eb/account/".$account_info['Account'];
|
|
|
|
|
|
linkcurl($url,'GET',[],[],0);
|
|
|
|
|
|
} elseif ($account_info['ProductId'] == 3 || $account_info['ProductId'] == 26) {
|
|
|
|
|
|
$url = "http://106.119.166.87:18702/api/agent/deleteAcct/apikey/80cf4f64e990b78a9fc5eb/account/".$account_info['Account'];
|
|
|
|
|
|
linkcurl($url,'GET',[],[],0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$account_model->updateOne($where,$update_data);
|
|
|
|
|
|
|
|
|
|
|
|
echo json_encode(['Code'=>10000,'Message' => '删除成功']);
|
|
|
|
|
|
}
|
2021-05-12 16:22:35 +08:00
|
|
|
|
}
|