Browse Source

Merge branch 'zhongqi-delivery' into dev

shizhongqi 9 months ago
parent
commit
febc5c312b
2 changed files with 15 additions and 19 deletions
  1. 0 11
      app-ghs/controllers/DeliveryController.php
  2. 15 8
      common/base/classes/BaseClass.php

+ 0 - 11
app-ghs/controllers/DeliveryController.php

@@ -579,17 +579,6 @@ class DeliveryController extends BaseController
         $get =  Yii::$app->request->get();
         $getData = json_encode($get, JSON_UNESCAPED_UNICODE);
         Yii::info($getData);
-
-        $callbackData = Yii::$app->request->post();
-        if (empty($callbackData)) {
-            $postStr = file_get_contents('php://input');
-            $callbackData = json_decode($postStr, true);
-            if (empty($callbackData)) {
-                Yii::info('回调请求的数据为空');
-            }
-        }
-        Yii::info('货拉拉授权回调:' . json_encode($callbackData, JSON_UNESCAPED_UNICODE), 'delivery');
-
         $code = $get['code'];
         $mainId = $get['mainId'];
 

+ 15 - 8
common/base/classes/BaseClass.php

@@ -30,15 +30,13 @@ class BaseClass
             $tableName = static::$baseTable;
             $dbId = property_exists(static::class, 'baseDb') ? static::$baseDb : null;
 
-            $model = new class($tableName, $dbId) extends \common\base\models\Base {
-                private static $_tableName;
-                private static $_dbId;
+            $modelClass = new class extends \common\base\models\Base {
+                private static $_tableName = '';
+                private static $_dbId = null;
 
-                public function __construct($tableName, $dbId = null)
+                public function __construct($config = [])
                 {
-                    self::$_tableName = $tableName;
-                    self::$_dbId = $dbId;
-                    parent::__construct();
+                    parent::__construct($config);
                 }
 
                 public static function tableName()
@@ -53,8 +51,17 @@ class BaseClass
                     }
                     return parent::getDb();
                 }
+
+                public static function setTableConfig($tbl, $db)
+                {
+                    self::$_tableName = $tbl;
+                    self::$_dbId = $db;
+                }
             };
-            return $model;
+            
+            $modelClass->setTableConfig($tableName, $dbId);
+            
+            return $modelClass;
         }
 
         // 未设置 $baseFile / $baseTable,配置不完整