From 01ee4a1771a2fbf74d5c807bb8ce7fbe2db9c61a Mon Sep 17 00:00:00 2001 From: cody <648753004@qq.com> Date: Mon, 28 Jul 2025 12:02:23 +0800 Subject: [PATCH] update --- app/Console/Commands/UpdateCompany.php | 6 +++ app/Repositories/YuanheRepository.php | 60 ++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100755 app/Repositories/YuanheRepository.php diff --git a/app/Console/Commands/UpdateCompany.php b/app/Console/Commands/UpdateCompany.php index 4d8bbe9..469e1f9 100755 --- a/app/Console/Commands/UpdateCompany.php +++ b/app/Console/Commands/UpdateCompany.php @@ -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('更新完成'); } diff --git a/app/Repositories/YuanheRepository.php b/app/Repositories/YuanheRepository.php new file mode 100755 index 0000000..47eb1fa --- /dev/null +++ b/app/Repositories/YuanheRepository.php @@ -0,0 +1,60 @@ +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; + } + } + +}