12345678910111213141516171819202122232425262728 |
- <?php
- /**
- * 修复群人数
- * User: solu
- * Date: 2019/2/27
- */
- ini_set("display_errors", "On");
- set_time_limit(0);
- error_reporting(E_ALL & ~E_NOTICE);
- require_once realpath(dirname(__FILE__)) . '/../common.php';
- $st = microtime(true);
- $objGroup = new GroupInfo();
- $objUserGroup = new UserGroup();
- $groups = $objUserGroup->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}");
|