Example #1
0
            }
        }
        unset($a_field);
        $c_upload->closure(1, $cid, 'reports');
        $c_upload->saveuptotal(1);
        $db->query("UPDATE {$tblprefix}reports SET updatedate='{$timestamp}' {$sqlstr} WHERE cid='{$cid}'");
        //处理函数字段
        $sqlstr = '';
        foreach ($bfields as $k => $v) {
            if ($v['isfunc'] && in_array($k, $fieldsarr)) {
                //得到原始数据的资料,带上当前文档资料
                if (!isset($sourcearr)) {
                    $sourcearr = $db->fetch_one("SELECT * FROM {$tblprefix}reports WHERE cid='{$cid}'");
                    $sourcearr = array_merge($a_edit->archive, $sourcearr);
                }
                $sqlstr .= ($sqlstr ? ',' : '') . "{$k}='" . field_func($v['func'], $sourcearr, $arr2 = '') . "'";
            }
        }
        unset($sourcearr);
        $sqlstr && $db->query("UPDATE {$tblprefix}reports SET {$sqlstr} WHERE cid='{$cid}'");
        //处理自定义函数
        if (!empty($commu['func'])) {
            //可以处理所有参数的变更
            $sourcearr = $db->fetch_one("SELECT * FROM {$tblprefix}reports WHERE cid='{$cid}'");
            $sourcearr = array_merge($aedit->archive, $sourcearr);
            field_func($commu['func'], $sourcearr, $arr2 = '');
            unset($sourcearr);
        }
        amessage('updatesucceed', axaction(10, $forward), $commu['cname']);
    }
}
Example #2
0
 function updatedb()
 {
     global $db, $tblprefix;
     if (empty($this->maid)) {
         return;
     }
     $fields = read_cache('mafields', $this->matid);
     foreach ($fields as $k => $v) {
         if ($v['isfunc']) {
             $v = read_cache('mafield', $this->matid, $k);
             $this->updatefield($k, field_func($v['func'], $this->archive, $arr2 = ''));
         }
     }
     if (!empty($this->updatearr)) {
         $sqlstr = '';
         foreach ($this->updatearr as $k => $v) {
             $sqlstr .= ($sqlstr ? "," : "") . $k . "='" . $v . "'";
         }
         if (!empty($sqlstr)) {
             $db->query("UPDATE {$tblprefix}marchives_{$this->matid} SET {$sqlstr} WHERE maid={$this->maid}");
         }
     }
     $this->updatearr = array();
 }
Example #3
0
 function updatedb()
 {
     global $db, $tblprefix;
     if (empty($this->info['mid'])) {
         return;
     }
     //分析是否有积分变化更新自动会员组系
     $this->autogrouptype();
     $this->autorgid();
     //在这里分析函数字段的值的变化
     $fields = read_cache('mfields', $this->info['mchid']);
     foreach ($fields as $k => $v) {
         if ($v['isfunc']) {
             $this->updatefield($k, field_func($v['func'], $this->info, $arr2 = ''), $v['tbl']);
         }
     }
     foreach (array('main', 'sub', 'custom') as $upmode) {
         if (!empty($this->updatearr[$upmode])) {
             $sqlstr = '';
             foreach ($this->updatearr[$upmode] as $k => $v) {
                 $sqlstr .= ($sqlstr ? "," : "") . $k . "='" . $v . "'";
             }
             if (!empty($sqlstr)) {
                 $tablename = 'members' . ($upmode == 'main' ? '' : ($upmode == 'sub' ? '_sub' : '_' . $this->info['mchid']));
                 $db->query("UPDATE {$tblprefix}{$tablename} SET {$sqlstr} WHERE mid=" . $this->info['mid']);
             }
             unset($this->updatearr[$upmode]);
         }
     }
 }
Example #4
0
 function updatedb()
 {
     global $db, $tblprefix;
     if (empty($this->aid)) {
         return;
     }
     $this->basic_data();
     $fields = read_cache('ffields', $this->archive['chid']);
     foreach ($fields as $k => $v) {
         if ($v['isfunc']) {
             $this->detail_data();
             $v = read_cache('ffield', $this->archive['chid'], $k);
             $this->updatefield($k, field_func($v['func'], $this->archive, $arr2 = ''), 'custom');
         }
     }
     foreach (array('main', 'custom') as $upmode) {
         if (!empty($this->updatearr[$upmode])) {
             $sqlstr = '';
             foreach ($this->updatearr[$upmode] as $k => $v) {
                 $sqlstr .= ($sqlstr ? "," : "") . $k . "='" . $v . "'";
             }
             if (!empty($sqlstr)) {
                 $tablename = $upmode == 'main' ? 'farchives' : 'farchives_' . $this->channel['chid'];
                 $db->query("UPDATE {$tblprefix}{$tablename} SET {$sqlstr} WHERE aid={$this->aid}");
             }
         }
     }
     $this->updatearr = array();
 }
Example #5
0
 function updatedb()
 {
     global $db, $tblprefix, $timestamp;
     if ($this->func) {
         $aedit = new cls_arcedit();
         $aedit->set_aid($this->aid);
         $aedit->detail_data(0);
         foreach ($this->fields as $k => $v) {
             if ($v['isfunc']) {
                 $this->updatefield($k, field_func($v['func'], $this->info, $aedit->archive));
             }
         }
     }
     if (!empty($this->updatearr)) {
         $this->updatearr['updatedate'] = $timestamp;
         $sqlstr = '';
         foreach ($this->updatearr as $k => $v) {
             $sqlstr .= ($sqlstr ? "," : "") . $k . "='" . $v . "'";
         }
         if ($sqlstr) {
             $db->query("UPDATE {$tblprefix}" . $this->cclass . "s SET {$sqlstr} WHERE cid={$this->cid}");
         }
         $this->avg_price();
         //平均价需要资料更改完成后写入
     }
     if ($this->func) {
         if ($this->commu['func']) {
             field_func($this->commu['func'], $this->info, $aedit->archive);
         }
         unset($aedit);
     }
     $this->updatearr = array();
 }
Example #6
0
 function updatedb()
 {
     global $db, $tblprefix, $timestamp;
     if (empty($this->aid)) {
         return;
     }
     //在这里分析函数字段的值的变化
     foreach ($this->fields as $k => $v) {
         //一旦有更新,重新计算函数字段。
         if ($v['available'] && $v['isfunc']) {
             $this->detail_data();
             //可以使用所有字段的值来计算函数值。
             if (empty($v['istxt'])) {
                 $this->updatefield($k, field_func($v['func'], $this->archive, $arr2 = ''), $v['tbl']);
             } else {
                 saveastxt(stripslashes(field_func($v['func'], $this->archive, $arr2 = '')), $aedit->namepres[$k]);
             }
         }
     }
     foreach (array('main', 'sub', 'custom') as $upmode) {
         if (!empty($this->updatearr[$upmode])) {
             //只要数组存在,就是内容作了修改
             $this->updatearr['main']['updatedate'] = $timestamp;
             $sqlstr = '';
             foreach ($this->updatearr[$upmode] as $k => $v) {
                 $sqlstr .= ($sqlstr ? "," : "") . $k . "='" . $v . "'";
             }
             if (!empty($sqlstr)) {
                 $tablename = $upmode == 'main' ? 'archives' : ($upmode == 'sub' ? 'archives_sub' : 'archives_' . $this->channel['chid']);
                 $db->query("UPDATE {$tblprefix}{$tablename} SET {$sqlstr} WHERE aid={$this->aid}");
             }
         }
     }
     $this->updatearr && notice_static($this->aid);
     $this->updatearr = array();
 }