1234567891011121314151617181920212223242526272829303132 |
- <?php
- /**
- * 首次登录账号初始化
- * User: solu
- * Date: 2019/4/04
- */
- 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);
- // UPDATE user_info u, user_bind_info b set u.first_account=b.account WHERE u.user_id=b.user_id and u.first_type=b.type
- exit(); // sql更新,脚本废弃
- $objUser = new TableHelper('user_info', 'dw_chat');
- $objUserBind = new UserBindInfo();
- $c = 0;
- $users = $objUser->getDb()->getAll("select user_id, first_type from `user_info` where isnull(first_account)");
- foreach ($users as $user) {
- $account = $objUserBind->getAccountByUserId($user['user_id'], $user['first_type']);
- if ($account) {
- $objUser->updateObject(['first_account' => $account], ['user_id' => $user['user_id']]);
- $c += 1;
- }
- }
- $t = microtime(true) - $st;
- var_dump("处理{$c},耗时{$t}");
|