本文整理汇总了PHP中batchupdatecredit函数的典型用法代码示例。如果您正苦于以下问题:PHP batchupdatecredit函数的具体用法?PHP batchupdatecredit怎么用?PHP batchupdatecredit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了batchupdatecredit函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updatepostcredits
function updatepostcredits($operator, $uidarray, $action, $fid = 0)
{
global $_G;
$val = $operator == '+' ? 1 : -1;
$extsql = array();
if (empty($uidarray)) {
return false;
}
$uidarray = (array) $uidarray;
$uidarr = array();
foreach ($uidarray as $uid) {
$uidarr[$uid] = !isset($uidarr[$uid]) ? 1 : $uidarr[$uid] + 1;
}
foreach ($uidarr as $uid => $coef) {
$opnum = $val * $coef;
if ($action == 'reply') {
$extsql = array('posts' => $opnum);
} elseif ($action == 'post') {
$extsql = array('threads' => $opnum, 'posts' => $opnum);
}
if ($uid == $_G['uid']) {
updatecreditbyaction($action, $uid, $extsql, '', $opnum, 1, $fid);
} elseif (empty($uid)) {
continue;
} else {
batchupdatecredit($action, $uid, $extsql, $opnum, $fid);
}
}
if ($operator == '+' && ($action == 'reply' || $action == 'post')) {
C::t('common_member_status')->update(array_keys($uidarr), array('lastpost' => TIMESTAMP), 'UNBUFFERED');
}
}
示例2: updatepostcredits
function updatepostcredits($operator, $uidarray, $action, $fid = 0)
{
global $_G;
$val = $operator == '+' ? 1 : -1;
$extsql = array();
if ($action == 'reply') {
$extsql = array('posts' => $val);
} elseif ($action == 'post') {
$extsql = array('threads' => $val, 'posts' => $val);
}
$uidarray = (array) $uidarray;
foreach ($uidarray as $uid) {
if ($uid == $_G['uid']) {
updatecreditbyaction($action, $uid, $extsql, '', $val, 1, $fid);
} elseif (empty($uid)) {
continue;
} else {
batchupdatecredit($action, $uid, $extsql, $val, $fid);
}
}
if ($operator == '+' && ($action == 'reply' || $action == 'post')) {
$uids = implode(',', $uidarray);
DB::query("UPDATE " . DB::table('common_member_status') . " SET lastpost='" . TIMESTAMP . "' WHERE uid IN ('{$uids}')", 'UNBUFFERED');
}
}
示例3: updatestat
updatestat('docomment');
C::t('common_member_status')->update($_G['uid'], array('lastpost' => TIMESTAMP), 'UNBUFFERED');
showmessage('do_success', dreferer(), array('doid' => $updo['doid']));
}
}
if ($_GET['op'] == 'delete') {
if (submitcheck('deletesubmit')) {
if ($id) {
$allowmanage = checkperm('managedoing');
if ($value = C::t('home_docomment')->fetch($id)) {
$home_doing = C::t('home_doing')->fetch($value['doid']);
$value['duid'] = $home_doing['uid'];
if ($allowmanage || $value['uid'] == $_G['uid'] || $value['duid'] == $_G['uid']) {
C::t('home_docomment')->update($id, array('uid' => 0, 'username' => '', 'message' => ''));
if ($value['uid'] != $_G['uid'] && $value['duid'] != $_G['uid']) {
batchupdatecredit('comment', $value['uid'], array(), -1);
}
C::t('home_doing')->update_replynum_by_doid(-1, $updo['doid']);
}
}
} else {
require_once libfile('function/delete');
deletedoings(array($doid));
}
dheader('location: ' . dreferer());
exit;
}
} elseif ($_GET['op'] == 'getcomment') {
include_once DISCUZ_ROOT . './source/class/lib/lib_tree.php';
$tree = new lib_tree();
$list = array();
示例4: IN
break;
case 'UEC':
case 'UEO':
$closed = $action == 'UEO' ? 1 : 0;
DB::query("UPDATE " . DB::table('forum_thread') . " SET closed='{$closed}' WHERE tid IN ({$tids})", 'UNBUFFERED');
DB::query("UPDATE " . DB::table('forum_threadmod') . " SET status='0' WHERE tid IN ({$tids}) AND action IN ('EOP', 'ECL', 'CLK')", 'UNBUFFERED');
break;
case 'UED':
DB::query("UPDATE " . DB::table('forum_threadmod') . " SET status='0' WHERE tid IN ({$tids}) AND action='EDI'", 'UNBUFFERED');
$digestarray = $authoridarry = array();
$query = DB::query("SELECT authorid, digest FROM " . DB::table('forum_thread') . " WHERE tid IN ({$tids})");
while ($digest = DB::fetch($query)) {
$authoridarry[] = $digest['authorid'];
$digestarray[$digest['digest']][] = $digest['authorid'];
}
foreach ($digestarray as $digest => $authorids) {
batchupdatecredit('digest', $authorids, array("digestposts=digestposts+'-1'"), -$digest, $fid = 0);
}
DB::query("UPDATE " . DB::table('forum_thread') . " SET digest='0' WHERE tid IN ({$tids})", 'UNBUFFERED');
break;
case 'SPD':
DB::query("UPDATE " . DB::table('forum_thread') . " SET " . buildbitsql('status', 5, FALSE) . " WHERE tid IN ({$tids})", 'UNBUFFERED');
DB::query("UPDATE " . DB::table('forum_threadmod') . " SET status='0' WHERE tid IN ({$tids}) AND action IN ('SPA')", 'UNBUFFERED');
break;
}
}
require_once libfile('function/post');
foreach ($actionarray as $action => $tids) {
updatemodlog(implode(',', $tids), $action, 0, 1);
}
}
示例5: deletedoings
function deletedoings($ids)
{
global $_G;
$allowmanage = checkperm('managedoing');
$doings = $newdoids = $counts = array();
$query = C::t('home_doing')->fetch_all($ids);
foreach ($query as $value) {
if ($allowmanage || $value['uid'] == $_G['uid']) {
$doings[] = $value;
$newdoids[] = $value['doid'];
if ($value['uid'] != $_G['uid']) {
$counts[$value['uid']]['coef'] -= 1;
}
$counts[$value['uid']]['doings'] -= 1;
}
}
if (empty($doings)) {
return array();
}
C::t('home_doing')->delete($newdoids);
C::t('home_docomment')->delete_by_doid_uid($newdoids);
C::t('home_feed')->delete_by_id_idtype($newdoids, 'doid');
C::t('common_moderate')->delete($newdoids, 'doid');
if ($counts) {
foreach ($counts as $uid => $setarr) {
if ($uid) {
batchupdatecredit('doing', $uid, array('doings' => $setarr['doings']), $setarr['coef']);
$lastdoing = C::t('home_doing')->fetch_all_by_uid_doid($uid, '', 'dateline', 0, 1, true, true);
$setarr = array('recentnote' => $lastdoing[0]['message'], 'spacenote' => $lastdoing[0]['message']);
C::t('common_member_field_home')->update($_G['uid'], $setarr);
}
}
}
return $doings;
}
示例6: deletepolls
function deletepolls($pids)
{
global $_G;
$counts = $polls = $newpids = array();
$allowmanage = checkperm('managepoll');
$query = DB::query("SELECT * FROM " . DB::table('home_poll') . " WHERE pid IN (" . dimplode($pids) . ")");
while ($value = DB::fetch($query)) {
if ($allowmanage || $value['uid'] == $_G['uid']) {
$polls[] = $value;
$newpids[] = $value['pid'];
if ($value['uid'] != $_G['uid']) {
$counts[$value['uid']]['coef'] -= 1;
}
$counts[$value['uid']]['polls'] -= 1;
}
}
if (empty($polls)) {
return array();
}
DB::query("DELETE FROM " . DB::table('home_poll') . " WHERE pid IN (" . dimplode($newpids) . ")");
DB::query("DELETE FROM " . DB::table('home_pollfield') . " WHERE pid IN (" . dimplode($newpids) . ")");
DB::query("DELETE FROM " . DB::table('home_polloption') . " WHERE pid IN (" . dimplode($newpids) . ")");
DB::query("DELETE FROM " . DB::table('home_polluser') . " WHERE pid IN (" . dimplode($newpids) . ")");
DB::query("DELETE FROM " . DB::table('home_comment') . " WHERE id IN (" . dimplode($newpids) . ") AND idtype='pid'");
DB::query("DELETE FROM " . DB::table('home_feed') . " WHERE id IN (" . dimplode($newpids) . ") AND idtype='pid'");
if ($counts) {
foreach ($counts as $uid => $setarr) {
batchupdatecredit('createpoll', $uid, array('polls' => $setarr['polls']), $setarr['coef']);
}
}
return $polls;
}
示例7: deletedoings
function deletedoings($ids)
{
global $_G;
$allowmanage = checkperm('managedoing');
$doings = $newdoids = $counts = array();
$query = C::t('home_doing')->fetch_all($ids);
foreach ($query as $value) {
if ($allowmanage || $value['uid'] == $_G['uid']) {
$doings[] = $value;
$newdoids[] = $value['doid'];
if ($value['uid'] != $_G['uid']) {
$counts[$value['uid']]['coef'] -= 1;
}
$counts[$value['uid']]['doings'] -= 1;
}
}
if (empty($doings)) {
return array();
}
C::t('home_doing')->delete($newdoids);
C::t('home_docomment')->delete_by_doid_uid($newdoids);
C::t('home_feed')->delete_by_id_idtype($newdoids, 'doid');
C::t('common_moderate')->delete($newdoids, 'doid');
if ($counts) {
foreach ($counts as $uid => $setarr) {
batchupdatecredit('doing', $uid, array('doings' => $setarr['doings']), $setarr['coef']);
}
}
return $doings;
}