- 積分
- 329
- 金幣
- 241 個(gè)
- 社區(qū)幣
- 0 元
爐火純青
- 貢獻(xiàn)
- 2 點(diǎn)
- 金幣
- 241 個(gè)
|
添加一條SQL,此 SQL 記錄可以在您插件安裝的時(shí)候內(nèi)置在里面
- INSERT INTO `pre_common_credit_rule` (`rulename`, `action`, `cycletype`, `cycletime`, `rewardnum`, `norepeat`, `extcredits1`, `extcredits2`, `extcredits3`, `extcredits4`, `extcredits5`, `extcredits6`, `extcredits7`, `extcredits8`, `fids`) VALUES
- (‘寵物購(gòu)買’, ‘petbuy’, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, ‘0′);
復(fù)制代碼
添加后站長(zhǎng)便可以在積分策略中看到這條記錄
此時(shí)可讓站長(zhǎng)自行調(diào)整此策略
在代碼中進(jìn)行積分操作時(shí),您只需在插件中添加以下代碼,即可執(zhí)行此積分策略
- updatecreditbyaction(‘petbuy’, $_G['uid']);
復(fù)制代碼
單獨(dú)增減積分可用 updatemembercount() 函數(shù)
- /**
- * 添加積分
- * @param Integer $uids: 用戶uid或者uid數(shù)組
- * @param String $dataarr: member count相關(guān)操作數(shù)組,例: array(‘extcredits1′ => 1)
- * @param Boolean $checkgroup: 是否檢查用戶組 true or false
- * @param String $operation: 積分記錄操作類型(不記錄積分日志可忽略)
- * @param Integer $relatedid: 積分記錄相關(guān) ID(不記錄積分日志可忽略)
- * @param String $ruletxt: 動(dòng)畫效果中的積分規(guī)則文本(UTF-8格式)
- */
- function updatemembercount($uids, $dataarr = array(), $checkgroup = true, $operation = ”, $relatedid = 0, $ruletxt = ”)
復(fù)制代碼
積分操作類型:
操作名字 | 關(guān)聯(lián)ID | 說(shuō)明 | ACC | forum_activity.tid | 參與活動(dòng)扣除積分 | AFD | common_member.uid | 購(gòu)買積分即積分充值 | AGC | common_magic.mid | 獲得紅包 | BAC | forum_attachment.aid | 購(gòu)買附件支出積分 | BGC | common_magic.mid | 埋下紅包 | BMC | common_magic.mid | 道具購(gòu)買消耗積分 | BTC | forum_thread.tid | 購(gòu)買主題支出積分 | CDC | 1 | 卡密充值 | CEC | common_member.uid | 積分兌換 | ECU | common_member.uid | 通過(guò)ucenter兌換積分 | MRC | common_magic.mid | 道具隨機(jī)獲取積分 | PRC | forum_post.pid | 帖子被評(píng)分所得積分 | RAC | forum_thread.tid | 最佳答案獲取懸賞積分 | RCA | forum_thread.tid | 回帖中獎(jiǎng) | RCB | forum_thread.tid | 返還回帖獎(jiǎng)勵(lì)積分 | RCT | forum_thread.tid | 回帖獎(jiǎng)勵(lì)積分 | RCV | common_member.uid | 積分轉(zhuǎn)賬接收 | RGC | common_magic.mid | 回收紅包 | RKC | common_member.uid | 競(jìng)價(jià)排名 | RPC | common_report.id | 舉報(bào)功能中的獎(jiǎng)懲 | RSC | forum_thread.tid | 評(píng)分帖子扣除自己的積分 | RTC | forum_thread.tid | 發(fā)表懸賞主題扣除積分 | SAC | forum_attachment.aid | 出售附件獲得積分 | STC | forum_thread.tid | 出售主題獲得積分 | TFR | common_member.uid | 積分轉(zhuǎn)賬轉(zhuǎn)出 | TRC | common_task.taskid | 任務(wù)獎(jiǎng)勵(lì)積分 | UGP | common_usergroup.groupid | 購(gòu)買擴(kuò)展用戶組支出積分 |
- function updatemembercount($uids, $dataarr = array(), $checkgroup = true, $operation = '', $relatedid = 0, $ruletxt = '') {
- if(!empty($uids) && (is_array($dataarr) && $dataarr)) {
- require_once libfile('function/credit');
- return _updatemembercount($uids, $dataarr, $checkgroup, $operation, $relatedid, $ruletxt);
- }
- return true;
- }
復(fù)制代碼
里面調(diào)用了另一個(gè)函數(shù),原始的定義我也發(fā)過(guò)來(lái)吧:
- function _updatemembercount($uids, $dataarr = array(), $checkgroup = true, $operation = '', $relatedid = 0, $ruletxt = '') {
- if(empty($uids)) return;
- if(!is_array($dataarr) || empty($dataarr)) return;
- if($operation && $relatedid) {
- $writelog = true;
- $log = array(
- 'uid' => $uids,
- 'operation' => $operation,
- 'relatedid' => $relatedid,
- 'dateline' => time(),
- );
- } else {
- $writelog = false;
- }
- $data = array();
- foreach($dataarr as $key => $val) {
- if(empty($val)) continue;
- $val = intval($val);
- $id = intval($key);
- $id = !$id && substr($key, 0, -1) == 'extcredits' ? intval(substr($key, -1, 1)) : $id;
- if(0 < $id && $id < 9) { $data['extcredits'.$id] = $val; if($writelog) { $log['extcredits'.$id] = $val; } } else { $data[$key] = $val; } } if($writelog) { DB::insert('common_credit_log', $log); } if($data) { include_once libfile('class/credit'); $credit = & credit::instance(); $credit->updatemembercount($data, $uids, $checkgroup, $ruletxt);
- }
- }
復(fù)制代碼
其中第四個(gè)參數(shù)和第五個(gè)參數(shù)在寫積分記錄的時(shí)候有用,如果兩者皆不為空,則系統(tǒng)會(huì)在積分記錄中記錄。
第四個(gè)參數(shù)是記錄相關(guān)操作的變量,第五個(gè)參數(shù)看名稱應(yīng)該是記錄產(chǎn)生這個(gè)積分操作的相關(guān)的id值(例如像uid,fid,tid這類的),第六個(gè)參數(shù)用于當(dāng)$data數(shù)組(即記錄積分增減情況的數(shù)組)不為空時(shí),重新調(diào)用函數(shù)并把值傳遞給第四個(gè)變量。
|
|