作者 郭文星

1231

... ... @@ -39,7 +39,29 @@ class Index extends Api
}else{
return $this->error("返回失败");
}
}
//获取token
public function tokenLogin(){
$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);
print_r($jsonlogin);return ;
return $this->success($jsondata['msg'],$jsondata['data']);
}else{
return $this->error("请求失败");
}
}
}
\ No newline at end of file
... ...