本文整理匯總了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;
}