\App\Console\CommandsRegionCommand

地区命令公共基类

职责:① forgetRegionCaches——DB 直插不触发模型事件的手动失效(stats + tree); ② syncRegionSequence——pgsql 序列同步(表名走 DbSchema::prefix); ③ batchInsert/flushInsert——2000 行/批攒插与尾部 flush(防长事务); ④ nullableColumns——当前库表列(列名 → 是否可空,Schema 抽象 PG/sqlite 通吃)。

Summary

Methods
Properties
Constants
No public methods found
No public properties found
REGION_TABLE
forgetRegionCaches()
syncRegionSequence()
batchInsert()
flushInsert()
nullableColumns()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

REGION_TABLE

REGION_TABLE = 'td_sys_region'

地区表名(裸表名,SQL 拼接处走 DbSchema::prefix)

Methods

forgetRegionCaches()

forgetRegionCaches() : void

手动失效地区缓存(DB 直插/直改不触发模型事件时的单源收口)。 sys:region:tree 含地区全字段,缺失失效会让旧值残留。

syncRegionSequence()

syncRegionSequence() : void

同步地区序列(仅 pgsql;表名走 DbSchema::prefix(),勿硬编码 schema)

batchInsert()

batchInsert(array  $rows, int  $count, int  $batchSize = 2000) : void

批量攒插:行攒满 $batchSize 即插入并清空(内存恒定,防单条长事务)

Parameters

array $rows
int $count
int $batchSize

flushInsert()

flushInsert(array  $rows, int  $count) : void

尾部 flush:不足一批的剩余行落库

Parameters

array $rows
int $count

nullableColumns()

nullableColumns() : array<string,bool>

当前库表列 → 是否可空(按定义顺序;Schema 抽象,PG/sqlite 通吃—— 此前 RegionDump 的 information_schema 版仅 PG 可用,统一为可移植实现)。

Returns

array

列名 → true=可空(空值语义由调用方按列决定)