<?php
/*
转换勋章及授勋记录
pre_forum_medallog
*/


truncatetable('forum_medallog');

$query_2 = $xc->db['source']->query("SELECT * FROM {$source_tablepre}medalslog") or die("检索数据表 '{$source_tablepre}medalslog' 错误！请将表 '{$source_tablepre}medalslog' 字段类型为 nText 的改为 Text 类型。");

while ($m = $xc->db['source']->fetch_array($query_2)) {
	
	$m = daddslashes(array_change_key_case($m));

	$id		= $m['id'];
	$uid		= $m['uid'];
	$medalid	= $m['medals'];
	$type		= 0;
	$dateline	= timetounix($m['postdatetime']);
	$expiration	= 0;
	$status		= 0;

	$fields1 = array('id', 'uid', 'medalid', 'type', 'dateline', 'expiration', 'status');
	$query1 = getinsertsql("{$discuz_tablepre}forum_medallog", $fields1);
	if ($xc->db['discuz']->query($query1)) {
		$convertedrows ++;
	} else {
		reportlog("插入 DZ 授勋记录出错 uid = $uid medalid = $medalid");
	}
	$totalrows ++;
}

?>