2021-03-27 19:27:21 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace app\product\controller;
|
|
|
|
|
|
|
|
|
|
class AccountAddress
|
|
|
|
|
{
|
2021-04-26 18:50:06 +08:00
|
|
|
|
|
|
|
|
|
2021-03-27 19:27:21 +08:00
|
|
|
public function index()
|
|
|
|
|
{
|
|
|
|
|
$info = $_GET;
|
|
|
|
|
$url = 'http://city.webok.me/apichange/?user='.$info['user'].'&password='.$info['password'].'&type=getline';
|
2021-06-01 14:59:44 +08:00
|
|
|
$current_url = 'http://city.webok.me/apichange/?user='.$info['user'].'&password='.$info['password'].'&type=current_line';
|
|
|
|
|
|
|
|
|
|
//获取已经选择的地区
|
|
|
|
|
$selected_address = json_decode(file_get_contents($current_url),true);;
|
|
|
|
|
$selected_id = explode(',',$selected_address['data']['default_line']);
|
|
|
|
|
unset($selected_id[count($selected_id)-1]);
|
|
|
|
|
|
|
|
|
|
$data = json_decode(file_get_contents($url),true);
|
|
|
|
|
//对已经选择的地区进行处理
|
|
|
|
|
$list = [];
|
|
|
|
|
foreach($data['data'] as $info) {
|
|
|
|
|
if(in_array($info['id'],$selected_id)){
|
|
|
|
|
$list[] = $info['name'].'-'.$info['id'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$data['list'] = $list;
|
|
|
|
|
echo json_encode($data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function index2()
|
|
|
|
|
{
|
|
|
|
|
$info = $_GET;
|
|
|
|
|
$url = 'http://city.webok.me/apichange2/?user='.$info['user'].'&password='.$info['password'].'&type=getline';
|
|
|
|
|
$current_url = 'http://city.webok.me/apichange2/?user='.$info['user'].'&password='.$info['password'].'&type=current_line';
|
|
|
|
|
|
|
|
|
|
//获取已经选择的地区
|
|
|
|
|
$selected_address = json_decode(file_get_contents($current_url),true);;
|
|
|
|
|
$selected_id = explode(',',$selected_address['data']['default_line']);
|
|
|
|
|
unset($selected_id[count($selected_id)-1]);
|
|
|
|
|
|
2021-03-27 19:27:21 +08:00
|
|
|
$data = json_decode(file_get_contents($url),true);
|
2021-06-01 14:59:44 +08:00
|
|
|
//对已经选择的地区进行处理
|
|
|
|
|
$list = [];
|
|
|
|
|
foreach($data['data'] as $info) {
|
|
|
|
|
if(in_array($info['id'],$selected_id)){
|
|
|
|
|
$list[] = $info['name'].'-'.$info['id'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$data['list'] = $list;
|
|
|
|
|
echo json_encode($data);
|
2021-03-27 19:27:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function select()
|
|
|
|
|
{
|
|
|
|
|
$data = json_decode(file_get_contents("php://input"),true);
|
|
|
|
|
$add_text = '';
|
|
|
|
|
$add_id = '';
|
|
|
|
|
$account = $data['account'];
|
|
|
|
|
$password = $data['password'];
|
|
|
|
|
foreach ($data['list'] as $info) {
|
|
|
|
|
$temp = explode('-',$info);
|
|
|
|
|
$add_text .= $temp[0].',';
|
|
|
|
|
$add_id .= $temp[1].',';
|
|
|
|
|
}
|
|
|
|
|
$url = 'http://city.webok.me/apichange/?user='.$account.'&password='.$password.'&type=edit¤t_line_list='.$add_text.'&line_id_list='.$add_id;
|
|
|
|
|
|
2021-05-27 16:51:39 +08:00
|
|
|
$content = linkcurl($url,'GET',[],[],0);
|
2021-03-27 19:27:21 +08:00
|
|
|
|
|
|
|
|
echo $content;
|
|
|
|
|
}
|
2021-04-26 18:50:06 +08:00
|
|
|
|
2021-06-01 14:59:44 +08:00
|
|
|
public function indexXigua()
|
|
|
|
|
{
|
|
|
|
|
$info = $_GET;
|
|
|
|
|
$url = 'http://www.yzip.vip/apichange/?user='.$info['user'].'&password='.$info['password'].'&type=getline';
|
|
|
|
|
$current_url = 'http://www.yzip.vip/apichange/?user='.$info['user'].'&password='.$info['password'].'&type=current_line';
|
|
|
|
|
|
|
|
|
|
//获取已经选择的地区
|
|
|
|
|
$selected_address = json_decode(file_get_contents($current_url),true);;
|
|
|
|
|
$selected_id = explode(',',$selected_address['data']['default_line']);
|
|
|
|
|
unset($selected_id[count($selected_id)-1]);
|
|
|
|
|
|
|
|
|
|
$data = json_decode(file_get_contents($url),true);
|
|
|
|
|
//对已经选择的地区进行处理
|
|
|
|
|
$list = [];
|
|
|
|
|
foreach($data['data'] as $info) {
|
|
|
|
|
if(in_array($info['id'],$selected_id)){
|
|
|
|
|
$list[] = $info['name'].'-'.$info['id'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$data['list'] = $list;
|
|
|
|
|
echo json_encode($data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function selectXigua()
|
|
|
|
|
{
|
|
|
|
|
$data = json_decode(file_get_contents("php://input"),true);
|
|
|
|
|
$add_text = '';
|
|
|
|
|
$add_id = '';
|
|
|
|
|
$account = $data['account'];
|
|
|
|
|
$password = $data['password'];
|
|
|
|
|
foreach ($data['list'] as $info) {
|
|
|
|
|
$temp = explode('-',$info);
|
|
|
|
|
$add_text .= $temp[0].',';
|
|
|
|
|
$add_id .= $temp[1].',';
|
|
|
|
|
}
|
|
|
|
|
$url = 'http://www.yzip.vip/apichange/?user='.$account.'&password='.$password.'&type=edit¤t_line_list='.$add_text.'&line_id_list='.$add_id;
|
|
|
|
|
|
|
|
|
|
$content = linkcurl($url,'GET',[],[],0);
|
|
|
|
|
|
|
|
|
|
echo $content;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-04-26 18:50:06 +08:00
|
|
|
//火狐ip
|
|
|
|
|
public function getList()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$login_url = 'http://106.52.152.33:8899/main/raduserLogin';
|
|
|
|
|
|
|
|
|
|
$params = array(
|
|
|
|
|
"username" => $_GET['user'],
|
|
|
|
|
"password" => $_GET['password'],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$login_content = linkcurl($login_url,'POST',$params);
|
|
|
|
|
|
|
|
|
|
preg_match_all('/set\-cookie:([^\r\n]*); path/i', $login_content, $m);
|
|
|
|
|
|
|
|
|
|
$cookie = $m[1][0];
|
|
|
|
|
|
|
|
|
|
$url = 'http://106.52.152.33:8899/panel/index';
|
|
|
|
|
$header = array();
|
|
|
|
|
$header[] = "Cookie:".$cookie;
|
|
|
|
|
$content = linkcurl($url,'POST',[],$header);
|
|
|
|
|
|
|
|
|
|
//获取所有大分类
|
|
|
|
|
preg_match_all("/<tr(.*?)<\/tr>/is", $content, $result);
|
|
|
|
|
//只获取ipmodel的数据
|
|
|
|
|
preg_match_all("/<td>(.*?)<\/td>/is", $result[1][1], $ipmodel);
|
|
|
|
|
//获取城市数据
|
|
|
|
|
preg_match_all("/<td id=\"pools\">(.*?)<a/is", $result[1][2], $city);
|
|
|
|
|
|
|
|
|
|
$data = [
|
|
|
|
|
'ipmodel' => $ipmodel[1],
|
|
|
|
|
'city' => $city[1],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// print_r($data);
|
|
|
|
|
|
|
|
|
|
echo json_encode($data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function setAddress()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$data = json_decode(file_get_contents("php://input"),true);
|
|
|
|
|
|
|
|
|
|
$login_url = 'http://106.52.152.33:8899/main/raduserLogin';
|
|
|
|
|
|
|
|
|
|
$params = array(
|
|
|
|
|
"username" => $data['account'],
|
|
|
|
|
"password" => $data['password'],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$login_content = linkcurl($login_url,'POST',$params);
|
|
|
|
|
|
|
|
|
|
preg_match_all('/set\-cookie:([^\r\n]*); path/i', $login_content, $m);
|
|
|
|
|
|
|
|
|
|
$cookie = $m[1][0];
|
|
|
|
|
|
|
|
|
|
$url = 'http://106.52.152.33:8899/panel/index';
|
|
|
|
|
$params = array(
|
|
|
|
|
"act" => 'save',
|
|
|
|
|
"username" => $data['account'],
|
|
|
|
|
"ipmode" => $data['ipmode'],
|
|
|
|
|
"citys[]" => implode(',',$data['list']),
|
|
|
|
|
);
|
|
|
|
|
$header = array();
|
|
|
|
|
$header[] = "Cookie:".$cookie;
|
|
|
|
|
$data = linkcurl($url,'POST',$params,$header);
|
|
|
|
|
|
|
|
|
|
if (strpos($data, '提交成功') !== false) {
|
|
|
|
|
echo json_encode(['code'=>1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-27 19:27:21 +08:00
|
|
|
}
|