Przeglądaj źródła

Merge branch 'master' into dev

shish 2 miesięcy temu
rodzic
commit
9a05f73cd8

+ 1 - 1
app-ghs/controllers/MainController.php

@@ -250,7 +250,7 @@ class MainController extends BaseController
             $showAd = 0;
             $showAd = 0;
         }
         }
         //是否展示终身版套餐
         //是否展示终身版套餐
-        $lifelong = 0;
+        $lifelong = 1;
 
 
         $deadline = $sj['deadline'] ?? '';
         $deadline = $sj['deadline'] ?? '';
         $relation = isset($this->shopAdmin) && !empty($this->shopAdmin) ? $this->shopAdmin->attributes : [];
         $relation = isset($this->shopAdmin) && !empty($this->shopAdmin) ? $this->shopAdmin->attributes : [];

+ 0 - 26
app-ghs/controllers/OrderController.php

@@ -2173,32 +2173,6 @@ class OrderController extends BaseController
         util::success($info);
         util::success($info);
     }
     }
 
 
-    //通过订单获取采购单分享salt ssh 20260521
-    public function actionCgSalt()
-    {
-        $get = Yii::$app->request->get();
-        $id = $get['id'] ?? 0;
-        if (empty($id)) {
-            util::fail('请求参数错误');
-        }
-        $order = OrderClass::getById($id, true);
-        if (empty($order)) {
-            util::fail('没有找到订单');
-        }
-		if($order->mainId != $this->mainId){
-			util::fail('不是你的订单哈。');
-		}
-        $purchaseId = $order->purchaseId ?? 0;
-        if (empty($purchaseId)) {
-            util::fail('没有找到采购单');
-        }
-        $cg = PurchaseClass::getById($purchaseId);
-        if (empty($cg)) {
-            util::fail('没有找到采购单');
-        }
-        util::success(['purchaseId' => $purchaseId, 'cgSalt' => $cg['salt'] ?? '']);
-    }
-
     //获取订单信息 ssh 20240102
     //获取订单信息 ssh 20240102
     public function actionGetInfoByOrderSn()
     public function actionGetInfoByOrderSn()
     {
     {

+ 15 - 0
biz-ghs/order/classes/OrderClass.php

@@ -1475,6 +1475,18 @@ class OrderClass extends BaseClass
         $customIds = array_unique(array_filter($customIds));
         $customIds = array_unique(array_filter($customIds));
         $customInfoList = CustomClass::getByIds($customIds, null, 'id');
         $customInfoList = CustomClass::getByIds($customIds, null, 'id');
 
 
+        $purchaseIds = array_unique(array_filter(array_column($list, 'purchaseId')));
+        $cgSaltMap = [];
+        if (!empty($purchaseIds)) {
+            $cgList = PurchaseClass::getByIds($purchaseIds, null, 'id', 'id,salt');
+            foreach ($cgList as $cg) {
+                $cgId = $cg['id'] ?? 0;
+                if (!empty($cgId)) {
+                    $cgSaltMap[$cgId] = $cg['salt'] ?? '';
+                }
+            }
+        }
+
         foreach ($list as $key => $val) {
         foreach ($list as $key => $val) {
             $adminId = $val['adminId'] ?? 0;
             $adminId = $val['adminId'] ?? 0;
             $list[$key]['adminName'] = $adminInfo[$adminId]['name'] ?? '';
             $list[$key]['adminName'] = $adminInfo[$adminId]['name'] ?? '';
@@ -1533,6 +1545,9 @@ class OrderClass extends BaseClass
             $profit = floatval($profit);
             $profit = floatval($profit);
             $list[$key]['profit'] = $profit;
             $list[$key]['profit'] = $profit;
 
 
+            $purchaseId = $val['purchaseId'] ?? 0;
+            $list[$key]['cgSalt'] = !empty($purchaseId) ? ($cgSaltMap[$purchaseId] ?? '') : '';
+
         }
         }
         return $list;
         return $list;
     }
     }

+ 140 - 36
console/controllers/SaltController.php

