diff --git a/.env.example b/.env.example index d70a78a..c525484 100755 --- a/.env.example +++ b/.env.example @@ -58,3 +58,4 @@ MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" # Match WeChat mini-program message push settings WECHAT_CONTENT_SECURITY_TOKEN= WECHAT_CONTENT_SECURITY_AES_KEY= +YUANHE_BASE_URL=https://e.oriza.com diff --git a/app/Repositories/YuanheRepository.php b/app/Repositories/YuanheRepository.php index b287c0f..15a5b44 100755 --- a/app/Repositories/YuanheRepository.php +++ b/app/Repositories/YuanheRepository.php @@ -21,7 +21,7 @@ class YuanheRepository public function __construct() { - $this->baseUrl = config('yuanhe.base_url'); + $this->baseUrl = rtrim((string) config('yuanhe.base_url'), '/'); $this->customerId = config('yuanhe.customer_id'); $this->authKey = config('yuanhe.auth_key'); } @@ -49,7 +49,7 @@ class YuanheRepository public function companyInfo($params) { $params = json_encode($params); - $url = $this->baseUrl . '/master-service/openapi/businessCollege/enterprise/info'; + $url = $this->baseUrl . '/gateway/openapi/businessCollege/enterprise/info'; $header = $this->getHeader(); try { $result = httpCurl($url, 'POST', $params, $header); @@ -69,7 +69,7 @@ class YuanheRepository */ public function search($params) { - $url = $this->baseUrl . '/master-service/openapi/businessCollege/enterprise/search'; + $url = $this->baseUrl . '/gateway/openapi/businessCollege/enterprise/search'; $header = $this->getHeader(); try { $result = httpCurl($url, 'GET', $params, $header); @@ -89,7 +89,7 @@ class YuanheRepository */ public function enterpriseSearchProbe(array $params): array { - $url = $this->baseUrl . '/master-service/openapi/businessCollege/enterprise/search'; + $url = $this->baseUrl . '/gateway/openapi/businessCollege/enterprise/search'; $headers = $this->getHeader(); $this->lastRequest = [ 'method' => 'GET', @@ -115,7 +115,7 @@ class YuanheRepository */ public function enterprisePackInfo(array $params, int $timeout = 3): array { - $url = $this->baseUrl . '/master-service/openapi/businessCollege/enterprise/packInfo'; + $url = $this->baseUrl . '/gateway/openapi/businessCollege/enterprise/packInfo'; $header = $this->getHeader(); $payload = json_encode($params, JSON_UNESCAPED_UNICODE); $this->lastRequest = [ @@ -195,7 +195,7 @@ class YuanheRepository 'openTime' => $course->start_date ]; $params = json_encode($params, JSON_UNESCAPED_UNICODE); - $url = $this->baseUrl . '/master-service/openapi/businessCollege/shareInfo/push'; + $url = $this->baseUrl . '/gateway/openapi/businessCollege/shareInfo/push'; $header = $this->getHeader(); try { $result = httpCurl($url, 'POST', $params, $header); diff --git a/config/yuanhe.php b/config/yuanhe.php index dc8e069..889423c 100644 --- a/config/yuanhe.php +++ b/config/yuanhe.php @@ -1,7 +1,7 @@ env('YUANHE_BASE_URL'), + 'base_url' => env('YUANHE_BASE_URL', 'https://e.oriza.com'), 'customer_id' => env('YUANHE_CUSTOMERID'), 'auth_key' => env('YUANHE_AUTHKEY'), ]; diff --git a/docs/company-news.md b/docs/company-news.md index de4d5e8..fcfaaf8 100644 --- a/docs/company-news.md +++ b/docs/company-news.md @@ -30,7 +30,7 @@ ## 元禾接口配置 -后端 `.env` 必须设置 YUANHE_BASE_URL、YUANHE_CUSTOMERID、YUANHE_AUTHKEY,值使用当前授权的元禾配置。密钥不得提交到版本控制。项目通过 config/yuanhe.php 读取,因此使用配置缓存的环境更新后需重新生成配置缓存,并重启采集进程。 +后端 `.env` 设置 `YUANHE_BASE_URL=https://e.oriza.com`(仅域名,不包含接口路径);接口统一使用 `/gateway/openapi/businessCollege/` 前缀。`YUANHE_CUSTOMERID`、`YUANHE_AUTHKEY` 使用当前授权的元禾配置。密钥不得提交到版本控制。项目通过 config/yuanhe.php 读取,因此使用配置缓存的环境更新后需重新生成配置缓存,并重启采集进程。 创建批次和启动消费者前会校验配置,缺少配置时直接说明缺少的键名,不会创建一批注定失败的任务;页面顶部也会显示配置错误。