OaGlobalsoApi.php
1.7 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
<?php
namespace App\Helper;
use App\Utils\HttpUtils;
use GuzzleHttp\Exception\GuzzleException;
/**
* Class OaGlobalsoApi
* @package App\Helper
* @author zbj
* @date 2023/6/27
*/
class OaGlobalsoApi
{
//接口地址
protected $url = 'https://oa.cmer.com';
protected $token = '';
public function __construct()
{
$this->token = md5('oa' . date('Y-m-d'));
}
/**
* 项目信息
* @author zbj
* @date 2023/5/17
*/
public function order_info($order_id)
{
$api_url = $this->url . '/api/order_info?token='.$this->token.'&order_id='.$order_id;
// $params = [
// 'token' => $this->token,
// 'order_id' => $order_id,
// ];
//https://oa.cmer.com/api/order_info
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($api_url, true) . PHP_EOL, FILE_APPEND);
// try {
// $res = HttpUtils::get($api_url, $params);
$res = http_get($api_url,["charset" => "UTF-8"]);
var_dump($res);
die();
// $res = Arr::s2a($res);
// } catch (\Exception | GuzzleException $e) {
// errorLog('项目信息', $params, $e);
// return false;
// }
return $res;
}
/**
* 渠道信息
* @author zbj
* @date 2023/5/17
*/
public function agents_lists()
{
$api_url = $this->url . '/api/agents_lists';
$params = [
'token' => $this->token,
];
try {
$res = HttpUtils::get($api_url, $params);
$res = Arr::s2a($res);
} catch (\Exception | GuzzleException $e) {
errorLog('渠道信息', $params, $e);
return false;
}
return $res;
}
}