@@ -12,17 +12,34 @@ use yii\console\ExitCode;
 /**
 /**
  * 补充历史订单 salt 字段
  * 补充历史订单 salt 字段
  *
  *
+ * 大表安全说明:
+ * - 不做 COUNT(*),避免全表统计
+ * - 默认 empty 模式只查 salt='' 的记录,补完后即停止,不会扫全表
+ * - 查询均为普通 SELECT(MVCC 快照读),不会锁表;UPDATE 仅锁单行
+ * - 大表建议先加索引: ALTER TABLE xhGhsOrder ADD INDEX idx_salt_id (salt, id);
+ *
  * 用法:
  * 用法:
  *   php yii salt/fill
  *   php yii salt/fill
  *   php yii salt/fill --dryRun=1
  *   php yii salt/fill --dryRun=1
  *   php yii salt/fill --batchSize=50 --sleepMs=200
  *   php yii salt/fill --batchSize=50 --sleepMs=200
+ *   php yii salt/fill --mode=pk --scanSize=2000
  *   php yii salt/fill-ghs-order
  *   php yii salt/fill-ghs-order
  *   php yii salt/fill-cg
  *   php yii salt/fill-cg
  */
  */
 class SaltController extends Controller
 class SaltController extends Controller
 {
 {
     /** @var int 每批处理条数 */
     /** @var int 每批处理条数 */
-    public $batchSize = 100;
+    public $batchSize = 5000;
+
+    /** @var int pk 模式下每次主键游标扫描行数 */
+    public $scanSize = 5000;
+
+    /**
+     * 扫描模式:
+     * - empty: 只查 salt='',适合待补数据量较少(默认)
+     * - pk: 按主键分段扫描,适合 salt 列无索引且 empty 模式执行计划不佳时
+     */
+    public $mode = 'empty';
 
 
     /** @var int 每批之间的休眠毫秒数,降低白天执行时的数据库压力 */
     /** @var int 每批之间的休眠毫秒数,降低白天执行时的数据库压力 */
     public $sleepMs = 100;
     public $sleepMs = 100;
@@ -35,7 +52,14 @@ class SaltController extends Controller
 
 
     public function options($actionID)
     public function options($actionID)
     {
     {
-        return array_merge(parent::options($actionID), ['batchSize', 'sleepMs', 'limit', 'dryRun']);
+        return array_merge(parent::options($actionID), [
+            'batchSize',
+            'scanSize',
+            'mode',
+            'sleepMs',
+            'limit',
+            'dryRun',
+        ]);
     }
     }
 
 
     /**
     /**
@@ -78,6 +102,14 @@ class SaltController extends Controller
             $this->stderr("batchSize 必须大于 0\n");
             $this->stderr("batchSize 必须大于 0\n");
             return ExitCode::UNSPECIFIED_ERROR;
             return ExitCode::UNSPECIFIED_ERROR;
         }
         }
+        if ($this->scanSize < 1) {
+            $this->stderr("scanSize 必须大于 0\n");
+            return ExitCode::UNSPECIFIED_ERROR;
+        }
+        if (!in_array($this->mode, ['empty', 'pk'], true)) {
+            $this->stderr("mode 仅支持 empty 或 pk\n");
+            return ExitCode::UNSPECIFIED_ERROR;
+        }
 
 
         $exitCode = ExitCode::OK;
         $exitCode = ExitCode::OK;
         foreach ($tables as $label => $tableName) {
         foreach ($tables as $label => $tableName) {
@@ -93,21 +125,34 @@ class SaltController extends Controller
     private function fillTable($label, $tableName)
     private function fillTable($label, $tableName)
     {
     {
         $db = Yii::$app->db;
         $db = Yii::$app->db;
-        $remaining = (int)$db->createCommand(
-            "SELECT COUNT(*) FROM {$tableName} WHERE salt = ''"
-        )->queryScalar();
+        $db->createCommand('SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED')->execute();
 
 
-        $this->stdout("{$label}({$tableName}) 待补充: {$remaining}\n");
-        if ($remaining === 0) {
-            return ExitCode::OK;
+        $this->stdout("{$label}({$tableName}) 开始补充 salt,模式: {$this->mode}\n");
+        if ($this->mode === 'empty') {
+            $processed = $this->fillByEmptySalt($label, $tableName);
+        } else {
+            $processed = $this->fillByPrimaryKeyScan($label, $tableName);
         }
         }
 
 
+        $this->stdout("{$label} 完成,本次处理 {$processed} 条\n");
+        return ExitCode::OK;
+    }
+
+    /**
+     * 只查 salt='' 的记录,补完即停,不会扫描已有 salt 的上千万数据
+     */
+    private function fillByEmptySalt($label, $tableName)
+    {
+        $db = Yii::$app->db;
         $processed = 0;
         $processed = 0;
-        $maxProcess = $this->limit > 0 ? min($this->limit, $remaining) : $remaining;
         $lastId = 0;
         $lastId = 0;
 
 
-        while ($processed < $maxProcess) {
-            $batchLimit = min($this->batchSize, $maxProcess - $processed);
+        while (true) {
+            if ($this->limit > 0 && $processed >= $this->limit) {
+                break;
+            }
+
+            $batchLimit = $this->limit > 0 ? min($this->batchSize, $this->limit - $processed) : $this->batchSize;
             $rows = $db->createCommand(
             $rows = $db->createCommand(
                 "SELECT id FROM {$tableName} WHERE salt = '' AND id > :lastId ORDER BY id ASC LIMIT {$batchLimit}"
                 "SELECT id FROM {$tableName} WHERE salt = '' AND id > :lastId ORDER BY id ASC LIMIT {$batchLimit}"
             )->bindValue(':lastId', $lastId)->queryColumn();
             )->bindValue(':lastId', $lastId)->queryColumn();
@@ -116,41 +161,100 @@ class SaltController extends Controller
                 break;
                 break;
             }
             }
 
 
-            foreach ($rows as $id) {
-                $id = (int)$id;
-                $lastId = $id;
+            $processed += $this->updateIds($label, $tableName, $rows);
+            $lastId = (int)end($rows);
 
 
-                if ($this->dryRun) {
-                    $this->stdout("[dry-run] {$label} id={$id}\n");
-                    $processed++;
-                    continue;
-                }
+            $this->stdout("{$label} 已处理 {$processed} 条,当前 id <= {$lastId}\n");
+            $this->sleepBetweenBatch();
+        }
 
 
-                $salt = stringUtil::charsShuffleLowerCase(10);
-                $affected = $db->createCommand(
-                    "UPDATE {$tableName} SET salt = :salt WHERE id = :id AND salt = ''"
-                )->bindValues([
-                    ':salt' => $salt,
-                    ':id' => $id,
-                ])->execute();
+        return $processed;
+    }
 
 
-                if ($affected > 0) {
-                    $processed++;
+    /**
+     * 按主键游标分段扫描,查询只走主键索引;适合 empty 模式执行计划不佳时使用
+     */
+    private function fillByPrimaryKeyScan($label, $tableName)
+    {
+        $db = Yii::$app->db;
+        $processed = 0;
+        $lastId = 0;
+
+        while (true) {
+            if ($this->limit > 0 && $processed >= $this->limit) {
+                break;
+            }
+
+            $ids = $db->createCommand(
+                "SELECT id FROM {$tableName} WHERE id > :lastId ORDER BY id ASC LIMIT {$this->scanSize}"
+            )->bindValue(':lastId', $lastId)->queryColumn();
+
+            if (empty($ids)) {
+                break;
+            }
+
+            $lastId = (int)end($ids);
+            $minId = (int)$ids[0];
+            $maxId = $lastId;
+
+            $emptyIds = $db->createCommand(
+                "SELECT id FROM {$tableName} WHERE id >= :minId AND id <= :maxId AND salt = '' ORDER BY id ASC"
+            )->bindValues([
+                ':minId' => $minId,
+                ':maxId' => $maxId,
+            ])->queryColumn();
+
+            if (!empty($emptyIds)) {
+                if ($this->limit > 0) {
+                    $emptyIds = array_slice($emptyIds, 0, $this->limit - $processed);
                 }
                 }
+                $processed += $this->updateIds($label, $tableName, $emptyIds);
             }
             }
 
 
-            $this->stdout("{$label} 已处理 {$processed}/{$maxProcess}\n");
+            $this->stdout("{$label} 已处理 {$processed} 条,已扫描到 id={$lastId}\n");
+            $this->sleepBetweenBatch();
+        }
 
 
-            if ($this->sleepMs > 0 && $processed < $maxProcess) {
-                usleep($this->sleepMs * 1000);
+        return $processed;
+    }
+
+    private function updateIds($label, $tableName, array $ids)
+    {
+        $db = Yii::$app->db;
+        $updated = 0;
+
+        foreach ($ids as $id) {
+            $id = (int)$id;
+            if ($id <= 0) {
+                continue;
+            }
+
+            if ($this->dryRun) {
+                $this->stdout("[dry-run] {$label} id={$id}\n");
+                $updated++;
+                continue;
+            }
+
+            $salt = stringUtil::charsShuffleLowerCase(10);
+            $affected = $db->createCommand(
+                "UPDATE {$tableName} SET salt = :salt WHERE id = :id AND salt = ''"
+            )->bindValues([
+                ':salt' => $salt,
+                ':id' => $id,
+            ])->execute();
+
+            if ($affected > 0) {
+                $updated++;
             }
             }
         }
         }
 
 
-        $left = (int)$db->createCommand(
-            "SELECT COUNT(*) FROM {$tableName} WHERE salt = ''"
-        )->queryScalar();
-        $this->stdout("{$label} 完成,本次处理 {$processed} 条,剩余 {$left} 条\n");
+        return $updated;
+    }
 
 
-        return ExitCode::OK;
+    private function sleepBetweenBatch()
+    {
+        if ($this->sleepMs > 0) {
+            usleep($this->sleepMs * 1000);
+        }
     }
     }
 }
 }

