<?php
/*
活动成员表：pre_forum_activityapply
*/
if($start <= 1){
	truncatetable('forum_activityapply');
}

$maxcount = $xc->db['source']->result($xc->db['source']->query("SELECT count(*) FROM {$source_tablepre}pcmember"), 0);

if($start < $maxcount){
	$converted = 1;
}

$query = $xc->db['source']->query("SELECT * FROM {$source_tablepre}pcmember limit $start,$end") or dexit();
while ($pwpcmember =	$xc->db['source']->fetch_array($query)) {
	$pwpcmember	=	daddslashes($pwpcmember);

	//pre_forum_activityapply
	$applyid	=	$pwpcmember['pcmid'];
	$tid		=	$pwpcmember['tid'];
	$username	=	$pwpcmember['username'];
	$uid		=	$pwpcmember['uid'];
	$message	=	$pwpcmember['message'];
	$verified	=	1;
	$dateline	=	$pwpcmember['jointime'];
	$payment	=	-1;
	$ufielddata	=	$pwpcmember['mobile'] ? serialize(array('userfield' => array(
		'mobile' => $pwpcmember['mobile'],
		'name' => $pwpcmember['name'],	
	))) : '';

	$field1	=	array('applyid','tid','username','uid','message','verified','dateline','payment','ufielddata');
	$query1	=	getinsertsql("{$discuz_tablepre}forum_activityapply", $field1);

	if ($xc->db['discuz']->query($query1)) {
		$convertedrows ++;
	} else {
		reportlog("无法转换活动成员 tid = $tid username = $username，SQL 语句如下 ：<br><textarea rows=\"3\" style=\"width: 100%;\">".$query1."</textarea>");
	}
	$converted = 1;
	$totalrows ++;
}
?>
