master
cody 3 months ago
parent 11c1a24c75
commit 01ee4a1771

@ -4,6 +4,7 @@ namespace App\Console\Commands;
use App\Models\User;
use App\Repositories\MeetRepository;
use App\Repositories\YuanheRepository;
use Illuminate\Console\Command;
@ -41,7 +42,12 @@ class UpdateCompany extends Command
public function handle()
{
$users = User::get();
$YuanheRepository = new YuanheRepository();
foreach ($users as $user) {
$result = $YuanheRepository->companyInfo(['enterpriseName' => $user->company_name]);
dd($result);
}
return $this->info('更新完成');
}

@ -0,0 +1,60 @@
<?php
namespace App\Repositories;
use App\Models\AppointmentConfig;
use App\Models\ThirdAppointmentLog;
/**
* 元禾控股
*/
class YuanheRepository
{
public $baseUrl;
public $customerId;
public $authKey;
public function __construct()
{
// 测试地址
$this->baseUrl = 'https://uat.oriza.com/';
$this->customerId = '1947941625517604864';
$this->authKey = '59C8ED8584EE4BA7BC22FC63BE45C73D';
}
public function getHeader()
{
$timestamp = time();
$token = md5($this->custmerId . time() . $this->authKey);
$token = strtoupper($token);
$header[] = 'Content-Type: application/x-www-form-urlencoded,application/json';
$header[] = "customerId: {$this->customerId}";
$header[] = "timestamp: {$timestamp}";
$header[] = "token: {$token}";
return $header;
}
/**
* 公司查询
*/
public function companyInfo($params)
{
$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;
}
}
}
Loading…
Cancel
Save