$hongbao_state = $empire->fetch1("select hongbao_id,remaining_points, recipients, total_amount from {$dbtbpre}hongbao_info where hongbao_id ='$hongbao_id'");
if (empty($hongbao_state['hongbao_id'])) {
// 插入新红包
$time=time();//获取当前时间
$empire->query("insert into {$dbtbpre}hongbao_info(hongbao_id,sender_userid,sender_username,total_amount,recipients,remaining_points,time) values('$hongbao_id','$userid','$username','$amount','$recipients','$remainingPoints','$time');");
$alreadyClaimed=$empire->gettotal("select count(*) as total from {$dbtbpre}hongbao_history where hongbao_id ='$hongbao_id' and receiver_userid ='$fuserid'");
$empire->query("insert into {$dbtbpre}hongbao_history(hongbao_id,receiver_userid,receiver_username,userid,username,points,total_amount,recipients,ip,duankou,time) values('$hongbao_id','$fuserid','$fusername','$userid','$username','$randomPoints','$amount','$recipients','$ip','$duankou','$time');");
// 更新用户积分
$sql = $empire->query("update {$dbtbpre}enewsmember set userfen = userfen - $randomPoints where userid = '$userid'"); // 扣除打赏者积分
$sql1 = $empire->query("update {$dbtbpre}enewsmember set userfen = userfen + $randomPoints where userid = '$fuserid'"); // 领取红包增加积分
$sql=$empire->query("select * from {$dbtbpre}hongbao_history where hongbao_id='$hongbao_id' order by id");
while($r=$empire->fetch($sql)){
$memberrr = fetch_memcache0("select userpic from {$dbtbpre}enewsmemberadd where userid='$r[receiver_userid]' order by userid desc limit 1", 'Memcached', 'chatpublic', 3600*24*1);