You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.5 KiB

4 months ago
<?php
namespace App\Repositories;
use App\Models\AppointmentConfig;
use App\Models\ThirdAppointmentLog;
/**
* 元禾控股
*/
class YuanheRepository
{
public $baseUrl;
public $customerId;
public $authKey;
public function __construct()
{
// 测试地址
4 months ago
$this->baseUrl = 'https://uat.oriza.com';
4 months ago
$this->customerId = '1947941625517604864';
$this->authKey = '59C8ED8584EE4BA7BC22FC63BE45C73D';
}
public function getHeader()
{
4 months ago
$timestamp = time() * 1000;
$token = $this->customerId . $timestamp . $this->authKey;
$token = md5($token);
4 months ago
$token = strtoupper($token);
4 months ago
$header[] = 'Content-Type: application/json';
4 months ago
$header[] = "customerId: {$this->customerId}";
$header[] = "timestamp: {$timestamp}";
$header[] = "token: {$token}";
return $header;
}
/**
* 公司查询
*/
public function companyInfo($params)
{
4 months ago
$params = json_encode($params);
4 months ago
$url = $this->baseUrl . '/master-service/openapi/businessCollege/enterprise/info';
$header = $this->getHeader();
try {
$result = httpCurl($url, 'POST', $params, $header);
$result = json_decode($result, true);
if ($result['code'] == 200) {
return $result['data'];
} else {
return false;
}
} catch (\Exception $e) {
return false;
}
}
}