本文整理汇总了PHP中frontend\models\User::deleteAll方法的典型用法代码示例。如果您正苦于以下问题:PHP User::deleteAll方法的具体用法?PHP User::deleteAll怎么用?PHP User::deleteAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类frontend\models\User
的用法示例。
在下文中一共展示了User::deleteAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUser
public function actionUser()
{
User::deleteAll();
$this->fdb->createCommand('DELETE FROM ngpt_ngpt_user')->query();
//获取所有的User
$offset = 0;
$limit = 1000;
QUERY:
$sql = <<<SQL
SELECT u.*,m.adminid FROM ngpt_ngpt_users u
LEFT JOIN ngpt_common_member m ON u.uid=m.uid
LIMIT {$limit} OFFSET {$offset};
SQL;
$res = $this->fdb->createCommand($sql)->queryAll();
foreach ($res as $ouser) {
$user = new User();
$user->stat_up = $ouser['uploaded'];
$user->stat_down = $ouser['downloaded'];
$user->real_up = $ouser['realup'];
$user->real_down = $ouser['realdown'];
$user->is_valid = $ouser['candownload'] == '1';
$user->passkey = $ouser['passkey'];
$user->discuz_user_id = $ouser['uid'];
if ($ouser['adminid'] != 0) {
$user->priv = 'Admin';
}
var_dump($ouser);
if (!$user->insert()) {
var_dump($user->errors);
return;
}
//进行ngpt的数据迁移
$msql = <<<SQL
INSERT INTO ngpt_ngpt_user(uid, passkey, candownload)
VALUES ({$ouser['uid']},"{$user->passkey}", {$user->is_valid});
SQL;
$res = $this->fdb->createCommand($msql)->query();
if (!$res) {
var_dump($msql);
return;
}
}
if (count($res)) {
$offset += $limit;
goto QUERY;
}
return;
}