Exemple #1
0
     $sql_arc .= ($sql_arc ? ',' : '') . "adopts={$adoptsnew}";
 }
 if (!empty($archivenew['notaclosed'])) {
     $auser = new cls_userinfo();
     $query = $db->query("SELECT * FROM {$tblprefix}answers WHERE aid={$aid}");
     while ($item = $db->fetch_array($query)) {
         if ($item['currency']) {
             $auser->activeuser($item['mid']);
             $auser->updatecrids(array($item['crid'] => $item['currency']), 1, lang('answer_reward'));
             $auser->init();
         }
     }
     $auser->activeuser($aedit->archive['mid']);
     $commu = read_cache('commu', $channels[$aedit->archive['chid']]['cuid']);
     if ($commu['setting']['credit']) {
         $auser->sub_data();
         $auser->updatefield('credits', $auser->info['credits'] + ($aedit->archive['currency'] - $sparenew) * $commu['setting']['credit'], 'sub');
     }
     $auser->updatecrids(array($aedit->archive['crid'] => $sparenew), 1, lang('answer_reward'));
     unset($auser);
     $sql_an .= ($sql_an ? ',' : '') . "end=1";
     $sql_arcs .= ($sql_arcs ? ',' : '') . "notaclosed=1";
     $sparenew = 0;
     $db->query("DELETE FROM {$tblprefix}notaanswer WHERE aid={$aid}");
 }
 //更新数据库
 if ($sparenew != $aedit->archive['spare']) {
     $sql_arcs .= ($sql_arcs ? ',' : '') . "spare={$sparenew}";
 }
 $sql_arc && $db->query("UPDATE {$tblprefix}archives SET {$sql_arc} WHERE aid={$aid}");
 $sql_arcs && $db->query("UPDATE {$tblprefix}archives_sub SET {$sql_arcs} WHERE aid={$aid}");