connection->command([ 'createIndexes' => $this->table, 'indexes' => [ [ 'key' => ['pid' => 1], 'name' => 'pid_index' ] ] ]); } protected static function init() { //把当前表加入到监听队列 Redis_sAdd('watch_tables', "qcode_classification"); self::beforeWrite(function ($model) { if (!isset($model->delete_time)){ $model->delete_time=""; } $model->sync_flag=0; }); // $model->sync_flag=1; } }