Ejemplo n.º 1
0
        $isExists = $mysql->field('count(1) as ct')->where(array('sku' => '"' . $_ary->sku . '"', 'lotid' => array('"' . $_ary->lotid . '"', '=', 'and'), 'supplyid' => array('"' . $_ary->supplyid . '"', '=', 'and')))->select('yy_reports');
        if ((int) $isExists[0]['ct'] == 0) {
            $data = array('sku' => $_ary->sku, 'lotid' => $_ary->lotid, 'spec' => $_ary->spec, 'cdname' => $_ary->cdname, 'cdcode' => $_ary->cdcode, 'supplyid' => $_ary->supplyid, 'spname' => $_ary->spname, 'spcode' => $_ary->spcode, 'picpath' => $_ary->picpath);
            $mysql->insert('yy_reports', $data);
            return true;
        }
        return false;
    }
    public function appendDataToMySql($ary)
    {
        foreach ($ary as $s) {
            $filename = $s;
            $file_extension = end(explode('.', $filename));
            if ($file_extension == 'json') {
                $filename = $this->_config['report']['jsonpath'] . '/' . $filename;
                $json_string = file_get_contents($filename);
                //Mysql
                if ($this->setData($json_string)) {
                    //echo $this->_config['msgs.success'];
                    copy($filename, $this->_config['report']['bak'] . $s);
                    unlink($filename);
                } else {
                    //
                }
            }
        }
    }
}
$ary = CommonFactory::Create()->getDir($configs['report']['jsonpath']);
$append = new Append($configs);
$append->appendDataToMySql($ary);
Ejemplo n.º 2
0
        $htmlData = $_POST['content'];
    }
}
$htmlData = htmlspecialchars($htmlData);
$smarty->assign(array('htmlData' => $htmlData));
$smarty->template_dir = $template_dir;
$smarty->display('add.tpl');
if ($_POST) {
    $str = ob_get_contents();
    $outpath = 'news/' . date('Ymd');
    //.DIRECTORY_SEPARATOR.date('m').DIRECTORY_SEPARATOR.date('d');
    if (!is_dir($outpath)) {
        mkdir($outpath);
        chmod($outpath, 0777);
    }
    $num = CommonFactory::Create()->random(10);
    $outfilename = $outpath . DIRECTORY_SEPARATOR . '' . $num . '.html';
    $fp = @fopen($outfilename, 'w');
    if (!$fp) {
        //Show_Error_Message( ERROR_WRITE_FILE );
        echo 'error';
        exit;
    }
    fwrite($fp, $str);
    fclose($fp);
    ob_end_clean();
    $data = array('title' => $_POST['title'], 'subtitle' => $_POST['subtitle'], 'content' => $_POST['content']);
    AdminNewsFactory::intance()->setData($data);
    //@header ( "Location: ../../admin/news/msgs?msg=ok" );
    echo "<script>self.location.href='../../admin/news/msgs?msg=ok&goto=admin/news/list';</script>";
}