User.php
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* Created by PhpStorm.
* User: YRF
* Date: 2023/11/14
* Time: 16:42
*/
namespace app\api\controller\v8;
//允许所有的跨域请求
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: *");
header('Access-Control-Allow-Methods: POST,GET,OPTIONS');
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400');
date_default_timezone_set('PRC');
use app\common\controller\Api;
use app\common\helper\HttpHelper;
use think\Db;
class User extends Api
{
// 无需登录的接口,*表示全部
protected $noNeedLogin = ['*'];
// 无需鉴权的接口,*表示全部
protected $noNeedRight = ['*'];
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 uimsApitoken(){
$appKey ="waterPro_54989312";
$appSecret ="bef381707451606b34c1f9b4b18bd5d7";
$url="/api/access_token";
$postdata=[
"appKey"=>$appKey,
"appSecret"=>$appSecret,
];
$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'];
}else{
return $this->error("请求失败".$jsondata['msg'],$jsondata['data']);
}
}
}