discuz X3評分流程分析

來源:互聯網
上載者:User

discuz X3評分流程分析

650) this.width=650;" src="http://www.bkjia.com/uploads/allimg/131228/1519132a2-0.png" title="2013-09-11_142941.png" />



一、涉及到的檔案


discuzX3/source/template/default/forum/rate.htm

discuzX3/forum.php

discuzX3/source/module/forum/forum_misc.php


二、流程注意:流程順序也是按照上面檔案依次向下)


如評分->進入到forum_misc.php檔案中處理。大約第606行

elseif($_GET['action'] == 'rate' && $_GET['pid']) {


rate方法即為評分分值的加減操作。大約在672行

foreach($_G['group']['raterange'] as $id => $rating) {    $score = intval($_GET['score'.$id]);    if(isset($_G['setting']['extcredits'][$id]) && !empty($score)) {                                                                                                                                             //showmessage($id);        $arr_goldId[]=$id;        $arr_goldValue[]=$score;                                                                                                                                             if($rating['isself'] && (intval($_G['member']['extcredits'.$id]) - $score < 0)) {            showmessage('thread_rate_range_self_invalid', '', array('extcreditstitle' => $_G['setting']['extcredits'][$id]['title']));        }        if(abs($score) <= $maxratetoday[$id]) {            if($score > $rating['max'] || $score < $rating['min']) {                showmessage('thread_rate_range_invalid');            } else {                $creditsarray[$id] = $score;                if($rating['isself']) {                    $sub_self_credit[$id] = -abs($score);                }                $rate += $score;                $ratetimes += ceil(max(abs($rating['min']), abs($rating['max'])) / 5);            }        } else {            showmessage('thread_rate_ctrl');        }    }}

這裡DZ通過foreach迴圈分別擷取使用者的評分種類及相應分值。

//showmessage($id);$arr_goldId[]=$id;$arr_goldValue[]=$score;

數組$arr_goldId評分種類id;數組$arr_goldValue評分分值。

這裡對“金錢”做二次開發:


if($arr_goldId[0] == 2){    $goldValue=$arr_goldValue[0];}elseif($arr_goldId[0] == 1 && $arr_goldId[1] == 2){    $goldValue=$arr_goldValue[1];}      if($arr_goldId[0] == 2 || ($arr_goldId[0] != 2 && $arr_goldId[1] == 2)){                        /*****************************    /*    /******   To do something    /*    /******************************/                        //showmessage($goldValue); }showmessage('thread_rate_succeed', dreferer());




本文出自 “PHPer許琴-專註於PHP技術” 部落格,請務必保留此出處http://xuqin.blog.51cto.com/5183168/1294298

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.