Discuz! X3 积分不足自动使用交易积分的方法(2018/11/11修正)
分类 网站技术/村民张先生 发布于 2017-04-19 20:11
接下来扣减积分时,如果积分不足,自动从交易积分兑换,并且添加积分日志。查找:
$this->updatemembercount($creditarr, $uids, is_array($uids) ? false : true, $this->coef > 0 ? urldecode($rule['rulenameuni']) : '');
在其下方增加(请将其中的数字6、7修改为可消耗但不是交易积分的积分编号,将 8 改为交易积分编号,将 10 改为两者的比值):
2018/11/11修正:原代码前后添加了排除审核时重复应用的代码(第一行和最后一行),否则审核帖子时将重复执行,且会导致部分帖子无法通过审核(审核操作无效)。
if(!$_GET['action'] || $_GET['action'] != 'moderate') { if(($creditarr['extcredits6'] || $creditarr['extcredits7']) && !is_array($uids)) { if(function_exists('credit_log')) { $log = array(); if($creditarr['extcredits6']) $log[extcredits6] = $creditarr['extcredits6']; if($creditarr['extcredits7']) $log[extcredits7] = $creditarr['extcredits7']; credit_log($uids, 'PTC', $uids, $log); } $cmc = DB::fetch_first('select * from '.DB::table('common_member_count').' where uid='.$uids); if($cmc['extcredits6'] < 0 || $cmc['extcredits7'] < 0) { $extcredits6_qianfei = $cmc['extcredits6'] < 0 ? (0 - $cmc['extcredits6']) : 0; $extcredits7_qianfei = $cmc['extcredits7'] < 0 ? (0 - $cmc['extcredits7']) : 0; $koufei = ($extcredits6_qianfei + $extcredits7_qianfei) / 10; _updatemembercount($uids, array('extcredits6' => $extcredits6_qianfei, 'extcredits7' => $extcredits7_qianfei, 'extcredits8' => -$koufei), false, 'CEC', $uids); } } }
欢迎谈谈你的看法(无须登录) *正文中请勿包含"http://"否则将被拦截