作者 郭文星

1231

... ... @@ -29,8 +29,9 @@ class Index extends Api
protected $noNeedRight = ['*'];
protected $token = "";
protected $cameraurl = "https://camera.ynzhsk.cn";
protected $govregurl = "http://124.71.107.128:9040";
protected $uimsApiurl="https://tyuims.tenyes.cn/";
protected $swApiurl="http://121.37.218.20:9011/";
protected $sxjApiurl="http://124.71.107.128:9040/";
//前置方法
public function _initialize()
{
... ... @@ -49,41 +50,11 @@ class Index extends Api
return $this->error("返回失败");
}
}
//获取token
public function tokenLogin($appKey,$appSecret){
$appKey= $this->request->param('appKey',"");
$appSecret= $this->request->param('appSecret',"");
$appKey="waterPro_54989312";
$appSecret="bef381707451606b34c1f9b4b18bd5d7";
$url="https://tyuims.tenyes.cn/api/access_token";
$postdata=[
"appKey"=>$appKey,
"appSecret"=>$appSecret,
];
$res =HttpHelper::post($url,$postdata);
$jsondata=json_decode($res,true);
if($jsondata['code']==200){
$loginurl="https://tyuims.tenyes.cn/api/login/token";
$logindata=[
"token"=>$jsondata['data']
];
$res =HttpHelper::post($loginurl,$logindata);
$jsonlogin=json_decode($res,true);
if($jsonlogin['code']==200){
return $this->success($jsonlogin['msg'],$jsonlogin['data']);
}else{
return $this->error("请求失败");
}
}else{
return $this->error("请求失败");
}
}
//获取水厂列表
public function getwaterworks(){
$token=$this->token;
$url="http://124.71.107.128:9040/data_api/v1/getWaterworksListData";
$user=new User();
$token=$user->sxjApitoken();
$url=$this->sxjApiurl."data_api/v1/getWaterworksListData";
$res =HttpHelper::postheader($url,"","",$token);
$res=json_decode($res,true);
return $this->success($res['message'],$res['data']);
... ... @@ -92,8 +63,9 @@ class Index extends Api
//获取水厂列表
public function getWaterworksDetailData(){
$id= $this->request->param('id',"");
$token=$this->token;
$url="http://124.71.107.128:9040/data_api/v1/getWaterworksDetailData";
$user=new User();
$token=$user->sxjApitoken();
$url=$this->sxjApiurl."data_api/v1/getWaterworksDetailData";
$data=['id'=>$id];
$res =HttpHelper::postheader($url,$data,"",$token);
$res=json_decode($res,true);
... ... @@ -109,8 +81,9 @@ class Index extends Api
//获得净水设备列表
public function getWaterworksEquipmentListData(){
$token=$this->token;
$url="http://124.71.107.128:9040/data_api/v1/getWaterworksEquipmentListData";
$user=new User();
$token=$user->sxjApitoken();
$url=$this->sxjApiurl."data_api/v1/getWaterworksEquipmentListData";
$res =HttpHelper::postheader($url,"","",$token);
$res=json_decode($res,true);
return $this->success($res['message'],$res['data']);
... ... @@ -119,9 +92,9 @@ class Index extends Api
//获得净水设备列表
public function getWaterworksEquipmentDetailData(){
$id= $this->request->param('id',"");
$token=$this->token;
$url="http://124.71.107.128:9040/data_api/v1/getWaterworksEquipmentDetailData";
//$token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IjE5OTY5MTA2NzEwIiwicGFzc3dvcmQiOiJhMGUxNWM0NDRmOGNiY2NiNTAwM2U1MDk5OGI2OGZhNyIsImV4cCI6MTczMTY2ODA5MSwiaXNzIjoidWltcyJ9.W3RBwrFdidL9ERykKC_gHtjp911xrkNvUKglSes1w7c";
$user=new User();
$token=$user->sxjApitoken();
$url=$this->sxjApiurl."data_api/v1/getWaterworksEquipmentDetailData";
$data=['id'=>$id];
$res =HttpHelper::postheader($url,$data,"",$token);
$res=json_decode($res,true);
... ... @@ -130,8 +103,9 @@ class Index extends Api
//-获得净水设备数据列表
public function getWaterworksEquipmentDataListData(){
$token=$this->token;
$url="http://124.71.107.128:9040/data_api/v1/getWaterworksEquipmentDataListData";
$user=new User();
$token=$user->sxjApitoken();
$url=$this->sxjApiurl."data_api/v1/getWaterworksEquipmentDataListData";
$res =HttpHelper::postheader($url,"","",$token);
$res=json_decode($res,true);
return $this->success($res['message'],$res['data']);
... ... @@ -141,8 +115,9 @@ class Index extends Api
//-获得设备数据详情
public function getWaterworksEquipmentDataDetailData(){
$id= $this->request->param('id',"");
$token=$this->token;
$url="http://124.71.107.128:9040/data_api/v1/getWaterworksEquipmentDataDetailData";
$user=new User();
$token=$user->sxjApitoken();
$url=$this->sxjApiurl."data_api/v1/getWaterworksEquipmentDataDetailData";
$data=['id'=>$id];
$res =HttpHelper::postheader($url,$data,"",$token);
$res=json_decode($res,true);
... ... @@ -162,16 +137,18 @@ class Index extends Api
}
//-获得设备数据详情
public function getAllSupplyStatistics(){
$token=$this->token;
$url="http://124.71.107.128:9040/data_all/v1/getAllSupplyStatistics";
$user=new User();
$token=$user->sxjApitoken();
$url=$this->sxjApiurl."data_all/v1/getAllSupplyStatistics";
$res =HttpHelper::postheader($url,"","",$token);
$res=json_decode($res,true);
return $this->success($res['message'],$res['data']);
}
//-获得设备数据详情
public function getPayAndOwe(){
$token=$this->token;
$url="http://124.71.107.128:9040//data_all/v1/getPayAndOwe";
$user=new User();
$token=$user->sxjApitoken();
$url=$this->sxjApiurl."data_all/v1/getPayAndOwe";
$res =HttpHelper::postheader($url,"","",$token);
$res=json_decode($res,true);
return $this->success($res['message'],$res['data']);
... ... @@ -179,9 +156,9 @@ class Index extends Api
//-获得水表列表
public function getInstrumentListData(){
$token=$this->token;
$url="http://121.37.218.20:9011/data_api/v1/insListAll";
//$token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IjE5OTY5MTA2NzEwIiwicGFzc3dvcmQiOiJhMGUxNWM0NDRmOGNiY2NiNTAwM2U1MDk5OGI2OGZhNyIsImV4cCI6MTczMTY2ODA5MSwiaXNzIjoidWltcyJ9.W3RBwrFdidL9ERykKC_gHtjp911xrkNvUKglSes1w7c";
$user=new User();
$token=$user->swApitoken();
$url=$this->swApiurl."data_api/v1/insListAll";
$data=["cat"=>0];
$res =HttpHelper::getheader($url,$data,"",$token);
$res=json_decode($res,true);
... ... @@ -190,9 +167,9 @@ class Index extends Api
//-获得水表列表
public function getInstrumentDetailData(){
$id= $this->request->param('id',"");
$token=$this->token;
$url="http://121.37.218.20:9011/data_api/v1/getInstrumentDetailData";
//$token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IjE5OTY5MTA2NzEwIiwicGFzc3dvcmQiOiJhMGUxNWM0NDRmOGNiY2NiNTAwM2U1MDk5OGI2OGZhNyIsImV4cCI6MTczMTY2ODA5MSwiaXNzIjoidWltcyJ9.W3RBwrFdidL9ERykKC_gHtjp911xrkNvUKglSes1w7c";
$user=new User();
$token=$user->swApitoken();
$url=$this->swApiurl."data_api/v1/getInstrumentDetailData";
$data=['id'=>$id];
$res =HttpHelper::postheader($url,$data,"",$token);
$res=json_decode($res,true);
... ... @@ -202,9 +179,9 @@ class Index extends Api
//-获得水表列表
public function eqpDataWaterCenInfo(){
$id= $this->request->param('id',"");
$token=$this->token;
$url="http://124.71.107.128:9040/screen_eqp_data/v1/eqpDataWaterCenInfo";
//$token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IjE5OTY5MTA2NzEwIiwicGFzc3dvcmQiOiJhMGUxNWM0NDRmOGNiY2NiNTAwM2U1MDk5OGI2OGZhNyIsImV4cCI6MTczMTY2ODA5MSwiaXNzIjoidWltcyJ9.W3RBwrFdidL9ERykKC_gHtjp911xrkNvUKglSes1w7c";
$user=new User();
$token=$user->sxjApitoken();
$url=$this->sxjApiurl."screen_eqp_data/v1/eqpDataWaterCenInfo";
$data=['wid'=>$id];
$res =HttpHelper::postheader($url,$data,"",$token);
$res=json_decode($res,true);
... ... @@ -212,9 +189,9 @@ class Index extends Api
}
//-获得水表列表
public function getDataWaterCenInfo($id){
$token=$this->token;
$url="http://124.71.107.128:9040/screen_eqp_data/v1/eqpDataWaterCenInfo";
//$token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IjE5OTY5MTA2NzEwIiwicGFzc3dvcmQiOiJhMGUxNWM0NDRmOGNiY2NiNTAwM2U1MDk5OGI2OGZhNyIsImV4cCI6MTczMTY2ODA5MSwiaXNzIjoidWltcyJ9.W3RBwrFdidL9ERykKC_gHtjp911xrkNvUKglSes1w7c";
$user=new User();
$token=$user->sxjApitoken();
$url=$this->sxjApiurl."screen_eqp_data/v1/eqpDataWaterCenInfo";
$data=['wid'=>$id];
$res =HttpHelper::postheader($url,$data,"",$token);
$res=json_decode($res,true);
... ... @@ -223,8 +200,9 @@ class Index extends Api
//-获得水表列表
public function getInstrumentcount(){
$token=$this->token;
$url="http://121.37.218.20:9011/data_api/v1/getInstrumentListData";
$user=new User();
$token=$user->swApitoken();
$url=$this->swApiurl."data_api/v1/getInstrumentListData";
$res =HttpHelper::postheader($url,"","",$token);
$res=json_decode($res,true);
if($res['code']){
... ...
... ... @@ -26,10 +26,12 @@ class User extends Api
protected $noNeedLogin = ['*'];
// 无需鉴权的接口,*表示全部
protected $noNeedRight = ['*'];
protected $url="https://tyuims.tenyes.cn/";
protected $uimsApiurl="https://tyuims.tenyes.cn/";
protected $swApiurl="http://121.37.218.20:9011/";
protected $sxjApiurl="http://124.71.107.128:9040/";
//获取token
public function tokenLogin(){
//统一用户系统配置:获得token,登录验证,手机号一键登录
public function uimsApitoken(){
$appKey ="waterPro_54989312";
$appSecret ="bef381707451606b34c1f9b4b18bd5d7";
$url="/api/access_token";
... ... @@ -37,7 +39,42 @@ class User extends Api
"appKey"=>$appKey,
"appSecret"=>$appSecret,
];
$res =HttpHelper::post($this->url.$url,$postdata);
$res =HttpHelper::post($this->uimsApiurl.$url,$postdata);
$jsondata=json_decode($res,true);
if($jsondata['code']==200){
return $jsondata['data'];
}else{
return $this->error("请求失败".$jsondata['msg'],$jsondata['data']);
}
}
//项目运营管理API:水表,水费账单
public function swApitoken(){
$appKey ="sw_70304512";
$appSecret ="186eb7122814b28af73724198afe6cfa";
$url="/api/access_token";
$postdata=[
"appKey"=>$appKey,
"appSecret"=>$appSecret,
];
$res =HttpHelper::post($this->swApiurl.$url,$postdata);
$jsondata=json_decode($res,true);
if($jsondata['code']==200){
return $jsondata['data'];
}else{
return $this->error("请求失败".$jsondata['msg'],$jsondata['data']);
}
}
//行政监管API:水厂,水厂设备数据
public function sxjApitoken(){
$appKey ="tyorderauto_69272576";
$appSecret ="1238cb88883413febbbabf17203b341d";
$url="/api/access_token";
$postdata=[
"appKey"=>$appKey,
"appSecret"=>$appSecret,
];
$res =HttpHelper::post($this->sxjApiurl.$url,$postdata);
$jsondata=json_decode($res,true);
if($jsondata['code']==200){
return $jsondata['data'];
... ...