第二部分:include/newthread.inc.php 以下为引用的内容: 这个文件处理发新帖的特定请求。 if(isset($poll)) { $special = 1; } elseif(isset($trade)) { $special = 2; } elseif(isset($reward)) { $special = 3; } elseif(isset($activity)) { $special = 4; } else { $special = 0; } 这一部分的代码是用来判断帖子的类型的,1为投票,2为交易帖,3为悬赏,4为活动,0为普通帖。 $price = intval($price); $price = $maxprice && !$special ? ($price <= $maxprice ? $price : $maxprice) : 0; 这里是帖子价格的赋值,超过了最大的价格的处理,特殊帖子的价格处理。 } elseif($special == 3 && $allowpostreward) { $rewardprice = intval($rewardprice); if(!$rewardprice) { showmessage('reward_credits_please'); } elseif($rewardprice > 32767) { showmessage('reward_credits_overflow'); } elseif($rewardprice < $minrewardprice || ($maxrewardprice > 0 && $rewardprice > $maxrewardprice)) { showmessage('reward_credits_between'); } elseif(($realprice = $rewardprice + ceil($rewardprice * $creditstax)) > $_DSESSION["extcredits$creditstrans"]) { showmessage('reward_credits_shortage'); } $price = $rewardprice; $db->query("UPDATE {$tablepre}members SET extcredits$creditstrans=extcredits$creditstrans-$realprice WHERE uid='$discuz_uid'"); 前面说过3表示悬赏帖子,那么当你发表成功了一个悬赏帖子后,就会相应在cdb_members表中减少相应的扩展积分,便是上面的代码的作用了。 elseif($special == 3 && $allowpostreward) { $db->query("INSERT INTO {$tablepre}rewardlog (tid, authorid, netamount, dateline) VALUES ('$tid', '$discuz_uid', $realprice, '$timestamp')"); } 后续判断如果为悬赏帖子的话就往cdb_rewardlog(悬赏记录表)里写入一条记录。 if($attachment) { $searcharray = $pregarray = $replacearray = array(); foreach($attachments as $key => $attach) { $db->query("INSERT INTO {$tablepre}attachments (tid, pid, dateline, readperm, price, filename, description, filetype, filesize, attachment, downloads, isimage, uid, thumb, remote) VALUES ('$tid', '$pid', '$timestamp', '$attach[perm]', '$attach[price]', '$attach[name]', '$attach[description]', '$attach[type]', '$attach[size]', '$attach[attachment]', '0', '$attach[isimage]', '$attach[uid]', '$attach[thumb]', '$attach[remote]')"); $searcharray[] = '[local]'.$localid[$key].'[/local]'; $pregarray[] = '/\[localimg=(\d{1,3}),(\d{1,3})\]'.$localid[$key].'\[\/localimg\]/is';
|