objTable->getAll([ '_field' => 'group_id, count(user_id) as c', '_groupby' => 'group_id', ]); foreach ($groups as $g) { $objGroup->objTable->updateObject(['member_num' => $g['c']], ['group_id' => $g['group_id']]); } $c = count($groups); $t = microtime(true) - $st; var_dump("处理{$c},耗时{$t}");