+ 0 - 6
sql/fix_scan_pay_refund_sn_addtime.php

@@ -1,6 +0,0 @@
-<?php
-$pdo = new PDO('mysql:host=118.178.193.23;dbname=huahuibao;charset=utf8mb4', 'root', 'zhh20250805', [
-    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
-]);
-$pdo->exec("ALTER TABLE xhScanPayRefundSn MODIFY addTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP");
-echo "alter ok\n";

+ 0 - 38
sql/payBack_scan_pay_refund.sql

@@ -1,38 +0,0 @@
--- 收款码流水退款 payBack 分支
-ALTER TABLE xhScanPay
-  ADD COLUMN tkPrice decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '累计退款金额' AFTER actPrice,
-  ADD COLUMN refundLog tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否有退款记录' AFTER tkPrice;
-
-CREATE TABLE IF NOT EXISTS xhScanPayRefund (
-  id int(11) NOT NULL AUTO_INCREMENT,
-  orderSn varchar(32) NOT NULL COMMENT '退款单号 SR*',
-  relateOrderSn varchar(32) NOT NULL COMMENT '原收款单号 SC*',
-  scanPayId int(11) NOT NULL DEFAULT 0,
-  mainId int(11) NOT NULL DEFAULT 0,
-  shopId int(11) NOT NULL DEFAULT 0,
-  hdId int(11) NOT NULL DEFAULT 0,
-  customId int(11) NOT NULL DEFAULT 0,
-  customName varchar(64) NOT NULL DEFAULT '',
-  refundPrice decimal(10,2) NOT NULL DEFAULT 0.00,
-  payWay tinyint(1) NOT NULL DEFAULT 0 COMMENT '0微信 1支付宝',
-  status tinyint(1) NOT NULL DEFAULT 1 COMMENT '1已通过',
-  thirdRefundNo varchar(64) NOT NULL DEFAULT '' COMMENT '拉卡拉退款流水号',
-  shopAdminId int(11) NOT NULL DEFAULT 0,
-  shopAdminName varchar(32) NOT NULL DEFAULT '',
-  remark varchar(255) NOT NULL DEFAULT '',
-  addTime datetime NOT NULL,
-  PRIMARY KEY (id),
-  KEY idx_relateOrderSn (relateOrderSn),
-  KEY idx_mainId (mainId),
-  KEY idx_scanPayId (scanPayId)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='收款码退款流水';
-
-CREATE TABLE IF NOT EXISTS xhScanPayRefundSn (
-  id int(11) NOT NULL AUTO_INCREMENT,
-  mainId int(11) NOT NULL DEFAULT 0,
-  shopId int(11) NOT NULL DEFAULT 0,
-  hdId int(11) NOT NULL DEFAULT 0,
-  customId int(11) NOT NULL DEFAULT 0,
-  addTime datetime NOT NULL,
-  PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

+ 0 - 68
sql/run_all_payBack_sql.php

@@ -1,68 +0,0 @@
-<?php
-$host = '118.178.193.23';
-$db = 'huahuibao';
-$user = 'root';
-$pass = 'zhh20250805';
-$pdo = new PDO("mysql:host=$host;dbname=$db;charset=utf8mb4", $user, $pass, [
-    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
-]);
-$results = [];
-function run(PDO $pdo, $sql, &$results, $label = '') {
-    try {
-        $pdo->exec($sql);
-        $results[] = ['status' => 'ok', 'label' => $label, 'sql' => preg_replace('/\s+/', ' ', trim($sql))];
-    } catch (Exception $e) {
-        $results[] = ['status' => 'err', 'label' => $label, 'sql' => preg_replace('/\s+/', ' ', trim($sql)), 'msg' => $e->getMessage()];
-    }
-}
-
-$cols = $pdo->query('DESCRIBE xhScanPay')->fetchAll(PDO::FETCH_COLUMN);
-if (!in_array('tkPrice', $cols, true)) {
-    run($pdo, "ALTER TABLE xhScanPay ADD COLUMN tkPrice decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '累计退款金额' AFTER actPrice", $results, 'add tkPrice');
-} else {
-    $results[] = ['status' => 'skip', 'label' => 'tkPrice exists'];
-}
-$cols = $pdo->query('DESCRIBE xhScanPay')->fetchAll(PDO::FETCH_COLUMN);
-if (!in_array('refundLog', $cols, true)) {
-    run($pdo, "ALTER TABLE xhScanPay ADD COLUMN refundLog tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否有退款记录' AFTER tkPrice", $results, 'add refundLog');
-} else {
-    $results[] = ['status' => 'skip', 'label' => 'refundLog exists'];
-}
-
-run($pdo, "CREATE TABLE IF NOT EXISTS xhScanPayRefund (
-  id int(11) NOT NULL AUTO_INCREMENT,
-  orderSn varchar(32) NOT NULL COMMENT '退款单号 SR*',
-  relateOrderSn varchar(32) NOT NULL COMMENT '原收款单号 SC*',
-  scanPayId int(11) NOT NULL DEFAULT 0,
-  mainId int(11) NOT NULL DEFAULT 0,
-  shopId int(11) NOT NULL DEFAULT 0,
-  hdId int(11) NOT NULL DEFAULT 0,
-  customId int(11) NOT NULL DEFAULT 0,
-  customName varchar(64) NOT NULL DEFAULT '',
-  refundPrice decimal(10,2) NOT NULL DEFAULT 0.00,
-  payWay tinyint(1) NOT NULL DEFAULT 0 COMMENT '0微信 1支付宝',
-  status tinyint(1) NOT NULL DEFAULT 1 COMMENT '1已通过',
-  thirdRefundNo varchar(64) NOT NULL DEFAULT '' COMMENT '拉卡拉退款流水号',
-  shopAdminId int(11) NOT NULL DEFAULT 0,
-  shopAdminName varchar(32) NOT NULL DEFAULT '',
-  remark varchar(255) NOT NULL DEFAULT '',
-  addTime datetime NOT NULL,
-  PRIMARY KEY (id),
-  KEY idx_relateOrderSn (relateOrderSn),
-  KEY idx_mainId (mainId),
-  KEY idx_scanPayId (scanPayId)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='收款码退款流水'", $results, 'create xhScanPayRefund');
-
-run($pdo, "CREATE TABLE IF NOT EXISTS xhScanPayRefundSn (
-  id int(11) NOT NULL AUTO_INCREMENT,
-  mainId int(11) NOT NULL DEFAULT 0,
-  shopId int(11) NOT NULL DEFAULT 0,
-  hdId int(11) NOT NULL DEFAULT 0,
-  customId int(11) NOT NULL DEFAULT 0,
-  addTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
-  PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", $results, 'create xhScanPayRefundSn');
-
-run($pdo, "ALTER TABLE xhScanPayRefundSn MODIFY addTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP", $results, 'fix addTime default');
-
-echo json_encode($results, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) . PHP_EOL;

+ 0 - 64
sql/run_payBack_migration.php

@@ -1,64 +0,0 @@
-<?php
-$host = '118.178.193.23';
-$db = 'huahuibao';
-$user = 'root';
-$pass = 'zhh20250805';
-$pdo = new PDO("mysql:host=$host;dbname=$db;charset=utf8mb4", $user, $pass, [
-    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
-]);
-$results = [];
-function runSql(PDO $pdo, $sql, &$results) {
-    try {
-        $pdo->exec($sql);
-        $results[] = ['status' => 'ok', 'sql' => trim($sql)];
-    } catch (Exception $e) {
-        $results[] = ['status' => 'err', 'sql' => trim($sql), 'msg' => $e->getMessage()];
-    }
-}
-$cols = $pdo->query('DESCRIBE xhScanPay')->fetchAll(PDO::FETCH_COLUMN);
-if (!in_array('tkPrice', $cols, true)) {
-    runSql($pdo, "ALTER TABLE xhScanPay ADD COLUMN tkPrice decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '累计退款金额' AFTER actPrice", $results);
-} else {
-    $results[] = ['status' => 'skip', 'sql' => 'tkPrice column already exists'];
-}
-$cols = $pdo->query('DESCRIBE xhScanPay')->fetchAll(PDO::FETCH_COLUMN);
-if (!in_array('refundLog', $cols, true)) {
-    runSql($pdo, "ALTER TABLE xhScanPay ADD COLUMN refundLog tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否有退款记录' AFTER tkPrice", $results);
-} else {
-    $results[] = ['status' => 'skip', 'sql' => 'refundLog column already exists'];
-}
-$createRefund = "CREATE TABLE IF NOT EXISTS xhScanPayRefund (
-  id int(11) NOT NULL AUTO_INCREMENT,
-  orderSn varchar(32) NOT NULL COMMENT '退款单号 SR*',
-  relateOrderSn varchar(32) NOT NULL COMMENT '原收款单号 SC*',
-  scanPayId int(11) NOT NULL DEFAULT 0,
-  mainId int(11) NOT NULL DEFAULT 0,
-  shopId int(11) NOT NULL DEFAULT 0,
-  hdId int(11) NOT NULL DEFAULT 0,
-  customId int(11) NOT NULL DEFAULT 0,
-  customName varchar(64) NOT NULL DEFAULT '',
-  refundPrice decimal(10,2) NOT NULL DEFAULT 0.00,
-  payWay tinyint(1) NOT NULL DEFAULT 0 COMMENT '0微信 1支付宝',
-  status tinyint(1) NOT NULL DEFAULT 1 COMMENT '1已通过',
-  thirdRefundNo varchar(64) NOT NULL DEFAULT '' COMMENT '拉卡拉退款流水号',
-  shopAdminId int(11) NOT NULL DEFAULT 0,
-  shopAdminName varchar(32) NOT NULL DEFAULT '',
-  remark varchar(255) NOT NULL DEFAULT '',
-  addTime datetime NOT NULL,
-  PRIMARY KEY (id),
-  KEY idx_relateOrderSn (relateOrderSn),
-  KEY idx_mainId (mainId),
-  KEY idx_scanPayId (scanPayId)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='收款码退款流水'";
-runSql($pdo, $createRefund, $results);
-$createSn = "CREATE TABLE IF NOT EXISTS xhScanPayRefundSn (
-  id int(11) NOT NULL AUTO_INCREMENT,
-  mainId int(11) NOT NULL DEFAULT 0,
-  shopId int(11) NOT NULL DEFAULT 0,
-  hdId int(11) NOT NULL DEFAULT 0,
-  customId int(11) NOT NULL DEFAULT 0,
-  addTime datetime NOT NULL,
-  PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4";
-runSql($pdo, $createSn, $results);
-echo json_encode($results, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);