如果该帖回帖奖励的中奖率$replycredit_rule['random']大于0:
$rand为在1-100中间生成的一个随机数,如果$rand小于或等于$replycredit_rule['random'],则设置$rand_replycredit为true,否则为false。
如果该帖回帖奖励的中奖率$replycredit_rule['random']不大于0:
设置$rand_replycredit为true。
- if($rand_replycredit) {
- if(!$posttable) {
- $posttable = getposttablebytid($_G['tid']);
- }
- updatemembercount($_G['uid'], array($replycredit_rule['extcreditstype'] => $replycredit_rule['extcredits']), 1, 'RCA', $_G[tid]);
- DB::update($posttable, array('replycredit' => $replycredit_rule['extcredits']), array('pid' => $pid));
- DB::update("forum_thread", array('replycredit' => $thread['replycredit'] - $replycredit_rule['extcredits']), array('tid'
=> $_G[tid]));- }
如果存在$rand_replycredit:
- if(!$posttable) {
- $posttable = getposttablebytid($_G['tid']);
- }
如果不存在回帖表$posttable,则通过tid获取$posttable。
- updatemembercount($_G['uid'], array($replycredit_rule['extcreditstype'] => $replycredit_rule['extcredits']), 1, 'RCA', $_G[tid]);
根据回帖奖励的规则,更新当前登录用户的积分:在原有积分基础上+$replycredit_rule['extcredits']。$replycredit_rule['extcreditstype']为积分类型,$replycredit_rule['extcredits']为奖励积分数。
- DB::update($posttable, array('replycredit' => $replycredit_rule['extcredits']), array('pid' => $pid));
更新回帖表$posttable中当前用户回复的积分奖励。
- DB::update("forum_thread", array('replycredit' => $thread['replycredit'] - $replycredit_rule['extcredits']), array('tid' => $_G[tid]));
$thread['replycredit'] - $replycredit_rule['extcredits']为计算回帖奖励的剩余总积分。
更新主题表forum_thread中当前帖子的回帖奖励总积分replycredit。