wesmiler 1 年之前
父节点
当前提交
821231089c
共有 2 个文件被更改,包括 10 次插入0 次删除
  1. 9 0
      app/Services/SupplyService.php
  2. 1 0
      resources/lang/zh-cn/api.php

+ 9 - 0
app/Services/SupplyService.php

@@ -45,6 +45,11 @@ class SupplyService extends BaseService
     public function __construct()
     {
         $this->model = new GoodsModel();
+
+        self::$apiUrl = ConfigService::make()->getConfigByCode('supply_api_url','https://www.douhuomall.com');
+        self::$supplyMobile = ConfigService::make()->getConfigByCode('supply_mobile','19354894149');
+        self::$appId = ConfigService::make()->getConfigByCode('supply_app_id','YS1ef14c155555dce4bb');
+        self::$appSecret = ConfigService::make()->getConfigByCode('supply_app_secret','2cbbf72408cb906ec039105d9ff9b365');
     }
 
     /**
@@ -67,6 +72,10 @@ class SupplyService extends BaseService
      */
     public function getToken()
     {
+        if(empty(self::$appId) || empty(self::$supplyMobile) || empty(self::$appSecret)){
+            $this->error = 2702;
+            return false;
+        }
         $cacheKey = "caches:supply:token_".self::$appId.'_'.self::$supplyMobile;
         $data = RedisService::get($cacheKey);
         $accessToken = isset($data['access_token'])? $data['access_token'] : '';

+ 1 - 0
resources/lang/zh-cn/api.php

@@ -150,6 +150,7 @@ return [
 
 
     '2701'=> '获取供应链授权Token失败',
+    '2702'=> '供应链参数未配置完整',